Skip to content

Commit bc2241f

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

File tree

121 files changed

+5022
-1664
lines changed

Some content is hidden

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

121 files changed

+5022
-1664
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

+164-89
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,63 @@
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 "kotlin-kapt"
7+
id 'androidx.navigation.safeargs.kotlin'
8+
id 'com.google.dagger.hilt.android'
9+
id 'com.github.triplet.play' version '3.8.4'
10+
id 'com.google.devtools.ksp'
11+
id 'jacoco'
12+
}
1113

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

1618
defaultConfig {
19+
namespace
1720
applicationId "de.psdev.devdrawer"
18-
minSdkVersion Config.min_sdk
19-
targetSdkVersion Config.target_sdk
21+
minSdkVersion 26
22+
targetSdkVersion 34
2023
versionCode project.ext.appVersionCode
2124
versionName project.ext.appVersionName
2225

2326
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2427
multiDexEnabled true
25-
26-
resConfig "en"
28+
resourceConfigurations += ['en']
2729

2830
// Version info
2931
buildConfigField 'String', 'GIT_SHA', "\"${project.ext.gitHash}\""
3032

31-
javaCompileOptions.annotationProcessorOptions.arguments['room.schemaLocation'] = rootProject.file('schemas').toString()
33+
vectorDrawables {
34+
useSupportLibrary true
35+
}
3236
}
3337
buildFeatures {
3438
viewBinding true
39+
compose true
40+
buildConfig true
3541
}
3642
compileOptions {
37-
sourceCompatibility = JavaVersion.VERSION_1_8
38-
targetCompatibility = JavaVersion.VERSION_1_8
43+
targetCompatibility JavaVersion.VERSION_17
3944
}
4045
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-
]
46+
jvmTarget = '17'
5047
}
5148
testOptions {
49+
managedDevices {
50+
devices {
51+
pixel4api31(com.android.build.api.dsl.ManagedVirtualDevice) {
52+
device = "Pixel 4"
53+
apiLevel = 31
54+
systemImageSource = "google"
55+
require64Bit = true
56+
}
57+
}
58+
}
5259
unitTests {
5360
includeAndroidResources = true
54-
all { ignoreFailures = true }
5561
}
5662
}
5763
final def keystorePropertiesFile = rootProject.file("release.properties")
@@ -92,114 +98,183 @@ android {
9298
}
9399
}
94100
}
95-
lintOptions {
96-
lintConfig project.file('lint.xml')
97-
disable "GoogleAppIndexingWarning"
98-
disable "RemoveWorkManagerInitializer"
101+
packagingOptions {
102+
resources {
103+
excludes += ['**/LICENSE', '**/LICENSE.txt', '**/NOTICE', '**/NOTICE.txt', '**/*.gwt.xml']
104+
}
105+
}
106+
composeOptions {
107+
kotlinCompilerExtensionVersion = "1.5.3"
108+
}
109+
lint {
110+
disable 'GoogleAppIndexingWarning', 'RemoveWorkManagerInitializer'
99111
enable 'Interoperability'
112+
lintConfig file('lint.xml')
100113
}
101-
packagingOptions {
102-
exclude '**/LICENSE'
103-
exclude '**/LICENSE.txt'
104-
exclude '**/NOTICE'
105-
exclude '**/NOTICE.txt'
106-
exclude '**/*.gwt.xml'
114+
applicationVariants.configureEach { variant ->
115+
kotlin.sourceSets {
116+
named(variant.name) {
117+
kotlin.srcDir("build/generated/ksp/${variant.name}/kotlin")
118+
}
119+
}
120+
}
121+
}
122+
123+
java {
124+
toolchain {
125+
languageVersion = JavaLanguageVersion.of(17)
107126
}
108127
}
109128

129+
ksp {
130+
arg("room.schemaLocation", rootProject.file('schemas').toString())
131+
}
132+
133+
110134
dependencies {
111135
//
112136
// Platforms
113137
//
114-
implementation platform(Platforms.firebase)
115-
implementation platform(Platforms.kotlin)
138+
implementation platform("com.google.firebase:firebase-bom:32.4.0")
116139

117140
//
118141
// Test dependencies
119142
//
120-
testImplementation Libs.junit
121-
testImplementation Libs.robolectric
122-
testImplementation Libs.mockk
143+
testImplementation libs.junit
144+
testImplementation libs.robolectric
145+
def mockkVersion = "1.13.8"
146+
testImplementation "io.mockk:mockk-android:${mockkVersion}"
147+
testImplementation "io.mockk:mockk-agent:${mockkVersion}"
123148

124149
//
125150
// Runtime dependencies
126151
//
127152

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

131160
// 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
161+
def appcompat_version = "1.6.1"
162+
implementation "androidx.appcompat:appcompat:$appcompat_version"
163+
implementation "androidx.browser:browser:1.6.0"
164+
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
165+
def core_version = "1.12.0"
166+
implementation "androidx.core:core-ktx:$core_version"
167+
168+
implementation "androidx.core:core-splashscreen:1.0.1"
169+
def fragment_version = "1.6.1"
170+
implementation "androidx.fragment:fragment-ktx:$fragment_version"
171+
// Testing Fragments in Isolation
172+
debugImplementation "androidx.fragment:fragment-testing:$fragment_version"
173+
174+
implementation "com.google.dagger:hilt-android:2.48.1"
175+
kapt "com.google.dagger:hilt-compiler:2.48.1"
176+
implementation 'androidx.hilt:hilt-work:1.0.0'
177+
implementation 'androidx.hilt:hilt-navigation-fragment:1.0.0'
178+
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
179+
// When using Kotlin.
180+
kapt 'androidx.hilt:hilt-compiler:1.0.0'
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+
def nav_version = "2.7.4"
191+
implementation libs.androidx.navigation.fragment.ktx
192+
implementation libs.androidx.navigation.ui.ktx
193+
implementation "androidx.navigation:navigation-compose:$nav_version"
194+
// Jetpack Compose Integration
195+
implementation "androidx.navigation:navigation-compose:$nav_version"
196+
implementation libs.androidx.preference.ktx
197+
implementation libs.androidx.recyclerview
198+
// For control over item selection of both touch and mouse driven selection
199+
implementation libs.androidx.recyclerview.selection
200+
implementation libs.androidx.room.runtime
201+
ksp libs.androidx.room.compiler
202+
implementation libs.androidx.room.ktx
203+
204+
implementation libs.androidx.work.runtime.ktx
205+
androidTestImplementation libs.androidx.work.testing
206+
207+
def composeBom = platform(libs.androidx.compose.bom)
208+
implementation(composeBom)
209+
androidTestImplementation(composeBom)
210+
implementation 'androidx.compose.material3:material3'
211+
// Android Studio Preview support
212+
implementation 'androidx.compose.ui:ui-tooling-preview'
213+
debugImplementation 'androidx.compose.ui:ui-tooling'
214+
// UI Tests
215+
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
216+
debugImplementation 'androidx.compose.ui:ui-test-manifest'
217+
// Optional - Add full set of material icons
218+
implementation 'androidx.compose.material:material-icons-extended'
219+
// Optional - Add window size utils
220+
implementation 'androidx.compose.material3:material3-window-size-class'
221+
// Optional - Integration with activities
222+
implementation libs.androidx.activity.compose
223+
// Optional - Integration with ViewModels
224+
implementation libs.androidx.lifecycle.viewmodel.compose
155225

156226
// Color Picker
157-
implementation "com.github.dhaval2404:colorpicker:2.0"
227+
implementation libs.colorpicker
158228

159-
// Dagger
160-
implementation Libs.daggerHiltAndroid
161-
kapt Libs.daggerHiltAndroidCompiler
229+
// Compose Destinations
230+
implementation libs.compose.destinations.core
231+
ksp libs.compose.destinations.ksp
162232

163233
// 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"
234+
implementation "com.google.firebase:firebase-analytics"
235+
implementation "com.google.firebase:firebase-config"
236+
implementation "com.google.firebase:firebase-crashlytics"
237+
implementation "com.google.firebase:firebase-perf"
168238

169239
// FlowBinding
170-
implementation Libs.flowBindingAndroid
171-
implementation Libs.flowBindingCommon
172-
implementation Libs.flowBindingMaterial
240+
implementation libs.flowbinding.android
241+
implementation libs.flowbinding.material
173242

174243
// Google Play
175-
implementation Libs.googlePlayCore
176-
implementation Libs.googlePlayCoreKtx
244+
implementation 'com.google.android.play:review:2.0.1'
245+
implementation 'com.google.android.play:review-ktx:2.0.1'
246+
implementation 'com.google.android.play:app-update:2.0.1'
247+
implementation 'com.google.android.play:app-update-ktx:2.0.1'
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 "de.psdev.slf4j-android-logger:slf4j-android-logger:1.0.5"
261+
implementation "io.github.microutils:kotlin-logging:2.1.23"
191262

192263
// OkHttp
193-
implementation Libs.okhttp
264+
implementation("com.squareup.okhttp3:okhttp:4.11.0")
194265

195266
// Okio
196-
implementation Libs.okio
267+
implementation("com.squareup.okio:okio:3.6.0")
197268
}
198269

199270
kapt {
200271
correctErrorTypes true
201272
}
202273

274+
jacoco {
275+
toolVersion = "0.8.7"
276+
}
277+
203278
play {
204279
def serviceAccountFileName = "google-play-api.json"
205280
if (rootProject.file(serviceAccountFileName).exists()) {

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)