Moved dark theme setting to setup

This commit is contained in:
M66B
2018-08-04 15:37:42 +00:00
parent fe9c0a4a8f
commit 4467a088ea
5 changed files with 56 additions and 15 deletions

View File

@@ -111,9 +111,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
case R.string.menu_folders:
onMenuFolders();
break;
case R.string.menu_theme:
onMenuTheme();
break;
case R.string.menu_setup:
onMenuSetup();
break;
@@ -184,6 +181,7 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
super.onSharedPreferenceChanged(prefs, key);
if ("eula".equals(key))
init();
}
@@ -244,7 +242,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
ArrayAdapterDrawer drawerArray = new ArrayAdapterDrawer(this, R.layout.item_drawer);
drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_unified));
drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_folders));
drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_theme, "dark".equals(prefs.getString("theme", "light"))));
drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_setup));
drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_debug));
drawerList.setAdapter(drawerArray);
@@ -268,14 +265,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
fragmentTransaction.commit();
}
private void onMenuTheme() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String theme = prefs.getString("theme", "light");
theme = ("dark".equals(theme) ? "light" : "dark");
prefs.edit().putString("theme", theme).apply();
recreate();
}
private void onMenuSetup() {
startActivity(new Intent(ActivityView.this, ActivitySetup.class));
}