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 Jun 23, 2024
1 parent ccefd8c commit 6021c42
Show file tree
Hide file tree
Showing 126 changed files with 5,107 additions and 1,969 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
255 changes: 163 additions & 92 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"
alias(libs.plugins.org.jetbrains.kotlin.android)
alias(libs.plugins.compose.compiler)
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
id 'androidx.navigation.safeargs.kotlin'
id 'com.google.dagger.hilt.android'
id 'com.github.triplet.play' version '3.10.1'
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 {
pixel8api34(com.android.build.api.dsl.ManagedVirtualDevice) {
device = "Pixel 8 Pro"
apiLevel = 34
systemImageSource = "google"
require64Bit = true
}
}
}
unitTests {
includeAndroidResources = true
all { ignoreFailures = true }
}
}
final def keystorePropertiesFile = rootProject.file("release.properties")
Expand Down Expand Up @@ -92,112 +98,177 @@ android {
}
}
}
lintOptions {
lintConfig project.file('lint.xml')
disable "GoogleAppIndexingWarning"
disable "RemoveWorkManagerInitializer"
packagingOptions {
resources {
excludes += ['**/LICENSE', '**/LICENSE.txt', '**/NOTICE', '**/NOTICE.txt', '**/*.gwt.xml']
}
}
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")
}
}
}
}

composeCompiler {
enableStrongSkippingMode = true
}

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

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

dependencies {
//
// Platforms
//
implementation platform(Platforms.firebase)
implementation platform(Platforms.kotlin)

def firebaseBom = platform(libs.firebase.bom)
implementation(firebaseBom)
androidTestImplementation(firebaseBom)
//
// Test dependencies
//
testImplementation Libs.junit
testImplementation Libs.robolectric
testImplementation Libs.mockk
testImplementation libs.junit
testImplementation libs.robolectric
def mockkVersion = "1.13.8"
testImplementation libs.mockk.android
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 libs.aboutlibraries


// 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
implementation libs.androidx.appcompat
implementation libs.androidx.browser
implementation libs.androidx.constraintlayout
implementation libs.androidx.core.ktx

implementation libs.androidx.core.splashscreen
implementation libs.androidx.fragment.ktx
// Testing Fragments in Isolation
debugImplementation libs.androidx.fragment.testing

def dagger = "2.51.1"
implementation libs.hilt.android
ksp "com.google.dagger:hilt-compiler:$dagger"
implementation libs.androidx.hilt.work
implementation libs.androidx.hilt.navigation.fragment
implementation libs.androidx.hilt.navigation.compose
def hilt = "1.2.0"
ksp "androidx.hilt:hilt-compiler:$hilt"

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
implementation libs.androidx.navigation.fragment.ktx
implementation libs.androidx.navigation.ui.ktx
// Jetpack Compose Integration
implementation libs.navigation.compose
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

// Compose
def composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)
androidTestImplementation(composeBom)

// Material Design 3
implementation libs.androidx.material3
// Android Studio Preview support
implementation libs.androidx.ui.tooling.preview
debugImplementation libs.androidx.ui.tooling
// UI Tests
androidTestImplementation libs.androidx.ui.test.junit4
debugImplementation libs.androidx.ui.test.manifest
// Optional - Add full set of material icons
implementation libs.androidx.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 libs.firebase.analytics
implementation libs.firebase.config
implementation libs.firebase.crashlytics
implementation libs.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 libs.review
implementation libs.review.ktx
implementation libs.app.update
implementation libs.app.update.ktx

// Kotlin
implementation Libs.kotlinStdlib
implementation libs.kotlin.stdlib

// Kotlin Coroutines
implementation Libs.kotlinCoroutinesAndroid
implementation libs.kotlinx.coroutines.android

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

// Logging
implementation Libs.slf4jAndroidLogger
implementation Libs.kotlinLogging
implementation libs.slf4j.android.logger
implementation libs.kotlin.logging

// OkHttp
implementation Libs.okhttp
implementation(libs.okhttp)

// Okio
implementation Libs.okio
implementation(libs.okio)
}

kapt {
correctErrorTypes true
jacoco {
toolVersion = "0.8.12"
}

play {
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 6021c42

Please sign in to comment.