Fix overdraw and do some layout optimizations
- use a specific layout for the Dashboard and for the Preferences
- use a specific background for the Dashboard and for the Preferences
The main idea here is that you cannot have the same layout / background
because the Dashboard is using the "Z elevation" for having its card
"poping up"
Change-Id: I42b7c91efea14315b8a60cf3876938a7f1d1e0b3
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 290473e..a0f43fb 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -489,9 +489,10 @@
setTheme(R.style.Theme_SubSettings);
}
- setContentView(R.layout.settings_main);
+ setContentView(mIsShowingDashboard ?
+ R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
- mContent = (ViewGroup) findViewById(R.id.prefs);
+ mContent = (ViewGroup) findViewById(R.id.main_content);
getFragmentManager().addOnBackStackChangedListener(this);
@@ -830,7 +831,7 @@
*/
public void startPreferenceFragment(Fragment fragment, boolean push) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.replace(R.id.prefs, fragment);
+ transaction.replace(R.id.main_content, fragment);
if (push) {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
@@ -851,7 +852,7 @@
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.replace(R.id.prefs, f);
+ transaction.replace(R.id.main_content, f);
if (withTransition) {
TransitionManager.beginDelayedTransition(mContent);
}
@@ -1239,7 +1240,7 @@
if (mSearchResultsFragment != null) {
return;
}
- Fragment current = getFragmentManager().findFragmentById(R.id.prefs);
+ Fragment current = getFragmentManager().findFragmentById(R.id.main_content);
if (current != null && current instanceof SearchResultsSummary) {
mSearchResultsFragment = (SearchResultsSummary) current;
} else {