Skip to content

Commit 710ef16

Browse files
refactor(settings): Replace AndroidView with Compose Text
This commit refactors the settings UI by replacing `AndroidView` wrappers around `FontAppCompatTextView` with native Jetpack Compose `Text` and `ClickableHtmlText` composable. This change eliminates the need for the `AndroidView` interop for displaying simple and HTML-styled text, resulting in a more streamlined and pure-Compose implementation. The key changes include: - Introduction of `ClickableHtmlText`, a new composable function that handles HTML parsing and makes embedded links clickable using `buildAnnotatedString`. - The `TitleWithHtmlLink` composable has been removed and its functionality absorbed into the more versatile `TitleWithHtmlLinks`. - Various settings composable (`SettingsHeader`, `SettingsItem`, `SettingsSelect`, `SettingsSwitch`, and `TitleWithHtmlLinks`) have been updated to use the native `Text` composable, removing `AndroidView` and `FontAppCompatTextView`. - In the "About" section, links for the GitHub repository and privacy policy have been added for better user navigation. - The `created_by` link in `nontranslatable.xml` has been updated to point to the correct GitHub organization.
1 parent 2802817 commit 710ef16

File tree

3 files changed

+177
-227
lines changed

3 files changed

+177
-227
lines changed

app/src/main/java/com/github/droidworksstudio/mlauncher/ui/SettingsFragment.kt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ import com.github.droidworksstudio.mlauncher.ui.compose.SettingsComposable.Setti
9797
import com.github.droidworksstudio.mlauncher.ui.compose.SettingsComposable.SettingsSelect
9898
import com.github.droidworksstudio.mlauncher.ui.compose.SettingsComposable.SettingsSwitch
9999
import com.github.droidworksstudio.mlauncher.ui.compose.SettingsComposable.SettingsTitle
100-
import com.github.droidworksstudio.mlauncher.ui.compose.SettingsComposable.TitleWithHtmlLink
101100
import com.github.droidworksstudio.mlauncher.ui.compose.SettingsComposable.TitleWithHtmlLinks
102101
import com.github.droidworksstudio.mlauncher.ui.compose.SettingsComposable.TopMainHeader
103102
import com.github.droidworksstudio.mlauncher.ui.iconpack.CustomIconSelectionActivity
@@ -491,7 +490,7 @@ class SettingsFragment : BaseFragment() {
491490
descriptionFontSize = descriptionFontSize,
492491
iconSize = iconSize,
493492
onClick = { currentScreen = "about" },
494-
enableMultiClick = true,
493+
enableMultiClick = !toggledExpertOptions,
495494
onMultiClick = { count ->
496495
if (!prefs.enableExpertOptions) {
497496
if (count in 2..4) {
@@ -2688,13 +2687,21 @@ class SettingsFragment : BaseFragment() {
26882687
descriptionFontSize = descriptionFontSize
26892688
)
26902689

2690+
TitleWithHtmlLinks(
2691+
title = getLocalizedString(R.string.app_version),
2692+
titleFontSize = descriptionFontSize,
2693+
)
2694+
26912695
Spacer(modifier = Modifier.height(16.dp))
26922696

2693-
TitleWithHtmlLink(
2697+
TitleWithHtmlLinks(
26942698
title = getLocalizedString(R.string.settings_source_code),
2695-
description = getLocalizedString(R.string.github_link),
2699+
descriptions = listOf(
2700+
getLocalizedString(R.string.github_link)
2701+
),
26962702
titleFontSize = titleFontSize,
2697-
descriptionFontSize = descriptionFontSize
2703+
descriptionFontSize = descriptionFontSize,
2704+
columns = true
26982705
)
26992706

27002707
Spacer(modifier = Modifier.height(16.dp))
@@ -2717,6 +2724,7 @@ class SettingsFragment : BaseFragment() {
27172724
descriptions = listOf(
27182725
getLocalizedString(R.string.weather_link),
27192726
getLocalizedString(R.string.forked_link),
2727+
getLocalizedString(R.string.privacy_policy_link)
27202728
),
27212729
titleFontSize = titleFontSize,
27222730
descriptionFontSize = descriptionFontSize,

0 commit comments

Comments
 (0)