Check if selected theme it's not the current

pull/464/head
Mauricio Colli 2017-02-25 16:04:10 -03:00
rodzic f8d9e0fa60
commit 6ec393699e
1 zmienionych plików z 21 dodań i 17 usunięć

Wyświetl plik

@ -98,6 +98,8 @@ public class SettingsFragment extends PreferenceFragment
downloadPathAudioPreference = findPreference(DOWNLOAD_PATH_AUDIO_PREFERENCE);
themePreference = findPreference(THEME);
final String currentTheme = defaultPreferences.getString(THEME, "Light");
prefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
@ -139,9 +141,10 @@ public class SettingsFragment extends PreferenceFragment
}
else if (key == THEME)
{
String theme = sharedPreferences.getString(THEME, "Light");
themePreference.setSummary(theme);
String selectedTheme = sharedPreferences.getString(THEME, "Light");
themePreference.setSummary(selectedTheme);
if(!selectedTheme.equals(currentTheme)) { // If it's not the current theme
new AlertDialog.Builder(activity)
.setTitle(R.string.restart_title)
.setMessage(R.string.msg_restart)
@ -159,6 +162,7 @@ public class SettingsFragment extends PreferenceFragment
.setNegativeButton(R.string.later, null)
.create().show();
}
}
updateSummary();
}
};