Skip to content

Commit

Permalink
Implement JetPack Compose
Browse files Browse the repository at this point in the history
This commit reimplements the UI with JetPack Compose.
  • Loading branch information
hameno committed May 30, 2024
1 parent ccefd8c commit 8264db2
Show file tree
Hide file tree
Showing 126 changed files with 5,002 additions and 1,967 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Decode release google-services.json
Expand Down
253 changes: 164 additions & 89 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,57 +1,63 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.github.triplet.play'
plugins {
id "com.android.application"
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
id "kotlin-android"
id "kotlin-kapt"
id 'androidx.navigation.safeargs.kotlin'
id 'com.google.dagger.hilt.android'
id 'com.github.triplet.play' version '3.8.4'
id 'com.google.devtools.ksp'
id 'jacoco'
}

android {
compileSdkVersion Config.compile_sdk
buildToolsVersion Config.build_tools
namespace "de.psdev.devdrawer"
compileSdk = 34

defaultConfig {
namespace
applicationId "de.psdev.devdrawer"
minSdkVersion Config.min_sdk
targetSdkVersion Config.target_sdk
minSdkVersion 26
targetSdkVersion 34
versionCode project.ext.appVersionCode
versionName project.ext.appVersionName

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true

resConfig "en"
resourceConfigurations += ['en']

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

javaCompileOptions.annotationProcessorOptions.arguments['room.schemaLocation'] = rootProject.file('schemas').toString()
vectorDrawables {
useSupportLibrary true
}
}
buildFeatures {
viewBinding true
compose true
buildConfig true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += [
"-Xinline-classes",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.time.ExperimentalTime",
"-Xopt-in=kotlinx.coroutines.FlowPreview",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
]
jvmTarget = '17'
}
testOptions {
managedDevices {
devices {
pixel4api31(com.android.build.api.dsl.ManagedVirtualDevice) {
device = "Pixel 4"
apiLevel = 31
systemImageSource = "google"
require64Bit = true
}
}
}
unitTests {
includeAndroidResources = true
all { ignoreFailures = true }
}
}
final def keystorePropertiesFile = rootProject.file("release.properties")
Expand Down Expand Up @@ -92,114 +98,183 @@ android {
}
}
}
lintOptions {
lintConfig project.file('lint.xml')
disable "GoogleAppIndexingWarning"
disable "RemoveWorkManagerInitializer"
packagingOptions {
resources {
excludes += ['**/LICENSE', '**/LICENSE.txt', '**/NOTICE', '**/NOTICE.txt', '**/*.gwt.xml']
}
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
}
lint {
disable 'GoogleAppIndexingWarning', 'RemoveWorkManagerInitializer'
enable 'Interoperability'
lintConfig file('lint.xml')
}
packagingOptions {
exclude '**/LICENSE'
exclude '**/LICENSE.txt'
exclude '**/NOTICE'
exclude '**/NOTICE.txt'
exclude '**/*.gwt.xml'
applicationVariants.configureEach { variant ->
kotlin.sourceSets {
named(variant.name) {
kotlin.srcDir("build/generated/ksp/${variant.name}/kotlin")
}
}
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

ksp {
arg("room.schemaLocation", rootProject.file('schemas').toString())
}


dependencies {
//
// Platforms
//
implementation platform(Platforms.firebase)
implementation platform(Platforms.kotlin)
implementation platform("com.google.firebase:firebase-bom:32.4.0")

//
// Test dependencies
//
testImplementation Libs.junit
testImplementation Libs.robolectric
testImplementation Libs.mockk
testImplementation libs.junit
testImplementation libs.robolectric
def mockkVersion = "1.13.8"
testImplementation "io.mockk:mockk-android:${mockkVersion}"
testImplementation "io.mockk:mockk-agent:${mockkVersion}"

//
// Runtime dependencies
//

// AboutLibraries
implementation Libs.about_libraries
def latestAboutLibsRelease = "10.9.1"
implementation "com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}"
implementation "com.mikepenz:aboutlibraries-compose:${latestAboutLibsRelease}"
implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"


// AndroidX
implementation Libs.androidx_appcompat
implementation Libs.androidx_browser
implementation Libs.androidx_constraint_layout
implementation Libs.androidx_core
implementation Libs.androidx_fragment
implementation Libs.androidx_hilt_work
implementation Libs.androidx_lifecycle_viewmodel
implementation Libs.androidx_lifecycle_java8
implementation Libs.androidx_lifecycle_process
implementation Libs.androidx_navigation_fragment
implementation Libs.androidx_navigation_ui
implementation Libs.androidx_preference
implementation Libs.androidx_recyclerview
implementation Libs.androidx_recyclerview_selection
implementation Libs.androidx_room_runtime
implementation Libs.androidx_room_ktx
implementation Libs.androidx_work_runtime
implementation Libs.androidx_work_gcm
kapt Libs.androidx_room_compiler
kapt Libs.androidx_hilt_compiler

// Android Material
implementation Libs.material_components
def appcompat_version = "1.6.1"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.browser:browser:1.6.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
def core_version = "1.12.0"
implementation "androidx.core:core-ktx:$core_version"

implementation "androidx.core:core-splashscreen:1.0.1"
def fragment_version = "1.6.1"
implementation "androidx.fragment:fragment-ktx:$fragment_version"
// Testing Fragments in Isolation
debugImplementation "androidx.fragment:fragment-testing:$fragment_version"

implementation "com.google.dagger:hilt-android:2.48.1"
kapt "com.google.dagger:hilt-compiler:2.48.1"
implementation 'androidx.hilt:hilt-work:1.0.0'
implementation 'androidx.hilt:hilt-navigation-fragment:1.0.0'
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
// When using Kotlin.
kapt 'androidx.hilt:hilt-compiler:1.0.0'

implementation libs.androidx.lifecycle.viewmodel.ktx
implementation libs.androidx.lifecycle.livedata.ktx
implementation(libs.androidx.lifecycle.runtime.compose)
implementation libs.androidx.lifecycle.common.java8
// optional - Test helpers for Lifecycle runtime
testImplementation libs.androidx.lifecycle.runtime.testing
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
implementation libs.androidx.lifecycle.process
def nav_version = "2.7.4"
implementation libs.androidx.navigation.fragment.ktx
implementation libs.androidx.navigation.ui.ktx
implementation "androidx.navigation:navigation-compose:$nav_version"
// Jetpack Compose Integration
implementation "androidx.navigation:navigation-compose:$nav_version"
implementation libs.androidx.preference.ktx
implementation libs.androidx.recyclerview
// For control over item selection of both touch and mouse driven selection
implementation libs.androidx.recyclerview.selection
implementation libs.androidx.room.runtime
ksp libs.androidx.room.compiler
implementation libs.androidx.room.ktx

implementation libs.androidx.work.runtime.ktx
androidTestImplementation libs.androidx.work.testing

def composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)
androidTestImplementation(composeBom)
implementation 'androidx.compose.material3:material3'
// Android Studio Preview support
implementation 'androidx.compose.ui:ui-tooling-preview'
debugImplementation 'androidx.compose.ui:ui-tooling'
// UI Tests
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
// Optional - Add full set of material icons
implementation 'androidx.compose.material:material-icons-extended'
// Optional - Add window size utils
implementation 'androidx.compose.material3:material3-window-size-class'
// Optional - Integration with activities
implementation libs.androidx.activity.compose
// Optional - Integration with ViewModels
implementation libs.androidx.lifecycle.viewmodel.compose

// Color Picker
implementation "com.github.dhaval2404:colorpicker:2.0"
implementation libs.colorpicker

// Dagger
implementation Libs.daggerHiltAndroid
kapt Libs.daggerHiltAndroidCompiler
// Compose Destinations
implementation libs.compose.destinations.core
ksp libs.compose.destinations.ksp

// Firebase
implementation "com.google.firebase:firebase-analytics-ktx"
implementation "com.google.firebase:firebase-config-ktx"
implementation "com.google.firebase:firebase-crashlytics-ktx"
implementation "com.google.firebase:firebase-perf-ktx"
implementation "com.google.firebase:firebase-analytics"
implementation "com.google.firebase:firebase-config"
implementation "com.google.firebase:firebase-crashlytics"
implementation "com.google.firebase:firebase-perf"

// FlowBinding
implementation Libs.flowBindingAndroid
implementation Libs.flowBindingCommon
implementation Libs.flowBindingMaterial
implementation libs.flowbinding.android
implementation libs.flowbinding.material

// Google Play
implementation Libs.googlePlayCore
implementation Libs.googlePlayCoreKtx
implementation 'com.google.android.play:review:2.0.1'
implementation 'com.google.android.play:review-ktx:2.0.1'
implementation 'com.google.android.play:app-update:2.0.1'
implementation 'com.google.android.play:app-update-ktx:2.0.1'

// Kotlin
implementation Libs.kotlinStdlib
implementation "org.jetbrains.kotlin:kotlin-stdlib"

// Kotlin Coroutines
implementation Libs.kotlinCoroutinesAndroid
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'

// LeakCanary
debugImplementation Libs.leakCanary
implementation Libs.leakCanaryPlumberAndroid
// debugImplementation Libs.leakCanary
// implementation Libs.leakCanaryPlumberAndroid

// Logging
implementation Libs.slf4jAndroidLogger
implementation Libs.kotlinLogging
implementation "de.psdev.slf4j-android-logger:slf4j-android-logger:1.0.5"
implementation "io.github.microutils:kotlin-logging:2.1.23"

// OkHttp
implementation Libs.okhttp
implementation("com.squareup.okhttp3:okhttp:4.11.0")

// Okio
implementation Libs.okio
implementation("com.squareup.okio:okio:3.6.0")
}

kapt {
correctErrorTypes true
}

jacoco {
toolVersion = "0.8.7"
}

play {
def serviceAccountFileName = "google-play-api.json"
if (rootProject.file(serviceAccountFileName).exists()) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/debug/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">DevDrawer2 (Debug)</string>
<string name="app_name" translatable="false">DevDrawer2 (Debug)</string>
</resources>
Loading

0 comments on commit 8264db2

Please sign in to comment.