aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-01-31 14:09:46 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-01-31 14:09:46 +0000
commit02db44e532fc329fecab9c139dae6799ae4269d8 (patch)
tree1fefe2f80fa3ee7073bcb798099fb2ac74b70c9b /app/src/main/java/ml
parent119afb6084cbdc3f85889893281082a0640b56ee (diff)
downloadinfinity-for-reddit-02db44e532fc329fecab9c139dae6799ae4269d8.tar
infinity-for-reddit-02db44e532fc329fecab9c139dae6799ae4269d8.tar.gz
infinity-for-reddit-02db44e532fc329fecab9c139dae6799ae4269d8.tar.bz2
infinity-for-reddit-02db44e532fc329fecab9c139dae6799ae4269d8.tar.lz
infinity-for-reddit-02db44e532fc329fecab9c139dae6799ae4269d8.tar.xz
infinity-for-reddit-02db44e532fc329fecab9c139dae6799ae4269d8.tar.zst
infinity-for-reddit-02db44e532fc329fecab9c139dae6799ae4269d8.zip
Reorganize settings. Opening link in app is now available.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java132
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java136
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java60
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/GesturesAndButtonsPreferenceFragment.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java95
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java196
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/NotificationPreferenceFragment.java131
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java1
11 files changed, 448 insertions, 347 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
index d35e129f..b066cb99 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
@@ -154,16 +154,21 @@ public class LinkResolverActivity extends AppCompatActivity {
}
private void deepLinkError(Uri uri) {
+ PackageManager pm = getPackageManager();
+ if (mSharedPreferences.getBoolean(SharedPreferencesUtils.OPEN_LINK_IN_APP, false)) {
+ openInCustomTabs(uri, pm);
+ return;
+ }
+
String authority = uri.getAuthority();
if(authority != null && (authority.contains("reddit.com") || authority.contains("redd.it") || authority.contains("reddit.app.link"))) {
- openInCustomTabs(uri, getPackageManager());
+ openInCustomTabs(uri, pm);
return;
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
- PackageManager pm = getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0);
ArrayList<String> packageNames = new ArrayList<>();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java
index 8d5e07a7..5abda777 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java
@@ -17,6 +17,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment;
+import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
public class SettingsActivity extends BaseActivity implements
@@ -66,6 +67,8 @@ public class SettingsActivity extends BaseActivity implements
setTitle(R.string.settings_activity_label);
} else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof AboutPreferenceFragment) {
setTitle(R.string.settings_about_master_title);
+ } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof InterfacePreferenceFragment) {
+ setTitle(R.string.settings_interface_title);
}
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java
index 79f0dfb5..0a0bd3bf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java
@@ -2,11 +2,13 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
+import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
@@ -19,6 +21,8 @@ import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
*/
public class AboutPreferenceFragment extends PreferenceFragmentCompat {
+ private Activity activity;
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.about_preferences, rootKey);
@@ -30,77 +34,79 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY);
Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY);
- Activity activity = getActivity();
+ if (openSourcePreference != null) {
+ openSourcePreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://github.com/Docile-Alligator/Infinity-For-Reddit"));
+ startActivity(intent);
+ return true;
+ });
+ }
- if (activity != null) {
- if (openSourcePreference != null) {
- openSourcePreference.setOnPreferenceClickListener(preference -> {
+ if (reviewPreference != null) {
+ reviewPreference.setOnPreferenceClickListener(preference -> {
+ Intent playStoreIntent = new Intent(Intent.ACTION_VIEW);
+ playStoreIntent.setData(Uri.parse("market://details?id=ml.docilealligator.infinityforreddit"));
+ if (playStoreIntent.resolveActivity(activity.getPackageManager()) != null) {
+ activity.startActivity(playStoreIntent);
+ } else {
Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://github.com/Docile-Alligator/Infinity-For-Reddit"));
+ intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit"));
startActivity(intent);
- return true;
- });
- }
+ }
+ return true;
+ });
+ }
- if (reviewPreference != null) {
- reviewPreference.setOnPreferenceClickListener(preference -> {
- Intent playStoreIntent = new Intent(Intent.ACTION_VIEW);
- playStoreIntent.setData(Uri.parse("market://details?id=ml.docilealligator.infinityforreddit"));
- if (playStoreIntent.resolveActivity(activity.getPackageManager()) != null) {
- activity.startActivity(playStoreIntent);
- } else {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit"));
- startActivity(intent);
- }
- return true;
- });
- }
+ if (emailPreference != null) {
+ emailPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(Intent.ACTION_SENDTO);
+ intent.setData(Uri.parse("mailto:docilealligator.app@gmail.com"));
+ if (intent.resolveActivity(activity.getPackageManager()) != null) {
+ startActivity(intent);
+ } else {
+ Toast.makeText(activity, R.string.no_email_client, Toast.LENGTH_SHORT).show();
+ }
+ return true;
+ });
+ }
- if (emailPreference != null) {
- emailPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(Intent.ACTION_SENDTO);
- intent.setData(Uri.parse("mailto:docilealligator.app@gmail.com"));
- if (intent.resolveActivity(activity.getPackageManager()) != null) {
- startActivity(intent);
- } else {
- Toast.makeText(activity, R.string.no_email_client, Toast.LENGTH_SHORT).show();
- }
- return true;
- });
- }
+ if (redditAccountPreference != null) {
+ redditAccountPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.reddit.com/user/Hostilenemy"));
+ startActivity(intent);
+ return true;
+ });
+ }
- if (redditAccountPreference != null) {
- redditAccountPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://www.reddit.com/user/Hostilenemy"));
- startActivity(intent);
- return true;
- });
- }
+ if (subredditPreference != null) {
+ subredditPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.reddit.com/r/Infinity_For_Reddit"));
+ startActivity(intent);
+ return true;
+ });
+ }
- if (subredditPreference != null) {
- subredditPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://www.reddit.com/r/Infinity_For_Reddit"));
+ if (sharePreference != null) {
+ sharePreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("text/plain");
+ intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_this_app));
+ if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
- return true;
- });
- }
-
- if (sharePreference != null) {
- sharePreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setType("text/plain");
- intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_this_app));
- if (intent.resolveActivity(activity.getPackageManager()) != null) {
- startActivity(intent);
- } else {
- Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show();
- }
- return true;
- });
- }
+ } else {
+ Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show();
+ }
+ return true;
+ });
}
}
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java
index cb348c68..c7022006 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java
@@ -2,12 +2,14 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
+import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -23,9 +25,9 @@ import ml.docilealligator.infinityforreddit.R;
*/
public class AcknowledgementFragment extends Fragment {
-
@BindView(R.id.recycler_view_acknowledgement_fragment)
RecyclerView recyclerView;
+ private Activity activity;
public AcknowledgementFragment() {
// Required empty public constructor
@@ -37,8 +39,6 @@ public class AcknowledgementFragment extends Fragment {
View rootView = inflater.inflate(R.layout.fragment_acknowledgement, container, false);
ButterKnife.bind(this, rootView);
- Activity activity = getActivity();
-
ArrayList<Acknowledgement> acknowledgements = new ArrayList<>();
acknowledgements.add(new Acknowledgement("ExoPlayer",
"An application level media player for Android",
@@ -107,4 +107,10 @@ public class AcknowledgementFragment extends Fragment {
return rootView;
}
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java
index 7fc725bb..8607b486 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java
@@ -2,10 +2,12 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
+import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
@@ -18,6 +20,8 @@ import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
*/
public class CreditsPreferenceFragment extends PreferenceFragmentCompat {
+ private Activity activity;
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.credits_preferences, rootKey);
@@ -30,71 +34,73 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat {
Preference thumbtackIconPreference = findPreference(SharedPreferencesUtils.THUMBTACK_ICON_KEY);
Preference materialIconsPreference = findPreference(SharedPreferencesUtils.MATERIAL_ICONS_KEY);
- Activity activity = getActivity();
-
- if (activity != null) {
- if (iconForegroundPreference != null) {
- iconForegroundPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology"));
- startActivity(intent);
- return true;
- });
- }
-
- if (iconBackgroundPreference != null) {
- iconBackgroundPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/background"));
- startActivity(intent);
- return true;
- });
- }
-
- if (errorImagePreference != null) {
- errorImagePreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology"));
- startActivity(intent);
- return true;
- });
- }
-
- if (gildedIconPreference != null) {
- gildedIconPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://br.flaticon.com/icone-gratis/medalha_1007239"));
- startActivity(intent);
- return true;
- });
- }
-
- if (crosspostIconPreference != null) {
- crosspostIconPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://www.flaticon.com/free-icon/crossed-arrows_2291"));
- startActivity(intent);
- return true;
- });
- }
-
- if (thumbtackIconPreference != null) {
- thumbtackIconPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://www.flaticon.com/free-icon/tack-save-button_61845#term=thumbtack&page=1&position=3"));
- startActivity(intent);
- return true;
- });
- }
-
- if (materialIconsPreference != null) {
- materialIconsPreference.setOnPreferenceClickListener(preference -> {
- Intent intent = new Intent(activity, LinkResolverActivity.class);
- intent.setData(Uri.parse("https://material.io/resources/icons/"));
- startActivity(intent);
- return true;
- });
- }
+ if (iconForegroundPreference != null) {
+ iconForegroundPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if (iconBackgroundPreference != null) {
+ iconBackgroundPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/background"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if (errorImagePreference != null) {
+ errorImagePreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if (gildedIconPreference != null) {
+ gildedIconPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://br.flaticon.com/icone-gratis/medalha_1007239"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if (crosspostIconPreference != null) {
+ crosspostIconPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.flaticon.com/free-icon/crossed-arrows_2291"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if (thumbtackIconPreference != null) {
+ thumbtackIconPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.flaticon.com/free-icon/tack-save-button_61845#term=thumbtack&page=1&position=3"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if (materialIconsPreference != null) {
+ materialIconsPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://material.io/resources/icons/"));
+ startActivity(intent);
+ return true;
+ });
}
}
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java
index 53abe8ab..5d4a0a5a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java
@@ -1,8 +1,10 @@
package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
+import android.content.Context;
import android.os.Bundle;
+import androidx.annotation.NonNull;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
@@ -13,37 +15,41 @@ import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
public class FontSizePreferenceFragment extends PreferenceFragmentCompat {
+ private Activity activity;
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.font_size_preferences, rootKey);
+ ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY);
+ ListPreference titleFontSizePreference = findPreference(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY);
+ ListPreference contentFontSizePreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY);
+
+ if (fontSizePreference != null) {
+ fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ activity.recreate();
+ return true;
+ });
+ }
+
+ if (titleFontSizePreference != null) {
+ titleFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+ }
- Activity activity = getActivity();
- if (activity != null) {
- ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY);
- ListPreference titleFontSizePreference = findPreference(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY);
- ListPreference contentFontSizePreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY);
-
- if (fontSizePreference != null) {
- fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new RecreateActivityEvent());
- activity.recreate();
- return true;
- });
- }
-
- if (titleFontSizePreference != null) {
- titleFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new RecreateActivityEvent());
- return true;
- });
- }
-
- if (contentFontSizePreference != null) {
- contentFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new RecreateActivityEvent());
- return true;
- });
- }
+ if (contentFontSizePreference != null) {
+ contentFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
}
}
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/GesturesAndButtonsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/GesturesAndButtonsPreferenceFragment.java
new file mode 100644
index 00000000..39e6874d
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/GesturesAndButtonsPreferenceFragment.java
@@ -0,0 +1,20 @@
+package ml.docilealligator.infinityforreddit.Settings;
+
+
+import android.os.Bundle;
+
+import androidx.fragment.app.Fragment;
+import androidx.preference.PreferenceFragmentCompat;
+
+import ml.docilealligator.infinityforreddit.R;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class GesturesAndButtonsPreferenceFragment extends PreferenceFragmentCompat {
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.gestures_and_buttons_preference, rootKey);
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java
new file mode 100644
index 00000000..e3f9893e
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java
@@ -0,0 +1,95 @@
+package ml.docilealligator.infinityforreddit.Settings;
+
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Build;
+import android.os.Bundle;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.preference.ListPreference;
+import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.SwitchPreference;
+
+import org.greenrobot.eventbus.EventBus;
+
+import ml.docilealligator.infinityforreddit.Event.ChangePostLayoutEvent;
+import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent;
+import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent;
+import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
+import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
+ private Activity activity;
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.interface_preference, rootKey);
+
+ SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
+ SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
+ SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
+ SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY);
+ ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
+ SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
+
+ if (immersiveInterfaceSwitch != null) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
+ immersiveInterfaceSwitch.setVisible(true);
+ immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+ } else {
+ immersiveInterfaceSwitch.setVisible(false);
+ }
+ }
+
+ if (bottomAppBarSwitch != null) {
+ bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+ }
+
+ if (voteButtonsOnTheRightSwitch != null) {
+ voteButtonsOnTheRightSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeVoteButtonsPositionEvent((Boolean) newValue));
+ return true;
+ });
+ }
+
+ if (showElapsedTimeSwitch != null) {
+ showElapsedTimeSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeShowElapsedTimeEvent((Boolean) newValue));
+ return true;
+ });
+ }
+
+ if (defaultPostLayoutSwitch != null) {
+ defaultPostLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangePostLayoutEvent(Integer.parseInt((String) newValue)));
+ return true;
+ });
+ }
+
+ if (showDividerInCompactLayout != null) {
+ showDividerInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
+ return true;
+ });
+ }
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
index e6b9f04b..1a94cc37 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
@@ -2,11 +2,13 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
+import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
+import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
@@ -18,12 +20,8 @@ import javax.inject.Inject;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
-import ml.docilealligator.infinityforreddit.Event.ChangePostLayoutEvent;
-import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
-import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent;
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
-import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
@@ -40,144 +38,94 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
@Inject
SharedPreferences sharedPreferences;
+ private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.main_preferences, rootKey);
+ ((Infinity) activity.getApplication()).getAppComponent().inject(this);
- Activity activity = getActivity();
- if (activity != null) {
- ((Infinity) activity.getApplication()).getAppComponent().inject(this);
-
- SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
- SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
- SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
- SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
- SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY);
- ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
- SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
- SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
- SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY);
- SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY);
- ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
-
- if (amoledDarkSwitch != null) {
- amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) {
- EventBus.getDefault().post(new RecreateActivityEvent());
- activity.recreate();
- }
- return true;
- });
- }
-
- if (immersiveInterfaceSwitch != null) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
- immersiveInterfaceSwitch.setVisible(true);
- immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new RecreateActivityEvent());
- return true;
- });
- } else {
- immersiveInterfaceSwitch.setVisible(false);
- }
- }
+ SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
+ SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
+ SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY);
+ SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY);
+ ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
- if (bottomAppBarSwitch != null) {
- bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ if (amoledDarkSwitch != null) {
+ amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) {
EventBus.getDefault().post(new RecreateActivityEvent());
- return true;
- });
- }
-
- if (voteButtonsOnTheRightSwitch != null) {
- voteButtonsOnTheRightSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeVoteButtonsPositionEvent((Boolean) newValue));
- return true;
- });
- }
-
- if (showElapsedTimeSwitch != null) {
- showElapsedTimeSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeShowElapsedTimeEvent((Boolean) newValue));
- return true;
- });
- }
+ activity.recreate();
+ }
+ return true;
+ });
+ }
- if (defaultPostLayoutSwitch != null) {
- defaultPostLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangePostLayoutEvent(Integer.parseInt((String) newValue)));
- return true;
- });
- }
+ if (nsfwSwitch != null) {
+ nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeNSFWEvent((Boolean) newValue));
+ if (blurNSFWSwitch != null) {
+ blurNSFWSwitch.setVisible((Boolean) newValue);
+ }
+ return true;
+ });
+ }
- if (showDividerInCompactLayout != null) {
- showDividerInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
- return true;
- });
- }
+ if (blurNSFWSwitch != null) {
+ boolean nsfwEnabled = sharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
- if (nsfwSwitch != null) {
- nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeNSFWEvent((Boolean) newValue));
- if (blurNSFWSwitch != null) {
- blurNSFWSwitch.setVisible((Boolean) newValue);
- }
- return true;
- });
+ if (nsfwEnabled) {
+ blurNSFWSwitch.setVisible(true);
+ } else {
+ blurNSFWSwitch.setVisible(false);
}
- if (blurNSFWSwitch != null) {
- boolean nsfwEnabled = sharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
+ blurNSFWSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeNSFWBlurEvent((Boolean) newValue));
+ return true;
+ });
+ }
- if (nsfwEnabled) {
- blurNSFWSwitch.setVisible(true);
- } else {
- blurNSFWSwitch.setVisible(false);
- }
+ if (blurSpoilerSwitch != null) {
+ blurSpoilerSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeSpoilerBlurEvent((Boolean) newValue));
+ return true;
+ });
+ }
- blurNSFWSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeNSFWBlurEvent((Boolean) newValue));
- return true;
- });
- }
+ boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
- if (blurSpoilerSwitch != null) {
- blurSpoilerSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeSpoilerBlurEvent((Boolean) newValue));
- return true;
- });
+ if (themePreference != null) {
+ if (systemDefault) {
+ themePreference.setEntries(R.array.settings_theme_q);
+ } else {
+ themePreference.setEntries(R.array.settings_theme);
}
- boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
-
- if (themePreference != null) {
- if (systemDefault) {
- themePreference.setEntries(R.array.settings_theme_q);
- } else {
- themePreference.setEntries(R.array.settings_theme);
+ themePreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ int option = Integer.parseInt((String) newValue);
+ switch (option) {
+ case 0:
+ AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
+ break;
+ case 1:
+ AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
+ break;
+ case 2:
+ if (systemDefault) {
+ AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
+ } else {
+ AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
+ }
}
-
- themePreference.setOnPreferenceChangeListener((preference, newValue) -> {
- int option = Integer.parseInt((String) newValue);
- switch (option) {
- case 0:
- AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
- break;
- case 1:
- AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
- break;
- case 2:
- if (systemDefault) {
- AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
- } else {
- AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
- }
- }
- return true;
- });
- }
+ return true;
+ });
}
}
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/NotificationPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/NotificationPreferenceFragment.java
index 86169571..36b0326e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/NotificationPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/NotificationPreferenceFragment.java
@@ -2,9 +2,11 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
+import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
+import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
@@ -34,83 +36,86 @@ public class NotificationPreferenceFragment extends PreferenceFragmentCompat {
private boolean enableNotification;
private long notificationInterval;
private WorkManager workManager;
+ private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.notification_preferences, rootKey);
- Activity activity = getActivity();
+ workManager = WorkManager.getInstance(activity);
- if (activity != null) {
- workManager = WorkManager.getInstance(activity);
+ ((Infinity) activity.getApplication()).getAppComponent().inject(this);
- ((Infinity) activity.getApplication()).getAppComponent().inject(this);
+ SwitchPreference enableNotificationSwitchPreference = findPreference(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY);
+ ListPreference notificationIntervalListPreference = findPreference(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY);
- SwitchPreference enableNotificationSwitchPreference = findPreference(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY);
- ListPreference notificationIntervalListPreference = findPreference(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY);
+ enableNotification = sharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
+ notificationInterval = Long.parseLong(sharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"));
- enableNotification = sharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
- notificationInterval = Long.parseLong(sharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"));
+ if (enableNotification) {
+ if (notificationIntervalListPreference != null) {
+ notificationIntervalListPreference.setVisible(true);
+ }
+ }
- if (enableNotification) {
+ if (enableNotificationSwitchPreference != null) {
+ enableNotificationSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ enableNotification = ((Boolean) newValue);
if (notificationIntervalListPreference != null) {
- notificationIntervalListPreference.setVisible(true);
+ notificationIntervalListPreference.setVisible(enableNotification);
}
- }
- if (enableNotificationSwitchPreference != null) {
- enableNotificationSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> {
- enableNotification = ((Boolean) newValue);
- if (notificationIntervalListPreference != null) {
- notificationIntervalListPreference.setVisible(enableNotification);
- }
-
- if (enableNotification) {
- Constraints constraints = new Constraints.Builder()
- .setRequiredNetworkType(NetworkType.CONNECTED)
- .build();
-
- PeriodicWorkRequest pullNotificationRequest =
- new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
- notificationInterval, TimeUnit.HOURS)
- .setConstraints(constraints)
- .setInitialDelay(notificationInterval, TimeUnit.HOURS)
- .build();
-
- workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
- ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
- } else {
- workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
- }
- return true;
- });
- }
+ if (enableNotification) {
+ Constraints constraints = new Constraints.Builder()
+ .setRequiredNetworkType(NetworkType.CONNECTED)
+ .build();
+
+ PeriodicWorkRequest pullNotificationRequest =
+ new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
+ notificationInterval, TimeUnit.HOURS)
+ .setConstraints(constraints)
+ .setInitialDelay(notificationInterval, TimeUnit.HOURS)
+ .build();
+
+ workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
+ ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
+ } else {
+ workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
+ }
+ return true;
+ });
+ }
- if (notificationIntervalListPreference != null) {
- notificationIntervalListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
- notificationInterval = Long.parseLong((String) newValue);
-
- if (enableNotification) {
- Constraints constraints = new Constraints.Builder()
- .setRequiredNetworkType(NetworkType.CONNECTED)
- .build();
-
- PeriodicWorkRequest pullNotificationRequest =
- new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
- notificationInterval, TimeUnit.HOURS)
- .setConstraints(constraints)
- .setInitialDelay(notificationInterval, TimeUnit.HOURS)
- .build();
-
- workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
- ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
- } else {
- workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
- }
-
- return true;
- });
- }
+ if (notificationIntervalListPreference != null) {
+ notificationIntervalListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ notificationInterval = Long.parseLong((String) newValue);
+
+ if (enableNotification) {
+ Constraints constraints = new Constraints.Builder()
+ .setRequiredNetworkType(NetworkType.CONNECTED)
+ .build();
+
+ PeriodicWorkRequest pullNotificationRequest =
+ new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
+ notificationInterval, TimeUnit.HOURS)
+ .setConstraints(constraints)
+ .setInitialDelay(notificationInterval, TimeUnit.HOURS)
+ .build();
+
+ workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
+ ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
+ } else {
+ workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
+ }
+
+ return true;
+ });
}
}
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
index 7154f06e..4a8dad83 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
@@ -68,4 +68,5 @@ public class SharedPreferencesUtils {
public static final String VOLUME_KEYS_NAVIGATE_COMMENTS = "volume_keys_navigate_comments";
public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts";
public static final String MUTE_VIDEO = "mute_video";
+ public static final String OPEN_LINK_IN_APP = "open_link_in_app";
}