1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-03 05:50:32 +00:00

Added buttons to alert dialog

This commit is contained in:
Isira Seneviratne 2024-07-14 08:03:01 +05:30
parent 05271d95a9
commit 8a41c8cf66

View File

@ -8,6 +8,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.NonRestartableComposable
@ -26,6 +27,7 @@ import androidx.compose.ui.text.style.TextDecoration
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.schabi.newpipe.R
import org.schabi.newpipe.util.external_communication.ShareUtils
private val SOFTWARE_COMPONENTS = listOf(
SoftwareComponent(
@ -148,8 +150,19 @@ fun LicenseTab() {
AlertDialog(
onDismissRequest = { selectedLicense = null },
confirmButton = {},
title = { Text(text = it.name) },
confirmButton = {
TextButton(onClick = { ShareUtils.openUrlInApp(context, it.link) }) {
Text(text = stringResource(R.string.open_website_license))
}
},
dismissButton = {
TextButton(onClick = { selectedLicense = null }) {
Text(text = stringResource(R.string.done))
}
},
title = {
Text(text = it.name, color = MaterialTheme.colorScheme.onBackground)
},
text = {
val styles = TextLinkStyles(SpanStyle(textDecoration = TextDecoration.Underline))
Text(