Change theme from start screen

pull/193/head
M66B 4 years ago
parent cfa67f4bc5
commit 846ef59dd2

@ -493,7 +493,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
Log.i("Preference " + key + "=" + prefs.getAll().get(key));
if ("theme".equals(key)) {
finish();
if (this.getClass().equals(ActivitySetup.class))
if (this.getClass().equals(ActivitySetup.class) || this.getClass().equals(ActivityView.class))
startActivity(getIntent());
} else if (!this.getClass().equals(ActivitySetup.class) && !visible &&
Arrays.asList(FragmentOptions.OPTIONS_RESTART).contains(key))

@ -298,6 +298,7 @@ public class FragmentAccounts extends FragmentBase {
public void onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.menu_search).setVisible(!settings);
menu.findItem(R.id.menu_unified).setVisible(!settings);
menu.findItem(R.id.menu_theme).setVisible(!settings);
super.onPrepareOptionsMenu(menu);
}
@ -311,6 +312,9 @@ public class FragmentAccounts extends FragmentBase {
case R.id.menu_unified:
onMenuUnified();
return true;
case R.id.menu_theme:
onMenuTheme();
return true;
case R.id.menu_force_sync:
onMenuForceSync();
return true;
@ -336,6 +340,10 @@ public class FragmentAccounts extends FragmentBase {
fragmentTransaction.commit();
}
private void onMenuTheme() {
new FragmentDialogTheme().show(getParentFragmentManager(), "messages:theme");
}
private void onMenuForceSync() {
ServiceSynchronize.reload(getContext(), null, true, "force sync");
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();

@ -459,6 +459,7 @@ public class FragmentFolders extends FragmentBase {
boolean subscribed_only = prefs.getBoolean("subscribed_only", false);
menu.findItem(R.id.menu_unified).setVisible(account < 0 || primary);
menu.findItem(R.id.menu_theme).setVisible(account < 0 || primary);
menu.findItem(R.id.menu_compact).setChecked(compact);
menu.findItem(R.id.menu_show_hidden).setChecked(show_hidden);
menu.findItem(R.id.menu_show_flagged).setChecked(show_flagged);
@ -478,6 +479,9 @@ public class FragmentFolders extends FragmentBase {
case R.id.menu_unified:
onMenuUnified();
return true;
case R.id.menu_theme:
onMenuTheme();
return true;
case R.id.menu_compact:
onMenuCompact();
return true;
@ -519,6 +523,10 @@ public class FragmentFolders extends FragmentBase {
fragmentTransaction.commit();
}
private void onMenuTheme() {
new FragmentDialogTheme().show(getParentFragmentManager(), "messages:theme");
}
private void onMenuCompact() {
compact = !compact;

@ -4172,6 +4172,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
onMenuCompact();
return true;
case R.id.menu_theme:
onMenuTheme();
return true;
case R.id.menu_select_language:
onMenuSelectLanguage();
return true;
@ -4303,6 +4307,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
getActivity().invalidateOptionsMenu();
}
private void onMenuTheme() {
new FragmentDialogTheme().show(getParentFragmentManager(), "messages:theme");
}
private void clearMeasurements() {
sizes.clear();
heights.clear();

@ -14,6 +14,11 @@
android:title="@string/title_folders_unified"
app:showAsAction="always" />
<item
android:id="@+id/menu_theme"
android:title="@string/title_setup_theme"
app:showAsAction="never" />
<item
android:id="@+id/menu_force_sync"
android:title="@string/title_force_sync"

@ -14,6 +14,11 @@
android:title="@string/title_folders_unified"
app:showAsAction="always" />
<item
android:id="@+id/menu_theme"
android:title="@string/title_setup_theme"
app:showAsAction="never" />
<item
android:id="@+id/menu_compact"
android:checkable="true"

@ -113,6 +113,11 @@
android:title="@string/title_compact"
app:showAsAction="never" />
<item
android:id="@+id/menu_theme"
android:title="@string/title_setup_theme"
app:showAsAction="never" />
<item
android:id="@+id/menu_select_language"
android:title="@string/title_select_language"

Loading…
Cancel
Save