feat: 首页可选择是否开启滑动切换

This commit is contained in:
HuanChengFly 2021-02-01 18:41:17 +08:00
parent ee7335f913
commit 1ac4c9bee8
5 changed files with 27 additions and 1 deletions

View File

@ -142,7 +142,7 @@ open class MainActivity : BaseActivity(), BottomNavigationView.OnNavigationItemS
}
mAdapter.addFragment(MessageFragment.newInstance(MessageFragment.TYPE_REPLY_ME, true))
mAdapter.addFragment(MyInfoFragment())
mViewPager.isCanScroll = false
mViewPager.isCanScroll = appPreferences.homePageScroll
mViewPager.adapter = mAdapter
mViewPager.offscreenPageLimit = mAdapter.count
}

View File

@ -32,6 +32,8 @@ open class AppPreferencesUtils(context: Context) {
var hideExplore by SharedPreferenceDelegates.boolean(defaultValue = false)
var homePageScroll by SharedPreferenceDelegates.boolean(defaultValue = false)
var imageLoadType by SharedPreferenceDelegates.string(key = "image_load_type", defaultValue = "0")
var listSingle by SharedPreferenceDelegates.boolean(defaultValue = false)
@ -48,6 +50,8 @@ open class AppPreferencesUtils(context: Context) {
var showBothUsernameAndNickname by SharedPreferenceDelegates.boolean(defaultValue = false, key = "show_both_username_and_nickname")
var showHotMessageList by SharedPreferenceDelegates.boolean(defaultValue = true)
var showShortcutInThread by SharedPreferenceDelegates.boolean(defaultValue = true)
var showTopForumInNormalList by SharedPreferenceDelegates.boolean(defaultValue = true, key = "show_top_forum_in_normal_list")

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M10.46,2.12c-4.06,0.61 -7.4,3.77 -8.24,7.8c-0.47,2.26 -0.15,4.41 0.7,6.26l4.37,-4.37c0.37,-0.37 0.95,-0.39 1.35,-0.06l2.3,1.92l3.35,-3.35l-0.59,-0.59C13.08,9.08 13.52,8 14.41,8H17c0.55,0 1,0.45 1,1v2.59c0,0.89 -1.08,1.34 -1.71,0.71l-0.59,-0.59l-4,4c-0.36,0.36 -0.95,0.39 -1.34,0.06l-2.31,-1.91l-4.08,4.08c2.08,2.8 5.57,4.49 9.43,3.96c4.52,-0.61 8.12,-4.37 8.56,-8.91C22.58,6.51 17,1.14 10.46,2.12z" />
</vector>

View File

@ -421,4 +421,5 @@
<string name="btn_reply_post">%1$s 回复</string>
<string name="btn_reply_post_default">回复</string>
<string name="title_home_page_scroll">首页滑动切换页面</string>
<string name="title_show_hot_message_list">搜索页面显示贴吧话题</string>
</resources>

View File

@ -102,6 +102,18 @@
android:key="loadPictureWhenScroll"
android:title="@string/title_load_picture_when_scroll" />
<SwitchPreference
android:icon="@drawable/ic_round_view_carousel_white"
android:defaultValue="false"
android:key="homePageScroll"
android:title="@string/title_home_page_scroll" />
<SwitchPreference
android:icon="@drawable/ic_round_whatshot"
android:defaultValue="true"
android:key="showHotMessageList"
android:title="@string/title_show_hot_message_list" />
<Preference
android:enabled="false"
android:layout="@layout/layout_preference_bottom" />