Skip to content

Commit

Permalink
init core module
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume M committed Jun 18, 2019
1 parent 1f91f73 commit c3e2df5
Show file tree
Hide file tree
Showing 88 changed files with 2,802 additions and 0 deletions.
38 changes: 38 additions & 0 deletions base_dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
dependencies {
implementation "com.google.dagger:dagger:$dagger_version"
implementation "androidx.multidex:multidex:$multidex_version"
implementation "androidx.vectordrawable:vectordrawable-animated:$vectordrawable_animated_version"
implementation "androidx.legacy:legacy-support-v13:$legacy_support_v13_version"
implementation "androidx.browser:browser:$browser_version"
implementation "androidx.cardview:cardview:$cardview_version"
implementation "androidx.legacy:legacy-support-v4:$legacy_support_v4_version"
implementation "androidx.gridlayout:gridlayout:$gridlayout_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "com.google.android.material:material:$material_version"
implementation "androidx.dynamicanimation:dynamicanimation:$dynamicanimation_version"
implementation "androidx.palette:palette:$palette_version"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
implementation "androidx.arch.core:core-runtime:$arch_core_version"
implementation "androidx.arch.core:core-common:$arch_core_version"
implementation "com.jakewharton.rxbinding2:rxbinding-kotlin:$rx_binding_version"
implementation "com.jakewharton.rxbinding2:rxbinding-recyclerview-v7-kotlin:$rx_binding_version"
implementation "io.reactivex.rxjava2:rxjava:$rx_java_version"
implementation "io.reactivex.rxjava2:rxandroid:$rx_android_version"
implementation "com.uber.autodispose:autodispose:$rx_auto_dispose_version"
implementation "com.uber.autodispose:autodispose-android:$rx_auto_dispose_version"
implementation "com.uber.autodispose:autodispose-android-archcomponents:$rx_auto_dispose_version"
implementation "com.uber.autodispose:autodispose-ktx:$rx_auto_dispose_ktx_version"
implementation "com.uber.autodispose:autodispose-android-ktx:$rx_auto_dispose_ktx_version"
implementation "com.uber.autodispose:autodispose-android-archcomponents-ktx:$rx_auto_dispose_ktx_version"
implementation "com.uber.autodispose:autodispose-android-archcomponents-test-ktx:$rx_auto_dispose_ktx_version"
implementation "com.jakewharton.timber:timber:$timber_version"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
implementation "com.squareup.moshi:moshi:$moshi_version"
implementation "com.github.bumptech.glide:glide:$glide_version"
implementation "com.airbnb.android:lottie:$lottie_version"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
25 changes: 25 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
51 changes: 51 additions & 0 deletions config_base.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ext {

application_id = "io.freshdroid.mymonzo"

version_code = 1
version_name = "0.1.0"

compile_sdk_version = 28
target_sdk_version = 28
min_sdk_version = 21

build_tools_version = "28.0.3"

multidex_version = "2.0.1"
support_library_version = "1.0.0"
vectordrawable_animated_version = "1.0.0"
legacy_support_v13_version = "1.0.0"
browser_version = "1.0.0"
cardview_version = "1.0.0"
legacy_support_v4_version = "1.0.0"
gridlayout_version = "1.0.0"
recyclerview_version = "1.0.0"
appcompat_version = "1.0.2"
material_version = "1.0.0"
dynamicanimation_version = "1.0.0"
palette_version = "1.0.0"
lifecycle_version = "2.0.0"
arch_core_version = "2.0.1"
dagger_version = "2.22.1"
timber_version = "4.7.1"
retrofit_version = "2.5.0"
moshi_version = "1.8.0"
okhttp3_version = "3.14.1"
ok2curl_version = "0.4.5"
rx_java_version = "2.2.8"
rx_android_version = "2.1.1"
rx_binding_version = "2.2.0"
rx_auto_dispose_version = "1.2.0"
rx_auto_dispose_ktx_version = "1.2.0"
glide_version = "4.9.0"
joda_time_version = "2.10"
chuck_version = "1.1.0"
lottie_version = "3.0.3"

mockito_version = "2.25.1"
robolectric_version = "4.3"
test_monitor_version = "1.1.1"
test_core_version = "1.1.0"
junit_version = "4.12"

}
64 changes: 64 additions & 0 deletions config_module.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apply from: '../config_base.gradle'

ext {
android {
compileSdkVersion project.compile_sdk_version
buildToolsVersion "$project.build_tools_version"

androidExtensions {
experimental = true
}

lintOptions {
quiet true
abortOnError true
warningsAsErrors true
}

testOptions {
unitTests.all {
jvmArgs '-noverify'

testLogging {
afterSuite { desc, result ->
if (!desc.parent) {
println "Results: ${result.resultType} (${result.testCount} test, ${result.successfulTestCount} success, ${result.failedTestCount} failure, ${result.skippedTestCount} skipped)"
}
}
}
}
unitTests {
includeAndroidResources = true
}
}

defaultConfig {
minSdkVersion project.min_sdk_version
targetSdkVersion project.target_sdk_version

vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
debug {
debuggable true
}
release {
debuggable false
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/LICENSE'
}
}

}
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
51 changes: 51 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

apply from: '../config_module.gradle'
apply from: '../base_dependencies.gradle'
apply from: '../test_dependencies.gradle'

def secretsPropertiesFile = rootProject.file("secrets.properties")
def secretsProperties = new Properties()
secretsProperties.load(new FileInputStream(secretsPropertiesFile))

android {

defaultConfig {
versionCode project.version_code
versionName = "$project.version_name"
}

lintOptions {
lintConfig file(project.rootDir.path + "/core/lint-rules.xml")
}

buildTypes {
debug {
buildConfigField 'String', 'BASE_URL', secretsProperties['devBaseUrl']
}
release {
buildConfigField 'String', 'BASE_URL', secretsProperties['prodBaseUrl']

minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
kapt "com.google.dagger:dagger-compiler:$dagger_version"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"

implementation "com.github.mrmike:ok2curl:$ok2curl_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"

debugImplementation "com.readystatesoftware.chuck:library:$chuck_version"
releaseImplementation "com.readystatesoftware.chuck:library-no-op:$chuck_version"
}
19 changes: 19 additions & 0 deletions core/lint-rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>

<issue id="ObsoleteSdkInt" severity="ignore" /> <!-- Prevent lint warning on build min21 -->
<issue id="GradleDependency" severity="ignore" />
<issue id="InvalidPackage" severity="ignore"/> <!-- caused by sdk Zendesk -->

<issue id="UnusedResources">
<ignore path="build" />
</issue>

<issue id="ParcelCreator"
severity="ignore" /> <!-- remove when kotlin @Parcelize no longer on experimental mode -->
<issue id="UnusedResources">
<ignore
path="src/main/res/" /> <!-- remove when gradle will suport Kotlin linter https://youtrack.jetbrains.com/issue/KT-12499#comment=27-2334737 -->
</issue>

</lint>
21 changes: 21 additions & 0 deletions core/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
8 changes: 8 additions & 0 deletions core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.freshdroid.core">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>

</manifest>
29 changes: 29 additions & 0 deletions core/src/main/java/io/freshdroid/core/di/CoreComponent.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.freshdroid.core.di

import android.app.Application
import android.content.Context
import android.content.SharedPreferences
import com.squareup.moshi.Moshi
import dagger.Component
import io.freshdroid.core.network.HttpTransitionFactoryType
import io.freshdroid.core.rx.RxBusType
import io.freshdroid.core.user.CurrentUserType
import io.reactivex.Scheduler
import okhttp3.OkHttpClient
import javax.inject.Singleton

@Singleton
@Component(modules = [CoreModule::class])
interface CoreComponent {

fun application(): Application
fun context(): Context
fun sharedPreferences(): SharedPreferences
fun currentUser(): CurrentUserType
fun httpTransitionFactory(): HttpTransitionFactoryType
fun okHttpClient(): OkHttpClient
fun moshi(): Moshi
fun scheduler(): Scheduler
fun rxBus(): RxBusType

}
Loading

0 comments on commit c3e2df5

Please sign in to comment.