Skip to content

Commit d8b1202

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

File tree

126 files changed

+5070
-1970
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

+5070
-1970
lines changed

.github/workflows/android.yml

Lines changed: 2 additions & 2 deletions
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

Lines changed: 159 additions & 92 deletions
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,174 @@ 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)
116-
137+
def firebaseBom = platform(libs.firebase.bom)
138+
implementation(firebaseBom)
139+
androidTestImplementation(firebaseBom)
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 libs.mockk.android
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 libs.aboutlibraries
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+
implementation libs.androidx.appcompat
162+
implementation libs.androidx.browser
163+
implementation libs.androidx.constraintlayout
164+
implementation libs.androidx.core.ktx
165+
166+
implementation libs.androidx.core.splashscreen
167+
implementation libs.androidx.fragment.ktx
168+
// Testing Fragments in Isolation
169+
debugImplementation libs.androidx.fragment.testing
170+
171+
def dagger = "2.51.1"
172+
implementation libs.hilt.android
173+
ksp "com.google.dagger:hilt-compiler:$dagger"
174+
implementation libs.androidx.hilt.work
175+
implementation libs.androidx.hilt.navigation.fragment
176+
implementation libs.androidx.hilt.navigation.compose
177+
def hilt = "1.2.0"
178+
ksp "androidx.hilt:hilt-compiler:$hilt"
179+
180+
implementation libs.androidx.lifecycle.viewmodel.ktx
181+
implementation libs.androidx.lifecycle.livedata.ktx
182+
implementation(libs.androidx.lifecycle.runtime.compose)
183+
implementation libs.androidx.lifecycle.common.java8
184+
// optional - Test helpers for Lifecycle runtime
185+
testImplementation libs.androidx.lifecycle.runtime.testing
186+
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
187+
implementation libs.androidx.lifecycle.process
188+
implementation libs.androidx.navigation.fragment.ktx
189+
implementation libs.androidx.navigation.ui.ktx
190+
// Jetpack Compose Integration
191+
implementation libs.navigation.compose
192+
implementation libs.androidx.preference.ktx
193+
implementation libs.androidx.recyclerview
194+
// For control over item selection of both touch and mouse driven selection
195+
implementation libs.androidx.recyclerview.selection
196+
implementation libs.androidx.room.runtime
197+
ksp libs.androidx.room.compiler
198+
implementation libs.androidx.room.ktx
199+
200+
implementation libs.androidx.work.runtime.ktx
201+
androidTestImplementation libs.androidx.work.testing
202+
203+
def composeBom = platform(libs.androidx.compose.bom)
204+
implementation(composeBom)
205+
androidTestImplementation(composeBom)
206+
implementation libs.androidx.material3
207+
// Android Studio Preview support
208+
implementation libs.androidx.ui.tooling.preview
209+
debugImplementation libs.androidx.ui.tooling
210+
// UI Tests
211+
androidTestImplementation libs.androidx.ui.test.junit4
212+
debugImplementation libs.androidx.ui.test.manifest
213+
// Optional - Add full set of material icons
214+
implementation libs.androidx.material.icons.extended
215+
// Optional - Add window size utils
216+
implementation 'androidx.compose.material3:material3-window-size-class'
217+
// Optional - Integration with activities
218+
implementation libs.androidx.activity.compose
219+
// Optional - Integration with ViewModels
220+
implementation libs.androidx.lifecycle.viewmodel.compose
155221

156222
// Color Picker
157-
implementation "com.github.dhaval2404:colorpicker:2.0"
223+
implementation libs.colorpicker
158224

159-
// Dagger
160-
implementation Libs.daggerHiltAndroid
161-
kapt Libs.daggerHiltAndroidCompiler
225+
// Compose Destinations
226+
implementation libs.compose.destinations.core
227+
ksp libs.compose.destinations.ksp
162228

163229
// 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"
230+
implementation libs.firebase.analytics
231+
implementation libs.firebase.config
232+
implementation libs.firebase.crashlytics
233+
implementation libs.firebase.perf
168234

169235
// FlowBinding
170-
implementation Libs.flowBindingAndroid
171-
implementation Libs.flowBindingCommon
172-
implementation Libs.flowBindingMaterial
236+
implementation libs.flowbinding.android
237+
implementation libs.flowbinding.material
173238

174239
// Google Play
175-
implementation Libs.googlePlayCore
176-
implementation Libs.googlePlayCoreKtx
240+
implementation libs.review
241+
implementation libs.review.ktx
242+
implementation libs.app.update
243+
implementation libs.app.update.ktx
177244

178245
// Kotlin
179-
implementation Libs.kotlinStdlib
246+
implementation libs.kotlin.stdlib
180247

181248
// Kotlin Coroutines
182-
implementation Libs.kotlinCoroutinesAndroid
249+
implementation libs.kotlinx.coroutines.android
183250

184251
// LeakCanary
185-
debugImplementation Libs.leakCanary
186-
implementation Libs.leakCanaryPlumberAndroid
252+
// debugImplementation Libs.leakCanary
253+
// implementation Libs.leakCanaryPlumberAndroid
187254

188255
// Logging
189-
implementation Libs.slf4jAndroidLogger
190-
implementation Libs.kotlinLogging
256+
implementation libs.slf4j.android.logger
257+
implementation libs.kotlin.logging
191258

192259
// OkHttp
193-
implementation Libs.okhttp
260+
implementation(libs.okhttp)
194261

195262
// Okio
196-
implementation Libs.okio
263+
implementation(libs.okio)
197264
}
198265

199-
kapt {
200-
correctErrorTypes true
266+
jacoco {
267+
toolVersion = "0.8.12"
201268
}
202269

203270
play {

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

Lines changed: 1 addition & 1 deletion
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)