Move the action buttons in installed app detail page in the preference xml.

- instead of dynamically creating the preferences for the action
buttons, add the actions items to the installed app details xml.
- rename the reference as it is no longer a footer.

Change-Id: I41b99f50bcc4916384555b5d9470ac937ff1d2ac
Fix: 36001501
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2017-03-07 14:52:02 -08:00
parent 3183c22238
commit cb22870aa1
2 changed files with 11 additions and 9 deletions

View File

@@ -68,7 +68,6 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.webkit.IWebViewUpdateService;
import android.widget.Button;
@@ -148,7 +147,7 @@ public class InstalledAppDetails extends AppInfoBase
private static final int DLG_SPECIAL_DISABLE = DLG_BASE + 3;
private static final String KEY_HEADER = "header_view";
private static final String KEY_FOOTER = "header_footer";
private static final String KEY_ACTION_BUTTONS = "action_buttons";
private static final String KEY_NOTIFICATION = "notification_settings";
private static final String KEY_STORAGE = "storage_settings";
private static final String KEY_PERMISSION = "permission_settings";
@@ -165,7 +164,7 @@ public class InstalledAppDetails extends AppInfoBase
private boolean mInitialized;
private boolean mShowUninstalled;
private LayoutPreference mHeader;
private LayoutPreference mFooter;
private LayoutPreference mActionButtons;
private Button mUninstallButton;
private boolean mUpdatedSysApp = false;
private Button mForceStopButton;
@@ -328,10 +327,6 @@ public class InstalledAppDetails extends AppInfoBase
setHasOptionsMenu(true);
addPreferencesFromResource(R.xml.installed_app_details_ia);
addDynamicPrefs();
mFooter = new LayoutPreference(getPrefContext(), R.layout.app_action_buttons);
mFooter.setOrder(-9999);
mFooter.setKey(KEY_FOOTER);
getPreferenceScreen().addPreference(mFooter);
if (Utils.isBandwidthControlEnabled()) {
INetworkStatsService statsService = INetworkStatsService.Stub.asInterface(
ServiceManager.getService(Context.NETWORK_STATS_SERVICE));
@@ -390,6 +385,7 @@ public class InstalledAppDetails extends AppInfoBase
}
final Activity activity = getActivity();
mHeader = (LayoutPreference) findPreference(KEY_HEADER);
mActionButtons = (LayoutPreference) findPreference(KEY_ACTION_BUTTONS);
FeatureFactory.getFactory(activity)
.getApplicationFeatureProvider(activity)
.newAppHeaderController(this, mHeader.findViewById(R.id.app_snippet))
@@ -435,9 +431,9 @@ public class InstalledAppDetails extends AppInfoBase
}
private void prepareUninstallAndStop() {
mForceStopButton = (Button) mFooter.findViewById(R.id.right_button);
mForceStopButton = (Button) mActionButtons.findViewById(R.id.right_button);
mForceStopButton.setText(R.string.force_stop);
mUninstallButton = (Button) mFooter.findViewById(R.id.left_button);
mUninstallButton = (Button) mActionButtons.findViewById(R.id.left_button);
mForceStopButton.setEnabled(false);
}