Finished Settings
This commit is contained in:
parent
0d1e392281
commit
e0581c3fa7
|
@ -1,5 +1,6 @@
|
||||||
package com.module.breeze
|
package com.module.breeze
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.CalendarContract
|
import android.provider.CalendarContract
|
||||||
|
@ -79,6 +80,13 @@ class MainActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun openSettings(ctx: Context) {
|
||||||
|
var intent = Intent(ctx, SettingsActivity::class.java)
|
||||||
|
ctx.startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -90,10 +98,11 @@ fun WeatherInfo(modifier: Modifier = Modifier) {
|
||||||
var displaySnow = false;
|
var displaySnow = false;
|
||||||
var displayWind = false;
|
var displayWind = false;
|
||||||
|
|
||||||
Navigation(iconStyle.Settings, "Settings Icon", onClick = {
|
Navigation(
|
||||||
var intent = Intent(ctx, SettingsActivity::class.java)
|
iconStyle.Settings,
|
||||||
ctx.startActivity(intent)
|
"Settings Icon",
|
||||||
})
|
onClick = { MainActivity.openSettings(ctx) }
|
||||||
|
)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
@ -162,8 +171,9 @@ fun GreetingPreview() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
public fun Navigation(icon: ImageVector, iconDescription: String, onClick: () -> Unit = {}) {
|
fun Navigation(icon: ImageVector, iconDescription: String, onClick: () -> Unit = {}) {
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.End,
|
horizontalArrangement = Arrangement.End,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.module.breeze
|
package com.module.breeze
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
|
@ -10,18 +12,25 @@ import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material.icons.outlined.Home
|
import androidx.compose.material.icons.outlined.Home
|
||||||
import androidx.compose.material.icons.outlined.Map
|
import androidx.compose.material.icons.outlined.Map
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextField
|
||||||
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
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
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 com.module.breeze.ui.theme.BreezeTheme
|
import com.module.breeze.ui.theme.BreezeTheme
|
||||||
|
import java.nio.file.WatchEvent
|
||||||
|
|
||||||
class SettingsActivity : ComponentActivity() {
|
class SettingsActivity : ComponentActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -37,11 +46,21 @@ class SettingsActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun openHome(ctx: Context) {
|
||||||
|
var intent = Intent(ctx, MainActivity::class.java)
|
||||||
|
ctx.startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Settings(modifier: Modifier = Modifier) {
|
fun Settings(modifier: Modifier = Modifier) {
|
||||||
Navigation(iconStyle.Home, "Home Icon")
|
val ctx = LocalContext.current
|
||||||
|
Navigation(iconStyle.Home, "Home Icon", onClick = {
|
||||||
|
SettingsActivity.openHome(ctx)
|
||||||
|
})
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
|
@ -49,7 +68,8 @@ fun Settings(modifier: Modifier = Modifier) {
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier.padding(16.dp)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Icon(
|
Icon(
|
||||||
|
@ -63,6 +83,13 @@ fun Settings(modifier: Modifier = Modifier) {
|
||||||
fontSize = 22.sp
|
fontSize = 22.sp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
ConfiguredLocationDay("Monday")
|
||||||
|
ConfiguredLocationDay("Tuesday")
|
||||||
|
ConfiguredLocationDay("Wednesday")
|
||||||
|
ConfiguredLocationDay("Thursday")
|
||||||
|
ConfiguredLocationDay("Friday")
|
||||||
|
ConfiguredLocationDay("Saturday")
|
||||||
|
ConfiguredLocationDay("Sunday")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,3 +101,23 @@ fun GreetingPreview2() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ConfiguredLocationDay(dayName: String = "day") {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier.padding(0.dp, 4.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = dayName,
|
||||||
|
fontWeight = breezeFontWeight,
|
||||||
|
modifier = Modifier.width(100.dp)
|
||||||
|
)
|
||||||
|
TextField(
|
||||||
|
value = "0000",
|
||||||
|
onValueChange = {},
|
||||||
|
label = { Text("PLZ") },
|
||||||
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||||
|
modifier = Modifier.width(110.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue