From 8a41c8cf66561c8cdf1a051e6465885633c207bf Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sun, 14 Jul 2024 08:03:01 +0530 Subject: [PATCH] Added buttons to alert dialog --- .../java/org/schabi/newpipe/about/LicenseTab.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseTab.kt b/app/src/main/java/org/schabi/newpipe/about/LicenseTab.kt index 19f687455..a42cf864c 100644 --- a/app/src/main/java/org/schabi/newpipe/about/LicenseTab.kt +++ b/app/src/main/java/org/schabi/newpipe/about/LicenseTab.kt @@ -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(