[Catalyst] Support main switch bar
MainSwitchBar is a view widget in activity layout stick to the top of screen UI. There is no corresponding Preference in the preference screen. For Catalyst support, introduce an invisible Preference object to manipulate with MainSwitchBar, so that the binding mechanism is still working on top of this abstraction. Bug: 332201912 Flag: EXEMPT new class Test: manual Change-Id: If50932a443c1ed3ac04d3ea2e3273724d750297d
This commit is contained in:
@@ -311,6 +311,11 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
}
|
||||
|
||||
setContentView(R.layout.settings_main_prefs);
|
||||
mMainSwitch = findViewById(R.id.switch_bar);
|
||||
if (mMainSwitch != null) {
|
||||
mMainSwitch.setMetricsCategory(lookupMetricsCategory());
|
||||
mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1);
|
||||
}
|
||||
|
||||
getSupportFragmentManager().addOnBackStackChangedListener(this);
|
||||
|
||||
@@ -330,12 +335,6 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
launchSettingFragment(initialFragmentName, intent);
|
||||
}
|
||||
|
||||
mMainSwitch = findViewById(R.id.switch_bar);
|
||||
if (mMainSwitch != null) {
|
||||
mMainSwitch.setMetricsCategory(lookupMetricsCategory());
|
||||
mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1);
|
||||
}
|
||||
|
||||
// see if we should show Back/Next buttons
|
||||
if (intent.getBooleanExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false)) {
|
||||
|
||||
|
Reference in New Issue
Block a user