mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
初回起動の場合に初期化処理としてデフォルト値を書き込むように
This commit is contained in:
parent
4cfc87a40b
commit
ea0b1a7665
|
@ -40,6 +40,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
|
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
|
||||||
|
|
||||||
|
if (sharedPrefUtils.getIsFirstLaunch()) {
|
||||||
|
initializeApp();
|
||||||
|
}
|
||||||
|
|
||||||
// Init navigation
|
// Init navigation
|
||||||
try {
|
try {
|
||||||
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
||||||
|
@ -67,6 +71,15 @@ public class MainActivity extends AppCompatActivity {
|
||||||
getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface));
|
getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeApp() {
|
||||||
|
// Set feature switch override to default value
|
||||||
|
sharedPrefUtils.setFeatureSwitchOverride(FeatureSwitchOverride.ENABLE_SEARCH, FeatureSwitch.FeatureMaster.enableSearch);
|
||||||
|
sharedPrefUtils.setFeatureSwitchOverride(FeatureSwitchOverride.ENABLE_DEBUG_MENU, FeatureSwitch.FeatureMaster.enableDebugMenu);
|
||||||
|
|
||||||
|
// Set isFirstLaunch to false
|
||||||
|
sharedPrefUtils.setIsFirstLaunch(false);
|
||||||
|
}
|
||||||
|
|
||||||
private void applyFeatureSwitch(BottomNavigationView bottomNavigationView, FeatureSwitchOverride featureSwitchOverride, boolean defaultValue, int menuId) {
|
private void applyFeatureSwitch(BottomNavigationView bottomNavigationView, FeatureSwitchOverride featureSwitchOverride, boolean defaultValue, int menuId) {
|
||||||
boolean isEnabled = FeatureSwitch.Meta.canOverrideSwitch ? sharedPrefUtils.getFeatureSwitchOverride(featureSwitchOverride) : defaultValue;
|
boolean isEnabled = FeatureSwitch.Meta.canOverrideSwitch ? sharedPrefUtils.getFeatureSwitchOverride(featureSwitchOverride) : defaultValue;
|
||||||
if (!isEnabled) bottomNavigationView.getMenu().removeItem(menuId);
|
if (!isEnabled) bottomNavigationView.getMenu().removeItem(menuId);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user