mirror of
https://github.com/SimpleMobileTools/Simple-Thank-You.git
synced 2025-02-16 11:31:34 +01:00
fix: link color
This commit is contained in:
parent
3cd957d1bf
commit
8c7f434438
@ -4,12 +4,12 @@ import android.content.Intent
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
|
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
|
||||||
import com.simplemobiletools.commons.compose.extensions.onEventValue
|
import com.simplemobiletools.commons.compose.extensions.onEventValue
|
||||||
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
||||||
import com.simplemobiletools.commons.extensions.appLaunched
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.extensions.hideKeyboard
|
|
||||||
import com.simplemobiletools.commons.extensions.launchMoreAppsFromUsIntent
|
|
||||||
import com.simplemobiletools.commons.models.FAQItem
|
import com.simplemobiletools.commons.models.FAQItem
|
||||||
import com.simplemobiletools.commons.models.Release
|
import com.simplemobiletools.commons.models.Release
|
||||||
import com.simplemobiletools.thankyou.BuildConfig
|
import com.simplemobiletools.thankyou.BuildConfig
|
||||||
@ -24,8 +24,10 @@ class MainActivity : ComponentActivity() {
|
|||||||
enableEdgeToEdgeSimple()
|
enableEdgeToEdgeSimple()
|
||||||
setContent {
|
setContent {
|
||||||
AppThemeSurface {
|
AppThemeSurface {
|
||||||
|
val linkColor = rememberLinkColor()
|
||||||
val showMoreApps = onEventValue { !resources.getBoolean(R.bool.hide_google_relations) }
|
val showMoreApps = onEventValue { !resources.getBoolean(R.bool.hide_google_relations) }
|
||||||
MainScreen(
|
MainScreen(
|
||||||
|
linkColor = linkColor,
|
||||||
showMoreApps = showMoreApps,
|
showMoreApps = showMoreApps,
|
||||||
openSettings = ::launchSettings,
|
openSettings = ::launchSettings,
|
||||||
openAbout = ::launchAbout,
|
openAbout = ::launchAbout,
|
||||||
@ -37,6 +39,14 @@ class MainActivity : ComponentActivity() {
|
|||||||
checkWhatsNewDialog()
|
checkWhatsNewDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun rememberLinkColor() = remember {
|
||||||
|
when {
|
||||||
|
isWhiteTheme() || isBlackAndWhiteTheme() -> baseConfig.accentColor
|
||||||
|
else -> getProperPrimaryColor()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun launchSettings() {
|
private fun launchSettings() {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
startActivity(Intent(this, SettingsActivity::class.java))
|
startActivity(Intent(this, SettingsActivity::class.java))
|
||||||
|
@ -33,6 +33,7 @@ internal fun MainScreen(
|
|||||||
openSettings: () -> Unit,
|
openSettings: () -> Unit,
|
||||||
openAbout: () -> Unit,
|
openAbout: () -> Unit,
|
||||||
moreAppsFromUs: () -> Unit,
|
moreAppsFromUs: () -> Unit,
|
||||||
|
linkColor: Int,
|
||||||
) {
|
) {
|
||||||
SettingsLazyScaffold(customTopBar = { scrolledColor: Color, _: MutableInteractionSource, scrollBehavior: TopAppBarScrollBehavior, statusBarColor: Int, colorTransitionFraction: Float, contrastColor: Color ->
|
SettingsLazyScaffold(customTopBar = { scrolledColor: Color, _: MutableInteractionSource, scrollBehavior: TopAppBarScrollBehavior, statusBarColor: Int, colorTransitionFraction: Float, contrastColor: Color ->
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
@ -60,6 +61,7 @@ internal fun MainScreen(
|
|||||||
)
|
)
|
||||||
}) { paddingValues ->
|
}) { paddingValues ->
|
||||||
val textColor = MaterialTheme.colorScheme.onSurface.toArgb()
|
val textColor = MaterialTheme.colorScheme.onSurface.toArgb()
|
||||||
|
|
||||||
AndroidView(
|
AndroidView(
|
||||||
factory = { context ->
|
factory = { context ->
|
||||||
TextView(context).apply {
|
TextView(context).apply {
|
||||||
@ -67,6 +69,7 @@ internal fun MainScreen(
|
|||||||
textSize = 16.sp.value
|
textSize = 16.sp.value
|
||||||
setLineSpacing(3.dp.value, 1f)
|
setLineSpacing(3.dp.value, 1f)
|
||||||
gravity = Gravity.CENTER_HORIZONTAL
|
gravity = Gravity.CENTER_HORIZONTAL
|
||||||
|
setLinkTextColor(linkColor)
|
||||||
Linkify.addLinks(this, Linkify.WEB_URLS)
|
Linkify.addLinks(this, Linkify.WEB_URLS)
|
||||||
Linkify.addLinks(this, Linkify.EMAIL_ADDRESSES)
|
Linkify.addLinks(this, Linkify.EMAIL_ADDRESSES)
|
||||||
}
|
}
|
||||||
@ -85,6 +88,6 @@ internal fun MainScreen(
|
|||||||
@MyDevices
|
@MyDevices
|
||||||
private fun MainScreenPreview() {
|
private fun MainScreenPreview() {
|
||||||
AppThemeSurface {
|
AppThemeSurface {
|
||||||
MainScreen(showMoreApps = true, openSettings = {}, openAbout = {}, moreAppsFromUs = {})
|
MainScreen(showMoreApps = true, openSettings = {}, openAbout = {}, moreAppsFromUs = {}, linkColor = MaterialTheme.colorScheme.onSurface.toArgb())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user