Wip MVP
This commit is contained in:
parent
722f94ec22
commit
4cd56f267d
13 changed files with 154 additions and 1 deletions
1
core/.gitignore
vendored
Normal file
1
core/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
44
core/build.gradle
Normal file
44
core/build.gradle
Normal file
|
@ -0,0 +1,44 @@
|
|||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "29.0.0"
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'androidx.core:core-ktx:1.0.2'
|
||||
|
||||
implementation 'com.google.dagger:dagger:2.11'
|
||||
kapt 'com.google.dagger:dagger-compiler:2.11'
|
||||
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
0
core/consumer-rules.pro
Normal file
0
core/consumer-rules.pro
Normal file
21
core/proguard-rules.pro
vendored
Normal file
21
core/proguard-rules.pro
vendored
Normal file
|
@ -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.
|
||||
#
|
||||
# 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,24 @@
|
|||
package code.name.monkey.core
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("code.name.monkey.core.test", appContext.packageName)
|
||||
}
|
||||
}
|
2
core/src/main/AndroidManifest.xml
Normal file
2
core/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="code.name.monkey.core" />
|
6
core/src/main/java/code/name/monkey/core/DataManager.kt
Normal file
6
core/src/main/java/code/name/monkey/core/DataManager.kt
Normal file
|
@ -0,0 +1,6 @@
|
|||
package code.name.monkey.core
|
||||
|
||||
import io.reactivex.Observable
|
||||
|
||||
interface DataManager {
|
||||
}
|
7
core/src/main/java/code/name/monkey/core/Presenter.kt
Normal file
7
core/src/main/java/code/name/monkey/core/Presenter.kt
Normal file
|
@ -0,0 +1,7 @@
|
|||
package code.name.monkey.core
|
||||
|
||||
interface Presenter<T> {
|
||||
fun attachView(view: T)
|
||||
|
||||
fun detachView()
|
||||
}
|
13
core/src/main/java/code/name/monkey/core/PresenterImpl.kt
Normal file
13
core/src/main/java/code/name/monkey/core/PresenterImpl.kt
Normal file
|
@ -0,0 +1,13 @@
|
|||
package code.name.monkey.core
|
||||
|
||||
class PresenterImpl<T> {
|
||||
var view: T? = null
|
||||
|
||||
fun attachView(view: T) {
|
||||
this.view = view
|
||||
}
|
||||
|
||||
fun detachView() {
|
||||
this.view = null
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package code.name.monkey.core.dagger.songs
|
||||
|
||||
import code.name.monkey.core.DataManager
|
||||
import code.name.monkey.core.Presenter
|
||||
import javax.inject.Inject
|
||||
|
||||
interface SongsPresenter : Presenter<SongView> {
|
||||
fun loadSongs()
|
||||
|
||||
class SongsPresenterImpl @Inject constructor(private val dataManager: DataManager)
|
||||
}
|
||||
|
||||
interface SongView {
|
||||
fun songs()
|
||||
}
|
3
core/src/main/res/values/strings.xml
Normal file
3
core/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<resources>
|
||||
<string name="app_name">core</string>
|
||||
</resources>
|
17
core/src/test/java/code/name/monkey/core/ExampleUnitTest.kt
Normal file
17
core/src/test/java/code/name/monkey/core/ExampleUnitTest.kt
Normal file
|
@ -0,0 +1,17 @@
|
|||
package code.name.monkey.core
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* 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 @@
|
|||
include ':app', ':appthemehelper'
|
||||
include ':app', ':appthemehelper', ':core'
|
Loading…
Reference in a new issue