From 9f0698141f2fab5f9f8d41846c5c6b13ce573511 Mon Sep 17 00:00:00 2001 From: machiav3lli Date: Sun, 18 Sep 2022 14:45:12 +0200 Subject: [PATCH] Add: Links' to OtherPref Page --- .../ui/compose/components/prefs/Link.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/Link.kt diff --git a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/Link.kt b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/Link.kt new file mode 100644 index 00000000..cf1935cb --- /dev/null +++ b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/Link.kt @@ -0,0 +1,33 @@ +package com.machiav3lli.fdroid.ui.compose.components.prefs + +import android.content.Intent +import android.net.Uri +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import com.machiav3lli.fdroid.entity.LinkRef + +@Composable +fun LinkPreference( + modifier: Modifier = Modifier, + link: LinkRef, + index: Int = 1, + groupSize: Int = 1, +) { + val context = LocalContext.current + + BasePreference( + modifier = modifier, + titleId = link.titleId, + index = index, + groupSize = groupSize, + onClick = { + context.startActivity( + Intent( + Intent.ACTION_VIEW, + Uri.parse(link.url) + ) + ) + } + ) +} \ No newline at end of file