use string-constant

This commit is contained in:
B. Petersen
2020-05-04 18:08:14 +02:00
parent eee1f35b99
commit ea0653e89a
4 changed files with 5 additions and 4 deletions
@@ -63,7 +63,7 @@ public class ApplicationDcContext extends DcContext {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
if(sharedPreferences.contains("pref_compression")) {
if (sharedPreferences.getString("pref_compression", "0").equals("1")) {
setConfigInt("media_quality", DC_MEDIA_QUALITY_WORSE);
setConfigInt(DcHelper.CONFIG_MEDIA_QUALITY, DC_MEDIA_QUALITY_WORSE);
}
sharedPreferences.edit().remove("pref_compression").apply();
}
@@ -29,6 +29,7 @@ public class DcHelper {
public static final String CONFIG_MVBOX_MOVE = "mvbox_move";
public static final String CONFIG_BCC_SELF = "bcc_self";
public static final String CONFIG_SHOW_EMAILS = "show_emails";
public static final String CONFIG_MEDIA_QUALITY = "media_quality";
public static ApplicationDcContext getContext(Context context) {
return ApplicationContext.getInstance(context).dcContext;
@@ -46,7 +46,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
mediaQuality = (ListPreference) this.findPreference("pref_compression");
mediaQuality.setOnPreferenceChangeListener((preference, newValue) -> {
updateListSummary(preference, newValue);
dcContext.setConfigInt("media_quality", Util.objectToInt(newValue));
dcContext.setConfigInt(DcHelper.CONFIG_MEDIA_QUALITY, Util.objectToInt(newValue));
return true;
});
@@ -86,7 +86,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
showEmails.setValue(value);
updateListSummary(showEmails, value);
value = Integer.toString(dcContext.getConfigInt("media_quality"));
value = Integer.toString(dcContext.getConfigInt(DcHelper.CONFIG_MEDIA_QUALITY));
mediaQuality.setValue(value);
updateListSummary(mediaQuality, value);
@@ -175,7 +175,7 @@ public class Prefs {
}
public static boolean isHardCompressionEnabled(Context context) {
return DcHelper.getContext(context).getConfigInt("media_quality") == DcContext.DC_MEDIA_QUALITY_WORSE;
return DcHelper.getContext(context).getConfigInt(DcHelper.CONFIG_MEDIA_QUALITY) == DcContext.DC_MEDIA_QUALITY_WORSE;
}
public static boolean isLocationStreamingEnabled(Context context) {