aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java
index 84377724..915438a6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java
@@ -24,9 +24,33 @@ public class DataSavingModePreferenceFragment extends PreferenceFragmentCompat {
SwitchPreference disableImagePreviewPreference = findPreference(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW);
SwitchPreference onlyDisablePreviewInVideoAndGifPostsPreference = findPreference(SharedPreferencesUtils.ONLY_DISABLE_PREVIEW_IN_VIDEO_AND_GIF_POSTS);
+
if (dataSavingModeListPreference != null) {
+ if (dataSavingModeListPreference.getValue().equals("0")) {
+ if (onlyDisablePreviewInVideoAndGifPostsPreference != null) {
+ onlyDisablePreviewInVideoAndGifPostsPreference.setEnabled(false);
+ }
+ if (disableImagePreviewPreference != null) {
+ disableImagePreviewPreference.setEnabled(false);
+ }
+ }
dataSavingModeListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeDataSavingModeEvent((String) newValue));
+ if (newValue.equals("0")) {
+ if (onlyDisablePreviewInVideoAndGifPostsPreference != null) {
+ onlyDisablePreviewInVideoAndGifPostsPreference.setEnabled(false);
+ }
+ if (disableImagePreviewPreference != null) {
+ disableImagePreviewPreference.setEnabled(false);
+ }
+ } else {
+ if (onlyDisablePreviewInVideoAndGifPostsPreference != null) {
+ onlyDisablePreviewInVideoAndGifPostsPreference.setEnabled(true);
+ }
+ if (disableImagePreviewPreference != null) {
+ disableImagePreviewPreference.setEnabled(true);
+ }
+ }
return true;
});
}
@@ -34,6 +58,12 @@ public class DataSavingModePreferenceFragment extends PreferenceFragmentCompat {
if (disableImagePreviewPreference != null) {
disableImagePreviewPreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeDisableImagePreviewEvent((Boolean) newValue));
+ if ((Boolean) newValue) {
+ EventBus.getDefault().post(new ChangeOnlyDisablePreviewInVideoAndGifPostsEvent(false));
+ if (onlyDisablePreviewInVideoAndGifPostsPreference != null) {
+ onlyDisablePreviewInVideoAndGifPostsPreference.setChecked(false);
+ }
+ }
return true;
});
}
@@ -41,8 +71,14 @@ public class DataSavingModePreferenceFragment extends PreferenceFragmentCompat {
if (onlyDisablePreviewInVideoAndGifPostsPreference != null) {
onlyDisablePreviewInVideoAndGifPostsPreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeOnlyDisablePreviewInVideoAndGifPostsEvent((Boolean) newValue));
+ if ((Boolean) newValue) {
+ EventBus.getDefault().post(new ChangeDisableImagePreviewEvent(false));
+ if (disableImagePreviewPreference != null) {
+ disableImagePreviewPreference.setChecked(false);
+ }
+ }
return true;
});
}
}
-} \ No newline at end of file
+}