Skip to content

Commit a27dfa4

Browse files
authored
Multiple modules (#5)
* buildSrc * ktlint * domain + core * ktlint * data * ktlint * done * ktlint
1 parent ce51023 commit a27dfa4

File tree

110 files changed

+1639
-871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1639
-871
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_size=2
5+
end_of_line=lf
6+
charset=utf-8
7+
trim_trailing_whitespace=true
8+
insert_final_newline=true
9+
10+
[*.{kt,kts}]
11+
kotlin_imports_layout=ascii

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/.idea/assetWizardSettings.xml
1010
.DS_Store
1111
/build
12+
buildSrc/build
1213
/captures
1314
.externalNativeBuild
1415
.cxx

.idea/codeStyles/Project.xml

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 0 additions & 77 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
plugins {
2+
androidApplication
3+
kotlinAndroid
4+
}
5+
6+
android {
7+
compileSdkVersion(appConfig.compileSdkVersion)
8+
buildToolsVersion(appConfig.buildToolsVersion)
9+
10+
defaultConfig {
11+
applicationId = appConfig.applicationId
12+
minSdkVersion(appConfig.minSdkVersion)
13+
targetSdkVersion(appConfig.targetSdkVersion)
14+
versionCode = appConfig.versionCode
15+
versionName = appConfig.versionName
16+
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
buildTypes {
21+
getByName("release") {
22+
isMinifyEnabled = true
23+
isShrinkResources = true
24+
proguardFiles(
25+
getDefaultProguardFile("proguard-android-optimize.txt"),
26+
"proguard-rules.pro"
27+
)
28+
}
29+
}
30+
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_1_8
33+
targetCompatibility = JavaVersion.VERSION_1_8
34+
}
35+
kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() }
36+
buildFeatures { viewBinding = true }
37+
}
38+
39+
dependencies {
40+
implementation(
41+
fileTree(
42+
mapOf(
43+
"dir" to "libs",
44+
"include" to listOf("*.jar")
45+
)
46+
)
47+
)
48+
49+
implementation(domain)
50+
implementation(data)
51+
implementation(core)
52+
implementation(featureMain)
53+
implementation(featureAdd)
54+
55+
implementation(deps.jetbrains.coroutinesAndroid)
56+
implementation(deps.koin.android)
57+
58+
testImplementation(deps.test.junit)
59+
androidTestImplementation(deps.test.androidxJunit)
60+
androidTestImplementation(deps.test.androidXSspresso)
61+
}

app/src/androidTest/java/com/hoc/flowmvi/ExampleInstrumentedTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.hoc.flowmvi
22

3-
import androidx.test.platform.app.InstrumentationRegistry
43
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import org.junit.Assert.assertEquals
66
import org.junit.Test
77
import org.junit.runner.RunWith
88

9-
import org.junit.Assert.*
10-
119
/**
1210
* Instrumented test, which will execute on an Android device.
1311
*

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313
android:supportsRtl="true"
1414
android:theme="@style/AppTheme">
1515

16-
<activity android:name=".ui.main.MainActivity">
17-
<intent-filter>
18-
<action android:name="android.intent.action.MAIN" />
19-
20-
<category android:name="android.intent.category.LAUNCHER" />
21-
</intent-filter>
22-
</activity>
23-
24-
<activity
25-
android:name=".ui.add.AddActivity"
26-
android:label="Add user" />
27-
28-
<meta-data
29-
android:name="preloaded_fonts"
30-
android:resource="@array/preloaded_fonts" />
3116
</application>
3217

33-
</manifest>
18+
</manifest>

app/src/main/java/com/hoc/flowmvi/App.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.hoc.flowmvi
22

33
import android.app.Application
4-
import com.hoc.flowmvi.koin.dataModule
5-
import com.hoc.flowmvi.koin.domainModule
6-
import com.hoc.flowmvi.koin.viewModelModule
4+
import com.hoc.flowmvi.core.coreModule
5+
import com.hoc.flowmvi.data.dataModule
6+
import com.hoc.flowmvi.domain.domainModule
7+
import com.hoc.flowmvi.ui.add.addModule
8+
import com.hoc.flowmvi.ui.main.mainModule
79
import kotlinx.coroutines.ExperimentalCoroutinesApi
810
import kotlinx.coroutines.FlowPreview
911
import org.koin.android.ext.koin.androidContext
@@ -21,14 +23,15 @@ class App : Application() {
2123
startKoin {
2224
androidContext(this@App)
2325

24-
// https://github.com/InsertKoinIO/koin/issues/847
25-
androidLogger(level = Level.ERROR)
26+
androidLogger(level = Level.DEBUG)
2627

2728
modules(
28-
dataModule,
29-
domainModule,
30-
viewModelModule
29+
coreModule,
30+
dataModule,
31+
domainModule,
32+
mainModule,
33+
addModule,
3134
)
3235
}
3336
}
34-
}
37+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.hoc.flowmvi.core
2+
3+
import com.hoc.flowmvi.core.dispatchers.CoroutineDispatchers
4+
import com.hoc.flowmvi.core.navigator.Navigator
5+
import kotlinx.coroutines.ExperimentalCoroutinesApi
6+
import kotlinx.coroutines.FlowPreview
7+
import org.koin.dsl.module
8+
9+
@FlowPreview
10+
@ExperimentalCoroutinesApi
11+
val coreModule = module {
12+
single<CoroutineDispatchers> { CoroutineDispatchersImpl() }
13+
14+
single<Navigator> { NavigatorImpl(add = get()) }
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.hoc.flowmvi.core
2+
3+
import com.hoc.flowmvi.core.dispatchers.CoroutineDispatchers
4+
import kotlinx.coroutines.CoroutineDispatcher
5+
import kotlinx.coroutines.Dispatchers
6+
7+
internal class CoroutineDispatchersImpl(
8+
override val main: CoroutineDispatcher = Dispatchers.Main,
9+
override val io: CoroutineDispatcher = Dispatchers.IO
10+
) : CoroutineDispatchers
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.hoc.flowmvi.core
2+
3+
import android.content.Context
4+
import com.hoc.flowmvi.core.navigator.IntentProviders
5+
import com.hoc.flowmvi.core.navigator.Navigator
6+
import kotlinx.coroutines.ExperimentalCoroutinesApi
7+
import kotlinx.coroutines.FlowPreview
8+
9+
@ExperimentalCoroutinesApi
10+
@FlowPreview
11+
class NavigatorImpl(
12+
private val add: IntentProviders.Add
13+
) : Navigator {
14+
override fun Context.navigateToAdd() =
15+
startActivity(add.makeIntent(this))
16+
}

app/src/main/java/com/hoc/flowmvi/data/mapper/UserDomainToUserBodyMapper.kt

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/src/main/java/com/hoc/flowmvi/data/mapper/UserDomainToUserResponseMapper.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/src/main/java/com/hoc/flowmvi/data/mapper/UserResponseToUserDomainMapper.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)