diff --git a/app/build.gradle b/app/build.gradle index fc9512047..aac5991ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,6 @@ import java.text.SimpleDateFormat apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' -apply plugin: 'com.neenbedankt.android-apt' ext { // Git is needed in your system PATH for these commands to work. @@ -131,7 +130,6 @@ dependencies { compile 'com.github.amulyakhare:TextDrawable:558677e' compile "org.greenrobot:eventbus:3.0.0" - apt "org.greenrobot:eventbus-annotation-processor:3.0.1" compile "com.google.dagger:dagger:$DAGGER_VERSION" kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" @@ -151,7 +149,7 @@ dependencies { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } - androidTestApt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" + kaptTest "com.google.dagger:dagger-compiler:$DAGGER_VERSION" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 54f81002a..e615ab992 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -53,6 +53,7 @@ open class App : Application() { protected open fun setupEventBus() { EventBus.builder() + .addIndex(EventBusIndex()) .logNoSubscriberMessages(false) .installDefaultEventBus() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/EventBusIndex.java b/app/src/main/java/eu/kanade/tachiyomi/EventBusIndex.java new file mode 100644 index 000000000..2e3a61d00 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/EventBusIndex.java @@ -0,0 +1,75 @@ +package eu.kanade.tachiyomi; + +import org.greenrobot.eventbus.meta.SimpleSubscriberInfo; +import org.greenrobot.eventbus.meta.SubscriberMethodInfo; +import org.greenrobot.eventbus.meta.SubscriberInfo; +import org.greenrobot.eventbus.meta.SubscriberInfoIndex; + +import org.greenrobot.eventbus.ThreadMode; + +import java.util.HashMap; +import java.util.Map; + +/** This class is generated by EventBus, do not edit. */ +public class EventBusIndex implements SubscriberInfoIndex { + private static final Map, SubscriberInfo> SUBSCRIBER_INDEX; + + static { + SUBSCRIBER_INDEX = new HashMap, SubscriberInfo>(); + + putIndex(new SimpleSubscriberInfo(eu.kanade.tachiyomi.ui.manga.MangaPresenter.class, true, + new SubscriberMethodInfo[] { + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.data.database.models.Manga.class, ThreadMode.MAIN, 0, + true), + })); + + putIndex(new SimpleSubscriberInfo(eu.kanade.tachiyomi.ui.manga.myanimelist.MyAnimeListPresenter.class, true, + new SubscriberMethodInfo[] { + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.event.MangaEvent.class, ThreadMode.MAIN, 0, true), + })); + + putIndex(new SimpleSubscriberInfo(eu.kanade.tachiyomi.ui.reader.ReaderPresenter.class, true, + new SubscriberMethodInfo[] { + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.event.ReaderEvent.class, ThreadMode.MAIN, 0, true), + })); + + putIndex(new SimpleSubscriberInfo(eu.kanade.tachiyomi.ui.library.LibraryCategoryFragment.class, true, + new SubscriberMethodInfo[] { + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.event.LibraryMangasEvent.class, ThreadMode.MAIN, 0, + true), + })); + + putIndex(new SimpleSubscriberInfo(eu.kanade.tachiyomi.data.download.DownloadService.class, true, + new SubscriberMethodInfo[] { + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.event.DownloadChaptersEvent.class, ThreadMode.MAIN, + 0, true), + })); + + putIndex(new SimpleSubscriberInfo(eu.kanade.tachiyomi.ui.manga.chapter.ChaptersPresenter.class, true, + new SubscriberMethodInfo[] { + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.event.MangaEvent.class, ThreadMode.MAIN, 0, true), + })); + + putIndex(new SimpleSubscriberInfo(eu.kanade.tachiyomi.ui.manga.info.MangaInfoPresenter.class, true, + new SubscriberMethodInfo[] { + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.event.MangaEvent.class, ThreadMode.MAIN, 0, true), + new SubscriberMethodInfo("onEvent", eu.kanade.tachiyomi.event.ChapterCountEvent.class, ThreadMode.MAIN, 0, + true), + })); + + } + + private static void putIndex(SubscriberInfo info) { + SUBSCRIBER_INDEX.put(info.getSubscriberClass(), info); + } + + @Override + public SubscriberInfo getSubscriberInfo(Class subscriberClass) { + SubscriberInfo info = SUBSCRIBER_INDEX.get(subscriberClass); + if (info != null) { + return info; + } else { + return null; + } + } +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.java b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.java deleted file mode 100644 index 219fcdc58..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.kanade.tachiyomi.data.database.resolvers; - -import android.database.Cursor; -import android.support.annotation.NonNull; - -import eu.kanade.tachiyomi.data.database.models.Manga; -import eu.kanade.tachiyomi.data.database.models.MangaStorIOSQLiteGetResolver; -import eu.kanade.tachiyomi.data.database.tables.MangaTable; - -public class LibraryMangaGetResolver extends MangaStorIOSQLiteGetResolver { - - public static final LibraryMangaGetResolver INSTANCE = new LibraryMangaGetResolver(); - - @Override - @NonNull - public Manga mapFromCursor(@NonNull Cursor cursor) { - Manga manga = super.mapFromCursor(cursor); - - int unreadColumn = cursor.getColumnIndex(MangaTable.COLUMN_UNREAD); - manga.unread = cursor.getInt(unreadColumn); - - int categoryColumn = cursor.getColumnIndex(MangaTable.COLUMN_CATEGORY); - manga.category = cursor.getInt(categoryColumn); - - return manga; - } - -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.kt new file mode 100644 index 000000000..3a0ac84bc --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.kt @@ -0,0 +1,27 @@ +package eu.kanade.tachiyomi.data.database.resolvers + +import android.database.Cursor + +import eu.kanade.tachiyomi.data.database.models.Manga +import eu.kanade.tachiyomi.data.database.models.MangaStorIOSQLiteGetResolver +import eu.kanade.tachiyomi.data.database.tables.MangaTable + +class LibraryMangaGetResolver : MangaStorIOSQLiteGetResolver() { + + companion object { + val INSTANCE = LibraryMangaGetResolver() + } + + override fun mapFromCursor(cursor: Cursor): Manga { + val manga = super.mapFromCursor(cursor) + + val unreadColumn = cursor.getColumnIndex(MangaTable.COLUMN_UNREAD) + manga.unread = cursor.getInt(unreadColumn) + + val categoryColumn = cursor.getColumnIndex(MangaTable.COLUMN_CATEGORY) + manga.category = cursor.getInt(categoryColumn) + + return manga + } + +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.java b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.java deleted file mode 100644 index 35fbdc62d..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.java +++ /dev/null @@ -1,38 +0,0 @@ -package eu.kanade.tachiyomi.data.database.resolvers; - -import android.database.Cursor; -import android.support.annotation.NonNull; - -import com.pushtorefresh.storio.sqlite.operations.get.DefaultGetResolver; - -import eu.kanade.tachiyomi.data.database.models.Chapter; -import eu.kanade.tachiyomi.data.database.models.ChapterStorIOSQLiteGetResolver; -import eu.kanade.tachiyomi.data.database.models.Manga; -import eu.kanade.tachiyomi.data.database.models.MangaChapter; -import eu.kanade.tachiyomi.data.database.models.MangaStorIOSQLiteGetResolver; - -public class MangaChapterGetResolver extends DefaultGetResolver { - - public static final MangaChapterGetResolver INSTANCE = new MangaChapterGetResolver(); - - @NonNull - private final MangaStorIOSQLiteGetResolver mangaGetResolver; - - @NonNull - private final ChapterStorIOSQLiteGetResolver chapterGetResolver; - - public MangaChapterGetResolver() { - this.mangaGetResolver = new MangaStorIOSQLiteGetResolver(); - this.chapterGetResolver = new ChapterStorIOSQLiteGetResolver(); - } - - @NonNull - @Override - public MangaChapter mapFromCursor(@NonNull Cursor cursor) { - final Manga manga = mangaGetResolver.mapFromCursor(cursor); - final Chapter chapter = chapterGetResolver.mapFromCursor(cursor); - manga.id = chapter.manga_id; - - return new MangaChapter(manga, chapter); - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt new file mode 100644 index 000000000..e057c6a44 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt @@ -0,0 +1,27 @@ +package eu.kanade.tachiyomi.data.database.resolvers + +import android.database.Cursor +import com.pushtorefresh.storio.sqlite.operations.get.DefaultGetResolver +import eu.kanade.tachiyomi.data.database.models.ChapterStorIOSQLiteGetResolver +import eu.kanade.tachiyomi.data.database.models.MangaChapter +import eu.kanade.tachiyomi.data.database.models.MangaStorIOSQLiteGetResolver + +class MangaChapterGetResolver : DefaultGetResolver() { + + companion object { + val INSTANCE = MangaChapterGetResolver() + } + + private val mangaGetResolver = MangaStorIOSQLiteGetResolver() + + private val chapterGetResolver = ChapterStorIOSQLiteGetResolver() + + override fun mapFromCursor(cursor: Cursor): MangaChapter { + val manga = mangaGetResolver.mapFromCursor(cursor) + val chapter = chapterGetResolver.mapFromCursor(cursor) + manga.id = chapter.manga_id + + return MangaChapter(manga, chapter) + } + +} diff --git a/app/src/test/java/eu/kanade/tachiyomi/TestApp.java b/app/src/test/java/eu/kanade/tachiyomi/TestApp.java deleted file mode 100644 index f94649309..000000000 --- a/app/src/test/java/eu/kanade/tachiyomi/TestApp.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.kanade.tachiyomi; - -import eu.kanade.tachiyomi.injection.component.DaggerAppComponent; -import eu.kanade.tachiyomi.injection.module.AppModule; -import eu.kanade.tachiyomi.injection.module.TestDataModule; - -public class TestApp extends App { - - @Override - protected DaggerAppComponent.Builder prepareAppComponent() { - return DaggerAppComponent.builder() - .appModule(new AppModule(this)) - .dataModule(new TestDataModule()); - } - - @Override - protected void setupEventBus() { - // Do nothing - } - - @Override - protected void setupAcra() { - // Do nothing - } -} diff --git a/app/src/test/java/eu/kanade/tachiyomi/TestApp.kt b/app/src/test/java/eu/kanade/tachiyomi/TestApp.kt new file mode 100644 index 000000000..554865e5d --- /dev/null +++ b/app/src/test/java/eu/kanade/tachiyomi/TestApp.kt @@ -0,0 +1,22 @@ +package eu.kanade.tachiyomi + +import eu.kanade.tachiyomi.injection.component.DaggerAppComponent +import eu.kanade.tachiyomi.injection.module.AppModule +import eu.kanade.tachiyomi.injection.module.TestDataModule + +class TestApp : App() { + + override fun prepareAppComponent(): DaggerAppComponent.Builder { + return DaggerAppComponent.builder() + .appModule(AppModule(this)) + .dataModule(TestDataModule()) + } + + override fun setupEventBus() { + // Do nothing + } + + override fun setupAcra() { + // Do nothing + } +} diff --git a/build.gradle b/build.gradle index 922dc04c8..517e10293 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,6 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.1.0-alpha3' - classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files