diff --git a/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java b/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java index f23163ec..1f44a00f 100644 --- a/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java +++ b/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java @@ -90,7 +90,6 @@ public class GlobalSettings { private static final String PROXY_PORT = "proxy_port"; private static final String PROXY_USER = "proxy_user"; private static final String PROXY_PASS = "proxy_pass"; - private static final String PROXY_WARNING = "proxy_warning"; private static final String ENABLE_LIKE = "like_enable"; private static final String FILTER_RESULTS = "filter_results"; private static final String PUBLIC_TIMELINE = "public_timeline"; @@ -156,7 +155,6 @@ public class GlobalSettings { private boolean push_enabled; private boolean isProxyEnabled; private boolean isProxyAuthSet; - private boolean proxyWarning; private boolean toolbarOverlap; private boolean showStatusIcons; private boolean filterResults; @@ -811,9 +809,6 @@ public class GlobalSettings { edit.putString(PROXY_PASS, proxyPass); edit.apply(); - if (!proxyWarning) { - setProxyWarning(true); - } notifySettingsChange(); } @@ -840,19 +835,6 @@ public class GlobalSettings { notifySettingsChange(); } - /** - * enable/disable proxy warning - * - * @param enable true to enable proxy warning - */ - public void setProxyWarning(boolean enable) { - proxyWarning = enable; - - Editor edit = settings.edit(); - edit.putBoolean(PROXY_WARNING, enable); - edit.apply(); - } - /** * set proxy authentication enabled * @@ -941,13 +923,6 @@ public class GlobalSettings { return isProxyAuthSet; } - /** - * check if proxy warning should be shown when trying to open external link - */ - public boolean isProxyWarningEnabled() { - return proxyWarning; - } - /** * Check if current user is logged in * @@ -1056,7 +1031,6 @@ public class GlobalSettings { enableLike = settings.getBoolean(ENABLE_LIKE, false); hideSensitive = settings.getBoolean(HIDE_SENSITIVE, true); floatingEnabled = settings.getBoolean(FLOATING_BUTTON, true); - proxyWarning = settings.getBoolean(PROXY_WARNING, true); publicTimeline = settings.getString(PUBLIC_TIMELINE, TIMELINE_COMBINED); showAllAnnouncements = settings.getBoolean(ANNOUNCEMENTS_SHOW_ALL, false); chrologicalTimeline = settings.getBoolean(CHRONOLOGICAL_TIMELINE, false); diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java b/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java index c07b2df3..ba801f75 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java @@ -137,7 +137,6 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene private Relation relation; @Nullable private User user; - private String urlToRedirect; @Override @@ -435,18 +434,16 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene @Override - public void onTagClick(String text) { + public void onTagClick(String tag) { Intent intent = new Intent(this, SearchActivity.class); - intent.putExtra(SearchActivity.KEY_QUERY, text); + intent.putExtra(SearchActivity.KEY_QUERY, tag); startActivity(intent); } @Override - public void onLinkClick(String tag) { - if (ConfirmDialog.show(this, ConfirmDialog.CONTINUE_BROWSER, null)) { - urlToRedirect = tag; - } + public void onLinkClick(String link) { + LinkUtils.redirectToBrowser(this, link); } @@ -471,9 +468,7 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene // open link added to profile else if (v.getId() == R.id.page_profile_links) { if (!user.getProfileUrl().isEmpty()) { - if (ConfirmDialog.show(this, ConfirmDialog.CONTINUE_BROWSER, null)) { - urlToRedirect = user.getProfileUrl(); - } + LinkUtils.redirectToBrowser(this, user.getProfileUrl()); } } // open profile image @@ -529,11 +524,6 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene DomainAction.Param param = new DomainAction.Param(DomainAction.Param.MODE_BLOCK, url); domainAction.execute(param, domainCallback); } - // confirmed redirect to browser - else if (type == ConfirmDialog.CONTINUE_BROWSER) { - settings.setProxyWarning(!remember); - LinkUtils.redirectToBrowser(this, urlToRedirect); - } } } diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/activities/StatusActivity.java b/app/src/main/java/org/nuclearfog/twidda/ui/activities/StatusActivity.java index 43b5b7fd..3cb3f5f4 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/activities/StatusActivity.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/activities/StatusActivity.java @@ -683,7 +683,9 @@ public class StatusActivity extends AppCompatActivity implements OnClickListener @Override public void onCardClick(Card card, int type) { if (type == OnCardClickListener.TYPE_LINK) { - //LinkUtils.openLink(this, card.getUrl()); + if (!card.getUrl().isEmpty()) { + LinkUtils.redirectToBrowser(this, card.getUrl()); + } } else if (type == OnCardClickListener.TYPE_IMAGE) { String imageUrl = card.getImageUrl(); if (!imageUrl.isEmpty()) { diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/dialogs/ConfirmDialog.java b/app/src/main/java/org/nuclearfog/twidda/ui/dialogs/ConfirmDialog.java index fa79c5e4..9d2dd16a 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/dialogs/ConfirmDialog.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/dialogs/ConfirmDialog.java @@ -133,11 +133,6 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener { */ public static final int FILTER_REMOVE = 626; - /** - * show notification when opening an external link while proxy is enabled - */ - public static final int CONTINUE_BROWSER = 627; - /** * show 'unfollow tag' dialog */ @@ -175,7 +170,7 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener { */ private static final String KEY_MESSAGE = "dialog-message"; - private TextView title, message, remember_label; + private TextView title, message; private Button confirm, cancel; private CompoundButton remember; @@ -199,7 +194,6 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener { title = view.findViewById(R.id.confirm_title); message = view.findViewById(R.id.confirm_message); remember = view.findViewById(R.id.confirm_remember); - remember_label = view.findViewById(R.id.confirm_remember_label); GlobalSettings settings = GlobalSettings.get(requireContext()); if (savedInstanceState == null) @@ -385,14 +379,6 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener { messageRes = R.string.confirm_remove_filter; break; - case CONTINUE_BROWSER: - titleVis = View.VISIBLE; - remember_label.setVisibility(View.VISIBLE); - remember.setVisibility(View.VISIBLE); - titleRes = R.string.confirm_warning; - messageRes = R.string.confirm_proxy_bypass; - break; - case UNFOLLOW_TAG: messageRes = R.string.confirm_tag_unfollow; break; diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/FieldFragment.java b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/FieldFragment.java index 4ea1bcde..a2a655b4 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/FieldFragment.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/FieldFragment.java @@ -15,15 +15,13 @@ import org.nuclearfog.twidda.backend.utils.LinkUtils; import org.nuclearfog.twidda.model.lists.Fields; import org.nuclearfog.twidda.ui.adapter.recyclerview.FieldAdapter; import org.nuclearfog.twidda.ui.adapter.recyclerview.FieldAdapter.OnLinkClickListener; -import org.nuclearfog.twidda.ui.dialogs.ConfirmDialog; -import org.nuclearfog.twidda.ui.dialogs.ConfirmDialog.OnConfirmListener; /** * User field list fragment * * @author nuclearfog */ -public class FieldFragment extends ListFragment implements OnLinkClickListener, OnConfirmListener, AsyncCallback { +public class FieldFragment extends ListFragment implements OnLinkClickListener, AsyncCallback { public static final String KEY_ID = "user-id"; @@ -33,7 +31,6 @@ public class FieldFragment extends ListFragment implements OnLinkClickListener, private FieldAdapter adapter; private long id; - private String urlToRedirect; @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { @@ -82,8 +79,9 @@ public class FieldFragment extends ListFragment implements OnLinkClickListener, @Override public void onLinkClick(String url) { if (!isRefreshing()) { - if (ConfirmDialog.show(this, ConfirmDialog.CONTINUE_BROWSER, null)) { - urlToRedirect = url; + Activity parent = getActivity(); + if (parent != null) { + LinkUtils.redirectToBrowser(parent, url); } } } @@ -105,17 +103,6 @@ public class FieldFragment extends ListFragment implements OnLinkClickListener, } - @Override - public void onConfirm(int type, boolean remember) { - if (type == ConfirmDialog.CONTINUE_BROWSER) { - Activity parent = getActivity(); - if (parent != null) { - LinkUtils.redirectToBrowser(parent, urlToRedirect); - } - } - } - - @Override public void onResult(@NonNull UserLoader.Result result) { if (result.mode == UserLoader.Result.ONLINE) {