mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 19:17:21 +00:00
Created future InfoScreen, added resources
This commit is contained in:
1 parent
49f713d82c
commit
d59f9c7506
7 files changed
+106
-63
No files matched your search
@@ -22,6 +22,7 @@ import androidx.navigation.navArgument
|
||||
import com.rtbishop.look4sat.R
|
||||
import com.rtbishop.look4sat.presentation.entries.EntriesScreen
|
||||
import com.rtbishop.look4sat.presentation.entries.EntriesViewModel
|
||||
import com.rtbishop.look4sat.presentation.info.InfoScreen
|
||||
import com.rtbishop.look4sat.presentation.map.MapScreen
|
||||
import com.rtbishop.look4sat.presentation.passes.PassesScreen
|
||||
import com.rtbishop.look4sat.presentation.radar.RadarScreen
|
||||
@@ -30,9 +31,10 @@ import com.rtbishop.look4sat.presentation.settings.SettingsScreen
|
||||
sealed class Screen(var title: String, var icon: Int, var route: String) {
|
||||
data object Entries : Screen("Entries", R.drawable.ic_sputnik, "entries")
|
||||
data object Passes : Screen("Passes", R.drawable.ic_passes, "passes")
|
||||
data object Radar : Screen("Radar", R.drawable.ic_settings, "radar")
|
||||
data object Radar : Screen("Radar", R.drawable.ic_passes, "passes.radar")
|
||||
data object Map : Screen("World Map", R.drawable.ic_world_map, "world_map")
|
||||
data object Settings : Screen("Settings", R.drawable.ic_settings, "settings")
|
||||
data object Info : Screen("Info", R.drawable.ic_info, "info")
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -44,20 +46,18 @@ fun MainScreen(navController: NavHostController = rememberNavController()) {
|
||||
|
||||
@Composable
|
||||
private fun MainNavBar(navController: NavController) {
|
||||
val items = listOf(Screen.Entries, Screen.Passes, Screen.Radar, Screen.Map, Screen.Settings)
|
||||
val items = listOf(Screen.Entries, Screen.Passes, Screen.Map, Screen.Settings, Screen.Info)
|
||||
NavigationBar(modifier = Modifier.height(48.dp)) {
|
||||
val navBackStackEntry = navController.currentBackStackEntryAsState()
|
||||
val currentRoute = navBackStackEntry.value?.destination?.route
|
||||
items.forEach { item ->
|
||||
NavigationBarItem(selected = currentRoute?.contains(item.route) ?: false, onClick = {
|
||||
navController.navigate(item.route) {
|
||||
navController.graph.startDestinationRoute?.let { route ->
|
||||
popUpTo(route) { saveState = false }
|
||||
}
|
||||
items.forEach { screen ->
|
||||
NavigationBarItem(selected = currentRoute?.contains(screen.route) ?: false, onClick = {
|
||||
navController.navigate(screen.route) {
|
||||
navController.graph.startDestinationRoute?.let { popUpTo(it) { saveState = false } }
|
||||
launchSingleTop = true
|
||||
restoreState = false
|
||||
}
|
||||
}, icon = { Icon(painterResource(id = item.icon), contentDescription = item.title) })
|
||||
}, icon = { Icon(painterResource(id = screen.icon), contentDescription = screen.title) })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,5 +81,6 @@ private fun MainNavGraph(navController: NavHostController) {
|
||||
composable(radarRoute, radarArgs) { RadarScreen() }
|
||||
composable(Screen.Map.route) { MapScreen() }
|
||||
composable(Screen.Settings.route) { SettingsScreen() }
|
||||
composable(Screen.Info.route) { InfoScreen() }
|
||||
}
|
||||
}
|
||||
@@ -151,8 +151,8 @@ private fun MiddleBarPreview() = MainTheme { MiddleBar("Amateur", {}, {}, {}) }
|
||||
private fun MiddleBar(type: String, navigate: () -> Unit, uncheck: () -> Unit, check: () -> Unit) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.height(48.dp)) {
|
||||
EntryTypeCard(type = type, { navigate() }, modifier = Modifier.weight(1f))
|
||||
CardIcon(onClick = { uncheck() }, iconId = R.drawable.ic_checkbox_off)
|
||||
CardIcon(onClick = { check() }, iconId = R.drawable.ic_checkbox_on)
|
||||
CardIcon(onClick = { uncheck() }, iconId = R.drawable.ic_check_off)
|
||||
CardIcon(onClick = { check() }, iconId = R.drawable.ic_check_on)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.rtbishop.look4sat.presentation.info
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
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.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.rtbishop.look4sat.R
|
||||
import com.rtbishop.look4sat.presentation.CardButton
|
||||
import com.rtbishop.look4sat.presentation.MainTheme
|
||||
import com.rtbishop.look4sat.presentation.gotoUrl
|
||||
|
||||
private const val POLICY_URL = "https://sites.google.com/view/look4sat-privacy-policy/home"
|
||||
private const val LICENSE_URL = "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
|
||||
@Composable
|
||||
fun InfoScreen() {
|
||||
LazyColumn(modifier = Modifier.padding(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
item { CardCredits() }
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun CardCreditsPreview() = MainTheme { CardCredits() }
|
||||
|
||||
@Composable
|
||||
private fun CardCredits(modifier: Modifier = Modifier) {
|
||||
val context = LocalContext.current
|
||||
ElevatedCard(modifier = modifier.fillMaxWidth()) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.outro_title),
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = modifier.padding(6.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = R.string.outro_thanks
|
||||
), fontSize = 16.sp, textAlign = TextAlign.Center
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.outro_license),
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = modifier.padding(6.dp)
|
||||
)
|
||||
Row(horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
CardButton(
|
||||
onClick = { gotoUrl(context, LICENSE_URL) },
|
||||
text = stringResource(id = R.string.btn_license),
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(6.dp))
|
||||
CardButton(
|
||||
onClick = { gotoUrl(context, POLICY_URL) },
|
||||
text = stringResource(id = R.string.btn_privacy),
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ 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.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -48,8 +47,6 @@ import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
private const val POLICY_URL = "https://sites.google.com/view/look4sat-privacy-policy/home"
|
||||
private const val LICENSE_URL = "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
private const val GITHUB_URL = "https://github.com/rt-bishop/Look4Sat/"
|
||||
private const val DONATE_URL = "https://ko-fi.com/rt_bishop"
|
||||
private const val FDROID_URL = "https://f-droid.org/en/packages/com.rtbishop.look4sat/"
|
||||
@@ -123,7 +120,6 @@ fun SettingsScreen() {
|
||||
item { LocationCard(positionSettings, setGpsPos, showPosDialog, showLocDialog, dismissPos) }
|
||||
item { DataCard(dataSettings, updateFromWeb, updateFromFile, clearAllData) }
|
||||
item { OtherCard(otherSettings, toggleUtc, toggleUpdate, toggleSweep, toggleSensor) }
|
||||
item { CardCredits() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,54 +419,6 @@ private fun OtherCard(
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun CardCreditsPreview() = MainTheme { CardCredits() }
|
||||
|
||||
@Composable
|
||||
private fun CardCredits(modifier: Modifier = Modifier) {
|
||||
val context = LocalContext.current
|
||||
ElevatedCard(modifier = modifier.fillMaxWidth()) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.outro_title),
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = modifier.padding(6.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.outro_thanks),
|
||||
fontSize = 16.sp,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.outro_license),
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = modifier.padding(6.dp)
|
||||
)
|
||||
Row(horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
CardButton(
|
||||
onClick = { gotoUrl(context, LICENSE_URL) },
|
||||
text = stringResource(id = R.string.btn_license),
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(6.dp))
|
||||
CardButton(
|
||||
onClick = { gotoUrl(context, POLICY_URL) },
|
||||
text = stringResource(id = R.string.btn_privacy),
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun setUpdateTime(updateTime: Long): String {
|
||||
val updateDate = if (updateTime != 0L) {
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z" />
|
||||
</vector>
|
||||
Reference in new issue
Block a user