aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wear/src/main/java/dev/equestria/pluralwear/presentation/MainActivity.kt8
-rw-r--r--wear/src/main/java/dev/equestria/pluralwear/presentation/activity/home/HomeActivity.kt168
-rw-r--r--wear/src/main/java/dev/equestria/pluralwear/presentation/activity/register_switch/SwitchActivity.kt8
3 files changed, 8 insertions, 176 deletions
diff --git a/wear/src/main/java/dev/equestria/pluralwear/presentation/MainActivity.kt b/wear/src/main/java/dev/equestria/pluralwear/presentation/MainActivity.kt
index 599d74c..b3b1df2 100644
--- a/wear/src/main/java/dev/equestria/pluralwear/presentation/MainActivity.kt
+++ b/wear/src/main/java/dev/equestria/pluralwear/presentation/MainActivity.kt
@@ -59,7 +59,6 @@ import dev.equestria.pluralwear.pluralkt.types.PkMember
import dev.equestria.pluralwear.pluralkt.types.PkSystem
import dev.equestria.pluralwear.pluralkt.types.PkSystemSettings
import dev.equestria.pluralwear.presentation.activity.front.FrontPage
-import dev.equestria.pluralwear.presentation.activity.home.HomePage
import dev.equestria.pluralwear.presentation.activity.register_switch.SwitchPage
import dev.equestria.pluralwear.presentation.theme.PluralwearTheme
import dev.equestria.pluralwear.tile.MainTileService
@@ -190,9 +189,10 @@ class MainActivity : ComponentActivity() {
@Composable
fun WearApp() {
- val navController = rememberSwipeDismissableNavController()
+ //val navController = rememberSwipeDismissableNavController()
- PluralwearTheme {
+ SwitchPage(system)
+ /*PluralwearTheme {
SwipeDismissableNavHost(
navController = navController,
startDestination = "home"
@@ -208,7 +208,7 @@ fun WearApp() {
FrontPage(system, navController)
}
}
- }
+ }*/
}
@Composable
diff --git a/wear/src/main/java/dev/equestria/pluralwear/presentation/activity/home/HomeActivity.kt b/wear/src/main/java/dev/equestria/pluralwear/presentation/activity/home/HomeActivity.kt
deleted file mode 100644
index 259900a..0000000
--- a/wear/src/main/java/dev/equestria/pluralwear/presentation/activity/home/HomeActivity.kt
+++ /dev/null
@@ -1,168 +0,0 @@
-package dev.equestria.pluralwear.presentation.activity.home
-
-import dev.equestria.pluralwear.pluralkt.fulltypes.PkFullSystem
-import android.os.Bundle
-import androidx.activity.ComponentActivity
-import androidx.activity.compose.setContent
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.size
-import androidx.compose.foundation.layout.wrapContentSize
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.res.painterResource
-import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.style.TextAlign
-import androidx.compose.ui.tooling.preview.Devices
-import androidx.compose.ui.tooling.preview.Preview
-import androidx.compose.ui.unit.ExperimentalUnitApi
-import androidx.compose.ui.unit.TextUnit
-import androidx.compose.ui.unit.TextUnitType
-import androidx.navigation.NavHostController
-import androidx.wear.compose.material.Chip
-import androidx.wear.compose.material.ChipDefaults
-import androidx.wear.compose.material.Icon
-import androidx.wear.compose.material.MaterialTheme
-import androidx.wear.compose.material.Text
-import androidx.wear.compose.material.TimeText
-import dev.equestria.pluralwear.R
-import dev.equestria.pluralwear.components.ScalingLazyColumnWithRSB
-import java.util.Calendar
-
-class HomeActivity : ComponentActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContent {
- HomePage(null, null)
- }
- }
-}
-
-@Composable
-fun HomePage(system: PkFullSystem?, navigator: NavHostController?) {
- TimeText()
-
- ScalingLazyColumnWithRSB(
- modifier = Modifier.fillMaxWidth(),
- snap = true
- ) {
- item {
- if (system != null) {
- Greeting(
- //if (system.name != null) system.name!! else "No Name"
- if (system.front != null) {
- if (system.front!!.members.isEmpty()) {
- if (system.name != null) system.name!! else "No Name"
- } else if (system.front!!.members.size <= 2) {
- var name = system.front!!.members
- name.joinToString(", ") {
- if(it.displayName != null) it.displayName!! else it.name
- }
- } else {
- if (system.name != null) system.name!! else "No Name"
- }
- } else {
- if (system.name != null) system.name!! else "No Name"
- }
- )
- } else {
- Greeting(null)
- }
- }
-
- item {
- NavItem(
- label = "Front Info",
- drawableId = R.drawable.baseline_account_box_24,
- drawableDescriptor = "White box with person inside"
- ) {
- navigator?.navigate("front")
- }
- }
-
- item {
- Chip(
- modifier = Modifier.fillMaxWidth(),
- onClick = { navigator?.navigate("switch") },
- label = { Text("Register switch") },
- colors = ChipDefaults.secondaryChipColors(),
- icon = {
- Icon(
- painter = painterResource(id = R.drawable.baseline_switch_account_24),
- contentDescription = "Switch",
- modifier = Modifier
- .size(ChipDefaults.IconSize)
- .wrapContentSize(align = Alignment.Center),
- tint = Color.Unspecified
- )
- }
- )
- }
- }
-}
-
-@Composable
-fun NavItem(
- label: String,
- drawableId: Int,
- drawableDescriptor: String,
- onClick: () -> Unit
-) {
- Chip(
- modifier = Modifier.fillMaxWidth(),
- onClick = {
- onClick.invoke()
- },
- label = { Text(label) },
- colors = ChipDefaults.secondaryChipColors(),
- icon = {
- Icon(
- painter = painterResource(id = drawableId),
- contentDescription = drawableDescriptor,
- modifier = Modifier
- .size(ChipDefaults.IconSize)
- .wrapContentSize(align = Alignment.Center),
- tint = Color.Unspecified
- )
- }
- )
-}
-
-@OptIn(ExperimentalUnitApi::class)
-@Composable
-fun Greeting(greetingName: String?) {
- val greeting = when (Calendar.getInstance().get(Calendar.HOUR_OF_DAY)) {
- 6, 7, 8, 9, 10, 11 -> stringResource(R.string.greeting_morning)
- 12, 13, 14, 15, 16 -> stringResource(R.string.greeting_afternoon)
- else -> stringResource(R.string.greeting_evening)
- }
-
- Column(
- modifier = Modifier.fillMaxWidth()
- ) {
- Text(
- modifier = Modifier.fillMaxWidth(),
- textAlign = TextAlign.Center,
- color = MaterialTheme.colors.onSurface,
- text = stringResource(R.string.greeting, greeting)
- )
- if (greetingName != null) {
- Text(
- modifier = Modifier
- .fillMaxWidth(),
- textAlign = TextAlign.Center,
- color = MaterialTheme.colors.onSurfaceVariant,
- text = greetingName,
- fontSize = TextUnit(1.9F, TextUnitType.Em)
- )
- }
- }
-}
-
-@Preview(device = Devices.WEAR_OS_SMALL_ROUND, showSystemUi = true)
-@Composable
-fun DefaultPreview() {
- HomePage(null, null)
-} \ No newline at end of file
diff --git a/wear/src/main/java/dev/equestria/pluralwear/presentation/activity/register_switch/SwitchActivity.kt b/wear/src/main/java/dev/equestria/pluralwear/presentation/activity/register_switch/SwitchActivity.kt
index 06d2447..459a536 100644
--- a/wear/src/main/java/dev/equestria/pluralwear/presentation/activity/register_switch/SwitchActivity.kt
+++ b/wear/src/main/java/dev/equestria/pluralwear/presentation/activity/register_switch/SwitchActivity.kt
@@ -36,13 +36,13 @@ class HomeActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
- SwitchPage(null, null)
+ SwitchPage(null)
}
}
}
@Composable
-fun SwitchPage(system: PkFullSystem?, navController: NavHostController?) {
+fun SwitchPage(system: PkFullSystem?) {
var loadingDialog = LoadingDialog(
stringResource(id = R.string.register_switch),
remember { mutableStateOf(false) }
@@ -63,7 +63,7 @@ fun SwitchPage(system: PkFullSystem?, navController: NavHostController?) {
"home",
remember { mutableStateOf(false) }
) {
- navController?.popBackStack("switch", inclusive = true)
+ // Just hide yourself?
}
val coroutineScope = rememberCoroutineScope()
@@ -115,5 +115,5 @@ fun SwitchPage(system: PkFullSystem?, navController: NavHostController?) {
@Preview(device = Devices.WEAR_OS_SMALL_ROUND, showSystemUi = true)
@Composable
fun DefaultPreview() {
- SwitchPage(null, null)
+ SwitchPage(null)
} \ No newline at end of file