Skip to content

Commit

Permalink
Refactor all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Apr 1, 2018
1 parent 31c0b8f commit 3318285
Show file tree
Hide file tree
Showing 51 changed files with 481 additions and 198 deletions.
7 changes: 7 additions & 0 deletions .idea/gradle.xml

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

7 changes: 7 additions & 0 deletions .idea/modules.xml

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

10 changes: 10 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ android {

playAccountConfig = playAccountConfigs.defaultAccountConfig

buildConfigField "String", "TRAKT_CLIENT_ID", "\"" + propOrDef("TIVI_TRAKT_CLIENT_ID", "") + "\""
buildConfigField "String", "TRAKT_CLIENT_SECRET", "\"" + propOrDef("TIVI_TRAKT_CLIENT_SECRET", "") + "\""
buildConfigField "String", "TMDB_API_KEY", "\"" + propOrDef("TIVI_TMDB_API_KEY", "") + "\""

manifestPlaceholders += ['appAuthRedirectScheme': 'me.banes.chris.tivi']

// Crashlytics. Disabled by default
Expand Down Expand Up @@ -133,9 +137,15 @@ android {
}

dependencies {
implementation project(":base")
implementation project(":base-android")
implementation project(":data")
implementation project(":data-android")
implementation project(":trakt")
implementation project(":trakt-auth")
implementation project(":tmdb")
implementation project(":show-fetcher")
implementation project(":calls")

implementation "android.arch.lifecycle:extensions:${versions.arch_lifecycle}"
implementation "android.arch.lifecycle:reactivestreams:${versions.arch_lifecycle}"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/me/banes/chris/tivi/inject/AppComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import me.banes.chris.tivi.home.HomeBuilder
import me.banes.chris.tivi.jobs.JobsCreator
import me.banes.chris.tivi.showdetails.ShowDetailsBuilder
import me.banes.chris.tivi.tmdb.TmdbModule
import me.banes.chris.tivi.trakt.TraktAuthModule
import me.banes.chris.tivi.trakt.TraktModule
import javax.inject.Singleton

Expand All @@ -38,6 +39,7 @@ import javax.inject.Singleton
HomeBuilder::class,
ShowDetailsBuilder::class,
TraktModule::class,
TraktAuthModule::class,
TmdbModule::class,
NetworkModule::class
])
Expand Down
28 changes: 27 additions & 1 deletion app/src/main/java/me/banes/chris/tivi/inject/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import android.content.SharedPreferences
import android.preference.PreferenceManager
import dagger.Module
import dagger.Provides
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import me.banes.chris.tivi.AppNavigator
import me.banes.chris.tivi.BuildConfig
import me.banes.chris.tivi.TiviAppNavigator
import me.banes.chris.tivi.TiviApplication
import me.banes.chris.tivi.actions.TiviActions
Expand All @@ -45,7 +48,12 @@ class AppModule {
@Singleton
@Provides
fun provideRxSchedulers(): AppRxSchedulers {
return AppRxSchedulers()
return AppRxSchedulers(
Schedulers.single(),
Schedulers.io(),
Schedulers.io(),
AndroidSchedulers.mainThread()
)
}

@Named("app")
Expand Down Expand Up @@ -83,4 +91,22 @@ class AppModule {
fun provideTiviActions(): TiviActions {
return TiviActionsImpl()
}

@Provides
@Named("tmdb-api")
fun provideTmdbApiKey(): String {
return BuildConfig.TMDB_API_KEY
}

@Provides
@Named("trakt-client-id")
fun provideTraktClientId(): String {
return BuildConfig.TRAKT_CLIENT_ID
}

@Provides
@Named("trakt-client-secret")
fun provideTraktClientSecret(): String {
return BuildConfig.TRAKT_CLIENT_SECRET
}
}
46 changes: 46 additions & 0 deletions base-android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2017 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'

android {
compileSdkVersion 27

defaultConfig {
minSdkVersion 23
}

lintOptions {
disable 'GradleCompatible'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation project(":base")
implementation "com.android.support:support-fragment:${versions.support_library}"

compile "io.reactivex.rxjava2:rxandroid:2.0.2"

compile 'com.jakewharton.timber:timber:4.7.0'
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SharedElementHelper {

fun applyToTransaction(tx: FragmentTransaction) {
for ((viewRef, customTransitionName) in sharedElementViews) {
viewRef.get()?.apply {
viewRef.get().apply {
tx.addSharedElement(this, customTransitionName)
}
}
Expand Down
39 changes: 7 additions & 32 deletions base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,16 @@
*
*/

apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'

android {
compileSdkVersion 27

defaultConfig {
minSdkVersion 23
}

lintOptions {
disable 'GradleCompatible'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apply plugin: 'kotlin'

dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jre8:${versions.kotlin}"
api 'com.jakewharton.timber:timber:4.7.0'
api "com.google.dagger:dagger:${versions.dagger}"

api "android.arch.paging:runtime:${versions.arch_paging}"
// TODO want to remove this
implementation "com.android.support:support-fragment:${versions.support_library}"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}"
compile "com.google.dagger:dagger:${versions.dagger}"

api 'com.squareup.retrofit2:retrofit:2.4.0'
compile 'com.squareup.retrofit2:retrofit:2.4.0'

api 'com.squareup.okhttp3:logging-interceptor:3.10.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.10.0'

api "io.reactivex.rxjava2:rxjava:${versions.rx}"
api 'io.reactivex.rxjava2:rxkotlin:2.2.0'
implementation "io.reactivex.rxjava2:rxandroid:2.0.2"
compile "io.reactivex.rxjava2:rxjava:${versions.rx}"
compile 'io.reactivex.rxjava2:rxkotlin:2.2.0'
}
12 changes: 5 additions & 7 deletions base/src/main/java/me/banes/chris/tivi/util/AppRxSchedulers.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Google, Inc.
* Copyright 2018 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,12 +17,10 @@
package me.banes.chris.tivi.util

import io.reactivex.Scheduler
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

data class AppRxSchedulers(
val database: Scheduler = Schedulers.single(),
val disk: Scheduler = Schedulers.io(),
val network: Scheduler = Schedulers.io(),
val main: Scheduler = AndroidSchedulers.mainThread()
val database: Scheduler,
val disk: Scheduler,
val network: Scheduler,
val main: Scheduler
)
48 changes: 48 additions & 0 deletions calls/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2017 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

apply plugin: 'com.android.library'

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

android {
compileSdkVersion 27

defaultConfig {
minSdkVersion 23
}

lintOptions {
disable 'GradleCompatible'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation project(":base")
implementation project(":base-android")
implementation project(":show-fetcher")
implementation project(":trakt")
implementation project(":tmdb")
implementation project(":data")
implementation project(":data-android")
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Google, Inc.
* Copyright 2018 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Google, Inc.
* Copyright 2018 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
58 changes: 58 additions & 0 deletions data-android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright 2017 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

apply plugin: 'com.android.library'

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

android {
compileSdkVersion 27

defaultConfig {
minSdkVersion 23

javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}

lintOptions {
disable 'GradleCompatible'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation project(":base")
implementation project(":base-android")
implementation project(":data")

implementation "android.arch.persistence.room:runtime:${versions.arch_room}"
implementation "android.arch.persistence.room:rxjava2:${versions.arch_room}"
kapt "android.arch.persistence.room:compiler:${versions.arch_room}"

api "android.arch.paging:runtime:${versions.arch_paging}"

kapt "com.google.dagger:dagger-compiler:${versions.dagger}"
}
File renamed without changes.
Loading

0 comments on commit 3318285

Please sign in to comment.