From 804d677ecff758d858a7c9b153ee3ca56ccb3e17 Mon Sep 17 00:00:00 2001 From: TrianguloY Date: Sat, 20 May 2023 13:54:05 +0200 Subject: [PATCH] refactor --- .../urlchecker/modules/list/OpenModule.java | 20 +++++++++---------- app/src/main/res/layout/config_open.xml | 4 ++-- app/src/main/res/values/strings.xml | 5 +++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/trianguloy/urlchecker/modules/list/OpenModule.java b/app/src/main/java/com/trianguloy/urlchecker/modules/list/OpenModule.java index 18fc12e..b8f107f 100644 --- a/app/src/main/java/com/trianguloy/urlchecker/modules/list/OpenModule.java +++ b/app/src/main/java/com/trianguloy/urlchecker/modules/list/OpenModule.java @@ -45,8 +45,8 @@ public class OpenModule extends AModuleData { return new GenericPref.Bool("open_noReferrer", true, cntx); } - public static GenericPref.Bool MERGEBUTTON_PREF(Context cntx) { - return new GenericPref.Bool("", false, cntx); + public static GenericPref.Bool MERGECOPY_PREF(Context cntx) { + return new GenericPref.Bool("open_mergeCopy", false, cntx); } @Override @@ -77,7 +77,7 @@ class OpenDialog extends AModuleDialog { private final GenericPref.Bool closeOpenPref; private final GenericPref.Bool closeSharePref; private final GenericPref.Bool noReferrerPref; - private final GenericPref.Bool mergePref; + private final GenericPref.Bool mergeCopyPref; private final CTabs cTabs; private final Incognito incognito; @@ -95,7 +95,7 @@ class OpenDialog extends AModuleDialog { closeOpenPref = OpenModule.CLOSEOPEN_PREF(dialog); closeSharePref = OpenModule.CLOSESHARE_PREF(dialog); noReferrerPref = OpenModule.NOREFERRER_PREF(dialog); - mergePref = OpenModule.MERGEBUTTON_PREF(dialog); + mergeCopyPref = OpenModule.MERGECOPY_PREF(dialog); } @Override @@ -123,13 +123,13 @@ class OpenDialog extends AModuleDialog { btn_openWith.setOnClickListener(v -> showList()); // init copy to URL - View btn_copy = views.findViewById(R.id.copyUrl); + var btn_copy = views.findViewById(R.id.copyUrl); btn_copy.setOnClickListener(v -> AndroidUtils.copyToClipboard(getActivity(), R.string.mOpen_clipboard, getUrl())); // init share - View btn_share = views.findViewById(R.id.share); + var btn_share = views.findViewById(R.id.share); btn_share.setOnClickListener(v -> shareUrl()); - if (mergePref.get()) { + if (mergeCopyPref.get()) { btn_copy.setVisibility(View.GONE); btn_share.setOnLongClickListener(v -> { AndroidUtils.copyToClipboard(getActivity(), R.string.mOpen_clipboard, getUrl()); @@ -276,7 +276,7 @@ class OpenConfig extends AModuleConfig { private final GenericPref.Bool closeOpenPref; private final GenericPref.Bool closeSharePref; private final GenericPref.Bool noReferrerPref; - private final GenericPref.Bool mergePref; + private final GenericPref.Bool mergeCopyPref; private final GenericPref.Enumeration ctabsPref; private final GenericPref.Enumeration incognitoPref; @@ -290,7 +290,7 @@ class OpenConfig extends AModuleConfig { closeSharePref = OpenModule.CLOSESHARE_PREF(activity); noReferrerPref = OpenModule.NOREFERRER_PREF(activity); perDomainPref = LastOpened.PERDOMAIN_PREF(activity); - mergePref = OpenModule.MERGEBUTTON_PREF(activity); + mergeCopyPref = OpenModule.MERGECOPY_PREF(activity); } @@ -311,7 +311,7 @@ class OpenConfig extends AModuleConfig { closeSharePref.attachToSwitch(views.findViewById(R.id.closeshare_pref)); noReferrerPref.attachToSwitch(views.findViewById(R.id.noReferrer)); perDomainPref.attachToSwitch(views.findViewById(R.id.perDomain)); - mergePref.attachToSwitch(views.findViewById(R.id.mergeButtons_pref)); + mergeCopyPref.attachToSwitch(views.findViewById(R.id.mergeCopy_pref)); } } diff --git a/app/src/main/res/layout/config_open.xml b/app/src/main/res/layout/config_open.xml index 1d642f0..c46a497 100644 --- a/app/src/main/res/layout/config_open.xml +++ b/app/src/main/res/layout/config_open.xml @@ -79,10 +79,10 @@ android:text="@string/mOpen_noReferrer" /> + android:text="@string/mOpen_mergeCopy" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9d8049a..394fe61 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -140,14 +140,15 @@ Note: if you edit the patterns, new built-in patterns from app updates will not - Custom Tabs button: toggle to enable/disable the custom tab feature. When enabled, the browser should be opened in a 'lite' mode. - Incognito button: For Firefox only. Toggle to enable/disable the incognito mode. When enabled, the browser should be opened in incognito. - Open button: Press the app name to open the link on that app. If a link can be opened with multiple apps, an arrow will be shown to let you choose. -- Share button: Press the button to share the link. Long press to quickly copy to clipboard." +- Copy button: Press the button to copy the link into the clipboard. +- Share button: Press the button to share the link." Custom tabs: Incognito mode: Close dialog after opening Close dialog after sharing Sort different domains independently Hide the source app (referrer) - Merge Copy URL and Share into a single button (long press to copy) + Merge Copy URL and Share into a single button (long press to copy) Open with %s Open Share