Skip to content

Commit

Permalink
Added buttons to alert dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Jul 14, 2024
1 parent 047c288 commit cc49d7c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/src/main/java/org/schabi/newpipe/about/LicenseTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit cc49d7c

Please sign in to comment.