Cleanup AboutScreen
This commit is contained in:
1 parent
4ec58a0f62
commit
524a3a94c4
1 file changed
+17
-13
@@ -12,7 +12,7 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -20,6 +20,17 @@ import com.hippo.ehviewer.BuildConfig
|
||||
import com.hippo.ehviewer.R
|
||||
import com.hippo.ehviewer.ui.login.LocalNavController
|
||||
|
||||
private const val REPO_URL = "https://github.com/Ehviewer-Overhauled/Ehviewer"
|
||||
private const val RELEASE_URL = "https://github.com/Ehviewer-Overhauled/Ehviewer/releases"
|
||||
|
||||
@Composable
|
||||
@Stable
|
||||
private fun versionCode() = "${BuildConfig.VERSION_NAME} (${BuildConfig.COMMIT_SHA})\n" + stringResource(R.string.settings_about_build_time, BuildConfig.BUILD_TIME)
|
||||
|
||||
@Composable
|
||||
@Stable
|
||||
private fun author() = stringResource(R.string.settings_about_author_summary).replace('$', '@').let { Html.fromHtml(it, Html.FROM_HTML_MODE_LEGACY).toAnnotatedString() }
|
||||
|
||||
@Composable
|
||||
fun AboutScreen() {
|
||||
val navController = LocalNavController.current
|
||||
@@ -39,18 +50,11 @@ fun AboutScreen() {
|
||||
) {
|
||||
Column(modifier = Modifier.padding(it).nestedScroll(scrollBehavior.nestedScrollConnection)) {
|
||||
Preference(title = stringResource(id = R.string.settings_about_declaration), summary = stringResource(id = R.string.settings_about_declaration_summary))
|
||||
val author = stringResource(R.string.settings_about_author_summary).replace('$', '@').let {
|
||||
remember { Html.fromHtml(it, Html.FROM_HTML_MODE_LEGACY).toAnnotatedString() }
|
||||
}
|
||||
HtmlPreference(title = stringResource(id = R.string.settings_about_author), summary = author)
|
||||
val url = "https://github.com/Ehviewer-Overhauled/Ehviewer/releases"
|
||||
UrlPreference(title = stringResource(id = R.string.settings_about_latest_release), url = url)
|
||||
val url2 = "https://github.com/Ehviewer-Overhauled/Ehviewer"
|
||||
UrlPreference(title = stringResource(id = R.string.settings_about_source), url = url2)
|
||||
Preference(title = stringResource(id = R.string.license)) {
|
||||
navController.navigate(LICENSE_SCREEN)
|
||||
}
|
||||
Preference(title = stringResource(id = R.string.settings_about_version), summary = "${BuildConfig.VERSION_NAME} (${BuildConfig.COMMIT_SHA})\n" + stringResource(R.string.settings_about_build_time, BuildConfig.BUILD_TIME))
|
||||
HtmlPreference(title = stringResource(id = R.string.settings_about_author), summary = author())
|
||||
UrlPreference(title = stringResource(id = R.string.settings_about_latest_release), url = RELEASE_URL)
|
||||
UrlPreference(title = stringResource(id = R.string.settings_about_source), url = REPO_URL)
|
||||
Preference(title = stringResource(id = R.string.license)) { navController.navigate(LICENSE_SCREEN) }
|
||||
Preference(title = stringResource(id = R.string.settings_about_version), summary = versionCode())
|
||||
Preference(title = stringResource(id = R.string.settings_about_check_for_updates))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user