feat: add setting to disable double tap to search

This commit is contained in:
FineFindus
2023-09-03 15:47:11 +02:00
parent c3f3a9be7e
commit 0725c2a741
4 changed files with 8 additions and 2 deletions

View File

@@ -66,6 +66,7 @@ public class GlobalUserPreferences{
public static boolean showDividers; public static boolean showDividers;
public static boolean relocatePublishButton; public static boolean relocatePublishButton;
public static boolean defaultToUnlistedReplies; public static boolean defaultToUnlistedReplies;
public static boolean doubleTapToSearch;
public static boolean doubleTapToSwipe; public static boolean doubleTapToSwipe;
public static boolean confirmBeforeReblog; public static boolean confirmBeforeReblog;
public static boolean hapticFeedback; public static boolean hapticFeedback;
@@ -140,6 +141,7 @@ public class GlobalUserPreferences{
relocatePublishButton=prefs.getBoolean("relocatePublishButton", true); relocatePublishButton=prefs.getBoolean("relocatePublishButton", true);
compactReblogReplyLine=prefs.getBoolean("compactReblogReplyLine", true); compactReblogReplyLine=prefs.getBoolean("compactReblogReplyLine", true);
defaultToUnlistedReplies=prefs.getBoolean("defaultToUnlistedReplies", false); defaultToUnlistedReplies=prefs.getBoolean("defaultToUnlistedReplies", false);
doubleTapToSearch =prefs.getBoolean("doubleTapToSearch", true);
doubleTapToSwipe =prefs.getBoolean("doubleTapToSwipe", true); doubleTapToSwipe =prefs.getBoolean("doubleTapToSwipe", true);
replyLineAboveHeader=prefs.getBoolean("replyLineAboveHeader", true); replyLineAboveHeader=prefs.getBoolean("replyLineAboveHeader", true);
confirmBeforeReblog=prefs.getBoolean("confirmBeforeReblog", false); confirmBeforeReblog=prefs.getBoolean("confirmBeforeReblog", false);
@@ -216,6 +218,7 @@ public class GlobalUserPreferences{
// MOSHIDON // MOSHIDON
.putBoolean("defaultToUnlistedReplies", defaultToUnlistedReplies) .putBoolean("defaultToUnlistedReplies", defaultToUnlistedReplies)
.putBoolean("doubleTapToSearch", doubleTapToSearch)
.putBoolean("doubleTapToSwipe", doubleTapToSwipe) .putBoolean("doubleTapToSwipe", doubleTapToSwipe)
.putBoolean("compactReblogReplyLine", compactReblogReplyLine) .putBoolean("compactReblogReplyLine", compactReblogReplyLine)
.putBoolean("replyLineAboveHeader", replyLineAboveHeader) .putBoolean("replyLineAboveHeader", replyLineAboveHeader)

View File

@@ -269,7 +269,7 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
private void onTabSelected(@IdRes int tab){ private void onTabSelected(@IdRes int tab){
Fragment newFragment=fragmentForTab(tab); Fragment newFragment=fragmentForTab(tab);
if(tab==currentTab){ if(tab==currentTab){
if (tab == R.id.tab_search) if (tab == R.id.tab_search && GlobalUserPreferences.doubleTapToSearch)
discoverFragment.openSearch(); discoverFragment.openSearch();
else if(newFragment instanceof ScrollableToTop scrollable) else if(newFragment instanceof ScrollableToTop scrollable)
scrollable.scrollToTop(); scrollable.scrollToTop();

View File

@@ -43,7 +43,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
private CheckableListItem<Void> pronounsInUserListingsItem, pronounsInTimelinesItem, pronounsInThreadsItem; private CheckableListItem<Void> pronounsInUserListingsItem, pronounsInTimelinesItem, pronounsInThreadsItem;
// MOSHIDON // MOSHIDON
private CheckableListItem<Void> enableDoubleTapToSwipeItem, relocatePublishButtonItem, showPostDividersItem; private CheckableListItem<Void> enableDoubleTapToSwipeItem, relocatePublishButtonItem, showPostDividersItem, enableDoubleTapToSearchItem;
private AccountLocalPreferences lp; private AccountLocalPreferences lp;
@@ -66,6 +66,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
emojiInNamesItem=new CheckableListItem<>(R.string.settings_show_emoji_in_names, 0, CheckableListItem.Style.SWITCH, lp.customEmojiInNames, R.drawable.ic_fluent_emoji_24_regular, ()->toggleCheckableItem(emojiInNamesItem)), emojiInNamesItem=new CheckableListItem<>(R.string.settings_show_emoji_in_names, 0, CheckableListItem.Style.SWITCH, lp.customEmojiInNames, R.drawable.ic_fluent_emoji_24_regular, ()->toggleCheckableItem(emojiInNamesItem)),
marqueeItem=new CheckableListItem<>(R.string.sk_settings_enable_marquee, R.string.mo_setting_marquee_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.toolbarMarquee, R.drawable.ic_fluent_text_more_24_regular, ()->toggleCheckableItem(marqueeItem)), marqueeItem=new CheckableListItem<>(R.string.sk_settings_enable_marquee, R.string.mo_setting_marquee_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.toolbarMarquee, R.drawable.ic_fluent_text_more_24_regular, ()->toggleCheckableItem(marqueeItem)),
reduceMotionItem=new CheckableListItem<>(R.string.sk_settings_reduce_motion, R.string.mo_setting_reduced_motion_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.reduceMotion, R.drawable.ic_fluent_star_emphasis_24_regular, ()->toggleCheckableItem(reduceMotionItem)), reduceMotionItem=new CheckableListItem<>(R.string.sk_settings_reduce_motion, R.string.mo_setting_reduced_motion_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.reduceMotion, R.drawable.ic_fluent_star_emphasis_24_regular, ()->toggleCheckableItem(reduceMotionItem)),
enableDoubleTapToSearchItem=new CheckableListItem<>(R.string.mo_double_tap_to_search, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.doubleTapToSearch, R.drawable.ic_fluent_search_24_regular, ()->toggleCheckableItem(enableDoubleTapToSearchItem)),
disableSwipeItem=new CheckableListItem<>(R.string.sk_settings_tabs_disable_swipe, R.string.mo_setting_disable_swipe_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.disableSwipe, R.drawable.ic_fluent_swipe_right_24_regular, ()->toggleCheckableItem(disableSwipeItem)), disableSwipeItem=new CheckableListItem<>(R.string.sk_settings_tabs_disable_swipe, R.string.mo_setting_disable_swipe_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.disableSwipe, R.drawable.ic_fluent_swipe_right_24_regular, ()->toggleCheckableItem(disableSwipeItem)),
enableDoubleTapToSwipeItem=new CheckableListItem<>(R.string.mo_double_tap_to_swipe_between_tabs, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.doubleTapToSwipe, R.drawable.ic_fluent_double_tap_swipe_right_24_regular, ()->toggleCheckableItem(enableDoubleTapToSwipeItem)), enableDoubleTapToSwipeItem=new CheckableListItem<>(R.string.mo_double_tap_to_swipe_between_tabs, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.doubleTapToSwipe, R.drawable.ic_fluent_double_tap_swipe_right_24_regular, ()->toggleCheckableItem(enableDoubleTapToSwipeItem)),
altIndicatorItem=new CheckableListItem<>(R.string.sk_settings_show_alt_indicator, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.showAltIndicator, R.drawable.ic_fluent_scan_text_24_regular, ()->toggleCheckableItem(altIndicatorItem)), altIndicatorItem=new CheckableListItem<>(R.string.sk_settings_show_alt_indicator, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.showAltIndicator, R.drawable.ic_fluent_scan_text_24_regular, ()->toggleCheckableItem(altIndicatorItem)),
@@ -114,6 +115,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
GlobalUserPreferences.relocatePublishButton=relocatePublishButtonItem.checked; GlobalUserPreferences.relocatePublishButton=relocatePublishButtonItem.checked;
GlobalUserPreferences.reduceMotion=reduceMotionItem.checked; GlobalUserPreferences.reduceMotion=reduceMotionItem.checked;
GlobalUserPreferences.disableSwipe=disableSwipeItem.checked; GlobalUserPreferences.disableSwipe=disableSwipeItem.checked;
GlobalUserPreferences.doubleTapToSearch=enableDoubleTapToSearchItem.checked;
GlobalUserPreferences.doubleTapToSwipe=enableDoubleTapToSwipeItem.checked; GlobalUserPreferences.doubleTapToSwipe=enableDoubleTapToSwipeItem.checked;
GlobalUserPreferences.showAltIndicator=altIndicatorItem.checked; GlobalUserPreferences.showAltIndicator=altIndicatorItem.checked;
GlobalUserPreferences.showNoAltIndicator=noAltIndicatorItem.checked; GlobalUserPreferences.showNoAltIndicator=noAltIndicatorItem.checked;

View File

@@ -87,6 +87,7 @@
<!-- Settings --> <!-- Settings -->
<string name="mo_notification_audience_settings">Notification Audience</string> <string name="mo_notification_audience_settings">Notification Audience</string>
<string name="mo_settings_show_posts_without_alt">Show media posts with missing alt text</string> <string name="mo_settings_show_posts_without_alt">Show media posts with missing alt text</string>
<string name="mo_double_tap_to_search">Double tap to open search</string>
<string name="mo_double_tap_to_swipe_between_tabs">Double tap to swipe between tabs</string> <string name="mo_double_tap_to_swipe_between_tabs">Double tap to swipe between tabs</string>
<string name="mo_haptic_feedback">Haptic feedback</string> <string name="mo_haptic_feedback">Haptic feedback</string>
<string name="mo_swap_bookmark_with_reblog">Swap bookmark with reblog action</string> <string name="mo_swap_bookmark_with_reblog">Swap bookmark with reblog action</string>