feat: 隐藏吧页面快捷操作按钮

This commit is contained in:
HuanCheng65 2023-10-04 01:04:37 +08:00
parent d7748541fb
commit 17301cf540
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
4 changed files with 53 additions and 44 deletions

View File

@ -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?) {

View File

@ -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 ->

View File

@ -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)
)
)
}

View File

@ -737,4 +737,5 @@
<string name="title_lift_up_bottom_bar">全面屏优化</string>
<string name="summary_lift_up_bottom_bar">略微抬起贴子页面底栏以方便点按</string>
<string name="button_open">打开</string>
<string name="btn_hide">隐藏</string>
</resources>