[优化] 增加了一个页面切换过渡动画的开关 #557

This commit is contained in:
HapeLee
2026-01-17 16:49:36 +08:00
parent d05900b160
commit 1638966ba4
8 changed files with 42 additions and 14 deletions
+1 -1
View File
@@ -337,7 +337,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.versionL }}
name: ${{ needs.prepare.outputs.is_release == 'true' && format('正式版 {0}', needs.prepare.outputs.versionL) || format('测试版 {0}', needs.prepare.outputs.versionL) }}
name: ${{ needs.prepare.outputs.is_release == 'true' && format('Release {0}', needs.prepare.outputs.versionL) || format('Pre-release {0}', needs.prepare.outputs.versionL) }}
body: ${{ steps.get_commits.outputs.release_body }}
prerelease: ${{ needs.prepare.outputs.is_release != 'true' }}
files: |
@@ -46,6 +46,7 @@ object PreferKey {
const val enableReview = "enableReview"
const val showRss = "showRss"
const val showStatusBar = "showStatusBar"
const val swipeAnimation = "swipeAnimation"
const val bookshelfLayout = "bookshelfLayout"
const val bookshelfLayoutModePortrait = "bookshelfLayoutPortrait"
const val bookshelfLayoutModeLandscape = "bookshelf_layout_landscape"
@@ -53,7 +53,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
var themeMode = appCtx.getPrefString(PreferKey.themeMode, "0")
var AppTheme = appCtx.getPrefString(PreferKey.appTheme, "0")
var containerOpacity = appCtx.getPrefInt(PreferKey.containerOpacity, 100)
var swipeAnimation = appCtx.getPrefBoolean(PreferKey.swipeAnimation, true)
var useDefaultCover = appCtx.getPrefBoolean(PreferKey.useDefaultCover, false)
var optimizeRender = CanvasRecorderFactory.isSupport
&& appCtx.getPrefBoolean(PreferKey.optimizeRender, false)
@@ -998,4 +1000,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
return str * 60 * 1000L
}
var containerOpacity: Int
get() = appCtx.getPrefInt(PreferKey.containerOpacity, 100)
set(value) {
appCtx.putPrefInt(PreferKey.containerOpacity, value)
}
}
@@ -181,7 +181,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
}
PreferKey.paletteStyle, PreferKey.pureBlack, PreferKey.enableBlur -> {
PreferKey.paletteStyle, PreferKey.pureBlack, PreferKey.enableBlur, PreferKey.swipeAnimation -> {
ThemeSyncer.syncAll()
Handler(Looper.getMainLooper()).postDelayed({
recreateActivities()
@@ -248,25 +248,35 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
.setValue(10)
.setCustomButton((R.string.btn_default_s)) {
putPrefInt(PreferKey.fontScale, 0)
recreateActivities()
Handler(Looper.getMainLooper()).postDelayed({
recreateActivities()
}, 100)
}
.show {
putPrefInt(PreferKey.fontScale, it)
recreateActivities()
Handler(Looper.getMainLooper()).postDelayed({
recreateActivities()
}, 100)
}
PreferKey.containerOpacity -> NumberPickerDialog(requireContext())
.setTitle(getString(R.string.container_opacity))
.setMaxValue(100)
.setMinValue(0)
.setValue(100)
.setValue(AppConfig.containerOpacity)
.setCustomButton((R.string.btn_default_s)) {
putPrefInt(PreferKey.containerOpacity, 100)
ThemeSyncer.syncContainerOpacity()
AppConfig.containerOpacity = 100
Handler(Looper.getMainLooper()).postDelayed({
ThemeSyncer.syncContainerOpacity()
upPreferenceSummary(PreferKey.containerOpacity)
}, 100)
}
.show {
putPrefInt(PreferKey.containerOpacity, it)
ThemeSyncer.syncContainerOpacity()
AppConfig.containerOpacity = it
Handler(Looper.getMainLooper()).postDelayed({
ThemeSyncer.syncContainerOpacity()
upPreferenceSummary(PreferKey.containerOpacity)
}, 100)
}
PreferKey.bgImage -> selectBgAction(false)
@@ -96,6 +96,7 @@ open class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
private val fragmentMap = hashMapOf<Int, Fragment>()
private var bottomMenuCount = 4
private val realPositions = arrayOf(idBookshelf, idExplore, idRss, idMy)
private val swipeAnimation = AppConfig.swipeAnimation
private val adapter by lazy {
TabFragmentPageAdapter(this)
}
@@ -181,7 +182,7 @@ open class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
R.id.menu_my_config -> realPositions.indexOf(idMy)
else -> 0
}
binding.viewPagerMain.setCurrentItem(index, true)
binding.viewPagerMain.setCurrentItem(index, swipeAnimation)
return true
}
+4 -2
View File
@@ -1363,12 +1363,13 @@
<string name="enable_slider_vibrator">滑动进度条时震动</string>
<string name="edit_remark">编辑备注</string>
<string name="book_remark">书籍备注</string>
<string name="auto_check_new_backup_t">自动检查新备份</string>
<string name="save_to_local">保存至本地</string>
<string name="select_operation">选择操作</string>
<string name="text_accent_color">强调</string>
<string name="read_color">颜色样式</string>
<string name="reverse_volume_key_page">反转音量键翻页方向</string>
<string name="palette_style">调色板样式</string>
<string name="tip_compose_set">这里的选项仅可以控制使用Compose重写的界面。</string>
<string name="tip_compose_set">这里的选项仅可以控制使用Compose重写的界面。对于禁用的选项,会在日后实现时开放,现在仅作占位。</string>
<string name="is_blur_enable">启用控件模糊</string>
<string name="use_underline">总是使用下划线表示强调文本</string>
<string name="adapt_special_style">适配特殊样式</string>
@@ -1380,4 +1381,5 @@
<string name="read_aloud_preload_summary">%d</string>
<string name="audio_cache_clean_time">音频缓存保留时间(分钟)</string>
<string name="audio_cache_clean_time_summary">当前%d, 输入 0 代表退出即刻清理。</string>
<string name="show_swipe_animation">启用滑动时动画</string>
</resources>
+2 -1
View File
@@ -1373,7 +1373,7 @@
<string name="read_color">颜色样式</string>
<string name="reverse_volume_key_page">反转音量键翻页方向</string>
<string name="palette_style">调色板样式</string>
<string name="tip_compose_set">这里的选项仅可以控制使用Compose重写的界面。</string>
<string name="tip_compose_set">这里的选项仅可以控制使用Compose重写的界面。对于禁用的选项,会在日后实现时开放,现在仅作占位。</string>
<string name="is_blur_enable">启用控件模糊</string>
<string name="use_underline">总是使用下划线表示强调文本</string>
<string name="adapt_special_style">适配特殊样式</string>
@@ -1385,4 +1385,5 @@
<string name="read_aloud_preload_summary">%d</string>
<string name="audio_cache_clean_time">音频缓存保留时间(分钟)</string>
<string name="audio_cache_clean_time_summary">当前%d, 输入 0 代表退出即刻清理。</string>
<string name="show_swipe_animation">启用滑动时动画</string>
</resources>
@@ -144,6 +144,12 @@
android:title="@string/show_status"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="true"
android:key="swipeAnimation"
android:title="@string/show_swipe_animation"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="true"
android:key="showBottomView"