Skip to content

Commit 3222b7d

Browse files
authored
Merge pull request #16 from Kotlin-Android-Open-Source/feat/search
Feat/search
2 parents 59743d7 + 16ab24b commit 3222b7d

File tree

55 files changed

+1089
-333
lines changed

Some content is hidden

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

55 files changed

+1089
-333
lines changed

.idea/gradle.xml

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

.idea/jarRepositories.xml

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

.idea/kotlinc.xml

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

.idea/misc.xml

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

app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ dependencies {
5151
implementation(core)
5252
implementation(featureMain)
5353
implementation(featureAdd)
54+
implementation(featureSearch)
5455

5556
implementation(deps.coroutines.android)
5657
implementation(deps.koin.android)
5758

59+
debugImplementation(deps.squareup.leakCanary)
60+
5861
testImplementation(deps.test.junit)
5962
androidTestImplementation(deps.test.androidxJunit)
6063
androidTestImplementation(deps.test.androidXSspresso)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.hoc.flowmvi.data.dataModule
66
import com.hoc.flowmvi.domain.domainModule
77
import com.hoc.flowmvi.ui.add.addModule
88
import com.hoc.flowmvi.ui.main.mainModule
9+
import com.hoc.flowmvi.ui.search.searchModule
910
import kotlinx.coroutines.ExperimentalCoroutinesApi
1011
import kotlinx.coroutines.FlowPreview
1112
import org.koin.android.ext.koin.androidContext
@@ -25,15 +26,15 @@ class App : Application() {
2526
startKoin {
2627
androidContext(this@App)
2728

28-
// TODO: Koin
29-
androidLogger(level = Level.NONE)
29+
androidLogger(if (BuildConfig.DEBUG) Level.DEBUG else Level.NONE)
3030

3131
modules(
3232
coreModule,
3333
dataModule,
3434
domainModule,
3535
mainModule,
3636
addModule,
37+
searchModule,
3738
)
3839
}
3940
}

app/src/main/java/com/hoc/flowmvi/core/CoreModule.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@ package com.hoc.flowmvi.core
22

33
import com.hoc.flowmvi.core.dispatchers.CoroutineDispatchers
44
import com.hoc.flowmvi.core.navigator.Navigator
5-
import kotlinx.coroutines.ExperimentalCoroutinesApi
6-
import kotlinx.coroutines.FlowPreview
75
import org.koin.dsl.module
86

9-
@FlowPreview
10-
@ExperimentalCoroutinesApi
117
val coreModule = module {
128
single<CoroutineDispatchers> { CoroutineDispatchersImpl() }
139

14-
single<Navigator> { NavigatorImpl(add = get()) }
10+
single<Navigator> { NavigatorImpl(add = get(), search = get()) }
1511
}

app/src/main/java/com/hoc/flowmvi/core/NavigatorImpl.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package com.hoc.flowmvi.core
33
import android.content.Context
44
import com.hoc.flowmvi.core.navigator.IntentProviders
55
import com.hoc.flowmvi.core.navigator.Navigator
6-
import kotlinx.coroutines.ExperimentalCoroutinesApi
7-
import kotlinx.coroutines.FlowPreview
86

9-
@ExperimentalCoroutinesApi
10-
@FlowPreview
117
class NavigatorImpl(
12-
private val add: IntentProviders.Add
8+
private val add: IntentProviders.Add,
9+
private val search: IntentProviders.Search,
1310
) : Navigator {
1411
override fun Context.navigateToAdd() =
1512
startActivity(add.makeIntent(this))
13+
14+
override fun Context.navigateToSearch() {
15+
startActivity(search.makeIntent(this))
16+
}
1617
}

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ buildscript {
99
gradlePluginPortal()
1010
}
1111
dependencies {
12-
classpath("com.android.tools.build:gradle:4.2.0")
12+
classpath("com.android.tools.build:gradle:4.2.1")
1313
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
1414
classpath("com.diffplug.spotless:spotless-plugin-gradle:5.12.4")
15+
classpath("dev.ahmedmourad.nocopy:nocopy-gradle-plugin:1.4.0")
1516
}
1617
}
1718

@@ -63,8 +64,6 @@ subprojects {
6364
allprojects {
6465
tasks.withType<KotlinCompile> {
6566
kotlinOptions {
66-
useIR = true
67-
6867
val version = JavaVersion.VERSION_1_8.toString()
6968
jvmTarget = version
7069
sourceCompatibility = version
@@ -75,6 +74,7 @@ allprojects {
7574
repositories {
7675
google()
7776
mavenCentral()
77+
maven(url = "https://jitpack.io")
7878
}
7979
}
8080

buildSrc/src/main/kotlin/deps.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.gradle.plugin.use.PluginDependenciesSpec
66
import org.gradle.plugin.use.PluginDependencySpec
77

88
const val ktlintVersion = "0.41.0"
9-
const val kotlinVersion = "1.5.0"
9+
const val kotlinVersion = "1.5.10"
1010

1111
object appConfig {
1212
const val applicationId = "com.hoc.flowmvi"
@@ -43,23 +43,25 @@ object deps {
4343
const val converterMoshi = "com.squareup.retrofit2:converter-moshi:2.9.0"
4444
const val loggingInterceptor = "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2"
4545
const val moshiKotlin = "com.squareup.moshi:moshi-kotlin:1.11.0"
46+
const val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.7"
4647
}
4748

4849
object coroutines {
49-
private const val version = "1.5.0-RC"
50+
private const val version = "1.5.0"
5051

5152
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
5253
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
5354
}
5455

5556
object koin {
56-
private const val version = "3.0.1"
57+
private const val version = "3.0.2"
5758

5859
const val core = "io.insert-koin:koin-core:$version"
5960
const val android = "io.insert-koin:koin-android:$version"
6061
}
6162

6263
const val coil = "io.coil-kt:coil:1.2.1"
64+
const val viewBindingDelegate = "com.github.hoc081098:ViewBindingDelegate:1.0.0"
6365

6466
object test {
6567
const val junit = "junit:junit:4.13"
@@ -81,3 +83,4 @@ inline val DependencyHandler.core get() = project(":core")
8183
inline val DependencyHandler.data get() = project(":data")
8284
inline val DependencyHandler.featureMain get() = project(":feature-main")
8385
inline val DependencyHandler.featureAdd get() = project(":feature-add")
86+
inline val DependencyHandler.featureSearch get() = project(":feature-search")
Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
11
package com.hoc.flowmvi.core
2-
3-
import androidx.test.ext.junit.runners.AndroidJUnit4
4-
import androidx.test.platform.app.InstrumentationRegistry
5-
import org.junit.Test
6-
import org.junit.runner.RunWith
7-
8-
/**
9-
* Instrumented test, which will execute on an Android device.
10-
*
11-
* See [testing documentation](http://d.android.com/tools/testing).
12-
*/
13-
@RunWith(AndroidJUnit4::class)
14-
class ExampleInstrumentedTest {
15-
@Test
16-
fun useAppContext() {
17-
// Context of the app under test.
18-
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
19-
assertEquals("com.hoc081098.flowmvi.core.test", appContext.packageName)
20-
}
21-
}

0 commit comments

Comments
 (0)