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

@@ -23,6 +23,12 @@
android:selectable="false" android:selectable="false"
android:order="-10000"/> android:order="-10000"/>
<com.android.settings.applications.LayoutPreference
android:key="action_buttons"
android:layout="@layout/app_action_buttons"
android:selectable="false"
android:order="-9999"/>
<Preference <Preference
android:key="notification_settings" android:key="notification_settings"
android:title="@string/notifications_label" android:title="@string/notifications_label"

View File

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