Skip to content

Commit abbc6ab

Browse files
committed
Implement JetPack Compose
This commit reimplements the UI with JetPack Compose.
1 parent ccefd8c commit abbc6ab

File tree

126 files changed

+5053
-1969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+5053
-1969
lines changed

.github/workflows/android.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: set up JDK 11
16+
- name: set up JDK 17
1717
uses: actions/setup-java@v3
1818
with:
19-
java-version: '11'
19+
java-version: '17'
2020
distribution: 'temurin'
2121
cache: gradle
2222
- name: Decode release google-services.json

app/build.gradle

+162-91
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,62 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-kapt'
4-
apply plugin: "androidx.navigation.safeargs.kotlin"
5-
apply plugin: 'com.google.firebase.crashlytics'
6-
apply plugin: 'com.google.gms.google-services'
7-
apply plugin: 'dagger.hilt.android.plugin'
8-
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
9-
apply plugin: 'com.google.firebase.firebase-perf'
10-
apply plugin: 'com.github.triplet.play'
1+
plugins {
2+
id "com.android.application"
3+
id "com.google.gms.google-services"
4+
id "com.google.firebase.crashlytics"
5+
id "kotlin-android"
6+
id 'androidx.navigation.safeargs.kotlin'
7+
id 'com.google.dagger.hilt.android'
8+
id 'com.github.triplet.play' version '3.8.4'
9+
id 'com.google.devtools.ksp'
10+
id 'jacoco'
11+
}
1112

1213
android {
13-
compileSdkVersion Config.compile_sdk
14-
buildToolsVersion Config.build_tools
14+
namespace "de.psdev.devdrawer"
15+
compileSdk = 34
1516

1617
defaultConfig {
18+
namespace
1719
applicationId "de.psdev.devdrawer"
18-
minSdkVersion Config.min_sdk
19-
targetSdkVersion Config.target_sdk
20+
minSdkVersion 26
21+
targetSdkVersion 34
2022
versionCode project.ext.appVersionCode
2123
versionName project.ext.appVersionName
2224

2325
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2426
multiDexEnabled true
25-
26-
resConfig "en"
27+
resourceConfigurations += ['en']
2728

2829
// Version info
2930
buildConfigField 'String', 'GIT_SHA', "\"${project.ext.gitHash}\""
3031

31-
javaCompileOptions.annotationProcessorOptions.arguments['room.schemaLocation'] = rootProject.file('schemas').toString()
32+
vectorDrawables {
33+
useSupportLibrary true
34+
}
3235
}
3336
buildFeatures {
3437
viewBinding true
38+
compose true
39+
buildConfig true
3540
}
3641
compileOptions {
37-
sourceCompatibility = JavaVersion.VERSION_1_8
38-
targetCompatibility = JavaVersion.VERSION_1_8
42+
targetCompatibility JavaVersion.VERSION_17
3943
}
4044
kotlinOptions {
41-
jvmTarget = "1.8"
42-
freeCompilerArgs += [
43-
"-Xinline-classes",
44-
"-Xopt-in=kotlin.RequiresOptIn",
45-
"-Xopt-in=kotlin.ExperimentalStdlibApi",
46-
"-Xopt-in=kotlin.time.ExperimentalTime",
47-
"-Xopt-in=kotlinx.coroutines.FlowPreview",
48-
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
49-
]
45+
jvmTarget = '17'
5046
}
5147
testOptions {
48+
managedDevices {
49+
devices {
50+
pixel4api31(com.android.build.api.dsl.ManagedVirtualDevice) {
51+
device = "Pixel 4"
52+
apiLevel = 31
53+
systemImageSource = "google"
54+
require64Bit = true
55+
}
56+
}
57+
}
5258
unitTests {
5359
includeAndroidResources = true
54-
all { ignoreFailures = true }
5560
}
5661
}
5762
final def keystorePropertiesFile = rootProject.file("release.properties")
@@ -92,112 +97,178 @@ android {
9297
}
9398
}
9499
}
95-
lintOptions {
96-
lintConfig project.file('lint.xml')
97-
disable "GoogleAppIndexingWarning"
98-
disable "RemoveWorkManagerInitializer"
100+
packagingOptions {
101+
resources {
102+
excludes += ['**/LICENSE', '**/LICENSE.txt', '**/NOTICE', '**/NOTICE.txt', '**/*.gwt.xml']
103+
}
104+
}
105+
composeOptions {
106+
kotlinCompilerExtensionVersion = "1.5.3"
107+
}
108+
lint {
109+
disable 'GoogleAppIndexingWarning', 'RemoveWorkManagerInitializer'
99110
enable 'Interoperability'
111+
lintConfig file('lint.xml')
100112
}
101-
packagingOptions {
102-
exclude '**/LICENSE'
103-
exclude '**/LICENSE.txt'
104-
exclude '**/NOTICE'
105-
exclude '**/NOTICE.txt'
106-
exclude '**/*.gwt.xml'
113+
applicationVariants.configureEach { variant ->
114+
kotlin.sourceSets {
115+
named(variant.name) {
116+
kotlin.srcDir("build/generated/ksp/${variant.name}/kotlin")
117+
}
118+
}
107119
}
108120
}
109121

122+
java {
123+
toolchain {
124+
languageVersion = JavaLanguageVersion.of(17)
125+
}
126+
}
127+
128+
ksp {
129+
arg("room.schemaLocation", rootProject.file('schemas').toString())
130+
}
131+
132+
110133
dependencies {
111134
//
112135
// Platforms
113136
//
114-
implementation platform(Platforms.firebase)
115-
implementation platform(Platforms.kotlin)
137+
implementation platform("com.google.firebase:firebase-bom:32.4.0")
116138

117139
//
118140
// Test dependencies
119141
//
120-
testImplementation Libs.junit
121-
testImplementation Libs.robolectric
122-
testImplementation Libs.mockk
142+
testImplementation libs.junit
143+
testImplementation libs.robolectric
144+
def mockkVersion = "1.13.8"
145+
testImplementation "io.mockk:mockk-android:${mockkVersion}"
146+
testImplementation "io.mockk:mockk-agent:${mockkVersion}"
123147

124148
//
125149
// Runtime dependencies
126150
//
127151

128152
// AboutLibraries
129-
implementation Libs.about_libraries
153+
def latestAboutLibsRelease = "10.9.1"
154+
implementation "com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}"
155+
implementation "com.mikepenz:aboutlibraries-compose:${latestAboutLibsRelease}"
156+
implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"
157+
130158

131159
// AndroidX
132-
implementation Libs.androidx_appcompat
133-
implementation Libs.androidx_browser
134-
implementation Libs.androidx_constraint_layout
135-
implementation Libs.androidx_core
136-
implementation Libs.androidx_fragment
137-
implementation Libs.androidx_hilt_work
138-
implementation Libs.androidx_lifecycle_viewmodel
139-
implementation Libs.androidx_lifecycle_java8
140-
implementation Libs.androidx_lifecycle_process
141-
implementation Libs.androidx_navigation_fragment
142-
implementation Libs.androidx_navigation_ui
143-
implementation Libs.androidx_preference
144-
implementation Libs.androidx_recyclerview
145-
implementation Libs.androidx_recyclerview_selection
146-
implementation Libs.androidx_room_runtime
147-
implementation Libs.androidx_room_ktx
148-
implementation Libs.androidx_work_runtime
149-
implementation Libs.androidx_work_gcm
150-
kapt Libs.androidx_room_compiler
151-
kapt Libs.androidx_hilt_compiler
152-
153-
// Android Material
154-
implementation Libs.material_components
160+
def appcompat_version = "1.6.1"
161+
implementation "androidx.appcompat:appcompat:$appcompat_version"
162+
implementation "androidx.browser:browser:1.6.0"
163+
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
164+
def core_version = "1.12.0"
165+
implementation "androidx.core:core-ktx:$core_version"
166+
167+
implementation "androidx.core:core-splashscreen:1.0.1"
168+
def fragment_version = "1.6.1"
169+
implementation "androidx.fragment:fragment-ktx:$fragment_version"
170+
// Testing Fragments in Isolation
171+
debugImplementation "androidx.fragment:fragment-testing:$fragment_version"
172+
173+
def dagger = "2.51.1"
174+
implementation libs.hilt.android
175+
ksp "com.google.dagger:hilt-compiler:$dagger"
176+
implementation libs.androidx.hilt.work
177+
implementation libs.androidx.hilt.navigation.fragment
178+
implementation libs.androidx.hilt.navigation.compose
179+
def hilt = "1.2.0"
180+
ksp "androidx.hilt:hilt-compiler:$hilt"
181+
182+
implementation libs.androidx.lifecycle.viewmodel.ktx
183+
implementation libs.androidx.lifecycle.livedata.ktx
184+
implementation(libs.androidx.lifecycle.runtime.compose)
185+
implementation libs.androidx.lifecycle.common.java8
186+
// optional - Test helpers for Lifecycle runtime
187+
testImplementation libs.androidx.lifecycle.runtime.testing
188+
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
189+
implementation libs.androidx.lifecycle.process
190+
implementation libs.androidx.navigation.fragment.ktx
191+
implementation libs.androidx.navigation.ui.ktx
192+
// Jetpack Compose Integration
193+
implementation libs.navigation.compose
194+
implementation libs.androidx.preference.ktx
195+
implementation libs.androidx.recyclerview
196+
// For control over item selection of both touch and mouse driven selection
197+
implementation libs.androidx.recyclerview.selection
198+
implementation libs.androidx.room.runtime
199+
ksp libs.androidx.room.compiler
200+
implementation libs.androidx.room.ktx
201+
202+
implementation libs.androidx.work.runtime.ktx
203+
androidTestImplementation libs.androidx.work.testing
204+
205+
def composeBom = platform(libs.androidx.compose.bom)
206+
implementation(composeBom)
207+
androidTestImplementation(composeBom)
208+
implementation libs.androidx.material3
209+
// Android Studio Preview support
210+
implementation libs.androidx.ui.tooling.preview
211+
debugImplementation libs.androidx.ui.tooling
212+
// UI Tests
213+
androidTestImplementation libs.androidx.ui.test.junit4
214+
debugImplementation libs.androidx.ui.test.manifest
215+
// Optional - Add full set of material icons
216+
implementation libs.androidx.material.icons.extended
217+
// Optional - Add window size utils
218+
implementation 'androidx.compose.material3:material3-window-size-class'
219+
// Optional - Integration with activities
220+
implementation libs.androidx.activity.compose
221+
// Optional - Integration with ViewModels
222+
implementation libs.androidx.lifecycle.viewmodel.compose
155223

156224
// Color Picker
157-
implementation "com.github.dhaval2404:colorpicker:2.0"
225+
implementation libs.colorpicker
158226

159-
// Dagger
160-
implementation Libs.daggerHiltAndroid
161-
kapt Libs.daggerHiltAndroidCompiler
227+
// Compose Destinations
228+
implementation libs.compose.destinations.core
229+
ksp libs.compose.destinations.ksp
162230

163231
// Firebase
164-
implementation "com.google.firebase:firebase-analytics-ktx"
165-
implementation "com.google.firebase:firebase-config-ktx"
166-
implementation "com.google.firebase:firebase-crashlytics-ktx"
167-
implementation "com.google.firebase:firebase-perf-ktx"
232+
implementation libs.firebase.analytics
233+
implementation libs.firebase.config
234+
implementation libs.firebase.crashlytics
235+
implementation libs.firebase.perf
168236

169237
// FlowBinding
170-
implementation Libs.flowBindingAndroid
171-
implementation Libs.flowBindingCommon
172-
implementation Libs.flowBindingMaterial
238+
implementation libs.flowbinding.android
239+
implementation libs.flowbinding.material
173240

174241
// Google Play
175-
implementation Libs.googlePlayCore
176-
implementation Libs.googlePlayCoreKtx
242+
def playReview = "2.0.1"
243+
implementation libs.review
244+
implementation libs.review.ktx
245+
def playUpdate = "2.1.0"
246+
implementation libs.app.update
247+
implementation libs.app.update.ktx
177248

178249
// Kotlin
179-
implementation Libs.kotlinStdlib
250+
implementation "org.jetbrains.kotlin:kotlin-stdlib"
180251

181252
// Kotlin Coroutines
182-
implementation Libs.kotlinCoroutinesAndroid
253+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
183254

184255
// LeakCanary
185-
debugImplementation Libs.leakCanary
186-
implementation Libs.leakCanaryPlumberAndroid
256+
// debugImplementation Libs.leakCanary
257+
// implementation Libs.leakCanaryPlumberAndroid
187258

188259
// Logging
189-
implementation Libs.slf4jAndroidLogger
190-
implementation Libs.kotlinLogging
260+
implementation libs.slf4j.android.logger
261+
implementation libs.kotlin.logging
191262

192263
// OkHttp
193-
implementation Libs.okhttp
264+
implementation(libs.okhttp)
194265

195266
// Okio
196-
implementation Libs.okio
267+
implementation(libs.okio)
197268
}
198269

199-
kapt {
200-
correctErrorTypes true
270+
jacoco {
271+
toolVersion = "0.8.7"
201272
}
202273

203274
play {

app/src/debug/res/values/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<string name="app_name">DevDrawer2 (Debug)</string>
3+
<string name="app_name" translatable="false">DevDrawer2 (Debug)</string>
44
</resources>

0 commit comments

Comments
 (0)