mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:15:14 +01:00
Remove apt, add manual EventBusIndex (not sure if it works)
This commit is contained in:
parent
14f248546a
commit
53fae2939a
@ -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"
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ open class App : Application() {
|
||||
|
||||
protected open fun setupEventBus() {
|
||||
EventBus.builder()
|
||||
.addIndex(EventBusIndex())
|
||||
.logNoSubscriberMessages(false)
|
||||
.installDefaultEventBus()
|
||||
}
|
||||
|
75
app/src/main/java/eu/kanade/tachiyomi/EventBusIndex.java
Normal file
75
app/src/main/java/eu/kanade/tachiyomi/EventBusIndex.java
Normal file
@ -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<Class<?>, SubscriberInfo> SUBSCRIBER_INDEX;
|
||||
|
||||
static {
|
||||
SUBSCRIBER_INDEX = new HashMap<Class<?>, 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
}
|
@ -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<MangaChapter> {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -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<MangaChapter>() {
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
22
app/src/test/java/eu/kanade/tachiyomi/TestApp.kt
Normal file
22
app/src/test/java/eu/kanade/tachiyomi/TestApp.kt
Normal file
@ -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
|
||||
}
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user