Recreated About screen in Compose

This commit is contained in:
Arty Bishop committed 2025-12-27 15:01:28 +00:00
1 parent 8f411d4c5e
commit ee5b5a894b
6 files changed
+80 -30

No files matched your search

@@ -1,15 +1,14 @@
package com.rtbishop.look4sat.presentation.aboutScreen package com.rtbishop.look4sat.presentation.aboutScreen
import android.content.Intent
import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Card import androidx.compose.material.*
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@@ -17,11 +16,14 @@ import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.rtbishop.look4sat.BuildConfig
import com.rtbishop.look4sat.R import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.presentation.theme.Look4SatTheme import com.rtbishop.look4sat.presentation.theme.Look4SatTheme
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@@ -43,18 +45,18 @@ class AboutFragment : Fragment() {
private fun AboutScreen() { private fun AboutScreen() {
Look4SatTheme { Look4SatTheme {
LazyColumn( LazyColumn(
contentPadding = PaddingValues(8.dp), contentPadding = PaddingValues(6.dp),
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxSize()
) { ) {
item { CardAbout() } item { CardAbout(BuildConfig.VERSION_NAME) }
item { CardOutro() } item { CardCredits() }
} }
} }
} }
@Composable @Composable
private fun CardAbout(modifier: Modifier = Modifier, version: String = "3.2.0") { private fun CardAbout(version: String, modifier: Modifier = Modifier) {
Card(modifier = modifier.fillMaxWidth()) { Card(modifier = modifier.fillMaxWidth()) {
Column(horizontalAlignment = Alignment.CenterHorizontally) { Column(horizontalAlignment = Alignment.CenterHorizontally) {
Row(horizontalArrangement = Arrangement.Center) { Row(horizontalArrangement = Arrangement.Center) {
@@ -81,35 +83,83 @@ class AboutFragment : Fragment() {
Text( Text(
text = stringResource(id = R.string.app_subtitle), text = stringResource(id = R.string.app_subtitle),
fontSize = 21.sp, fontSize = 21.sp,
modifier = modifier.padding(top = 4.dp, bottom = 8.dp) modifier = modifier.padding(top = 4.dp)
) )
Row(
horizontalArrangement = Arrangement.SpaceEvenly,
modifier = Modifier.padding(start = 4.dp, end = 4.dp)
) {
LinkButton(
onClick = { gotoUrl("https://sites.google.com/view/look4sat-privacy-policy/home") },
text = stringResource(id = R.string.btn_privacy),
modifier = Modifier.weight(1f)
)
LinkButton(
onClick = { gotoUrl("https://www.gnu.org/licenses/gpl-3.0.html") },
text = stringResource(id = R.string.btn_license),
modifier = Modifier.weight(1f)
)
}
} }
} }
} }
@Composable @Composable
fun CardOutro(modifier: Modifier = Modifier) { private fun CardCredits(modifier: Modifier = Modifier) {
Card(modifier = modifier.fillMaxWidth()) { Card(modifier = modifier.fillMaxWidth()) {
Column(horizontalAlignment = Alignment.CenterHorizontally) { Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text( Text(
text = stringResource(id = R.string.outro_title), text = stringResource(id = R.string.outro_title),
fontSize = 19.sp, fontSize = 18.sp,
color = MaterialTheme.colors.secondary, color = MaterialTheme.colors.secondary,
modifier = modifier.padding(8.dp) modifier = modifier.padding(8.dp)
) )
Text( Text(
text = stringResource(id = R.string.outro_thanks), text = stringResource(id = R.string.outro_thanks),
fontSize = 17.sp, fontSize = 16.sp,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
modifier = modifier.padding(start = 8.dp, end = 8.dp) modifier = modifier.padding(start = 8.dp, end = 8.dp)
) )
Text( Text(
text = stringResource(id = R.string.outro_license), text = stringResource(id = R.string.outro_license),
fontSize = 17.sp, fontSize = 18.sp,
textAlign = TextAlign.Center, color = MaterialTheme.colors.secondary,
modifier = modifier.padding(8.dp) modifier = modifier.padding(start = 8.dp, end = 8.dp, top = 8.dp, bottom = 4.dp)
) )
Row(
horizontalArrangement = Arrangement.SpaceEvenly,
modifier = Modifier.padding(start = 4.dp, end = 4.dp)
) {
LinkButton(
onClick = { gotoUrl("https://github.com/rt-bishop/Look4Sat/") },
text = stringResource(id = R.string.btn_github),
modifier = Modifier.weight(1f)
)
LinkButton(
onClick = { gotoUrl("https://ko-fi.com/rt_bishop") },
text = stringResource(id = R.string.btn_support),
modifier = Modifier.weight(1f)
)
LinkButton(
onClick = { gotoUrl("https://f-droid.org/en/packages/com.rtbishop.look4sat/") },
text = stringResource(id = R.string.btn_fdroid),
modifier = Modifier.weight(1f)
)
}
} }
} }
} }
@Composable
private fun LinkButton(onClick: () -> Unit, text: String, modifier: Modifier = Modifier) {
Button(
onClick = { onClick() },
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.primaryVariant),
modifier = modifier.padding(4.dp)
) {
Text(text = text, style = TextStyle(fontWeight = FontWeight.Bold), fontSize = 18.sp)
}
}
private fun gotoUrl(url: String) = startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
} }
@@ -5,7 +5,7 @@ import androidx.compose.material.Shapes
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
val Shapes = Shapes( val Shapes = Shapes(
small = RoundedCornerShape(8.dp), small = RoundedCornerShape(12.dp),
medium = RoundedCornerShape(8.dp), medium = RoundedCornerShape(12.dp),
large = RoundedCornerShape(8.dp) large = RoundedCornerShape(12.dp)
) )
@@ -14,7 +14,7 @@ fun Look4SatTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composab
private val LightColors = lightColors( private val LightColors = lightColors(
primary = SurfaceGrey, primary = SurfaceGrey,
primaryVariant = Background, primaryVariant = ButtonGrey,
secondary = Yellow, secondary = Yellow,
background = Background, background = Background,
surface = SurfaceGrey, surface = SurfaceGrey,
@@ -26,7 +26,7 @@ private val LightColors = lightColors(
private val DarkColors = darkColors( private val DarkColors = darkColors(
primary = SurfaceGrey, primary = SurfaceGrey,
primaryVariant = Background, primaryVariant = ButtonGrey,
secondary = Yellow, secondary = Yellow,
background = Background, background = Background,
surface = SurfaceGrey, surface = SurfaceGrey,
+3 -3
View File
@@ -38,6 +38,8 @@
<string name="btn_github">GitHub</string> <string name="btn_github">GitHub</string>
<string name="btn_support">Поддержать</string> <string name="btn_support">Поддержать</string>
<string name="btn_fdroid">F-Droid</string> <string name="btn_fdroid">F-Droid</string>
<string name="btn_privacy">Конфиденц.</string>
<string name="btn_license">Лицензия</string>
<!--Dialogs--> <!--Dialogs-->
@@ -176,7 +178,5 @@
\n • <a href="https://appoftheday.downloadastro.com/app/look4sat-satellite-tracker/">DownloadAstro</a> \n • <a href="https://appoftheday.downloadastro.com/app/look4sat-satellite-tracker/">DownloadAstro</a>
за интерес к приложению и публикацию интервью на сайте. за интерес к приложению и публикацию интервью на сайте.
</string> </string>
<string name="outro_license"><a href="https://sites.google.com/view/look4sat-privacy-policy/home">Политика конфиденциальности.</a> <string name="outro_license">Это ПО поставляется без гарантий.</string>
\nЭто ПО поставляется без гарантий. \nПодробности в лицензии <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPLv3</a>.
</string>
</resources> </resources>
+3 -3
View File
@@ -38,6 +38,8 @@
<string name="btn_github">GitHub</string> <string name="btn_github">GitHub</string>
<string name="btn_support">支持</string> <string name="btn_support">支持</string>
<string name="btn_fdroid">F-Droid</string> <string name="btn_fdroid">F-Droid</string>
<string name="btn_privacy">隐私政策</string>
<string name="btn_license">GNU GPLv3</string>
<!--Dialogs--> <!--Dialogs-->
@@ -177,7 +179,5 @@
\n • <a href="https://appoftheday.downloadastro.com/app/look4sat-satellite-tracker/">DownloadAstro</a> \n • <a href="https://appoftheday.downloadastro.com/app/look4sat-satellite-tracker/">DownloadAstro</a>
team for their interest to the app and the interview published. team for their interest to the app and the interview published.
</string> </string>
<string name="outro_license"><a href="https://sites.google.com/view/look4sat-privacy-policy/home">隐私政策</a> <string name="outro_license">该应用程序不提供任何保修.</string>
该应用程序不提供任何保修。\n有关详细信息,请参阅 <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPLv3 许可证</a> 。
</string>
</resources> </resources>
+3 -3
View File
@@ -38,6 +38,8 @@
<string name="btn_github">GitHub</string> <string name="btn_github">GitHub</string>
<string name="btn_support">Support</string> <string name="btn_support">Support</string>
<string name="btn_fdroid">F-Droid</string> <string name="btn_fdroid">F-Droid</string>
<string name="btn_privacy">Privacy Policy</string>
<string name="btn_license">GPLv3 Licence</string>
<!--Dialogs--> <!--Dialogs-->
@@ -176,7 +178,5 @@
\n\n • <a href="https://appoftheday.downloadastro.com/app/look4sat-satellite-tracker/">DownloadAstro</a> \n\n • <a href="https://appoftheday.downloadastro.com/app/look4sat-satellite-tracker/">DownloadAstro</a>
team for their interest to the app and the interview published. team for their interest to the app and the interview published.
</string> </string>
<string name="outro_license"><a href="https://sites.google.com/view/look4sat-privacy-policy/home">Privacy Policy.</a> <string name="outro_license">The app comes with no warranty.</string>
The app comes with no warranty. \nSee the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPLv3</a> license for details.
</string>
</resources> </resources>