aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-10-10 13:51:10 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-10-10 13:51:10 +0000
commit43b9abd6ee455158553fbbc70df3c27eedd22b21 (patch)
tree88c48a1de545d82be50730b511b93e0737039bbb /app/src/main/java/ml
parentd40b81d7993b189142eadd79ab6b1daabba248d0 (diff)
downloadinfinity-for-reddit-43b9abd6ee455158553fbbc70df3c27eedd22b21.tar
infinity-for-reddit-43b9abd6ee455158553fbbc70df3c27eedd22b21.tar.gz
infinity-for-reddit-43b9abd6ee455158553fbbc70df3c27eedd22b21.tar.bz2
infinity-for-reddit-43b9abd6ee455158553fbbc70df3c27eedd22b21.tar.lz
infinity-for-reddit-43b9abd6ee455158553fbbc70df3c27eedd22b21.tar.xz
infinity-for-reddit-43b9abd6ee455158553fbbc70df3c27eedd22b21.tar.zst
infinity-for-reddit-43b9abd6ee455158553fbbc70df3c27eedd22b21.zip
New option: Link Handler. Removed option: Open Link In App.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java3
3 files changed, 12 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
index 3db1af77..2c337c63 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
@@ -298,10 +298,13 @@ public class LinkResolverActivity extends AppCompatActivity {
return;
}
- if (mSharedPreferences.getBoolean(SharedPreferencesUtils.OPEN_LINK_IN_APP, false)) {
+ int linkHandler = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.LINK_HANDLER, "0"));
+ if (linkHandler == 0) {
+ openInBrowser(uri, pm, true);
+ } else if (linkHandler == 1) {
openInCustomTabs(uri, pm, true);
} else {
- openInBrowser(uri, pm, true);
+ openInWebView(uri);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java
index f133863d..45661b85 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java
@@ -1,5 +1,8 @@
package ml.docilealligator.infinityforreddit.settings;
+import static android.app.Activity.RESULT_OK;
+import static android.content.Intent.ACTION_OPEN_DOCUMENT_TREE;
+
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@@ -39,9 +42,6 @@ import ml.docilealligator.infinityforreddit.asynctasks.RestoreSettings;
import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
-import static android.app.Activity.RESULT_OK;
-import static android.content.Intent.ACTION_OPEN_DOCUMENT_TREE;
-
/**
* A simple {@link Fragment} subclass.
*/
@@ -230,6 +230,8 @@ public class AdvancedPreferenceFragment extends PreferenceFragmentCompat {
editor.remove(SharedPreferencesUtils.NSFW_KEY_LEGACY);
editor.remove(SharedPreferencesUtils.BLUR_NSFW_KEY_LEGACY);
editor.remove(SharedPreferencesUtils.BLUR_SPOILER_KEY_LEGACY);
+ editor.remove(SharedPreferencesUtils.CONFIRM_TO_EXIT_LEGACY);
+ editor.remove(SharedPreferencesUtils.OPEN_LINK_IN_APP_LEGACY);
SharedPreferences.Editor sortTypeEditor = mSortTypeSharedPreferences.edit();
sortTypeEditor.remove(SharedPreferencesUtils.SORT_TYPE_ALL_POST_LEGACY);
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 9e3f8c69..6235c3c6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -93,7 +93,7 @@ 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";
+ public static final String LINK_HANDLER = "link_handler";
public static final String VIDEO_AUTOPLAY = "video_autoplay";
public static final String VIDEO_AUTOPLAY_VALUE_ALWAYS_ON = "2";
public static final String VIDEO_AUTOPLAY_VALUE_ON_WIFI = "1";
@@ -363,4 +363,5 @@ public class SharedPreferencesUtils {
public static final String BLUR_NSFW_KEY_LEGACY = "blur_nsfw";
public static final String BLUR_SPOILER_KEY_LEGACY = "blur_spoiler";
public static final String CONFIRM_TO_EXIT_LEGACY = "confirm_to_exit";
+ public static final String OPEN_LINK_IN_APP_LEGACY = "open_link_in_app";
}