Skip to content

Commit

Permalink
organized dependencies into single version source
Browse files Browse the repository at this point in the history
  • Loading branch information
jairrab committed Oct 7, 2019
1 parent 6f42910 commit 0077738
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 126 deletions.
21 changes: 10 additions & 11 deletions Data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,37 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'javax.inject:javax.inject:1'
implementation "javax.inject:javax.inject:$rootProject.javax_inject_version"

implementation "io.reactivex.rxjava2:rxkotlin:2.3.0"
implementation "io.reactivex.rxjava2:rxjava:2.2.9"
implementation "io.reactivex.rxjava2:rxkotlin:$rootProject.rxkotlin_version"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava_version"

implementation project(':Domain')

testImplementation 'junit:junit:4.12'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
testImplementation "junit:junit:$rootProject.junit_version"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:$rootProject.mockito_kotlin_version"
}

sourceCompatibility = "7"
targetCompatibility = "7"
sourceCompatibility = "$rootProject.javaSourceCompatibility"
targetCompatibility = "$rootProject.javaTargetCompatibility"
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$rootProject.kotlin_version"
}
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "$rootProject.jvmTarget"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "$rootProject.jvmTarget"
}
}
21 changes: 10 additions & 11 deletions Domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,38 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'javax.inject:javax.inject:1'
implementation "javax.inject:javax.inject:$rootProject.javax_inject_version"

implementation "io.reactivex.rxjava2:rxkotlin:2.3.0"
implementation "io.reactivex.rxjava2:rxjava:2.2.9"
implementation "io.reactivex.rxjava2:rxkotlin:$rootProject.rxkotlin_version"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava_version"
implementation 'junit:junit:4.12'

//Kotlin Json Serializer
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.11.1"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$rootProject.kotlin_serialization_version"

testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:$rootProject.mockito_kotlin_version"
}

sourceCompatibility = "7"
targetCompatibility = "7"
javaSourceCompatibility
targetCompatibility = "$rootProject.javaTargetCompatibility"
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$rootProject.kotlin_version"
}
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "$rootProject.jvmTarget"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "$rootProject.jvmTarget"
}
}
27 changes: 13 additions & 14 deletions Remote/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,41 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation "com.squareup.retrofit2:retrofit:2.6.0"
implementation "com.squareup.retrofit2:converter-gson:2.6.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.6.0"
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofit_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofit_version"

implementation "com.squareup.okhttp3:okhttp:3.12.3"
implementation "com.squareup.okhttp3:logging-interceptor:3.12.3"
implementation "com.squareup.okhttp3:okhttp:$rootProject.okhttp_version"
implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttp_version"

implementation 'javax.inject:javax.inject:1'
implementation "javax.inject:javax.inject:$rootProject.javax_inject_version"

implementation "io.reactivex.rxjava2:rxkotlin:2.3.0"
implementation "io.reactivex.rxjava2:rxjava:2.2.9"
implementation "io.reactivex.rxjava2:rxkotlin:$rootProject.rxkotlin_version"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava_version"

implementation project(':Data')
}

sourceCompatibility = "7"
targetCompatibility = "7"
javaSourceCompatibility
targetCompatibility = "$rootProject.javaTargetCompatibility"
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$rootProject.kotlin_version"
}
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "$rootProject.jvmTarget"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "$rootProject.jvmTarget"
}
}
66 changes: 32 additions & 34 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
compileSdkVersion rootProject.compileSdkVersion

buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
applicationId "com.jairrab.mapboxapp"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode rootProject.versionCode
versionName rootProject.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -27,34 +29,30 @@ android {

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.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.navigation:navigation-fragment-ktx:2.2.0-alpha03"
implementation "androidx.navigation:navigation-ui-ktx:2.2.0-alpha03"
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation "androidx.preference:preference-ktx:1.1.0"

implementation 'com.google.dagger:dagger-android-support:2.22.1'
kapt 'com.google.dagger:dagger-android-processor:2.22.1'
kapt 'com.google.dagger:dagger-compiler:2.22.1'

//implementation 'com.google.dagger:dagger:2.22.1'
//implementation 'com.google.dagger:dagger-android:2.22.1'

implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v8:0.3.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:4.9.0'

implementation "io.reactivex.rxjava2:rxandroid:2.1.1"

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlin_version"
implementation "androidx.appcompat:appcompat:$rootProject.appcompat_version"
implementation "androidx.core:core-ktx:$rootProject.ktx_version"
implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraint_layout_version"
testImplementation "junit:junit:$rootProject.junit_version"
androidTestImplementation "androidx.test:runner:$rootProject.androidx_test_runner_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espresso_version"

implementation "androidx.cardview:cardview:$rootProject.cardview_version"
implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.nav_fragment_version"
implementation "androidx.navigation:navigation-ui-ktx:$rootProject.nav_fragment_version"
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycle_version"
implementation "androidx.preference:preference-ktx:$rootProject.ktx_version"

implementation "com.google.dagger:dagger-android-support:$rootProject.dagger_version"
kapt "com.google.dagger:dagger-android-processor:$rootProject.dagger_version"
kapt "com.google.dagger:dagger-compiler:$rootProject.dagger_version"

implementation "com.mapbox.mapboxsdk:mapbox-android-sdk:$rootProject.mapbox_version"
implementation "com.mapbox.mapboxsdk:mapbox-sdk-turf:$rootProject.mapbox_turf_version"

implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroid_version"

debugImplementation "com.squareup.leakcanary:leakcanary-android:$rootProject.leakcanary_version"

implementation project(':presentation')
implementation project(':Domain')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ internal class ViewList @Inject constructor(
recyclerView.adapter = recyclerAdapter
}

fun updateRecyclerView(recyclerView: RecyclerView) {
val layoutManager = recyclerView.layoutManager as LinearLayoutManager
recyclerAdapter.notifyItemRangeChanged(
layoutManager.findFirstVisibleItemPosition(),
layoutManager.findLastVisibleItemPosition()
)
fun updateRecyclerView(recyclerView: RecyclerView?) {
(recyclerView?.layoutManager as? LinearLayoutManager)?.let {
recyclerAdapter.notifyItemRangeChanged(
it.findFirstVisibleItemPosition(),
it.findLastVisibleItemPosition()
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
import com.mapbox.mapboxsdk.maps.MapView
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.plugins.markerview.MarkerViewManager
import com.mapbox.mapboxsdk.style.layers.Property
import com.mapbox.mapboxsdk.style.layers.PropertyFactory
import com.mapbox.mapboxsdk.style.layers.SymbolLayer
Expand All @@ -45,14 +44,11 @@ internal class ViewMap @Inject constructor(
) : LifecycleObserver {

private var weakMapView: WeakReference<MapView?>? = null
private var markerViewManager: MarkerViewManager? = null

fun setup(mapView: MapView?, callback: (MapboxMap) -> Unit) {
weakMapView = WeakReference(mapView)

mapView?.getMapAsync { mapboxMap ->
markerViewManager = MarkerViewManager(mapView, mapboxMap)

mapboxMap.setStyle(Style.MAPBOX_STREETS) {
callback(mapboxMap)
}
Expand Down Expand Up @@ -97,10 +93,7 @@ internal class ViewMap @Inject constructor(
Lifecycle.Event.ON_RESUME -> mapView?.onResume()
Lifecycle.Event.ON_PAUSE -> mapView?.onPause()
Lifecycle.Event.ON_STOP -> mapView?.onStop()
Lifecycle.Event.ON_DESTROY -> {
mapView?.onDestroy()
markerViewManager?.onDestroy()
}
Lifecycle.Event.ON_DESTROY -> mapView?.onDestroy()
}
}

Expand Down Expand Up @@ -173,7 +166,7 @@ internal class ViewMap @Inject constructor(
toaster.showToast(
"$description\n" +
"Coordinates: $latitude:$longitude" +
(distance?.let { "\n$it from current location" }?:"")
(distance?.let { "\n$it from current location" } ?: "")
)
}
true
Expand Down
59 changes: 57 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,70 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
ext{
//App version
versionCode = 1
versionName = '1.0'

//SDK and tools
compileSdkVersion = 29
minSdkVersion = 21
targetSdkVersion = 29
buildToolsVersion = '29.0.2'

//Classpath
gradle_version = '3.5.0'
google_services_version = '4.3.1'
kotlin_version = '1.3.50'
fabric_version = '1.27.0'

appcompat_version = '1.1.0'
ktx_version = '1.1.0'
lifecycle_version = '2.1.0'
viewmodel_version = '2.2.0-alpha05'
room_version = '2.2.0-rc01'


constraint_layout_version = '1.1.3'
cardview_version = '1.0.0'
nav_fragment_version = '2.2.0-alpha03'
nav_fragment_version = '2.2.0-alpha03'

javax_inject_version = '1'
dagger_version = '2.22.1'
retrofit_version = '2.6.0'
okhttp_version = '3.12.3'
rxandroid_version = '2.1.1'
rxkotlin_version = '2.3.0'
rxjava_version = '2.2.9'
leakcanary_version = '2.0-beta-3'
mapbox_version = '8.4.0'
mapbox_turf_version = '4.9.0'
kotlin_serialization_version = '0.11.1'

junit_version = '4.12'
androidx_test_runner_version = '1.2.0'
espresso_version = '3.2.0'
mockito_kotlin_version = '2.1.0'

android_arch_core_testing_version = '1.1.1'
androidx_core_testing_version = '1.2.0'
androidx_junit_version = '1.1.1'

javaSourceCompatibility = '7'
javaTargetCompatibility = '7'
jvmTarget = '1.8'
}


repositories {
google()
jcenter()

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

//Serialization support
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
Expand Down
Loading

0 comments on commit 0077738

Please sign in to comment.