Fix again bug #15940103 ACTION_SYNC_SETTINGS shows the non-functional
...left arrow button at the top (the back button works)
- the android.settings.DATE_SETTINGS Intent was showing similar issue
so this CL fix it on a more generic basis
Change-Id: I4c26a5a8dc3eb090d26967fa607449a4fe6631c6
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index cdcc116..1b2a48c 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -285,6 +285,11 @@
BatterySaverSettings.class.getName(),
};
+
+ private static final String[] LIKE_SHORTCUT_INTENT_ACTION_ARRAY = {
+ "android.settings.APPLICATION_DETAILS_SETTINGS"
+ };
+
private SharedPreferences mDevelopmentPreferences;
private SharedPreferences.OnSharedPreferenceChangeListener mDevelopmentPreferencesListener;
@@ -453,9 +458,13 @@
private static boolean isLikeShortCutIntent(final Intent intent) {
String action = intent.getAction();
- return (action != null) &&
- (action.equals("android.settings.APPLICATION_DETAILS_SETTINGS") ||
- action.equals("android.settings.SYNC_SETTINGS")) ;
+ if (action == null) {
+ return false;
+ }
+ for (int i = 0; i < LIKE_SHORTCUT_INTENT_ACTION_ARRAY.length; i++) {
+ if (LIKE_SHORTCUT_INTENT_ACTION_ARRAY[i].equals(action)) return true;
+ }
+ return false;
}
@Override
@@ -486,14 +495,16 @@
mIsShortcut = isShortCutIntent(intent) || isLikeShortCutIntent(intent) ||
intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SHORTCUT, false);
- mIsShowingDashboard = (initialFragmentName == null) && !mIsShortcut;
-
final ComponentName cn = getIntent().getComponent();
- final boolean isSubSettings = cn.getClassName().equals(SubSettings.class.getName());
+ final String className = cn.getClassName();
- // If this is a sub settings or not the main Dashboard and not a Shortcut then apply the
- // correct theme for the ActionBar content inset
- if (isSubSettings || (!mIsShowingDashboard && !mIsShortcut)) {
+ mIsShowingDashboard = className.equals(Settings.class.getName());
+ final boolean isSubSettings = className.equals(SubSettings.class.getName());
+
+ // If this is a sub settings or not the main Dashboard and not a Shortcut and not initial
+ // Fragment then apply the correct theme for the ActionBar content inset
+ if (isSubSettings ||
+ (!mIsShowingDashboard && !mIsShortcut && (initialFragmentName == null))) {
setTheme(R.style.Theme_SubSettings);
}
@@ -503,9 +514,6 @@
getFragmentManager().addOnBackStackChangedListener(this);
- mDisplayHomeAsUpEnabled = true;
- mDisplaySearch = true;
-
if (mIsShowingDashboard) {
Index.getInstance(getApplicationContext()).update();
}
@@ -535,6 +543,9 @@
if (mIsShortcut) {
mDisplayHomeAsUpEnabled = isSubSettings;
mDisplaySearch = false;
+ } else if (isSubSettings) {
+ mDisplayHomeAsUpEnabled = true;
+ mDisplaySearch = true;
}
setTitleFromIntent(intent);
@@ -542,8 +553,10 @@
switchToFragment(initialFragmentName, initialArguments, true, false,
mInitialTitleResId, mInitialTitle, false);
} else {
- // No UP if we are displaying the main Dashboard
+ // No UP affordance if we are displaying the main Dashboard
mDisplayHomeAsUpEnabled = false;
+ // Show Search affordance
+ mDisplaySearch = true;
mInitialTitleResId = R.string.dashboard_title;
switchToFragment(DashboardSummary.class.getName(), null, false, false,
mInitialTitleResId, mInitialTitle, false);