Jelajahi Sumber

add multi modules

MrOzOn 5 tahun lalu
induk
melakukan
ecb9b24346

+ 2 - 0
app/src/main/java/com/mrozon/healthdiary/presentation/showperson/ShowPersonFragment.kt

@@ -3,9 +3,11 @@ package com.mrozon.healthdiary.presentation.showperson
 import com.mrozon.core.base.BaseFragment
 import com.mrozon.healthdiary.R
 import com.mrozon.healthdiary.databinding.FragmentShowPersonBinding
+import javax.inject.Inject
 
 class ShowPersonFragment: BaseFragment<FragmentShowPersonBinding>() {
 
+    @Inject
     lateinit var showPersonViewModal: ShowPersonViewModal
 
     override fun getLayoutId(): Int = R.layout.fragment_show_person

+ 2 - 1
app/src/main/java/com/mrozon/healthdiary/presentation/showperson/ShowPersonViewModal.kt

@@ -1,5 +1,6 @@
 package com.mrozon.healthdiary.presentation.showperson
 
 import com.mrozon.core.base.BaseViewModel
+import javax.inject.Inject
 
-class ShowPersonViewModal: BaseViewModel()
+class ShowPersonViewModal @Inject constructor(): BaseViewModel()

+ 1 - 0
feature_auth_api/.gitignore

@@ -0,0 +1 @@
+/build

+ 36 - 0
feature_auth_api/build.gradle

@@ -0,0 +1,36 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+    compileSdkVersion 29
+    buildToolsVersion "29.0.3"
+
+    defaultConfig {
+        minSdkVersion 21
+        targetSdkVersion 29
+        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.1.0'
+    implementation 'androidx.core:core-ktx:1.3.1'
+    testImplementation 'junit:junit:4.12'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+}

+ 0 - 0
feature_auth_api/consumer-rules.pro


+ 21 - 0
feature_auth_api/proguard-rules.pro

@@ -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

+ 24 - 0
feature_auth_api/src/androidTest/java/com/mrozon/feature_auth_api/ExampleInstrumentedTest.kt

@@ -0,0 +1,24 @@
+package com.mrozon.feature_auth_api
+
+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("com.mrozon.feature_auth_api.test", appContext.packageName)
+    }
+}

+ 2 - 0
feature_auth_api/src/main/AndroidManifest.xml

@@ -0,0 +1,2 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.mrozon.feature_auth_api" />

+ 7 - 0
feature_auth_api/src/main/java/com/mrozon/feature_auth_api/domain/entities/User.kt

@@ -0,0 +1,7 @@
+package com.mrozon.feature_auth_api.domain.entities
+
+data class User(
+    val id: Int,
+    val username: String,
+    val firstName: String,
+    val lastName: String)

+ 10 - 0
feature_auth_api/src/main/java/com/mrozon/feature_auth_api/domain/usecases/AuthUseCase.kt

@@ -0,0 +1,10 @@
+package com.mrozon.feature_auth_api.domain.usecases
+
+import com.mrozon.feature_auth_api.domain.entities.User
+
+interface AuthUseCase {
+    fun isLoggedIn(user: User): Boolean
+    fun registerUser(user: User): Boolean
+    fun loginUser(user: User): Boolean
+    fun logoutUser(user: User): Boolean
+}

+ 17 - 0
feature_auth_api/src/test/java/com/mrozon/feature_auth_api/ExampleUnitTest.kt

@@ -0,0 +1,17 @@
+package com.mrozon.feature_auth_api
+
+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 - 0
feature_auth_impl/.gitignore

@@ -0,0 +1 @@
+/build

+ 37 - 0
feature_auth_impl/build.gradle

@@ -0,0 +1,37 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+    compileSdkVersion 29
+    buildToolsVersion "29.0.3"
+
+    defaultConfig {
+        minSdkVersion 21
+        targetSdkVersion 29
+        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 project(':feature_auth_api')
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+    implementation 'androidx.appcompat:appcompat:1.1.0'
+    implementation 'androidx.core:core-ktx:1.3.1'
+    testImplementation 'junit:junit:4.12'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+}

+ 0 - 0
feature_auth_impl/consumer-rules.pro


+ 21 - 0
feature_auth_impl/proguard-rules.pro

@@ -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

+ 24 - 0
feature_auth_impl/src/androidTest/java/com/mrozon/feature_auth_impl/ExampleInstrumentedTest.kt

@@ -0,0 +1,24 @@
+package com.mrozon.feature_auth_impl
+
+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("com.mrozon.feature_auth_impl.test", appContext.packageName)
+    }
+}

+ 2 - 0
feature_auth_impl/src/main/AndroidManifest.xml

@@ -0,0 +1,2 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.mrozon.feature_auth_impl" />

+ 23 - 0
feature_auth_impl/src/main/java/com/mrozon/feature_auth_impl/domain/usecases/AuthUseCaseImpl.kt

@@ -0,0 +1,23 @@
+package com.mrozon.feature_auth_impl.domain.usecases
+
+import com.mrozon.feature_auth_api.domain.entities.User
+import com.mrozon.feature_auth_api.domain.usecases.AuthUseCase
+
+class AuthUseCaseImpl : AuthUseCase {
+
+    override fun isLoggedIn(user: User): Boolean {
+        TODO("Not yet implemented")
+    }
+
+    override fun registerUser(user: User): Boolean {
+        TODO("Not yet implemented")
+    }
+
+    override fun loginUser(user: User): Boolean {
+        TODO("Not yet implemented")
+    }
+
+    override fun logoutUser(user: User): Boolean {
+        TODO("Not yet implemented")
+    }
+}

+ 17 - 0
feature_auth_impl/src/test/java/com/mrozon/feature_auth_impl/ExampleUnitTest.kt

@@ -0,0 +1,17 @@
+package com.mrozon.feature_auth_impl
+
+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)
+    }
+}

+ 2 - 0
settings.gradle

@@ -1,3 +1,5 @@
 rootProject.name='HealthDiary'
 include ':app'
 include ':core'
+include ':feature_auth_api'
+include ':feature_auth_impl'