Skip to content

Commit 6021c42

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

File tree

126 files changed

+5107
-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

+5107
-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

+163-92
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+
alias(libs.plugins.org.jetbrains.kotlin.android)
4+
alias(libs.plugins.compose.compiler)
5+
id "com.google.gms.google-services"
6+
id "com.google.firebase.crashlytics"
7+
id 'androidx.navigation.safeargs.kotlin'
8+
id 'com.google.dagger.hilt.android'
9+
id 'com.github.triplet.play' version '3.10.1'
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+
pixel8api34(com.android.build.api.dsl.ManagedVirtualDevice) {
52+
device = "Pixel 8 Pro"
53+
apiLevel = 34
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,112 +98,177 @@ 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+
lint {
107+
disable 'GoogleAppIndexingWarning', 'RemoveWorkManagerInitializer'
99108
enable 'Interoperability'
109+
lintConfig file('lint.xml')
100110
}
101-
packagingOptions {
102-
exclude '**/LICENSE'
103-
exclude '**/LICENSE.txt'
104-
exclude '**/NOTICE'
105-
exclude '**/NOTICE.txt'
106-
exclude '**/*.gwt.xml'
111+
applicationVariants.configureEach { variant ->
112+
kotlin.sourceSets {
113+
named(variant.name) {
114+
kotlin.srcDir("build/generated/ksp/${variant.name}/kotlin")
115+
}
116+
}
117+
}
118+
}
119+
120+
composeCompiler {
121+
enableStrongSkippingMode = true
122+
}
123+
124+
java {
125+
toolchain {
126+
languageVersion = JavaLanguageVersion.of(17)
107127
}
108128
}
109129

130+
ksp {
131+
arg("room.schemaLocation", rootProject.file('schemas').toString())
132+
}
133+
110134
dependencies {
111135
//
112136
// Platforms
113137
//
114-
implementation platform(Platforms.firebase)
115-
implementation platform(Platforms.kotlin)
116-
138+
def firebaseBom = platform(libs.firebase.bom)
139+
implementation(firebaseBom)
140+
androidTestImplementation(firebaseBom)
117141
//
118142
// Test dependencies
119143
//
120-
testImplementation Libs.junit
121-
testImplementation Libs.robolectric
122-
testImplementation Libs.mockk
144+
testImplementation libs.junit
145+
testImplementation libs.robolectric
146+
def mockkVersion = "1.13.8"
147+
testImplementation libs.mockk.android
148+
testImplementation "io.mockk:mockk-agent:${mockkVersion}"
123149

124150
//
125151
// Runtime dependencies
126152
//
127153

128154
// AboutLibraries
129-
implementation Libs.about_libraries
155+
def latestAboutLibsRelease = "10.9.1"
156+
implementation "com.mikepenz:aboutlibraries-core:$latestAboutLibsRelease"
157+
implementation "com.mikepenz:aboutlibraries-compose:$latestAboutLibsRelease"
158+
implementation libs.aboutlibraries
159+
130160

131161
// 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
162+
implementation libs.androidx.appcompat
163+
implementation libs.androidx.browser
164+
implementation libs.androidx.constraintlayout
165+
implementation libs.androidx.core.ktx
166+
167+
implementation libs.androidx.core.splashscreen
168+
implementation libs.androidx.fragment.ktx
169+
// Testing Fragments in Isolation
170+
debugImplementation libs.androidx.fragment.testing
171+
172+
def dagger = "2.51.1"
173+
implementation libs.hilt.android
174+
ksp "com.google.dagger:hilt-compiler:$dagger"
175+
implementation libs.androidx.hilt.work
176+
implementation libs.androidx.hilt.navigation.fragment
177+
implementation libs.androidx.hilt.navigation.compose
178+
def hilt = "1.2.0"
179+
ksp "androidx.hilt:hilt-compiler:$hilt"
180+
181+
implementation libs.androidx.lifecycle.viewmodel.ktx
182+
implementation libs.androidx.lifecycle.livedata.ktx
183+
implementation(libs.androidx.lifecycle.runtime.compose)
184+
implementation libs.androidx.lifecycle.common.java8
185+
// optional - Test helpers for Lifecycle runtime
186+
testImplementation libs.androidx.lifecycle.runtime.testing
187+
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
188+
implementation libs.androidx.lifecycle.process
189+
implementation libs.androidx.navigation.fragment.ktx
190+
implementation libs.androidx.navigation.ui.ktx
191+
// Jetpack Compose Integration
192+
implementation libs.navigation.compose
193+
implementation libs.androidx.preference.ktx
194+
implementation libs.androidx.recyclerview
195+
// For control over item selection of both touch and mouse driven selection
196+
implementation libs.androidx.recyclerview.selection
197+
implementation libs.androidx.room.runtime
198+
ksp libs.androidx.room.compiler
199+
implementation libs.androidx.room.ktx
200+
201+
implementation libs.androidx.work.runtime.ktx
202+
androidTestImplementation libs.androidx.work.testing
203+
204+
// Compose
205+
def composeBom = platform(libs.androidx.compose.bom)
206+
implementation(composeBom)
207+
androidTestImplementation(composeBom)
208+
209+
// Material Design 3
210+
implementation libs.androidx.material3
211+
// Android Studio Preview support
212+
implementation libs.androidx.ui.tooling.preview
213+
debugImplementation libs.androidx.ui.tooling
214+
// UI Tests
215+
androidTestImplementation libs.androidx.ui.test.junit4
216+
debugImplementation libs.androidx.ui.test.manifest
217+
// Optional - Add full set of material icons
218+
implementation libs.androidx.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 libs.firebase.analytics
235+
implementation libs.firebase.config
236+
implementation libs.firebase.crashlytics
237+
implementation libs.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 libs.review
245+
implementation libs.review.ktx
246+
implementation libs.app.update
247+
implementation libs.app.update.ktx
177248

178249
// Kotlin
179-
implementation Libs.kotlinStdlib
250+
implementation libs.kotlin.stdlib
180251

181252
// Kotlin Coroutines
182-
implementation Libs.kotlinCoroutinesAndroid
253+
implementation libs.kotlinx.coroutines.android
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.12"
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)