Skip to content

Commit 1bdceff

Browse files
committed
improved axelero prediction and added readme file
1 parent c38f014 commit 1bdceff

File tree

6 files changed

+40
-8
lines changed

6 files changed

+40
-8
lines changed

Assignment3/Axelero/app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ dependencies {
7575
androidTestImplementation(libs.androidx.junit)
7676
androidTestImplementation(libs.androidx.espresso.core)
7777
androidTestImplementation(platform(libs.androidx.compose.bom))
78+
implementation(libs.androidx.core.splashscreen)
7879
androidTestImplementation(libs.androidx.ui.test.junit4)
7980
debugImplementation(libs.androidx.ui.tooling)
8081
debugImplementation(libs.androidx.ui.test.manifest)

Assignment3/Axelero/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
android:label="@string/app_name"
1313
android:roundIcon="@mipmap/ic_launcher_round"
1414
android:supportsRtl="true"
15-
android:theme="@style/Theme.Axelero"
15+
android:theme="@style/Theme.MySplashScreen"
1616
tools:targetApi="31">
1717
<activity
1818
android:name=".HistoryActivity"
@@ -23,7 +23,7 @@
2323
android:name=".MainActivity"
2424
android:exported="true"
2525
android:label="@string/app_name"
26-
android:theme="@style/Theme.Axelero">
26+
android:theme="@style/Theme.MySplashScreen">
2727
<intent-filter>
2828
<action android:name="android.intent.action.MAIN" />
2929

Assignment3/Axelero/app/src/main/java/com/example/axelero/ui/components/SensorDelayDropdownMenu.kt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ package com.example.axelero.ui.components
22

33
import android.hardware.SensorManager
44
import androidx.compose.foundation.clickable
5+
import androidx.compose.foundation.layout.Arrangement
56
import androidx.compose.foundation.layout.Box
7+
import androidx.compose.foundation.layout.Row
68
import androidx.compose.foundation.layout.fillMaxWidth
79
import androidx.compose.foundation.layout.padding
810
import androidx.compose.material3.DropdownMenu
911
import androidx.compose.material3.DropdownMenuItem
12+
import androidx.compose.material3.ExperimentalMaterial3Api
13+
import androidx.compose.material3.ExposedDropdownMenuDefaults
1014
import androidx.compose.material3.Text
1115
import androidx.compose.runtime.Composable
1216
import androidx.compose.runtime.getValue
@@ -21,6 +25,7 @@ import androidx.compose.ui.text.style.TextAlign
2125
import androidx.compose.ui.unit.dp
2226
import com.example.axelero.repository.OrientationDataRepository
2327

28+
@OptIn(ExperimentalMaterial3Api::class)
2429
@Composable
2530
fun SensorDelayDropdownMenu(
2631
orientationDataRepository: OrientationDataRepository,
@@ -38,14 +43,23 @@ fun SensorDelayDropdownMenu(
3843
Box(modifier = Modifier.fillMaxWidth(),
3944
contentAlignment = Alignment.Center
4045
) {
41-
Text(
42-
text = items[selectedInterval].toString(),
46+
Row(
4347
modifier = Modifier
4448
.fillMaxWidth()
4549
.clickable(onClick = { expanded = true })
4650
.padding(horizontal = 16.dp),
47-
textAlign = TextAlign.Center
48-
)
51+
horizontalArrangement = Arrangement.SpaceBetween,
52+
verticalAlignment = Alignment.CenterVertically
53+
) {
54+
Text(
55+
text = items[selectedInterval].toString(),
56+
textAlign = TextAlign.Center,
57+
modifier = Modifier.weight(1f)
58+
)
59+
ExposedDropdownMenuDefaults.TrailingIcon(
60+
expanded = expanded
61+
)
62+
}
4963
DropdownMenu(
5064
expanded = expanded,
5165
onDismissRequest = { expanded = false },
@@ -55,7 +69,7 @@ fun SensorDelayDropdownMenu(
5569
DropdownMenuItem(
5670
{
5771
Text(text = label,
58-
modifier = Modifier.fillMaxWidth(), // Make sure text is able to fill the menu width
72+
modifier = Modifier.fillMaxWidth(),
5973
textAlign = TextAlign.Center // Center text
6074
)
6175
},
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<style name="Theme.MySplashScreen" parent="Theme.Axelero">
5+
<item name="android:windowSplashScreenBackground">@color/gray</item>
6+
<item name="windowSplashScreenAnimatedIcon">@drawable/axeleroicon_small</item>
7+
<item name="windowSplashScreenAnimationDuration">1000</item>
8+
<item name="postSplashScreenTheme">@style/Theme.Axelero</item>
9+
</style>
10+
</resources>
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
3+
<style name="Theme.MySplashScreen" parent="Theme.Axelero">
4+
<item name="windowSplashScreenBackground">@color/gray</item>
5+
<item name="windowSplashScreenAnimatedIcon">@drawable/axeleroicon_small</item>
6+
<item name="windowSplashScreenAnimationDuration">1000</item>
7+
<item name="postSplashScreenTheme">@style/Theme.Axelero</item>
8+
</style>
49
<style name="Theme.Axelero" parent="android:Theme.Material.Light.NoActionBar" />
510
</resources>

Assignment3/Axelero/gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[versions]
22
agp = "8.3.1"
3+
coreSplashscreen = "1.0.1"
34
kotlin = "1.9.0"
45
coreKtx = "1.12.0"
56
junit = "4.13.2"
@@ -18,6 +19,7 @@ navigationRuntimeKtx = "2.7.7"
1819

1920
[libraries]
2021
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
22+
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" }
2123
junit = { group = "junit", name = "junit", version.ref = "junit" }
2224
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
2325
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }

0 commit comments

Comments
 (0)