Setup the template project
This commit is contained in:
+4
-14
@@ -7,7 +7,6 @@ plugins {
|
||||
kotlin("kapt")
|
||||
id("dagger.hilt.android.plugin")
|
||||
id("kotlin-android")
|
||||
id("com.google.devtools.ksp") version "1.5.21-1.0.0-beta07"
|
||||
}
|
||||
|
||||
kapt {
|
||||
@@ -77,11 +76,13 @@ android {
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation(project(":util"))
|
||||
implementation(project(":data"))
|
||||
implementation(project(":i18n"))
|
||||
|
||||
implementation(Libs.activity_compose)
|
||||
implementation(Libs.navigation_compose)
|
||||
implementation(Libs.core_ktx)
|
||||
implementation(Libs.lifecycle_runtime_ktx)
|
||||
implementation(Libs.preference_ktx)
|
||||
implementation(Libs.appcompat)
|
||||
implementation(Libs.startup_runtime)
|
||||
@@ -104,8 +105,6 @@ dependencies {
|
||||
implementation(Libs.accompanist_placeholder)
|
||||
implementation(Libs.accompanist_navigation_animation)
|
||||
|
||||
implementation(kotlin("reflect"))
|
||||
|
||||
implementation(platform(Libs.kotlin_coroutine_bom))
|
||||
testImplementation(Libs.kotlin_coroutine_test)
|
||||
|
||||
@@ -113,23 +112,16 @@ dependencies {
|
||||
implementation(Libs.hilt_navigation_compose)
|
||||
kapt(Libs.hilt_android_compiler)
|
||||
|
||||
implementation(Libs.lifecycle_runtime_ktx)
|
||||
|
||||
testImplementation(Libs.junit_jupiter_api)
|
||||
testImplementation(Libs.junit_jupiter_engine)
|
||||
|
||||
implementation(Libs.koin_android)
|
||||
implementation(Libs.koin_androidx_compose)
|
||||
implementation(Libs.koin_androidx_workmanager)
|
||||
testImplementation(Libs.koin_test_junit5)
|
||||
|
||||
implementation(Libs.ksp_api)
|
||||
|
||||
implementation(Libs.orbit_mvi_core)
|
||||
implementation(Libs.orbit_mvi_viewmodel)
|
||||
testImplementation(Libs.orbit_mvi_test)
|
||||
|
||||
ksp(Libs.room_compiler)
|
||||
kapt(Libs.room_compiler)
|
||||
implementation(Libs.room_runtime)
|
||||
testImplementation(Libs.room_testing)
|
||||
|
||||
@@ -137,6 +129,4 @@ dependencies {
|
||||
androidTestImplementation(Libs.mockk_android)
|
||||
|
||||
debugImplementation(Libs.leakcanary_android)
|
||||
|
||||
implementation(Libs.timber)
|
||||
}
|
||||
@@ -1,7 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.ericampire.android.androidstudycase">
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.APP_BROWSER" />
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@@ -21,6 +35,16 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="${applicationId}.androidx-startup"
|
||||
android:exported="false"
|
||||
tools:node="merge">
|
||||
<meta-data
|
||||
android:name="com.ericampire.android.androidstudycase.app.initializer.TimberInitializer"
|
||||
android:value="androidx.startup" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ericampire.android.androidstudycase.app.di
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.PreferenceManager
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object AppModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideSharedPreference(
|
||||
@ApplicationContext context: Context
|
||||
): SharedPreferences {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ericampire.android.androidstudycase.app.di
|
||||
|
||||
|
||||
import com.ericampire.android.androidstudycase.util.IoDispatcher
|
||||
import com.ericampire.android.androidstudycase.util.MainDispatcher
|
||||
import com.ericampire.android.androidstudycase.util.MainImmediateDispatcher
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object CoroutineModule {
|
||||
|
||||
@Provides
|
||||
@IoDispatcher
|
||||
fun providesIoDispatcher(): CoroutineDispatcher = Dispatchers.IO
|
||||
|
||||
@Provides
|
||||
@MainDispatcher
|
||||
fun providesMainDispatcher(): CoroutineDispatcher = Dispatchers.Main
|
||||
|
||||
@Provides
|
||||
@MainImmediateDispatcher
|
||||
fun providesMainImmediateDispatcher(): CoroutineDispatcher = Dispatchers.Main.immediate
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ericampire.android.androidstudycase.app.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ViewModelComponent
|
||||
|
||||
@Module
|
||||
@InstallIn(ViewModelComponent::class)
|
||||
object ViewModelModule {
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.ericampire.android.androidstudycase.app.initializer
|
||||
|
||||
import android.content.Context
|
||||
import androidx.startup.Initializer
|
||||
import com.ericampire.android.androidstudycase.BuildConfig
|
||||
import timber.log.Timber
|
||||
|
||||
class TimberInitializer : Initializer<Unit> {
|
||||
override fun create(context: Context) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Timber.plant(Timber.DebugTree())
|
||||
}
|
||||
}
|
||||
|
||||
override fun dependencies(): MutableList<Class<out Initializer<*>>> {
|
||||
return mutableListOf()
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.darkColors
|
||||
import androidx.compose.material.lightColors
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
private val DarkColorPalette = darkColors(
|
||||
primary = Purple200,
|
||||
@@ -15,16 +16,13 @@ private val DarkColorPalette = darkColors(
|
||||
private val LightColorPalette = lightColors(
|
||||
primary = Purple500,
|
||||
primaryVariant = Purple700,
|
||||
secondary = Teal200
|
||||
|
||||
/* Other default colors to override
|
||||
secondary = Teal200,
|
||||
background = Color.White,
|
||||
surface = Color.White,
|
||||
onPrimary = Color.White,
|
||||
onSecondary = Color.Black,
|
||||
onBackground = Color.Black,
|
||||
onSurface = Color.Black,
|
||||
*/
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -11,8 +11,6 @@ buildscript {
|
||||
classpath(Libs.kotlin_gradle_plugin)
|
||||
classpath(Libs.gradle_plugin)
|
||||
classpath(Libs.hilt_gradle_plugin)
|
||||
classpath(Libs.play_service_plugin)
|
||||
classpath(Libs.firebase_crashlytics_plugin)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,48 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = Apps.compileSdk
|
||||
buildToolsVersion = Apps.buildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdk = Apps.minSdk
|
||||
targetSdk = Apps.targetSdk
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
api(project(":domain"))
|
||||
implementation(Libs.core_ktx)
|
||||
|
||||
api(platform(Libs.kotlin_coroutine_bom))
|
||||
api(Libs.kotlin_coroutine_core)
|
||||
|
||||
testImplementation(Libs.junit_jupiter_api)
|
||||
testImplementation(Libs.junit_jupiter_engine)
|
||||
|
||||
testImplementation(Libs.mockk_core)
|
||||
|
||||
api(Libs.hilt_android)
|
||||
kapt(Libs.hilt_android_compiler)
|
||||
|
||||
api(Libs.timber)
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.ericampire.android.androidstudycase.data">
|
||||
|
||||
</manifest>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.ericampire.android.androidstudycase.data.datasource.user
|
||||
|
||||
|
||||
interface UserDataSource {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.ericampire.android.androidstudycase.data.di
|
||||
|
||||
|
||||
object DataSourceModule {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.ericampire.android.androidstudycase.data.di
|
||||
|
||||
|
||||
object RepositoryModule {
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ericampire.android.androidstudycase.data.repository
|
||||
|
||||
import com.ericampire.android.androidstudycase.data.datasource.user.UserDataSource
|
||||
import com.ericampire.android.androidstudycase.domain.repository.UserRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
class UserRepositoryImpl @Inject constructor(
|
||||
private val dataSource: UserDataSource
|
||||
) : UserRepository {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.zxconnect.android.beserve.util
|
||||
package com.ericampire.android.androidstudycase.data
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,48 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = Apps.compileSdk
|
||||
buildToolsVersion = Apps.buildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdk = Apps.minSdk
|
||||
targetSdk = Apps.targetSdk
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
api(project(":util"))
|
||||
implementation(Libs.core_ktx)
|
||||
|
||||
api(platform(Libs.kotlin_coroutine_bom))
|
||||
api(Libs.kotlin_coroutine_core)
|
||||
|
||||
testImplementation(Libs.junit_jupiter_api)
|
||||
testImplementation(Libs.junit_jupiter_engine)
|
||||
|
||||
testImplementation(Libs.mockk_core)
|
||||
|
||||
api(Libs.hilt_android)
|
||||
kapt(Libs.hilt_android_compiler)
|
||||
|
||||
api(Libs.timber)
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.ericampire.android.androidstudycase.domain">
|
||||
|
||||
</manifest>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package com.ericampire.android.androidstudycase.domain.di
|
||||
|
||||
|
||||
object UseCaseModule {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ericampire.android.androidstudycase.domain.entity
|
||||
|
||||
|
||||
data class User(
|
||||
val uid: String = "",
|
||||
|
||||
)
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
package com.ericampire.android.androidstudycase.domain.extension
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ericampire.android.androidstudycase.domain.mapper
|
||||
|
||||
interface Mapper<I, O> {
|
||||
fun map(input: I): O
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package com.ericampire.android.androidstudycase.domain.repository
|
||||
|
||||
|
||||
interface UserRepository {
|
||||
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
package com.ericampire.android.androidstudycase.domain.usecase
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.ericampire.android.androidstudycase.domain
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
+7
-5
@@ -8,13 +8,15 @@ refreshVersions {
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
jcenter() // Warning: this repository is going to shut down soon
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
jcenter() // Warning: this repository is going to shut down soon
|
||||
}
|
||||
}
|
||||
rootProject.name = "android-study-case"
|
||||
include(":app")
|
||||
include(":util")
|
||||
include(":i18n")
|
||||
include(":data")
|
||||
include(":domain")
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
package org.zxconnect.android.beserve.util
|
||||
package com.ericampire.android.androidstudycase.util
|
||||
|
||||
|
||||
import javax.inject.Qualifier
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.zxconnect.android.beserve.util
|
||||
package com.ericampire.android.androidstudycase.util
|
||||
|
||||
import androidx.lifecycle.Observer
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.zxconnect.android.beserve.util
|
||||
package com.ericampire.android.androidstudycase.util
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
package org.zxconnect.android.beserve.util.usecase
|
||||
package com.ericampire.android.androidstudycase.util.usecase
|
||||
|
||||
|
||||
import com.ericampire.android.androidstudycase.util.Result
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.zxconnect.android.beserve.util.Result
|
||||
import timber.log.Timber
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package org.zxconnect.android.beserve.util.usecase
|
||||
package com.ericampire.android.androidstudycase.util.usecase
|
||||
|
||||
import com.ericampire.android.androidstudycase.util.Result
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import org.zxconnect.android.beserve.util.Result
|
||||
|
||||
/**
|
||||
* Executes business logic in its execute method and keep posting updates to the result as
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ericampire.android.androidstudycase.util
|
||||
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
#### suppress inspection "SpellCheckingInspection" for whole file
|
||||
#### suppress inspection "UnusedProperty" for whole file
|
||||
|
||||
plugin.android=7.0.1
|
||||
plugin.android=7.0.2
|
||||
version.androidx.activity=1.3.0-alpha08
|
||||
version.androidx.preference=1.1.1
|
||||
version.androidx.appcompat=1.3.0
|
||||
|
||||
Reference in New Issue
Block a user