diff --git a/app/src/main/java/com/readrops/app/more/MoreTab.kt b/app/src/main/java/com/readrops/app/more/MoreTab.kt index 12f92393..e2e2a455 100644 --- a/app/src/main/java/com/readrops/app/more/MoreTab.kt +++ b/app/src/main/java/com/readrops/app/more/MoreTab.kt @@ -1,15 +1,21 @@ package com.readrops.app.more import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.statusBarsPadding +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp @@ -20,7 +26,9 @@ import cafe.adriel.voyager.navigator.tab.TabOptions import com.readrops.app.BuildConfig import com.readrops.app.R import com.readrops.app.account.selection.adaptiveIconPainterResource +import com.readrops.app.util.components.IconText import com.readrops.app.util.components.SelectableIconText +import com.readrops.app.util.openUrl import com.readrops.app.util.theme.LargeSpacer import com.readrops.app.util.theme.MediumSpacer import com.readrops.app.util.theme.ShortSpacer @@ -39,6 +47,7 @@ object MoreTab : Tab { @Composable override fun Content() { val navigator = LocalNavigator.currentOrThrow + val context = LocalContext.current Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -63,11 +72,61 @@ object MoreTab : Tab { ShortSpacer() - Text( - text = "v${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})", + IconText( + text = if (BuildConfig.DEBUG) { + "v${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})" + } else { + "v${BuildConfig.VERSION_NAME}" + }, + icon = painterResource(id = R.drawable.ic_version), style = MaterialTheme.typography.labelLarge ) + ShortSpacer() + + Text( + text = stringResource(id = R.string.app_licence), + style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + + ShortSpacer() + + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + modifier = Modifier.fillMaxWidth() + ) { + IconButton( + onClick = { context.openUrl(context.getString(R.string.app_url)) } + ) { + Icon( + painter = painterResource(id = R.drawable.ic_github), + contentDescription = null, + modifier = Modifier.size(24.dp) + ) + } + + IconButton( + onClick = { context.openUrl(context.getString(R.string.changelog_url)) } + ) { + Icon( + painter = painterResource(id = R.drawable.ic_changelog), + contentDescription = null, + modifier = Modifier.size(24.dp) + ) + } + + IconButton( + onClick = { context.openUrl(context.getString(R.string.app_issues_url)) } + ) { + Icon( + painter = painterResource(id = R.drawable.ic_bug_report), + contentDescription = null + ) + } + } + LargeSpacer() SelectableIconText( @@ -87,6 +146,15 @@ object MoreTab : Tab { padding = MaterialTheme.spacing.mediumSpacing, onClick = { navigator.push(AboutLibrariesScreen()) } ) + + SelectableIconText( + icon = painterResource(id = R.drawable.ic_donation), + text = stringResource(id = R.string.make_donation), + style = MaterialTheme.typography.titleMedium, + spacing = MaterialTheme.spacing.mediumSpacing, + padding = MaterialTheme.spacing.mediumSpacing, + onClick = { } + ) } } } \ No newline at end of file diff --git a/app/src/main/java/com/readrops/app/util/Extensions.kt b/app/src/main/java/com/readrops/app/util/Extensions.kt index e420a750..44f46660 100644 --- a/app/src/main/java/com/readrops/app/util/Extensions.kt +++ b/app/src/main/java/com/readrops/app/util/Extensions.kt @@ -1,7 +1,12 @@ package com.readrops.app.util +import android.content.Context +import android.content.Intent +import android.net.Uri import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -fun TextStyle.toDp(): Dp = fontSize.value.dp \ No newline at end of file +fun TextStyle.toDp(): Dp = fontSize.value.dp + +fun Context.openUrl(url: String) = startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_bug_report.xml b/app/src/main/res/drawable/ic_bug_report.xml new file mode 100644 index 00000000..e9dbae4d --- /dev/null +++ b/app/src/main/res/drawable/ic_bug_report.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_changelog.xml b/app/src/main/res/drawable/ic_changelog.xml new file mode 100644 index 00000000..30d5d26b --- /dev/null +++ b/app/src/main/res/drawable/ic_changelog.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_donation.xml b/app/src/main/res/drawable/ic_donation.xml new file mode 100644 index 00000000..3a8a4aea --- /dev/null +++ b/app/src/main/res/drawable/ic_donation.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_github.xml b/app/src/main/res/drawable/ic_github.xml new file mode 100644 index 00000000..62989ed4 --- /dev/null +++ b/app/src/main/res/drawable/ic_github.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_version.xml b/app/src/main/res/drawable/ic_version.xml new file mode 100644 index 00000000..e78b6839 --- /dev/null +++ b/app/src/main/res/drawable/ic_version.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index dc035999..7a409c2f 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -169,4 +169,5 @@ Tout activer Tout désactiver Bibliothèques Open source + Faire une donation \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a7b8aa9d..c5502d2b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ Readrops + App released under the GPLv3 licence To read Non read articles Open menu @@ -175,4 +176,7 @@ Enable all Disable all Open source libraries + Make a donation + https://github.com/readrops/Readrops/blob/develop/CHANGELOG.md + https://github.com/readrops/Readrops/issues \ No newline at end of file