2020-01-05 20:43:07 +01:00
|
|
|
package eu.kanade.tachiyomi.source
|
|
|
|
|
2020-03-20 06:52:03 +01:00
|
|
|
import android.graphics.drawable.Drawable
|
|
|
|
import eu.kanade.tachiyomi.extension.ExtensionManager
|
2020-01-05 20:43:07 +01:00
|
|
|
import eu.kanade.tachiyomi.source.model.Page
|
|
|
|
import eu.kanade.tachiyomi.source.model.SChapter
|
|
|
|
import eu.kanade.tachiyomi.source.model.SManga
|
2020-05-24 02:49:20 +02:00
|
|
|
import java.io.Serializable
|
2020-01-05 20:43:07 +01:00
|
|
|
import rx.Observable
|
2020-03-20 06:52:03 +01:00
|
|
|
import uy.kohesive.injekt.Injekt
|
|
|
|
import uy.kohesive.injekt.api.get
|
2020-01-05 20:43:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A basic interface for creating a source. It could be an online source, a local source, etc...
|
|
|
|
*/
|
2020-05-24 02:49:20 +02:00
|
|
|
interface Source : Serializable {
|
2020-01-05 20:43:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Id for the source. Must be unique.
|
|
|
|
*/
|
|
|
|
val id: Long
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the source.
|
|
|
|
*/
|
|
|
|
val name: String
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an observable with the updated details for a manga.
|
|
|
|
*
|
|
|
|
* @param manga the manga to update.
|
|
|
|
*/
|
|
|
|
fun fetchMangaDetails(manga: SManga): Observable<SManga>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an observable with all the available chapters for a manga.
|
|
|
|
*
|
|
|
|
* @param manga the manga to update.
|
|
|
|
*/
|
|
|
|
fun fetchChapterList(manga: SManga): Observable<List<SChapter>>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an observable with the list of pages a chapter has.
|
|
|
|
*
|
|
|
|
* @param chapter the chapter.
|
|
|
|
*/
|
|
|
|
fun fetchPageList(chapter: SChapter): Observable<List<Page>>
|
2020-02-27 00:03:34 +01:00
|
|
|
}
|
2020-03-20 06:52:03 +01:00
|
|
|
|
|
|
|
fun Source.icon(): Drawable? = Injekt.get<ExtensionManager>().getAppIconForSource(this)
|