mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge pull request #447 from neslihanturan/fixNewThemeIssues
Fix new theme issue (number 3)
This commit is contained in:
commit
a997184178
4 changed files with 6 additions and 6 deletions
|
|
@ -24,7 +24,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
|||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
// Check prefs on every activity starts
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true)) {
|
||||
setTheme(R.style.DarkAppTheme);
|
||||
}else {
|
||||
setTheme(R.style.LightAppTheme); // default
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class BaseActivity extends Activity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true)) {
|
||||
currentTheme = true;
|
||||
setTheme(R.style.DarkAppTheme);
|
||||
}else {
|
||||
|
|
@ -26,7 +26,7 @@ public class BaseActivity extends Activity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
// Restart activity if theme is changed
|
||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
|
||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true);
|
||||
if(currentTheme!=newTheme){ // is activity theme changed
|
||||
Intent intent = getIntent();
|
||||
finish();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class BaseAppCompatActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true)) {
|
||||
currentTheme = true;
|
||||
setTheme(R.style.DarkAppTheme);
|
||||
}else {
|
||||
|
|
@ -25,7 +25,7 @@ public class BaseAppCompatActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
// Restart activity if theme is changed
|
||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
|
||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true);
|
||||
if(currentTheme!=newTheme){ //is activity theme changed
|
||||
Intent intent = getIntent();
|
||||
finish();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<CheckBoxPreference
|
||||
android:title="@string/preference_theme"
|
||||
android:defaultValue="false"
|
||||
android:defaultValue="true"
|
||||
android:summary="@string/preference_theme_summary"
|
||||
android:key="theme" />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue