feat: 抬高贴子页面底栏
This commit is contained in:
parent
40915c0325
commit
2c4f7c5fc6
|
|
@ -16,6 +16,7 @@ import androidx.compose.material.icons.outlined.ColorLens
|
||||||
import androidx.compose.material.icons.outlined.Explore
|
import androidx.compose.material.icons.outlined.Explore
|
||||||
import androidx.compose.material.icons.outlined.FontDownload
|
import androidx.compose.material.icons.outlined.FontDownload
|
||||||
import androidx.compose.material.icons.outlined.FormatColorFill
|
import androidx.compose.material.icons.outlined.FormatColorFill
|
||||||
|
import androidx.compose.material.icons.outlined.Upcoming
|
||||||
import androidx.compose.material.icons.outlined.ViewAgenda
|
import androidx.compose.material.icons.outlined.ViewAgenda
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
|
|
@ -285,6 +286,23 @@ fun CustomSettingsPage(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
prefsItem {
|
||||||
|
SwitchPref(
|
||||||
|
key = "liftUpBottomBar",
|
||||||
|
title = stringResource(id = R.string.title_lift_up_bottom_bar),
|
||||||
|
defaultChecked = true,
|
||||||
|
leadingIcon = {
|
||||||
|
LeadingIcon {
|
||||||
|
AvatarIcon(
|
||||||
|
icon = Icons.Outlined.Upcoming,
|
||||||
|
size = Sizes.Small,
|
||||||
|
contentDescription = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
summary = stringResource(id = R.string.summary_lift_up_bottom_bar),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,12 +4,17 @@ import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
import androidx.compose.foundation.layout.navigationBars
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.requiredHeightIn
|
||||||
|
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
|
@ -308,45 +313,56 @@ internal fun SubPostsContent(
|
||||||
contentColor = ExtendedTheme.colors.text,
|
contentColor = ExtendedTheme.colors.text,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Row(
|
Column {
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.navigationBarsPadding()
|
|
||||||
.padding(horizontal = 16.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
|
||||||
) {
|
|
||||||
Avatar(
|
|
||||||
data = StringUtil.getAvatarUrl(account.portrait),
|
|
||||||
size = Sizes.Tiny,
|
|
||||||
contentDescription = account.name,
|
|
||||||
)
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(vertical = 8.dp)
|
.fillMaxWidth()
|
||||||
.weight(1f)
|
.padding(horizontal = 16.dp),
|
||||||
.clip(RoundedCornerShape(6.dp))
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
.background(ExtendedTheme.colors.bottomBarSurface)
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
.clickable {
|
|
||||||
val fid = forum?.get { id } ?: forumId
|
|
||||||
val forumName = forum?.get { name }
|
|
||||||
if (!forumName.isNullOrEmpty()) {
|
|
||||||
navigator.navigate(
|
|
||||||
ReplyPageDestination(
|
|
||||||
forumId = fid,
|
|
||||||
forumName = forumName,
|
|
||||||
threadId = threadId,
|
|
||||||
postId = postId,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(8.dp),
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Avatar(
|
||||||
text = stringResource(id = R.string.tip_reply_thread),
|
data = StringUtil.getAvatarUrl(account.portrait),
|
||||||
style = MaterialTheme.typography.caption,
|
size = Sizes.Tiny,
|
||||||
color = ExtendedTheme.colors.onBottomBarSurface,
|
contentDescription = account.name,
|
||||||
|
)
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(vertical = 8.dp)
|
||||||
|
.weight(1f)
|
||||||
|
.clip(RoundedCornerShape(6.dp))
|
||||||
|
.background(ExtendedTheme.colors.bottomBarSurface)
|
||||||
|
.clickable {
|
||||||
|
val fid = forum?.get { id } ?: forumId
|
||||||
|
val forumName = forum?.get { name }
|
||||||
|
if (!forumName.isNullOrEmpty()) {
|
||||||
|
navigator.navigate(
|
||||||
|
ReplyPageDestination(
|
||||||
|
forumId = fid,
|
||||||
|
forumName = forumName,
|
||||||
|
threadId = threadId,
|
||||||
|
postId = postId,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(8.dp),
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.tip_reply_thread),
|
||||||
|
style = MaterialTheme.typography.caption,
|
||||||
|
color = ExtendedTheme.colors.onBottomBarSurface,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.requiredHeightIn(min = if (LocalContext.current.appPreferences.liftUpBottomBar) 16.dp else 0.dp)
|
||||||
|
) {
|
||||||
|
Spacer(
|
||||||
|
modifier = Modifier
|
||||||
|
.windowInsetsBottomHeight(WindowInsets.navigationBars)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
import androidx.compose.foundation.layout.navigationBars
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.requiredHeightIn
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
||||||
|
|
@ -1503,7 +1504,9 @@ private fun BottomBar(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(40.dp))
|
||||||
}
|
}
|
||||||
|
|
||||||
BottomBarAgreeBtn(
|
BottomBarAgreeBtn(
|
||||||
|
|
@ -1528,10 +1531,15 @@ private fun BottomBar(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.windowInsetsBottomHeight(WindowInsets.navigationBars)
|
.requiredHeightIn(min = if (LocalContext.current.appPreferences.liftUpBottomBar) 16.dp else 0.dp)
|
||||||
)
|
) {
|
||||||
|
Spacer(
|
||||||
|
modifier = Modifier
|
||||||
|
.windowInsetsBottomHeight(WindowInsets.navigationBars)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,8 @@ open class AppPreferencesUtils private constructor(ctx: Context) {
|
||||||
|
|
||||||
var imeHeight by DataStoreDelegates.int(defaultValue = 800)
|
var imeHeight by DataStoreDelegates.int(defaultValue = 800)
|
||||||
|
|
||||||
|
var liftUpBottomBar by DataStoreDelegates.boolean(defaultValue = true)
|
||||||
|
|
||||||
var listItemsBackgroundIntermixed by DataStoreDelegates.boolean(defaultValue = true)
|
var listItemsBackgroundIntermixed by DataStoreDelegates.boolean(defaultValue = true)
|
||||||
|
|
||||||
var listSingle by DataStoreDelegates.boolean(defaultValue = false)
|
var listSingle by DataStoreDelegates.boolean(defaultValue = false)
|
||||||
|
|
|
||||||
|
|
@ -734,4 +734,6 @@
|
||||||
<string name="desc_photo">图片</string>
|
<string name="desc_photo">图片</string>
|
||||||
<string name="btn_open_photos">查看图片 (%d)</string>
|
<string name="btn_open_photos">查看图片 (%d)</string>
|
||||||
<string name="title_hide_media">收起贴子列表的图片和视频</string>
|
<string name="title_hide_media">收起贴子列表的图片和视频</string>
|
||||||
|
<string name="title_lift_up_bottom_bar">全面屏优化</string>
|
||||||
|
<string name="summary_lift_up_bottom_bar">略微抬起贴子页面底栏以方便点按</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue