-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
apply from: 'dependencies.gradle' | ||
|
||
buildscript { | ||
ext.kotlinVersion = '1.2.71' | ||
repositories { | ||
google() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.2.1' | ||
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion" | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" | ||
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha06" | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
} | ||
|
||
task runDomainTests(dependsOn: [':domain:test']) { | ||
description 'Run tests for the domain layer.' | ||
} | ||
|
||
task runDataTests(dependsOn: [':data:cleanTestDebugUnitTest', ':data:testDebugUnitTest', 'data:connectedAndroidTest']) { | ||
description 'Run tests for the data layer.' | ||
} | ||
|
||
task runAllTests(dependsOn: ['runDomainTests', | ||
'runDataTests', | ||
'presentation:cleanTestDebugUnitTest', | ||
'presentation:testDebugUnitTest', | ||
':presentation:connectedAndroidTest']) { | ||
|
||
description 'Run application tests.' | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
android { | ||
compileSdkVersion rootProject.ext.androidCompileSdkVersion | ||
defaultConfig { | ||
multiDexEnabled true | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
versionCode rootProject.ext.versionCode | ||
versionName rootProject.ext.versionName | ||
testInstrumentationRunner rootProject.ext.testInstrumentationRunner | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
targetCompatibility 1.8 | ||
sourceCompatibility 1.8 | ||
} | ||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
test.java.srcDirs += 'src/test/kotlin' | ||
androidTest.java.srcDirs += 'src/androidTest/kotlin' | ||
} | ||
} | ||
|
||
dependencies { | ||
def dataDependencies = rootProject.ext.dataDependencies | ||
def dataTestDependencies = rootProject.ext.dataTestDependencies | ||
|
||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
// android support libs | ||
implementation dataDependencies.appCompat | ||
// dependency injection | ||
implementation dataDependencies.javaxInject | ||
/*implementation dataDependencies.dagger | ||
implementation dataDependencies.daggerAndroid | ||
implementation dataDependencies.daggerAndroidSupport | ||
kapt dataDependencies.daggerAndroidProcessor | ||
annotationProcessor dataDependencies.daggerCompiler | ||
kapt dataDependencies.daggerCompiler*/ | ||
// reactive | ||
implementation dataDependencies.rxJava | ||
// network | ||
implementation dataDependencies.retrofit | ||
implementation dataDependencies.retrofitGsonConverter | ||
implementation dataDependencies.retrofitRxJava2Adapter | ||
implementation dataDependencies.okhttpLogging | ||
// database | ||
implementation dataDependencies.room | ||
kapt dataDependencies.roomCompiler | ||
implementation dataDependencies.roomCommon | ||
implementation dataDependencies.roomRxJava | ||
implementation dataDependencies.pagingRuntime | ||
implementation dataDependencies.pagingRxJava | ||
// other | ||
implementation dataDependencies.kotlin | ||
// android architecture component | ||
implementation dataDependencies.lifecycleExtensions | ||
implementation dataDependencies.lifecycleCommon | ||
implementation dataDependencies.reactiveStreams | ||
// test | ||
testImplementation dataTestDependencies.junit | ||
testImplementation dataTestDependencies.mockito | ||
androidTestImplementation dataTestDependencies.testRunner | ||
testImplementation dataTestDependencies.room | ||
|
||
implementation project(':domain') | ||
} | ||
repositories { | ||
mavenCentral() | ||
google() | ||
jcenter() | ||
} |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="ir.hosseinabbasi.data" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package ir.hosseinabbasi.data.api | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import io.reactivex.Single | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
import retrofit2.http.Query | ||
|
||
/** | ||
* Created by Dr.jacky on 9/19/2018. | ||
*/ | ||
/** | ||
* Get albums | ||
*/ | ||
interface AlbumApi { | ||
|
||
/** | ||
* Get all albums | ||
*/ | ||
@GET("albums?_limit=10") | ||
fun getAlbums(@Query("_start") limit: Int): Single<List<Dto.Album>> | ||
|
||
/** | ||
* Get an album photo by the album id | ||
*/ | ||
@GET("albums/{albumId}/photos") | ||
fun getPhotosByAlbumId(@Path("albumId") albumId: Int): Single<List<Dto.Photo>> | ||
|
||
sealed class Dto { | ||
|
||
data class Album( | ||
@SerializedName("id") val id: Long, | ||
@SerializedName("userId") val userId: Long, | ||
@SerializedName("title") val title: String | ||
) : Dto() | ||
|
||
data class Photo( | ||
@SerializedName("id") val id: Long, | ||
@SerializedName("albumId") val albumId: Long, | ||
@SerializedName("title") val title: String, | ||
@SerializedName("url") val url: String, | ||
@SerializedName("thumbnailUrl") val thumbnailUrl: String | ||
) : Dto() | ||
} | ||
} |