diff --git a/light_client_app/android/app/build.gradle.kts b/light_client_app/android/app/build.gradle.kts index a582b4f3..17685556 100644 --- a/light_client_app/android/app/build.gradle.kts +++ b/light_client_app/android/app/build.gradle.kts @@ -35,6 +35,7 @@ android { } buildFeatures { compose = true + buildConfig = true } composeOptions { kotlinCompilerExtensionVersion = "1.4.3" @@ -48,19 +49,21 @@ android { dependencies { - implementation("androidx.core:core-ktx:1.9.0") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1") - implementation("androidx.activity:activity-compose:1.7.0") - implementation(platform("androidx.compose:compose-bom:2023.03.00")) + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4") + implementation("androidx.activity:activity-compose:1.9.1") + implementation(platform("androidx.compose:compose-bom:2024.06.00")) implementation("androidx.compose.ui:ui") implementation("androidx.compose.ui:ui-graphics") implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.compose.material3:material3") testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") - androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00")) + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") + androidTestImplementation(platform("androidx.compose:compose-bom:2024.06.00")) androidTestImplementation("androidx.compose.ui:ui-test-junit4") debugImplementation("androidx.compose.ui:ui-tooling") debugImplementation("androidx.compose.ui:ui-test-manifest") + + } \ No newline at end of file diff --git a/light_client_app/android/app/src/main/java/com/example/beerus_android/MainActivity.kt b/light_client_app/android/app/src/main/java/com/example/beerus_android/MainActivity.kt index 54b798c8..79752635 100644 --- a/light_client_app/android/app/src/main/java/com/example/beerus_android/MainActivity.kt +++ b/light_client_app/android/app/src/main/java/com/example/beerus_android/MainActivity.kt @@ -3,23 +3,53 @@ package com.example.beerus_android import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Check +import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface +import androidx.compose.material3.Switch +import androidx.compose.material3.SwitchDefaults +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.width import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.core.graphics.toColorInt +import androidx.core.view.WindowCompat import com.example.beerus_android.ui.theme.BeerusandroidTheme +import org.intellij.lang.annotations.JdkConstants.HorizontalAlignment class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + enableEdgeToEdge() + WindowCompat.setDecorFitsSystemWindows(window, true) setContent { BeerusandroidTheme { // A surface container using the 'background' color from the theme Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { - Greeting("Android") + Toggle(modifier=Modifier.padding(20.dp)) } } } @@ -27,17 +57,62 @@ class MainActivity : ComponentActivity() { } @Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier - ) -} +fun Toggle(modifier: Modifier = Modifier) { + var runState by rememberSaveable { + mutableStateOf("Not Running") + } + var checked by rememberSaveable { mutableStateOf(true)} + + Column(modifier = Modifier + .fillMaxSize() + .background(Color("#0C0C4F".toColorInt())) + .padding(16.dp), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center) { + Spacer(modifier=Modifier.height(40.dp)) + + Switch( + checked = checked, + onCheckedChange = { + checked = it + }, + thumbContent = if (checked) { + { + Icon( + imageVector = Icons.Filled.Check, + contentDescription = null, + modifier = Modifier.size(SwitchDefaults.IconSize), + ) + } + } else { + null + } + ) + Spacer(modifier=Modifier.height(40.dp)) + + if(checked){ + runState="Running" + + }else{ + runState="Not Running" + } + + Text( + text = runState, + fontFamily = FontFamily(Font(R.font.publicsans_regular)), + color = Color.White, + fontSize = 14.sp + ) -@Preview(showBackground = true) -@Composable -fun GreetingPreview() { - BeerusandroidTheme { - Greeting("Android") } -} \ No newline at end of file + + +} + +//@Preview(showBackground = true) +//@Composable +//fun GreetingPreview() { +// BeerusandroidTheme { +// Greeting("Android") +// } +//} \ No newline at end of file diff --git a/light_client_app/android/app/src/main/res/font/inter_regular.ttf b/light_client_app/android/app/src/main/res/font/inter_regular.ttf new file mode 100644 index 00000000..5e4851f0 Binary files /dev/null and b/light_client_app/android/app/src/main/res/font/inter_regular.ttf differ diff --git a/light_client_app/android/app/src/main/res/font/nohemi_medium.ttf b/light_client_app/android/app/src/main/res/font/nohemi_medium.ttf new file mode 100644 index 00000000..7511146e Binary files /dev/null and b/light_client_app/android/app/src/main/res/font/nohemi_medium.ttf differ diff --git a/light_client_app/android/app/src/main/res/font/publicsans_bold.ttf b/light_client_app/android/app/src/main/res/font/publicsans_bold.ttf new file mode 100644 index 00000000..2298f2f2 Binary files /dev/null and b/light_client_app/android/app/src/main/res/font/publicsans_bold.ttf differ diff --git a/light_client_app/android/app/src/main/res/font/publicsans_regular.ttf b/light_client_app/android/app/src/main/res/font/publicsans_regular.ttf new file mode 100644 index 00000000..8afd7e0a Binary files /dev/null and b/light_client_app/android/app/src/main/res/font/publicsans_regular.ttf differ diff --git a/light_client_app/android/app/src/main/res/font/publicsans_semibold.ttf b/light_client_app/android/app/src/main/res/font/publicsans_semibold.ttf new file mode 100644 index 00000000..45ec9847 Binary files /dev/null and b/light_client_app/android/app/src/main/res/font/publicsans_semibold.ttf differ