Add preference to disable swipe gesture for switching tabs, close #1718 (#1752)

This commit is contained in:
Ivan Kupalov 2020-04-27 21:41:43 +02:00 committed by GitHub
parent 0ccd2c4133
commit f52fd355d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -168,6 +168,11 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
val pageMargin = resources.getDimensionPixelSize(R.dimen.tab_page_margin)
viewPager.setPageTransformer(MarginPageTransformer(pageMargin))
val uswSwipeForTabs = PreferenceManager.getDefaultSharedPreferences(this)
.getBoolean("enableSwipeForTabs", true)
viewPager.isUserInputEnabled = uswSwipeForTabs
tabLayout.addOnTabSelectedListener(object : OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
if (tab.position == notificationTabPosition) {

View File

@ -129,7 +129,7 @@ class PreferencesActivity : BaseActivity(), SharedPreferences.OnSharedPreference
}
"statusTextSize", "absoluteTimeView", "showBotOverlay", "animateGifAvatars",
"useBlurhash", "showCardsInTimelines", "confirmReblogs" -> {
"useBlurhash", "showCardsInTimelines", "confirmReblogs", "enableSwipeForTabs" -> {
restartActivitiesOnExit = true
}
"language" -> {

View File

@ -541,6 +541,7 @@
<string name="failed_search">Failed to search</string>
<string name="pref_title_show_notifications_filter">Show Notifications filter</string>
<string name="pref_title_enable_swipe_for_tabs">Enable swipe gesture to switch between tabs</string>
<string name="create_poll_title">Poll</string>

View File

@ -84,6 +84,12 @@
android:title="@string/pref_title_confirm_reblogs"
app:singleLineTitle="false" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="enableSwipeForTabs"
android:title="@string/pref_title_enable_swipe_for_tabs"
app:singleLineTitle="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_title_browser_settings">