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
This commit is contained in:
Fabrice Di Meglio
2014-07-18 15:20:34 -07:00
parent 3bd0515242
commit d40dd45c18
8 changed files with 45 additions and 21 deletions

View File

@@ -489,9 +489,10 @@ public class SettingsActivity extends Activity
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 class SettingsActivity extends Activity
*/
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 @@ public class SettingsActivity extends Activity
}
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 @@ public class SettingsActivity extends Activity
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 {