Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_and_local_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
run: ./gradlew testDebug --stacktrace

- name: Upload build outputs (APKs)
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v7
with:
name: build-outputs
path: ./app/build/outputs

- name: Upload build reports
if: always()
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v7
with:
name: build-reports
path: ./app/build/reports
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/instrumented_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v7
with:
name: test-reports-${{ matrix.api-level }}
path: ./app/build/reports/androidTests
30 changes: 8 additions & 22 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
* limitations under the License.
*/

@Suppress("DSL_SCOPE_VIOLATION") // Remove when fixed https://youtrack.jetbrains.com/issue/KTIJ-19369
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.hilt.gradle)
alias(libs.plugins.ksp)
alias(libs.plugins.compose.compiler)
Expand All @@ -40,11 +37,6 @@ android {
vectorDrawables {
useSupportLibrary = true
}

// Enable room auto-migrations
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
}

buildTypes {
Expand All @@ -54,30 +46,24 @@ android {
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}

buildFeatures {
compose = true
aidl = false
buildConfig = false
renderScript = false
shaders = false
}

packagingOptions {
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}

dependencies {

val composeBom = platform(libs.androidx.compose.bom)
Expand All @@ -91,13 +77,13 @@ dependencies {

// Hilt Dependency Injection
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)
ksp(libs.hilt.compiler)
// Hilt and instrumented tests.
androidTestImplementation(libs.hilt.android.testing)
kaptAndroidTest(libs.hilt.android.compiler)
kspAndroidTest(libs.hilt.android.compiler)
// Hilt and Robolectric tests.
testImplementation(libs.hilt.android.testing)
kaptTest(libs.hilt.android.compiler)
kspTest(libs.hilt.android.compiler)

// Arch Components
implementation(libs.androidx.lifecycle.runtime.compose)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
<activity
android:name=".ui.MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.MyApplication">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/android/template/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,27 @@
package android.template.ui

import android.os.Bundle
import android.template.ui.theme.MyApplicationTheme
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import dagger.hilt.android.AndroidEntryPoint
import android.template.ui.theme.MyApplicationTheme

@AndroidEntryPoint
class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.auto(
lightScrim = android.graphics.Color.TRANSPARENT,
darkScrim = android.graphics.Color.TRANSPARENT
)
)
super.onCreate(savedInstanceState)
setContent {
MyApplicationTheme {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/android/template/ui/Navigation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package android.template.ui

import android.template.ui.mymodel.MyModelScreen
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
Expand All @@ -37,7 +38,7 @@ fun MainNavigation() {
entry<Main> {
MyModelScreen(
onItemClick = { navKey -> backStack.add(navKey) },
modifier = Modifier.padding(16.dp)
modifier = Modifier.safeDrawingPadding().padding(16.dp)
)
}
}
Expand Down
18 changes: 12 additions & 6 deletions app/src/main/java/android/template/ui/mymodel/MyModelScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ import androidx.navigation3.runtime.NavKey
fun MyModelScreen(
onItemClick: (NavKey) -> Unit,
modifier: Modifier = Modifier,
viewModel: MyModelViewModel = hiltViewModel()
viewModel: MyModelViewModel = hiltViewModel(),
) {
val items by viewModel.uiState.collectAsStateWithLifecycle()
if (items is MyModelUiState.Success) {
MyModelScreen(
items = (items as MyModelUiState.Success).data,
onSave = viewModel::addMyModel,
modifier = modifier
modifier = modifier,
)
}
}
Expand All @@ -58,20 +58,26 @@ fun MyModelScreen(
internal fun MyModelScreen(
items: List<String>,
onSave: (name: String) -> Unit,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
) {
Column(modifier) {
var nameMyModel by remember { mutableStateOf("Compose") }
Row(
modifier = Modifier.fillMaxWidth().padding(bottom = 24.dp),
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 24.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
TextField(
modifier = Modifier.weight(1f),
value = nameMyModel,
onValueChange = { nameMyModel = it }
)

Button(modifier = Modifier.width(96.dp), onClick = { onSave(nameMyModel) }) {
Button(
modifier = Modifier.width(96.dp),
onClick = { onSave(nameMyModel) }
) {
Text("Save")
}
}
Expand All @@ -91,7 +97,7 @@ private fun DefaultPreview() {
}
}

@Preview(showBackground = true, widthDp = 480)
@Preview(showBackground = true, widthDp = 340)
@Composable
private fun PortraitPreview() {
MyApplicationTheme {
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/android/template/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package android.template.ui.theme

import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
Expand All @@ -25,11 +24,7 @@ import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.ViewCompat

private val DarkColorScheme = darkColorScheme(
primary = Purple80,
Expand Down Expand Up @@ -68,13 +63,6 @@ fun MyApplicationTheme(
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
(view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb()
ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = darkTheme
}
}

MaterialTheme(
colorScheme = colorScheme,
Expand Down
26 changes: 0 additions & 26 deletions app/src/main/res/values/colors.xml

This file was deleted.

18 changes: 7 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[versions]
androidGradlePlugin = "8.13.1"
androidGradlePlugin = "9.0.1"
androidxCore = "1.17.0"
androidxLifecycle = "2.10.0"
androidxActivity = "1.12.0"
androidxComposeBom = "2025.11.01"
androidxActivity = "1.12.4"
androidxComposeBom = "2026.02.00"
androidxHilt = "1.3.0"
androidxRoom = "2.8.4"
androidxTest = "1.7.0"
androidxTestExt = "1.3.0"
androidxTestRunner = "1.7.0"
coroutines = "1.10.2"
hilt = "2.57.2"
hilt = "2.59.2"
junit = "4.13.2"
kotlin = "2.2.21"
ksp = "2.3.2"
nav3Core = "1.0.0"
kotlin = "2.3.10"
ksp = "2.3.6"
nav3Core = "1.0.1"
lifecycleViewmodelNav3 = "2.10.0"

[libraries]
Expand All @@ -41,7 +41,6 @@ hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt"
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
hilt-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
junit = { module = "junit:junit", version.ref = "junit" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
androidx-navigation3-runtime = { module = "androidx.navigation3:navigation3-runtime", version.ref = "nav3Core" }
Expand All @@ -50,10 +49,7 @@ androidx-lifecycle-viewmodel-navigation3 = { module = "androidx.lifecycle:lifecy

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"}
hilt-gradle = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
Expand Down