Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Drjacky committed Oct 28, 2018
0 parents commit 4221463
Show file tree
Hide file tree
Showing 113 changed files with 3,024 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
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
Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/dictionaries/Abbasi.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions .idea/navEditor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions build.gradle
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
}
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
80 changes: 80 additions & 0 deletions data/build.gradle
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()
}
21 changes: 21 additions & 0 deletions data/proguard-rules.pro
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
2 changes: 2 additions & 0 deletions data/src/main/AndroidManifest.xml
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" />
45 changes: 45 additions & 0 deletions data/src/main/kotlin/ir/hosseinabbasi/data/api/AlbumApi.kt
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()
}
}
Loading

0 comments on commit 4221463

Please sign in to comment.