Skip to content

Commit 8a41c8c

Browse files
Added buttons to alert dialog
1 parent 05271d9 commit 8a41c8c

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/about/LicenseTab.kt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import androidx.compose.foundation.verticalScroll
88
import androidx.compose.material3.AlertDialog
99
import androidx.compose.material3.MaterialTheme
1010
import androidx.compose.material3.Text
11+
import androidx.compose.material3.TextButton
1112
import androidx.compose.runtime.Composable
1213
import androidx.compose.runtime.LaunchedEffect
1314
import androidx.compose.runtime.NonRestartableComposable
@@ -26,6 +27,7 @@ import androidx.compose.ui.text.style.TextDecoration
2627
import kotlinx.coroutines.Dispatchers
2728
import kotlinx.coroutines.withContext
2829
import org.schabi.newpipe.R
30+
import org.schabi.newpipe.util.external_communication.ShareUtils
2931

3032
private val SOFTWARE_COMPONENTS = listOf(
3133
SoftwareComponent(
@@ -148,8 +150,19 @@ fun LicenseTab() {
148150

149151
AlertDialog(
150152
onDismissRequest = { selectedLicense = null },
151-
confirmButton = {},
152-
title = { Text(text = it.name) },
153+
confirmButton = {
154+
TextButton(onClick = { ShareUtils.openUrlInApp(context, it.link) }) {
155+
Text(text = stringResource(R.string.open_website_license))
156+
}
157+
},
158+
dismissButton = {
159+
TextButton(onClick = { selectedLicense = null }) {
160+
Text(text = stringResource(R.string.done))
161+
}
162+
},
163+
title = {
164+
Text(text = it.name, color = MaterialTheme.colorScheme.onBackground)
165+
},
153166
text = {
154167
val styles = TextLinkStyles(SpanStyle(textDecoration = TextDecoration.Underline))
155168
Text(

0 commit comments

Comments
 (0)