-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove some strings unused remove catalog view add captcha option when logging in
- Loading branch information
Showing
44 changed files
with
216 additions
and
1,650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
app/src/main/java/eu/kanade/tachiyomi/source/ConfigurableSource.kt
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
app/src/main/java/eu/kanade/tachiyomi/source/SourceFactory.kt
This file was deleted.
Oops, something went wrong.
64 changes: 5 additions & 59 deletions
64
app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,21 @@ | ||
package eu.kanade.tachiyomi.source | ||
|
||
import android.content.Context | ||
import eu.kanade.tachiyomi.R | ||
import eu.kanade.tachiyomi.source.model.Page | ||
import eu.kanade.tachiyomi.source.model.SChapter | ||
import eu.kanade.tachiyomi.source.model.SManga | ||
import eu.kanade.tachiyomi.source.online.HttpSource | ||
import eu.kanade.tachiyomi.source.online.english.Mangadex | ||
import rx.Observable | ||
|
||
open class SourceManager(private val context: Context) { | ||
open class SourceManager { | ||
|
||
private val sourcesMap = mutableMapOf<Long, Source>() | ||
|
||
private val stubSourcesMap = mutableMapOf<Long, StubSource>() | ||
|
||
init { | ||
createInternalSources().forEach { registerSource(it) } | ||
val source = Mangadex("en", "gb", 1) | ||
sourcesMap[source.id] = source | ||
} | ||
|
||
open fun get(sourceKey: Long): Source? { | ||
return sourcesMap[sourceKey] | ||
} | ||
fun getSource(sourceKey: Long): Source = sourcesMap[sourceKey]!! | ||
|
||
fun getOrStub(sourceKey: Long): Source { | ||
return sourcesMap[sourceKey] ?: stubSourcesMap.getOrPut(sourceKey) { | ||
StubSource(sourceKey) | ||
} | ||
} | ||
|
||
fun getOnlineSources() = sourcesMap.values.filterIsInstance<HttpSource>() | ||
|
||
fun getCatalogueSources() = sourcesMap.values.filterIsInstance<CatalogueSource>() | ||
|
||
internal fun registerSource(source: Source, overwrite: Boolean = false) { | ||
if (overwrite || !sourcesMap.containsKey(source.id)) { | ||
sourcesMap[source.id] = source | ||
} | ||
} | ||
|
||
internal fun unregisterSource(source: Source) { | ||
sourcesMap.remove(source.id) | ||
} | ||
|
||
private fun createInternalSources(): List<Source> = listOf( | ||
Mangadex("en", "gb", 1) | ||
) | ||
|
||
private inner class StubSource(override val id: Long) : Source { | ||
|
||
override val name: String | ||
get() = id.toString() | ||
|
||
override fun fetchMangaDetails(manga: SManga): Observable<SManga> { | ||
return Observable.error(getSourceNotInstalledException()) | ||
} | ||
fun getSources() = sourcesMap.values.toList() | ||
|
||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> { | ||
return Observable.error(getSourceNotInstalledException()) | ||
} | ||
|
||
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> { | ||
return Observable.error(getSourceNotInstalledException()) | ||
} | ||
|
||
override fun toString(): String { | ||
return name | ||
} | ||
|
||
private fun getSourceNotInstalledException(): Exception { | ||
return Exception(context.getString(R.string.source_not_installed, id.toString())) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 0 additions & 48 deletions
48
app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.