From fa8d0946e958d90458201bbcc26c53db4939b6b8 Mon Sep 17 00:00:00 2001 From: len Date: Wed, 6 Apr 2016 20:40:37 +0200 Subject: [PATCH] Remove unneded dependency --- app/build.gradle | 2 -- app/proguard-rules.pro | 13 ------------- app/src/main/java/eu/kanade/tachiyomi/App.kt | 8 -------- .../tachiyomi/data/download/DownloadService.kt | 12 ------------ .../tachiyomi/ui/manga/chapter/ChaptersPresenter.kt | 4 ++-- .../tachiyomi/ui/recent/RecentChaptersPresenter.kt | 7 ++++--- app/src/test/java/eu/kanade/tachiyomi/TestApp.kt | 4 ---- 7 files changed, 6 insertions(+), 44 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d002e2aac9..cb180b8588 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -130,8 +130,6 @@ dependencies { compile 'com.nononsenseapps:filepicker:2.5.2' compile 'com.github.amulyakhare:TextDrawable:558677e' - compile "org.greenrobot:eventbus:3.0.0" - compile "com.google.dagger:dagger:$DAGGER_VERSION" kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" kapt "com.pushtorefresh.storio:sqlite-annotations-processor:$STORIO_VERSION" diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index b75c022d13..0bbdd0063f 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -38,19 +38,6 @@ public (...); } -## GreenRobot EventBus specific rules ## -# http://greenrobot.org/eventbus/documentation/proguard/ --keepattributes *Annotation* --keepclassmembers class ** { - @org.greenrobot.eventbus.Subscribe ; -} --keep enum org.greenrobot.eventbus.ThreadMode { *; } - -# Only required if you use AsyncExecutor --keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent { - (java.lang.Throwable); -} - # Glide specific rules # # https://github.com/bumptech/glide -keep public class * implements com.bumptech.glide.module.GlideModule diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 54f81002a5..98be1f295e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.injection.component.DaggerAppComponent import eu.kanade.tachiyomi.injection.module.AppModule import org.acra.ACRA import org.acra.annotation.ReportsCrashes -import org.greenrobot.eventbus.EventBus import timber.log.Timber @ReportsCrashes( @@ -38,7 +37,6 @@ open class App : Application() { componentReflection = ComponentReflectionInjector(AppComponent::class.java, component) setupTheme() - setupEventBus() setupAcra() } @@ -51,12 +49,6 @@ open class App : Application() { .appModule(AppModule(this)) } - protected open fun setupEventBus() { - EventBus.builder() - .logNoSubscriberMessages(false) - .installDefaultEventBus() - } - protected open fun setupAcra() { ACRA.init(this) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt index 9add67cd78..597374c9d5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt @@ -10,11 +10,7 @@ import com.github.pwittchen.reactivenetwork.library.ReactiveNetwork import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.event.DownloadChaptersEvent import eu.kanade.tachiyomi.util.toast -import org.greenrobot.eventbus.EventBus -import org.greenrobot.eventbus.Subscribe -import org.greenrobot.eventbus.ThreadMode import rx.Subscription import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers @@ -48,7 +44,6 @@ class DownloadService : Service() { createWakeLock() listenQueueRunningChanges() - EventBus.getDefault().register(this) listenNetworkChanges() } @@ -57,7 +52,6 @@ class DownloadService : Service() { } override fun onDestroy() { - EventBus.getDefault().unregister(this) queueRunningSubscription?.unsubscribe() networkChangeSubscription?.unsubscribe() downloadManager.destroySubscriptions() @@ -69,12 +63,6 @@ class DownloadService : Service() { return null } - @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) - fun onEvent(event: DownloadChaptersEvent) { - EventBus.getDefault().removeStickyEvent(event) - downloadManager.onDownloadChaptersEvent(event) - } - private fun listenNetworkChanges() { networkChangeSubscription = ReactiveNetwork().enableInternetCheck() .observeConnectivity(applicationContext) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt index 90bdbaa284..7c06c1dee4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt @@ -16,7 +16,6 @@ import eu.kanade.tachiyomi.event.MangaEvent import eu.kanade.tachiyomi.event.ReaderEvent import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.SharedData -import org.greenrobot.eventbus.EventBus import rx.Observable import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers @@ -198,7 +197,8 @@ class ChaptersPresenter : BasePresenter() { fun downloadChapters(selectedChapters: Observable) { add(selectedChapters.toList() - .subscribe { chapters -> EventBus.getDefault().postSticky(DownloadChaptersEvent(manga, chapters)) }) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { downloadManager.onDownloadChaptersEvent(DownloadChaptersEvent(manga, it)) }) } fun deleteChapters(selectedChapters: Observable) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersPresenter.kt index 55e2f49876..0fbd17a230 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersPresenter.kt @@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.event.DownloadChaptersEvent import eu.kanade.tachiyomi.event.ReaderEvent import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.SharedData -import org.greenrobot.eventbus.EventBus import rx.Observable import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers @@ -267,7 +266,9 @@ class RecentChaptersPresenter : BasePresenter() { * @param manga manga that belongs to chapter */ fun downloadChapter(selectedChapter: Observable, manga: Manga) { - add(selectedChapter.toList().subscribe { chapters -> EventBus.getDefault().postSticky(DownloadChaptersEvent(manga, chapters)) }) + add(selectedChapter.toList() + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { downloadManager.onDownloadChaptersEvent(DownloadChaptersEvent(manga, it)) }) } /** @@ -289,7 +290,7 @@ class RecentChaptersPresenter : BasePresenter() { add(selectedChapters .subscribe( { chapter -> downloadManager.queue.del(chapter) }) - { error -> Timber.e(error.message) }) + { error -> Timber.e(error.message) }) } /** diff --git a/app/src/test/java/eu/kanade/tachiyomi/TestApp.kt b/app/src/test/java/eu/kanade/tachiyomi/TestApp.kt index d85bc10dc2..0685aced35 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/TestApp.kt +++ b/app/src/test/java/eu/kanade/tachiyomi/TestApp.kt @@ -12,10 +12,6 @@ open class TestApp : App() { .dataModule(TestDataModule()) } - override fun setupEventBus() { - // Do nothing - } - override fun setupAcra() { // Do nothing }