Fix crash on startup because R has changed
This commit is contained in:
parent
62ebf44d14
commit
d055253f97
6 changed files with 13 additions and 10 deletions
|
|
@ -104,7 +104,7 @@ dependencies {
|
|||
implementation "com.android.support:percent:$supportLibVersion"
|
||||
implementation "com.android.support:preference-v7:$supportLibVersion"
|
||||
implementation "com.android.support:preference-v14:$supportLibVersion"
|
||||
implementation 'com.github.kabouzeid:app-theme-helper:1.3.8'
|
||||
implementation 'com.github.kabouzeid:app-theme-helper:1.3.9'
|
||||
implementation 'com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod'
|
||||
implementation 'com.github.kabouzeid:SeekArc:1.2-kmod'
|
||||
implementation 'com.github.kabouzeid:AndroidSlidingUpPanel:3.3.0-kmod3'
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ public class App extends Application {
|
|||
// default theme
|
||||
if (!ThemeStore.isConfigured(this, 1)) {
|
||||
ThemeStore.editTheme(this)
|
||||
.activityTheme(R.style.Theme_Phonograph_Light)
|
||||
.primaryColorRes(R.color.md_indigo_500)
|
||||
.accentColorRes(R.color.md_pink_A400)
|
||||
.commit();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.kabouzeid.gramophone.ui.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
|
@ -19,7 +18,6 @@ import android.util.Log;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
|
|
|||
|
|
@ -200,15 +200,13 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
|||
return false;
|
||||
}
|
||||
|
||||
int theme = PreferenceUtil.getThemeResFromPrefValue(themeName);
|
||||
setSummary(generalTheme, o);
|
||||
ThemeStore.editTheme(getActivity())
|
||||
.activityTheme(theme)
|
||||
.commit();
|
||||
|
||||
ThemeStore.markChanged(getActivity());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
// Set the new theme so that updateAppShortcuts can pull it
|
||||
getActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue((String) o));
|
||||
getActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue(themeName));
|
||||
new DynamicShortcutManager(getActivity()).updateDynamicShortcuts();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public abstract class AbsThemeActivity extends ATHToolbarActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(PreferenceUtil.getInstance(this).getGeneralTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,8 +105,15 @@ public final class PreferenceUtil {
|
|||
mPreferences.unregisterOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||
}
|
||||
|
||||
@StyleRes
|
||||
public int getGeneralTheme() {
|
||||
return getThemeResFromPrefValue(mPreferences.getString(GENERAL_THEME, ""));
|
||||
return getThemeResFromPrefValue(mPreferences.getString(GENERAL_THEME, "light"));
|
||||
}
|
||||
|
||||
public void setGeneralTheme(String theme) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(GENERAL_THEME, theme);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
@StyleRes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue