Added always open links with external browser option

master
Alex 7 years ago
parent 27288d30af
commit 39c1744786
  1. 2
      Clover/app/src/main/java/org/floens/chan/core/settings/ChanSettings.java
  2. 3
      Clover/app/src/main/java/org/floens/chan/ui/controller/BehaviourSettingsController.java
  3. 8
      Clover/app/src/main/java/org/floens/chan/ui/layout/ThreadLayout.java
  4. 1
      Clover/app/src/main/res/values/strings.xml

@ -95,6 +95,7 @@ public class ChanSettings {
public static final StringSetting fontSize; public static final StringSetting fontSize;
public static final BooleanSetting fontCondensed; public static final BooleanSetting fontCondensed;
public static final BooleanSetting openLinkConfirmation; public static final BooleanSetting openLinkConfirmation;
public static final BooleanSetting openLinkBrowser;
public static final BooleanSetting autoRefreshThread; public static final BooleanSetting autoRefreshThread;
// public static final BooleanSetting imageAutoLoad; // public static final BooleanSetting imageAutoLoad;
public static final OptionsSetting<MediaAutoLoadMode> imageAutoLoadNetwork; public static final OptionsSetting<MediaAutoLoadMode> imageAutoLoadNetwork;
@ -170,6 +171,7 @@ public class ChanSettings {
fontSize = new StringSetting(p, "preference_font", tablet ? "16" : "14"); fontSize = new StringSetting(p, "preference_font", tablet ? "16" : "14");
fontCondensed = new BooleanSetting(p, "preference_font_condensed", false); fontCondensed = new BooleanSetting(p, "preference_font_condensed", false);
openLinkConfirmation = new BooleanSetting(p, "preference_open_link_confirmation", false); openLinkConfirmation = new BooleanSetting(p, "preference_open_link_confirmation", false);
openLinkBrowser = new BooleanSetting(p, "preference_open_link_browser", false);
autoRefreshThread = new BooleanSetting(p, "preference_auto_refresh_thread", true); autoRefreshThread = new BooleanSetting(p, "preference_auto_refresh_thread", true);
// imageAutoLoad = new BooleanSetting(p, "preference_image_auto_load", true); // imageAutoLoad = new BooleanSetting(p, "preference_image_auto_load", true);
imageAutoLoadNetwork = new OptionsSetting<>(p, "preference_image_auto_load_network", MediaAutoLoadMode.class, MediaAutoLoadMode.WIFI); imageAutoLoadNetwork = new OptionsSetting<>(p, "preference_image_auto_load_network", MediaAutoLoadMode.class, MediaAutoLoadMode.WIFI);

@ -128,6 +128,9 @@ public class BehaviourSettingsController extends SettingsController {
post.add(new BooleanSettingView(this, post.add(new BooleanSettingView(this,
ChanSettings.openLinkConfirmation, ChanSettings.openLinkConfirmation,
R.string.setting_open_link_confirmation, 0)); R.string.setting_open_link_confirmation, 0));
post.add(new BooleanSettingView(this,
ChanSettings.openLinkBrowser,
R.string.setting_open_link_browser, 0));
groups.add(post); groups.add(post);
} }

@ -301,16 +301,24 @@ public class ThreadLayout extends CoordinatorLayout implements
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (ChanSettings.openLinkBrowser.get()) {
AndroidUtils.openLink(link);
} else {
AndroidUtils.openLinkInBrowser((Activity) getContext(), link); AndroidUtils.openLinkInBrowser((Activity) getContext(), link);
} }
}
}) })
.setTitle(R.string.open_link_confirmation) .setTitle(R.string.open_link_confirmation)
.setMessage(link) .setMessage(link)
.show(); .show();
} else {
if (ChanSettings.openLinkBrowser.get()) {
AndroidUtils.openLink(link);
} else { } else {
AndroidUtils.openLinkInBrowser((Activity) getContext(), link); AndroidUtils.openLinkInBrowser((Activity) getContext(), link);
} }
} }
}
@Override @Override
public void openReportView(Post post) { public void openReportView(Post post) {

@ -482,6 +482,7 @@ Crash reports do not collect any personally identifiable information."
<string name="setting_volume_key_scrolling">Volume keys scroll content</string> <string name="setting_volume_key_scrolling">Volume keys scroll content</string>
<string name="setting_tap_no_rely">Tap the post number to reply</string> <string name="setting_tap_no_rely">Tap the post number to reply</string>
<string name="setting_open_link_confirmation">Ask before opening links</string> <string name="setting_open_link_confirmation">Ask before opening links</string>
<string name="setting_open_link_browser">Always open links in external browser</string>
<!-- Behavior proxy group --> <!-- Behavior proxy group -->

Loading…
Cancel
Save