diff --git a/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java b/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java index f47a92063..285b619c9 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java +++ b/mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java @@ -25,6 +25,7 @@ public class GlobalUserPreferences{ public static boolean showInteractionCounts; public static boolean alwaysExpandContentWarnings; public static boolean disableMarquee; + public static boolean disableSwipe; public static boolean voteButtonForSingleChoice; public static ThemePreference theme; public static ColorPreference color; @@ -54,6 +55,7 @@ public class GlobalUserPreferences{ showInteractionCounts=prefs.getBoolean("showInteractionCounts", false); alwaysExpandContentWarnings=prefs.getBoolean("alwaysExpandContentWarnings", false); disableMarquee=prefs.getBoolean("disableMarquee", false); + disableSwipe=prefs.getBoolean("disableSwipe", false); voteButtonForSingleChoice=prefs.getBoolean("voteButtonForSingleChoice", true); theme=ThemePreference.values()[prefs.getInt("theme", 0)]; recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>()); @@ -77,6 +79,7 @@ public class GlobalUserPreferences{ .putBoolean("showInteractionCounts", showInteractionCounts) .putBoolean("alwaysExpandContentWarnings", alwaysExpandContentWarnings) .putBoolean("disableMarquee", disableMarquee) + .putBoolean("disableSwipe", disableSwipe) .putInt("theme", theme.ordinal()) .putString("recentLanguages", gson.toJson(recentLanguages)) .putInt("color", color.ordinal()) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java index 666e5395e..0bfc93cad 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java @@ -14,6 +14,7 @@ import android.widget.FrameLayout; import android.widget.LinearLayout; import org.joinmastodon.android.E; +import org.joinmastodon.android.GlobalUserPreferences; import org.joinmastodon.android.R; import org.joinmastodon.android.api.requests.accounts.GetFollowRequests; import org.joinmastodon.android.events.FollowRequestHandledEvent; @@ -109,6 +110,7 @@ public class NotificationsFragment extends MastodonToolbarFragment implements Sc tabLayout.setTabTextColors(UiUtils.getThemeColor(getActivity(), R.attr.colorTabInactive), UiUtils.getThemeColor(getActivity(), android.R.attr.textColorPrimary)); pager.setOffscreenPageLimit(4); + pager.setUserInputEnabled(!GlobalUserPreferences.disableSwipe); pager.setAdapter(new DiscoverPagerAdapter()); pager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback(){ @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index 3e3530f7b..35d293826 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -237,6 +237,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList } pager.setOffscreenPageLimit(5); + pager.setUserInputEnabled(!GlobalUserPreferences.disableSwipe); pager.setAdapter(new ProfilePagerAdapter()); pager.getLayoutParams().height=getResources().getDisplayMetrics().heightPixels; diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index cfb3e319a..3a8abb764 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -121,6 +121,11 @@ public class SettingsFragment extends MastodonToolbarFragment{ GlobalUserPreferences.alwaysExpandContentWarnings=i.checked; GlobalUserPreferences.save(); })); + items.add(new SwitchItem(R.string.sk_tabs_disable_swipe, R.drawable.ic_fluent_swipe_right_24_regular, GlobalUserPreferences.disableSwipe, i->{ + GlobalUserPreferences.disableSwipe=i.checked; + GlobalUserPreferences.save(); + needAppRestart=true; + })); items.add(new HeaderItem(R.string.home_timeline)); items.add(new SwitchItem(R.string.sk_settings_show_replies, R.drawable.ic_fluent_chat_multiple_24_regular, GlobalUserPreferences.showReplies, i->{ diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java index a51f9fd90..b67c7f5da 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java @@ -104,6 +104,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, tabLayout.setTabTextColors(UiUtils.getThemeColor(getActivity(), R.attr.colorTabInactive), UiUtils.getThemeColor(getActivity(), android.R.attr.textColorPrimary)); pager.setOffscreenPageLimit(4); + pager.setUserInputEnabled(!GlobalUserPreferences.disableSwipe); pager.setAdapter(new DiscoverPagerAdapter()); pager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback(){ @Override diff --git a/mastodon/src/main/res/drawable/ic_fluent_swipe_right_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_swipe_right_24_regular.xml new file mode 100644 index 000000000..0e2d0c11f --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_swipe_right_24_regular.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml index 60826e3f7..1bdb2145b 100644 --- a/mastodon/src/main/res/values/strings_sk.xml +++ b/mastodon/src/main/res/values/strings_sk.xml @@ -1,65 +1,66 @@ - Moshidon - Pinned - Delete and re-draft - Delete and re-draft Post - Are you sure you want to delete and re-draft this post? - Pin to profile - Pin post to profile - Do you want to pin this post to your profile? - Pinning post… - Unpin from profile - Unpin post from profile - Are you sure you want to unpin this post? - Unpinning post… - Image description - Unlisted - Show replies - Show boosts - Automatically load new posts - Show interaction counts - Moshidon v%1$s (%2$d) - Mark media as sensitive - Turned on post notifications for %s - Turned off post notifications for %s - Federation - These are the most recent posts by the people in your federation. - Moshidon %s is ready to download. - Moshidon %s is downloaded and ready to install. - Check for update - No update available - Lists - Follow requests - Accept follow request - Reject follow request - Lists with %s - Always reveal content warnings - Disable scrolling text in title bars - Contribute to Moshidon - Show federated timeline - Posts - Post notifications - Color theme - Pink - Purple - Green - Blue - Orange - Yellow - Red - Material You - Not supported on your device - Allow multiple choices - Translate - Show original - Translated using %s - Language: %s - Available languages - %s (%s) - Clear recent languages - Are you sure you want to clear your recently used languages? - Welcome to Moshidon! - To get started, please enter your home instance’s domain name below. - example.social + Megalodon + Pinned + Delete and re-draft + Delete and re-draft Post + Are you sure you want to delete and re-draft this post? + Pin to profile + Pin post to profile + Do you want to pin this post to your profile? + Pinning post… + Unpin from profile + Unpin post from profile + Are you sure you want to unpin this post? + Unpinning post… + Image description + Unlisted + Show replies + Show boosts + Automatically load new posts + Show interaction counts + Megalodon v%1$s (%2$d) + Mark media as sensitive + Turned on post notifications for %s + Turned off post notifications for %s + Federation + These are the most recent posts by the people in your federation. + Megalodon %s is ready to download. + Megalodon %s is downloaded and ready to install. + Check for update + No update available + Lists + Follow requests + Accept follow request + Reject follow request + Lists with %s + Always reveal content warnings + Disable scrolling text in title bars + Contribute to Megalodon + Show federated timeline + Posts + Post notifications + Color theme + System + Pink + Purple + Green + Blue + Brown + Red + Yellow + Allow multiple choices + Translate + Show original + Translated using %s + Language: %s + Available languages + %s (%s) + Clear recently used languages + Are you sure you want to clear your recently used languages? + Welcome! + The shark salutes you! To get started, please enter your home instance’s domain name below. + example.social + \@megalodon + Disable swiping between tabs