From 17301cf54081929129dd988c64ae0994ff54ef28 Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Wed, 4 Oct 2023 01:04:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=9A=90=E8=97=8F=E5=90=A7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=BF=AB=E6=8D=B7=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tieba/post/activities/ForumActivity.kt | 5 ++ .../tieba/post/ui/page/forum/ForumPage.kt | 88 ++++++++++--------- .../page/settings/habit/HabitSettingsPage.kt | 3 +- app/src/main/res/values/strings.xml | 1 + 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/activities/ForumActivity.kt b/app/src/main/java/com/huanchengfly/tieba/post/activities/ForumActivity.kt index d610d76c..daf4d6cb 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/activities/ForumActivity.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/activities/ForumActivity.kt @@ -365,6 +365,11 @@ class ForumActivity : BaseActivity(), View.OnClickListener, OnRefreshedListener, addMaskAnimation(maskRadius = 50f.dpToPxFloat()) } }.init() + if (appPreferences.forumFabFunction == "hide") { + fab.visibility = View.GONE + } else { + fab.visibility = View.VISIBLE + } } override fun setTitle(newTitle: String?) { diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumPage.kt index ca0c8d70..12e994d9 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumPage.kt @@ -589,55 +589,57 @@ fun ForumPage( ) }, floatingActionButton = { - FloatingActionButton( - onClick = { - when (context.appPreferences.forumFabFunction) { - "refresh" -> { - coroutineScope.launch { - emitGlobalEventSuspend( - ForumThreadListUiEvent.BackToTop( - pagerState.currentPage == 1 - ) - ) - emitGlobalEventSuspend( - ForumThreadListUiEvent.Refresh( - pagerState.currentPage == 1, - getSortType( - context, - forumName + if (context.appPreferences.forumFabFunction != "hide") { + FloatingActionButton( + onClick = { + when (context.appPreferences.forumFabFunction) { + "refresh" -> { + coroutineScope.launch { + emitGlobalEventSuspend( + ForumThreadListUiEvent.BackToTop( + pagerState.currentPage == 1 ) ) - ) - } - } - - "back_to_top" -> { - coroutineScope.launch { - emitGlobalEvent( - ForumThreadListUiEvent.BackToTop( - pagerState.currentPage == 1 + emitGlobalEventSuspend( + ForumThreadListUiEvent.Refresh( + pagerState.currentPage == 1, + getSortType( + context, + forumName + ) + ) ) - ) + } + } + + "back_to_top" -> { + coroutineScope.launch { + emitGlobalEvent( + ForumThreadListUiEvent.BackToTop( + pagerState.currentPage == 1 + ) + ) + } + } + + else -> { + context.toastShort(R.string.toast_feature_unavailable) } } - - else -> { - context.toastShort(R.string.toast_feature_unavailable) - } - } - }, - backgroundColor = ExtendedTheme.colors.windowBackground, - contentColor = ExtendedTheme.colors.primary, - modifier = Modifier.navigationBarsPadding() - ) { - Icon( - imageVector = when (context.appPreferences.forumFabFunction) { - "refresh" -> Icons.Rounded.Refresh - "back_to_top" -> Icons.Rounded.VerticalAlignTop - else -> Icons.Rounded.Add }, - contentDescription = null - ) + backgroundColor = ExtendedTheme.colors.windowBackground, + contentColor = ExtendedTheme.colors.primary, + modifier = Modifier.navigationBarsPadding() + ) { + Icon( + imageVector = when (context.appPreferences.forumFabFunction) { + "refresh" -> Icons.Rounded.Refresh + "back_to_top" -> Icons.Rounded.VerticalAlignTop + else -> Icons.Rounded.Add + }, + contentDescription = null + ) + } } } ) { contentPadding -> diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/habit/HabitSettingsPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/habit/HabitSettingsPage.kt index 7c64d36b..e3d92abb 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/habit/HabitSettingsPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/habit/HabitSettingsPage.kt @@ -168,7 +168,8 @@ fun HabitSettingsPage( entries = mapOf( "post" to stringResource(id = R.string.btn_post), "refresh" to stringResource(id = R.string.btn_refresh), - "back_to_top" to stringResource(id = R.string.btn_back_to_top) + "back_to_top" to stringResource(id = R.string.btn_back_to_top), + "hide" to stringResource(id = R.string.btn_hide) ) ) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b8039eb7..165e5ffc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -737,4 +737,5 @@ 全面屏优化 略微抬起贴子页面底栏以方便点按 打开 + 隐藏