forked from openMF/mifos-mobile-cn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Initialised project with MVP Architecture packages
- Loading branch information
0 parents
commit 53a8dc3
Showing
84 changed files
with
3,332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# Intellij | ||
*.iml | ||
.idea | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
|
||
# Keystore files | ||
*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
google-services.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
apply plugin: 'com.android.application' | ||
apply from: '../config/quality/quality.gradle' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
android { | ||
compileSdkVersion 27 | ||
defaultConfig { | ||
applicationId "org.mifos.mobile.cn" | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
vectorDrawables.useSupportLibrary = true | ||
} | ||
buildTypes { | ||
|
||
debug { | ||
versionNameSuffix " Debug" | ||
debuggable true | ||
} | ||
|
||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
sourceSets { | ||
def commonTestDir = 'src/commonTest/kotlin' | ||
main.java.srcDirs += 'src/main/kotlin' | ||
androidTest { | ||
java.srcDir commonTestDir | ||
} | ||
test { | ||
java.srcDir commonTestDir | ||
} | ||
} | ||
|
||
// Always show the result of every unit test, even if it passes. | ||
testOptions.unitTests.all { | ||
testLogging { | ||
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' | ||
} | ||
} | ||
|
||
lintOptions { | ||
abortOnError false | ||
warning 'InvalidPackage' | ||
} | ||
|
||
packagingOptions { | ||
exclude 'META-INF/rxjava.properties' | ||
} | ||
|
||
repositories { | ||
maven { url 'https://maven.fabric.io/public' } | ||
maven { url 'https://maven.google.com' } | ||
} | ||
|
||
androidExtensions { | ||
experimental = true | ||
} | ||
} | ||
|
||
dependencies { | ||
def daggerCompiler = "com.google.dagger:dagger-compiler:$rootProject.daggerVersion" | ||
def jUnit = "junit:junit:4.12" | ||
def mockito = "org.mockito:mockito-core:$rootProject.mockitoVersion" | ||
|
||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
|
||
// Kotlin Dependencies | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$rootProject.kotlinVersion" | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion" | ||
|
||
// Support Dependencies | ||
implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" | ||
implementation "com.android.support:design:$rootProject.supportLibraryVersion" | ||
implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion" | ||
implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion" | ||
implementation "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espressoVersion" | ||
implementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion" | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.0' | ||
|
||
// Rx Dependencies | ||
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjavaVersion" | ||
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroidVersion" | ||
implementation "io.reactivex.rxjava2:rxkotlin:$rootProject.rxKotlinVersion" | ||
|
||
// Timber for logging | ||
implementation 'com.jakewharton.timber:timber:4.5.1' | ||
|
||
// Dagger 2 Dependencies | ||
implementation "com.google.dagger:dagger:$rootProject.daggerVersion" | ||
compileOnly "org.glassfish:javax.annotation:10.0-b28" //Required by Dagger2 | ||
kapt daggerCompiler | ||
|
||
// Square Dependencies | ||
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion" | ||
implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion" | ||
implementation "com.squareup.retrofit2:converter-scalars:$rootProject.retrofitVersion" | ||
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion" | ||
implementation "com.squareup.okhttp3:okhttp:$rootProject.okHttp3Version" | ||
implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okHttp3Version" | ||
|
||
// For debugging the local database | ||
implementation 'com.facebook.stetho:stetho:1.5.0' | ||
|
||
// Sweet Error for error handling | ||
implementation 'com.github.therajanmaurya:Sweet-Error:1.0.0' | ||
|
||
// Glide for Image Loading | ||
implementation 'com.github.bumptech.glide:glide:4.7.1' | ||
kapt 'com.github.bumptech.glide:compiler:4.7.1' | ||
|
||
// Instrumentation test dependencies | ||
androidTestImplementation jUnit | ||
androidTestImplementation mockito | ||
androidTestImplementation "org.mockito:mockito-android:$rootProject.mockitoVersion" | ||
androidTestImplementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion" | ||
androidTestImplementation("com.android.support.test.espresso:espresso-contrib:$rootProject.espressoVersion") { | ||
exclude group: 'com.android.support', module: 'appcompat' | ||
exclude group: 'com.android.support', module: 'support-v4' | ||
exclude group: 'com.android.support', module: 'recyclerview-v7' | ||
exclude group: 'com.android.support', module: 'design' | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
} | ||
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion" | ||
androidTestImplementation "com.android.support.test:runner:$rootProject.runnerVersion" | ||
androidTestImplementation "com.android.support.test:rules:$rootProject.rulesVersion" | ||
|
||
// Unit tests dependencies | ||
testImplementation jUnit | ||
testImplementation mockito | ||
testImplementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion" | ||
testImplementation "org.hamcrest:hamcrest-core:$rootProject.hamcrestVersion" | ||
testImplementation "org.hamcrest:hamcrest-library:$rootProject.hamcrestVersion" | ||
testImplementation "org.hamcrest:hamcrest-integration:$rootProject.hamcrestVersion" | ||
testImplementation 'org.robolectric:robolectric:3.3.1' | ||
} | ||
|
||
// Log out test results to console | ||
tasks.matching { it instanceof Test }.all { | ||
testLogging.events = ["failed", "passed", "skipped"] | ||
} | ||
|
||
/* | ||
Resolves dependency versions across test and production APKs, specifically, transitive | ||
dependencies. This is required since Espresso internally has a dependency on support-annotations. | ||
*/ | ||
configurations.all { | ||
resolutionStrategy { | ||
force 'com.android.support:support-annotations:27.1.1' | ||
force 'com.google.code.findbugs:jsr305:1.3.9' | ||
} | ||
} | ||
|
||
|
||
/* | ||
All direct/transitive dependencies shared between your test and production APKs need to be | ||
excluded from the test APK! This is necessary because both APKs will contain the same classes. Not | ||
excluding these dependencies from your test configuration will result in an dex pre-verifier error | ||
at runtime. More info in this tools bug: (https://code.google.com/p/android/issues/detail?id=192497) | ||
*/ | ||
configurations.compile.dependencies.each { compileDependency -> | ||
println "Excluding compile dependency: ${compileDependency.getName()}" | ||
configurations.androidTestCompile.dependencies.each { androidTestCompileDependency -> | ||
configurations.androidTestCompile.exclude module: "${compileDependency.getName()}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/org/mifos/mobile/cn/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.mifos.mobile.cn | ||
|
||
import android.support.test.InstrumentationRegistry | ||
import android.support.test.runner.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.getTargetContext() | ||
assertEquals("org.mifos.mobile.cn", appContext.packageName) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/commonTest/kotlin/org/mifos/mobile/cn/FakeJsonName.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.mifos.mobile.cn | ||
|
||
/** | ||
* @author Rajan Maurya | ||
* On 30/04/18. | ||
*/ | ||
object FakeJsonName { | ||
|
||
var TEST_JSON = "test.json" | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/commonTest/kotlin/org/mifos/mobile/cn/FakeRemoteDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package xyz.idtlabs.icommit.fieldui | ||
|
||
import org.mifos.mobile.cn.TestDataFactory | ||
|
||
/** | ||
* FakeRemoteDataSource is reading the local json files into the java object using gson. | ||
* Created by Rajan Maurya on 25/6/17. | ||
*/ | ||
class FakeRemoteDataSource { | ||
|
||
companion object { | ||
|
||
private val testDataFactory = TestDataFactory() | ||
|
||
/*fun getTestJson(): TestJson { | ||
return testDataFactory.convertJsonToDataObject(object : TypeToken<TestJson>() { | ||
}, FakeJsonName.TEST_JSON) | ||
}*/ | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
app/src/commonTest/kotlin/org/mifos/mobile/cn/TestDataFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.mifos.mobile.cn | ||
|
||
import com.google.gson.Gson | ||
import com.google.gson.reflect.TypeToken | ||
import com.google.gson.stream.JsonReader | ||
import java.io.InputStreamReader | ||
|
||
class TestDataFactory { | ||
|
||
/** | ||
* Note : This Generic Method DeSerialize Both Object and List Type Json in POJO | ||
* | ||
* | ||
* Note : Do Not use Array [] in POJO classes for of any element initialization, | ||
* Use Instead ArrayList. | ||
* | ||
* @param listModel Class of the List Model | ||
* @param jsonName Name of the Json in resources | ||
* @param <T> return type | ||
* @return Return the List of the listModel by Deserializing the Json of resources | ||
* @Example of Deserializing List Type Json | ||
* | ||
* | ||
* TestDataFactory mTestDataFactory = new TestDataFactory(); | ||
* | ||
* | ||
* List<Object> listObject = mTestDataFactory.convertJsonToDataObject( | ||
* new TypeToken<List></List><Object>>(){}, "ListObject.json") | ||
* @Example Of Deserializing Object Type Json | ||
* | ||
* | ||
* Object object = mTestDataFactory.convertJsonToDataObject( | ||
* new TypeToken<Object>(){}, "Object.json") | ||
</Object></Object></Object></T> */ | ||
fun <T> convertJsonToDataObject(listModel: TypeToken<T>, jsonName: String): T { | ||
val inputStream = javaClass.classLoader.getResourceAsStream(jsonName) | ||
val jsonReader = JsonReader(InputStreamReader(inputStream)) | ||
return Gson().fromJson(jsonReader, listModel.type) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.mifos.mobile.cn"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:name=".MifosApplication" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".ui.mifos.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.