Refactor(LibrariesScreen): Optimize prompts when there is no content or no content found

This commit is contained in:
2024-08-21 11:06:19 +08:00
parent 310214fc20
commit 0e5b6d7f98
3 changed files with 21 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.only
@@ -194,11 +195,25 @@ internal fun LibrariesScreen(
} }
LibrariesScreenUiState.Nothing -> { LibrariesScreenUiState.Nothing -> {
Text(text = "Nothing") Column(
modifier = Modifier
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(text = stringResource(R.string.core_nothing))
}
} }
LibrariesScreenUiState.NotFound -> { LibrariesScreenUiState.NotFound -> {
Text(text = "Not Found") Column(
modifier = Modifier
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(text = stringResource(R.string.core_nothing_found))
}
} }
is LibrariesScreenUiState.Success -> { is LibrariesScreenUiState.Success -> {

View File

@@ -22,6 +22,8 @@
<string name="core_unstar">取消收藏</string> <string name="core_unstar">取消收藏</string>
<string name="core_cancel">取消</string> <string name="core_cancel">取消</string>
<string name="core_undo">撤消</string> <string name="core_undo">撤消</string>
<string name="core_nothing">空空如也</string>
<string name="core_nothing_found">未找到相关内容</string>
<string name="feature_store_title">商店</string> <string name="feature_store_title">商店</string>
<string name="feature_store_install_tool">安装工具</string> <string name="feature_store_install_tool">安装工具</string>

View File

@@ -21,6 +21,8 @@
<string name="core_unstar">Unstar</string> <string name="core_unstar">Unstar</string>
<string name="core_cancel">Cancel</string> <string name="core_cancel">Cancel</string>
<string name="core_undo">Undo</string> <string name="core_undo">Undo</string>
<string name="core_nothing">Nothing</string>
<string name="core_nothing_found">Nothing found</string>
<string name="feature_store_title">Store</string> <string name="feature_store_title">Store</string>
<string name="feature_store_install_tool">Install Tool</string> <string name="feature_store_install_tool">Install Tool</string>