|
|
@ -16,8 +16,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
package com.google.samples.apps.nowinandroid.feature.settings
|
|
|
|
package com.google.samples.apps.nowinandroid.feature.settings
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
|
|
|
import android.net.Uri
|
|
|
|
|
|
|
|
import androidx.compose.foundation.clickable
|
|
|
|
import androidx.compose.foundation.clickable
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
@ -42,13 +40,12 @@ import androidx.compose.ui.Alignment
|
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
import androidx.compose.ui.platform.LocalConfiguration
|
|
|
|
import androidx.compose.ui.platform.LocalConfiguration
|
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
|
import androidx.compose.ui.platform.LocalUriHandler
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
import androidx.compose.ui.semantics.Role
|
|
|
|
import androidx.compose.ui.semantics.Role
|
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.compose.ui.window.DialogProperties
|
|
|
|
import androidx.compose.ui.window.DialogProperties
|
|
|
|
import androidx.core.content.ContextCompat
|
|
|
|
|
|
|
|
import androidx.hilt.navigation.compose.hiltViewModel
|
|
|
|
import androidx.hilt.navigation.compose.hiltViewModel
|
|
|
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
|
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme
|
|
|
@ -277,8 +274,7 @@ private fun LinksPanel() {
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
private fun TextLink(text: String, url: String) {
|
|
|
|
private fun TextLink(text: String, url: String) {
|
|
|
|
val launchResourceIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
|
|
|
val uriHandler = LocalUriHandler.current
|
|
|
|
val context = LocalContext.current
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
text = text,
|
|
|
|
text = text,
|
|
|
@ -286,9 +282,7 @@ private fun TextLink(text: String, url: String) {
|
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
|
modifier = Modifier
|
|
|
|
modifier = Modifier
|
|
|
|
.padding(vertical = 8.dp)
|
|
|
|
.padding(vertical = 8.dp)
|
|
|
|
.clickable {
|
|
|
|
.clickable { uriHandler.openUri(url) },
|
|
|
|
ContextCompat.startActivity(context, launchResourceIntent, null)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|