组件优化
This commit is contained in:
17 files changed
+303
-200
No files matched your search
@@ -69,7 +69,10 @@
|
|||||||
"Bash(Select-String -Pattern \"FAILED|error:\")",
|
"Bash(Select-String -Pattern \"FAILED|error:\")",
|
||||||
"Bash(Select-Object -First 5)",
|
"Bash(Select-Object -First 5)",
|
||||||
"Bash(Select-String -NotMatch \"^\\\\s*$\")",
|
"Bash(Select-String -NotMatch \"^\\\\s*$\")",
|
||||||
"Bash(Select-Object -Last 20)"
|
"Bash(Select-Object -Last 20)",
|
||||||
|
"WebFetch(domain:compose-miuix-ui.github.io)",
|
||||||
|
"Bash(Select-Object -Last 60)",
|
||||||
|
"PowerShell(.\\\\gradlew.bat :app:compileAppDebugKotlin 2>&1 | Select-Object -Last 60)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,6 +307,7 @@ object PreferKey {
|
|||||||
const val showBookIntro = "showBookIntro"
|
const val showBookIntro = "showBookIntro"
|
||||||
const val bookshelfShowIntro = "bookshelfShowIntro"
|
const val bookshelfShowIntro = "bookshelfShowIntro"
|
||||||
const val bookshelfShowTag = "bookshelfShowTag"
|
const val bookshelfShowTag = "bookshelfShowTag"
|
||||||
|
const val bookshelfShowLatestChapter = "bookshelfShowLatestChapter"
|
||||||
const val bookshelfIntroMaxLines = "bookshelfIntroMaxLines"
|
const val bookshelfIntroMaxLines = "bookshelfIntroMaxLines"
|
||||||
const val sliderVibrator = "sliderVibrator"
|
const val sliderVibrator = "sliderVibrator"
|
||||||
const val selectVibrator = "selectVibrator"
|
const val selectVibrator = "selectVibrator"
|
||||||
|
|||||||
@@ -42,9 +42,7 @@ import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
import androidx.compose.material3.Slider
|
import androidx.compose.material3.Slider
|
||||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
import io.legado.app.ui.widget.components.AppPullToRefresh
|
||||||
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults
|
|
||||||
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
@@ -136,7 +134,6 @@ fun ExploreShowScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val isRefreshing by viewModel.isRefreshing.collectAsState()
|
val isRefreshing by viewModel.isRefreshing.collectAsState()
|
||||||
val pullToRefreshState = rememberPullToRefreshState()
|
|
||||||
|
|
||||||
val hazeState = remember { HazeState() }
|
val hazeState = remember { HazeState() }
|
||||||
val shouldLoadMoreList = remember {
|
val shouldLoadMoreList = remember {
|
||||||
@@ -409,20 +406,10 @@ fun ExploreShowScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
PullToRefreshBox(
|
AppPullToRefresh(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
isRefreshing = isRefreshing,
|
isRefreshing = isRefreshing,
|
||||||
state = pullToRefreshState,
|
|
||||||
onRefresh = { viewModel.loadMore(isRefresh = true) },
|
onRefresh = { viewModel.loadMore(isRefresh = true) },
|
||||||
indicator = {
|
|
||||||
PullToRefreshDefaults.LoadingIndicator(
|
|
||||||
state = pullToRefreshState,
|
|
||||||
isRefreshing = isRefreshing,
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.TopCenter)
|
|
||||||
.padding(top = paddingValues.calculateTopPadding())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Crossfade(
|
Crossfade(
|
||||||
targetState = isGridMode,
|
targetState = isGridMode,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.Row
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
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.wrapContentSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
@@ -35,8 +36,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
import io.legado.app.ui.widget.components.AppPullToRefresh
|
||||||
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -178,31 +178,29 @@ private fun ImportBookContent(
|
|||||||
onSelectInvert = onSelectInvert,
|
onSelectInvert = onSelectInvert,
|
||||||
primaryAction = ActionItem(
|
primaryAction = ActionItem(
|
||||||
text = stringResource(R.string.add_to_bookshelf),
|
text = stringResource(R.string.add_to_bookshelf),
|
||||||
icon = { Icon(Icons.Default.CloudDownload, null) },
|
icon = Icons.Default.CloudDownload,
|
||||||
onClick = onAddToBookshelf
|
onClick = onAddToBookshelf
|
||||||
),
|
),
|
||||||
secondaryActions = listOf(
|
secondaryActions = listOf(
|
||||||
ActionItem(
|
ActionItem(
|
||||||
text = stringResource(R.string.delete),
|
text = stringResource(R.string.delete),
|
||||||
icon = { Icon(Icons.Default.Delete, null) },
|
icon = Icons.Default.Delete,
|
||||||
onClick = onDeleteSelection
|
onClick = onDeleteSelection
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
onAddClick = null
|
onAddClick = null
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
val refreshState = rememberPullToRefreshState()
|
AppPullToRefresh(
|
||||||
PullToRefreshBox(
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(paddingValues),
|
.padding(paddingValues),
|
||||||
isRefreshing = state.isLoading,
|
isRefreshing = state.isLoading,
|
||||||
state = refreshState,
|
onRefresh = onScanFolder,
|
||||||
onRefresh = onScanFolder
|
|
||||||
) {
|
) {
|
||||||
when {
|
when {
|
||||||
state.items.isEmpty() && state.isLoading -> {
|
state.items.isEmpty() && state.isLoading -> {
|
||||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
CircularProgressIndicator(modifier = Modifier.fillMaxSize().wrapContentSize(Alignment.Center))
|
||||||
}
|
}
|
||||||
|
|
||||||
state.items.isEmpty() -> {
|
state.items.isEmpty() -> {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.Row
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
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.wrapContentSize
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -44,8 +45,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
import io.legado.app.ui.widget.components.AppPullToRefresh
|
||||||
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -84,6 +84,7 @@ import io.legado.app.ui.widget.components.topbar.TopBarActionButton
|
|||||||
import io.legado.app.ui.widget.components.card.GlassCard
|
import io.legado.app.ui.widget.components.card.GlassCard
|
||||||
import io.legado.app.ui.widget.components.card.SelectionItemCard
|
import io.legado.app.ui.widget.components.card.SelectionItemCard
|
||||||
import io.legado.app.ui.widget.components.card.TextCard
|
import io.legado.app.ui.widget.components.card.TextCard
|
||||||
|
import io.legado.app.ui.widget.components.icon.AppIcon
|
||||||
import io.legado.app.ui.widget.components.list.ListScaffold
|
import io.legado.app.ui.widget.components.list.ListScaffold
|
||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
||||||
import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
|
import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
|
||||||
@@ -303,7 +304,7 @@ fun RemoteBookScreen(
|
|||||||
onSelectInvert = { viewModel.dispatch(RemoteBookIntent.SelectInvert) },
|
onSelectInvert = { viewModel.dispatch(RemoteBookIntent.SelectInvert) },
|
||||||
primaryAction = ActionItem(
|
primaryAction = ActionItem(
|
||||||
text = "添加至书架",
|
text = "添加至书架",
|
||||||
icon = { Icon(Icons.Default.CloudDownload, null) },
|
icon = Icons.Default.CloudDownload,
|
||||||
onClick = {
|
onClick = {
|
||||||
val selectedBooks = uiState.items
|
val selectedBooks = uiState.items
|
||||||
.filter { it.id in uiState.selectedIds }
|
.filter { it.id in uiState.selectedIds }
|
||||||
@@ -316,18 +317,16 @@ fun RemoteBookScreen(
|
|||||||
),
|
),
|
||||||
onAddClick = null,
|
onAddClick = null,
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
val pullToRefreshState = rememberPullToRefreshState()
|
AppPullToRefresh(
|
||||||
PullToRefreshBox(
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(paddingValues),
|
.padding | ||||||