Formatting
This commit is contained in:
parent
2dfafa387b
commit
5afff31f72
197 changed files with 481 additions and 483 deletions
|
@ -93,7 +93,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||||
this@App,
|
this@App,
|
||||||
0,
|
0,
|
||||||
Intent(ACTION_DISABLE_INCOGNITO_MODE),
|
Intent(ACTION_DISABLE_INCOGNITO_MODE),
|
||||||
PendingIntent.FLAG_ONE_SHOT
|
PendingIntent.FLAG_ONE_SHOT,
|
||||||
)
|
)
|
||||||
setContentIntent(pendingIntent)
|
setContentIntent(pendingIntent)
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||||
PreferenceValues.ThemeMode.light -> AppCompatDelegate.MODE_NIGHT_NO
|
PreferenceValues.ThemeMode.light -> AppCompatDelegate.MODE_NIGHT_NO
|
||||||
PreferenceValues.ThemeMode.dark -> AppCompatDelegate.MODE_NIGHT_YES
|
PreferenceValues.ThemeMode.dark -> AppCompatDelegate.MODE_NIGHT_YES
|
||||||
PreferenceValues.ThemeMode.system -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
PreferenceValues.ThemeMode.system -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
|
}.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
|
||||||
interval.toLong(),
|
interval.toLong(),
|
||||||
TimeUnit.HOURS,
|
TimeUnit.HOURS,
|
||||||
10,
|
10,
|
||||||
TimeUnit.MINUTES
|
TimeUnit.MINUTES,
|
||||||
)
|
)
|
||||||
.addTag(TAG_AUTO)
|
.addTag(TAG_AUTO)
|
||||||
.setInputData(workDataOf(IS_AUTO_BACKUP_KEY to true))
|
.setInputData(workDataOf(IS_AUTO_BACKUP_KEY to true))
|
||||||
|
@ -79,7 +79,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
|
||||||
val inputData = workDataOf(
|
val inputData = workDataOf(
|
||||||
IS_AUTO_BACKUP_KEY to false,
|
IS_AUTO_BACKUP_KEY to false,
|
||||||
LOCATION_URI_KEY to uri.toString(),
|
LOCATION_URI_KEY to uri.toString(),
|
||||||
BACKUP_FLAGS_KEY to flags
|
BACKUP_FLAGS_KEY to flags,
|
||||||
)
|
)
|
||||||
val request = OneTimeWorkRequestBuilder<BackupCreatorJob>()
|
val request = OneTimeWorkRequestBuilder<BackupCreatorJob>()
|
||||||
.addTag(TAG_MANUAL)
|
.addTag(TAG_MANUAL)
|
||||||
|
|
|
@ -73,7 +73,7 @@ class BackupNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_share_24dp,
|
R.drawable.ic_share_24dp,
|
||||||
context.getString(R.string.action_share),
|
context.getString(R.string.action_share),
|
||||||
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE)
|
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE),
|
||||||
)
|
)
|
||||||
|
|
||||||
show(Notifications.ID_BACKUP_COMPLETE)
|
show(Notifications.ID_BACKUP_COMPLETE)
|
||||||
|
@ -97,7 +97,7 @@ class BackupNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_close_24dp,
|
R.drawable.ic_close_24dp,
|
||||||
context.getString(R.string.action_stop),
|
context.getString(R.string.action_stop),
|
||||||
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS)
|
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +124,8 @@ class BackupNotifier(private val context: Context) {
|
||||||
R.string.restore_duration,
|
R.string.restore_duration,
|
||||||
TimeUnit.MILLISECONDS.toMinutes(time),
|
TimeUnit.MILLISECONDS.toMinutes(time),
|
||||||
TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(
|
TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(
|
||||||
TimeUnit.MILLISECONDS.toMinutes(time)
|
TimeUnit.MILLISECONDS.toMinutes(time),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
with(completeNotificationBuilder) {
|
with(completeNotificationBuilder) {
|
||||||
|
@ -144,7 +144,7 @@ class BackupNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_folder_24dp,
|
R.drawable.ic_folder_24dp,
|
||||||
context.getString(R.string.action_show_errors),
|
context.getString(R.string.action_show_errors),
|
||||||
errorLogIntent
|
errorLogIntent,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||||
backupManga(databaseManga, flags),
|
backupManga(databaseManga, flags),
|
||||||
backupCategories(),
|
backupCategories(),
|
||||||
emptyList(),
|
emptyList(),
|
||||||
backupExtensionInfo(databaseManga)
|
backupExtensionInfo(databaseManga),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class BackupCategory(
|
||||||
return BackupCategory(
|
return BackupCategory(
|
||||||
name = category.name,
|
name = category.name,
|
||||||
order = category.order,
|
order = category.order,
|
||||||
flags = category.flags
|
flags = category.flags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ data class BackupChapter(
|
||||||
lastPageRead = chapter.last_page_read,
|
lastPageRead = chapter.last_page_read,
|
||||||
dateFetch = chapter.date_fetch,
|
dateFetch = chapter.date_fetch,
|
||||||
dateUpload = chapter.date_upload,
|
dateUpload = chapter.date_upload,
|
||||||
sourceOrder = chapter.source_order
|
sourceOrder = chapter.source_order,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ data class BackupManga(
|
||||||
dateAdded = manga.date_added,
|
dateAdded = manga.date_added,
|
||||||
viewer = manga.readingModeType,
|
viewer = manga.readingModeType,
|
||||||
viewer_flags = manga.viewer_flags,
|
viewer_flags = manga.viewer_flags,
|
||||||
chapterFlags = manga.chapter_flags
|
chapterFlags = manga.chapter_flags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ data class BackupSource(
|
||||||
fun copyFrom(source: Source): BackupSource {
|
fun copyFrom(source: Source): BackupSource {
|
||||||
return BackupSource(
|
return BackupSource(
|
||||||
name = source.name,
|
name = source.name,
|
||||||
sourceId = source.id
|
sourceId = source.id,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ data class BackupTracking(
|
||||||
status = track.status,
|
status = track.status,
|
||||||
startedReadingDate = track.started_reading_date,
|
startedReadingDate = track.started_reading_date,
|
||||||
finishedReadingDate = track.finished_reading_date,
|
finishedReadingDate = track.finished_reading_date,
|
||||||
trackingUrl = track.tracking_url
|
trackingUrl = track.tracking_url,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
||||||
// Read the json and create a Json Object,
|
// Read the json and create a Json Object,
|
||||||
// cannot use the backupManager json deserializer one because its not initialized yet
|
// cannot use the backupManager json deserializer one because its not initialized yet
|
||||||
val backupObject = Json.decodeFromStream<JsonObject>(
|
val backupObject = Json.decodeFromStream<JsonObject>(
|
||||||
context.contentResolver.openInputStream(uri)!!
|
context.contentResolver.openInputStream(uri)!!,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get parser version
|
// Get parser version
|
||||||
|
|
|
@ -21,7 +21,7 @@ class LegacyBackupRestoreValidator : AbstractBackupRestoreValidator() {
|
||||||
|
|
||||||
val backup = try {
|
val backup = try {
|
||||||
backupManager.parser.decodeFromStream<Backup>(
|
backupManager.parser.decodeFromStream<Backup>(
|
||||||
context.contentResolver.openInputStream(uri)!!
|
context.contentResolver.openInputStream(uri)!!,
|
||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
throw ValidatorParseException(e)
|
throw ValidatorParseException(e)
|
||||||
|
|
|
@ -27,7 +27,7 @@ open class CategoryBaseSerializer<T : Category> : KSerializer<T> {
|
||||||
buildJsonArray {
|
buildJsonArray {
|
||||||
add(value.name)
|
add(value.name)
|
||||||
add(value.order)
|
add(value.order)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ open class ChapterBaseSerializer<T : Chapter> : KSerializer<T> {
|
||||||
if (value.last_page_read != 0) {
|
if (value.last_page_read != 0) {
|
||||||
put(LAST_READ, value.last_page_read)
|
put(LAST_READ, value.last_page_read)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ object HistoryTypeSerializer : KSerializer<DHistory> {
|
||||||
buildJsonArray {
|
buildJsonArray {
|
||||||
add(value.url)
|
add(value.url)
|
||||||
add(value.lastRead)
|
add(value.lastRead)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ object HistoryTypeSerializer : KSerializer<DHistory> {
|
||||||
val array = decoder.decodeJsonElement().jsonArray
|
val array = decoder.decodeJsonElement().jsonArray
|
||||||
return DHistory(
|
return DHistory(
|
||||||
url = array[0].jsonPrimitive.content,
|
url = array[0].jsonPrimitive.content,
|
||||||
lastRead = array[1].jsonPrimitive.long
|
lastRead = array[1].jsonPrimitive.long,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ open class MangaBaseSerializer<T : Manga> : KSerializer<T> {
|
||||||
add(value.source)
|
add(value.source)
|
||||||
add(value.viewer_flags)
|
add(value.viewer_flags)
|
||||||
add(value.chapter_flags)
|
add(value.chapter_flags)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ open class TrackBaseSerializer<T : Track> : KSerializer<T> {
|
||||||
put(LIBRARY, value.library_id)
|
put(LIBRARY, value.library_id)
|
||||||
put(LAST_READ, value.last_chapter_read)
|
put(LAST_READ, value.last_chapter_read)
|
||||||
put(TRACKING_URL, value.tracking_url)
|
put(TRACKING_URL, value.tracking_url)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ChapterCache(private val context: Context) {
|
||||||
File(context.cacheDir, PARAMETER_CACHE_DIRECTORY),
|
File(context.cacheDir, PARAMETER_CACHE_DIRECTORY),
|
||||||
PARAMETER_APP_VERSION,
|
PARAMETER_APP_VERSION,
|
||||||
PARAMETER_VALUE_COUNT,
|
PARAMETER_VALUE_COUNT,
|
||||||
PARAMETER_CACHE_SIZE
|
PARAMETER_CACHE_SIZE,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -75,7 +75,7 @@ class MangaCoverFetcher(
|
||||||
return SourceResult(
|
return SourceResult(
|
||||||
source = ImageSource(file = file.toOkioPath(), diskCacheKey = diskCacheKey),
|
source = ImageSource(file = file.toOkioPath(), diskCacheKey = diskCacheKey),
|
||||||
mimeType = "image/*",
|
mimeType = "image/*",
|
||||||
dataSource = DataSource.DISK
|
dataSource = DataSource.DISK,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class MangaCoverFetcher(
|
||||||
return SourceResult(
|
return SourceResult(
|
||||||
source = snapshot.toImageSource(),
|
source = snapshot.toImageSource(),
|
||||||
mimeType = "image/*",
|
mimeType = "image/*",
|
||||||
dataSource = DataSource.DISK
|
dataSource = DataSource.DISK,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class MangaCoverFetcher(
|
||||||
return SourceResult(
|
return SourceResult(
|
||||||
source = snapshot.toImageSource(),
|
source = snapshot.toImageSource(),
|
||||||
mimeType = "image/*",
|
mimeType = "image/*",
|
||||||
dataSource = DataSource.NETWORK
|
dataSource = DataSource.NETWORK,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class MangaCoverFetcher(
|
||||||
return SourceResult(
|
return SourceResult(
|
||||||
source = ImageSource(source = responseBody.source(), context = options.context),
|
source = ImageSource(source = responseBody.source(), context = options.context),
|
||||||
mimeType = "image/*",
|
mimeType = "image/*",
|
||||||
dataSource = if (response.cacheResponse != null) DataSource.DISK else DataSource.NETWORK
|
dataSource = if (response.cacheResponse != null) DataSource.DISK else DataSource.NETWORK,
|
||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
responseBody.closeQuietly()
|
responseBody.closeQuietly()
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
|
||||||
|
|
||||||
return DecodeResult(
|
return DecodeResult(
|
||||||
drawable = bitmap.toDrawable(options.context.resources),
|
drawable = bitmap.toDrawable(options.context.resources),
|
||||||
isSampled = false
|
isSampled = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
|
||||||
// Fix kissmanga covers after supporting cloudflare
|
// Fix kissmanga covers after supporting cloudflare
|
||||||
db.execSQL(
|
db.execSQL(
|
||||||
"""UPDATE mangas SET thumbnail_url =
|
"""UPDATE mangas SET thumbnail_url =
|
||||||
REPLACE(thumbnail_url, '93.174.95.110', 'kissmanga.com') WHERE source = 4"""
|
REPLACE(thumbnail_url, '93.174.95.110', 'kissmanga.com') WHERE source = 4""",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (oldVersion < 3) {
|
if (oldVersion < 3) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.CategoryTable.TABLE
|
||||||
class CategoryTypeMapping : SQLiteTypeMapping<Category>(
|
class CategoryTypeMapping : SQLiteTypeMapping<Category>(
|
||||||
CategoryPutResolver(),
|
CategoryPutResolver(),
|
||||||
CategoryGetResolver(),
|
CategoryGetResolver(),
|
||||||
CategoryDeleteResolver()
|
CategoryDeleteResolver(),
|
||||||
)
|
)
|
||||||
|
|
||||||
class CategoryPutResolver : DefaultPutResolver<Category>() {
|
class CategoryPutResolver : DefaultPutResolver<Category>() {
|
||||||
|
@ -40,7 +40,7 @@ class CategoryPutResolver : DefaultPutResolver<Category>() {
|
||||||
COL_ID to obj.id,
|
COL_ID to obj.id,
|
||||||
COL_NAME to obj.name,
|
COL_NAME to obj.name,
|
||||||
COL_ORDER to obj.order,
|
COL_ORDER to obj.order,
|
||||||
COL_FLAGS to obj.flags
|
COL_FLAGS to obj.flags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import eu.kanade.tachiyomi.data.database.tables.ChapterTable.TABLE
|
||||||
class ChapterTypeMapping : SQLiteTypeMapping<Chapter>(
|
class ChapterTypeMapping : SQLiteTypeMapping<Chapter>(
|
||||||
ChapterPutResolver(),
|
ChapterPutResolver(),
|
||||||
ChapterGetResolver(),
|
ChapterGetResolver(),
|
||||||
ChapterDeleteResolver()
|
ChapterDeleteResolver(),
|
||||||
)
|
)
|
||||||
|
|
||||||
class ChapterPutResolver : DefaultPutResolver<Chapter>() {
|
class ChapterPutResolver : DefaultPutResolver<Chapter>() {
|
||||||
|
@ -56,7 +56,7 @@ class ChapterPutResolver : DefaultPutResolver<Chapter>() {
|
||||||
COL_DATE_UPLOAD to obj.date_upload,
|
COL_DATE_UPLOAD to obj.date_upload,
|
||||||
COL_LAST_PAGE_READ to obj.last_page_read,
|
COL_LAST_PAGE_READ to obj.last_page_read,
|
||||||
COL_CHAPTER_NUMBER to obj.chapter_number,
|
COL_CHAPTER_NUMBER to obj.chapter_number,
|
||||||
COL_SOURCE_ORDER to obj.source_order
|
COL_SOURCE_ORDER to obj.source_order,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.HistoryTable.TABLE
|
||||||
class HistoryTypeMapping : SQLiteTypeMapping<History>(
|
class HistoryTypeMapping : SQLiteTypeMapping<History>(
|
||||||
HistoryPutResolver(),
|
HistoryPutResolver(),
|
||||||
HistoryGetResolver(),
|
HistoryGetResolver(),
|
||||||
HistoryDeleteResolver()
|
HistoryDeleteResolver(),
|
||||||
)
|
)
|
||||||
|
|
||||||
open class HistoryPutResolver : DefaultPutResolver<History>() {
|
open class HistoryPutResolver : DefaultPutResolver<History>() {
|
||||||
|
@ -40,7 +40,7 @@ open class HistoryPutResolver : DefaultPutResolver<History>() {
|
||||||
COL_ID to obj.id,
|
COL_ID to obj.id,
|
||||||
COL_CHAPTER_ID to obj.chapter_id,
|
COL_CHAPTER_ID to obj.chapter_id,
|
||||||
COL_LAST_READ to obj.last_read,
|
COL_LAST_READ to obj.last_read,
|
||||||
COL_TIME_READ to obj.time_read
|
COL_TIME_READ to obj.time_read,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaCategoryTable.TABLE
|
||||||
class MangaCategoryTypeMapping : SQLiteTypeMapping<MangaCategory>(
|
class MangaCategoryTypeMapping : SQLiteTypeMapping<MangaCategory>(
|
||||||
MangaCategoryPutResolver(),
|
MangaCategoryPutResolver(),
|
||||||
MangaCategoryGetResolver(),
|
MangaCategoryGetResolver(),
|
||||||
MangaCategoryDeleteResolver()
|
MangaCategoryDeleteResolver(),
|
||||||
)
|
)
|
||||||
|
|
||||||
class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
|
class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
|
||||||
|
@ -37,7 +37,7 @@ class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
COL_ID to obj.id,
|
COL_ID to obj.id,
|
||||||
COL_MANGA_ID to obj.manga_id,
|
COL_MANGA_ID to obj.manga_id,
|
||||||
COL_CATEGORY_ID to obj.category_id
|
COL_CATEGORY_ID to obj.category_id,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.TABLE
|
||||||
class MangaTypeMapping : SQLiteTypeMapping<Manga>(
|
class MangaTypeMapping : SQLiteTypeMapping<Manga>(
|
||||||
MangaPutResolver(),
|
MangaPutResolver(),
|
||||||
MangaGetResolver(),
|
MangaGetResolver(),
|
||||||
MangaDeleteResolver()
|
MangaDeleteResolver(),
|
||||||
)
|
)
|
||||||
|
|
||||||
class MangaPutResolver : DefaultPutResolver<Manga>() {
|
class MangaPutResolver : DefaultPutResolver<Manga>() {
|
||||||
|
@ -66,7 +66,7 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
|
||||||
COL_VIEWER to obj.viewer_flags,
|
COL_VIEWER to obj.viewer_flags,
|
||||||
COL_CHAPTER_FLAGS to obj.chapter_flags,
|
COL_CHAPTER_FLAGS to obj.chapter_flags,
|
||||||
COL_COVER_LAST_MODIFIED to obj.cover_last_modified,
|
COL_COVER_LAST_MODIFIED to obj.cover_last_modified,
|
||||||
COL_DATE_ADDED to obj.date_added
|
COL_DATE_ADDED to obj.date_added,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.data.database.tables.TrackTable.TABLE
|
||||||
class TrackTypeMapping : SQLiteTypeMapping<Track>(
|
class TrackTypeMapping : SQLiteTypeMapping<Track>(
|
||||||
TrackPutResolver(),
|
TrackPutResolver(),
|
||||||
TrackGetResolver(),
|
TrackGetResolver(),
|
||||||
TrackDeleteResolver()
|
TrackDeleteResolver(),
|
||||||
)
|
)
|
||||||
|
|
||||||
class TrackPutResolver : DefaultPutResolver<Track>() {
|
class TrackPutResolver : DefaultPutResolver<Track>() {
|
||||||
|
@ -58,7 +58,7 @@ class TrackPutResolver : DefaultPutResolver<Track>() {
|
||||||
COL_TRACKING_URL to obj.tracking_url,
|
COL_TRACKING_URL to obj.tracking_url,
|
||||||
COL_SCORE to obj.score,
|
COL_SCORE to obj.score,
|
||||||
COL_START_DATE to obj.started_reading_date,
|
COL_START_DATE to obj.started_reading_date,
|
||||||
COL_FINISH_DATE to obj.finished_reading_date
|
COL_FINISH_DATE to obj.finished_reading_date,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,6 @@ fun Manga.toMangaInfo(): MangaInfo {
|
||||||
genres = this.getGenres() ?: emptyList(),
|
genres = this.getGenres() ?: emptyList(),
|
||||||
key = this.url,
|
key = this.url,
|
||||||
status = this.status,
|
status = this.status,
|
||||||
title = this.title
|
title = this.title,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ interface CategoryQueries : DbProvider {
|
||||||
Query.builder()
|
Query.builder()
|
||||||
.table(CategoryTable.TABLE)
|
.table(CategoryTable.TABLE)
|
||||||
.orderBy(CategoryTable.COL_ORDER)
|
.orderBy(CategoryTable.COL_ORDER)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ interface CategoryQueries : DbProvider {
|
||||||
RawQuery.builder()
|
RawQuery.builder()
|
||||||
.query(getCategoriesForMangaQuery())
|
.query(getCategoriesForMangaQuery())
|
||||||
.args(manga.id)
|
.args(manga.id)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ interface ChapterQueries : DbProvider {
|
||||||
.table(ChapterTable.TABLE)
|
.table(ChapterTable.TABLE)
|
||||||
.where("${ChapterTable.COL_MANGA_ID} = ?")
|
.where("${ChapterTable.COL_MANGA_ID} = ?")
|
||||||
.whereArgs(manga.id)
|
.whereArgs(manga.id)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ interface ChapterQueries : DbProvider {
|
||||||
.query(getRecentsQuery())
|
.query(getRecentsQuery())
|
||||||
.args(date.time)
|
.args(date.time)
|
||||||
.observesTables(ChapterTable.TABLE)
|
.observesTables(ChapterTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.withGetResolver(MangaChapterGetResolver.INSTANCE)
|
.withGetResolver(MangaChapterGetResolver.INSTANCE)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
@ -46,7 +46,7 @@ interface ChapterQueries : DbProvider {
|
||||||
.table(ChapterTable.TABLE)
|
.table(ChapterTable.TABLE)
|
||||||
.where("${ChapterTable.COL_ID} = ?")
|
.where("${ChapterTable.COL_ID} = ?")
|
||||||
.whereArgs(id)
|
.whereArgs(id)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ interface ChapterQueries : DbProvider {
|
||||||
.table(ChapterTable.TABLE)
|
.table(ChapterTable.TABLE)
|
||||||
.where("${ChapterTable.COL_URL} = ?")
|
.where("${ChapterTable.COL_URL} = ?")
|
||||||
.whereArgs(url)
|
.whereArgs(url)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ interface ChapterQueries : DbProvider {
|
||||||
.table(ChapterTable.TABLE)
|
.table(ChapterTable.TABLE)
|
||||||
.where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?")
|
.where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?")
|
||||||
.whereArgs(url, mangaId)
|
.whereArgs(url, mangaId)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ interface HistoryQueries : DbProvider {
|
||||||
.query(getRecentMangasQuery(search))
|
.query(getRecentMangasQuery(search))
|
||||||
.args(date.time, limit, offset)
|
.args(date.time, limit, offset)
|
||||||
.observesTables(HistoryTable.TABLE)
|
.observesTables(HistoryTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.withGetResolver(MangaChapterHistoryGetResolver.INSTANCE)
|
.withGetResolver(MangaChapterHistoryGetResolver.INSTANCE)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
@ -44,7 +44,7 @@ interface HistoryQueries : DbProvider {
|
||||||
.query(getHistoryByMangaId())
|
.query(getHistoryByMangaId())
|
||||||
.args(mangaId)
|
.args(mangaId)
|
||||||
.observesTables(HistoryTable.TABLE)
|
.observesTables(HistoryTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ interface HistoryQueries : DbProvider {
|
||||||
.query(getHistoryByChapterUrl())
|
.query(getHistoryByChapterUrl())
|
||||||
.args(chapterUrl)
|
.args(chapterUrl)
|
||||||
.observesTables(HistoryTable.TABLE)
|
.observesTables(HistoryTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ interface HistoryQueries : DbProvider {
|
||||||
.byQuery(
|
.byQuery(
|
||||||
DeleteQuery.builder()
|
DeleteQuery.builder()
|
||||||
.table(HistoryTable.TABLE)
|
.table(HistoryTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ interface HistoryQueries : DbProvider {
|
||||||
.table(HistoryTable.TABLE)
|
.table(HistoryTable.TABLE)
|
||||||
.where("${HistoryTable.COL_LAST_READ} = ?")
|
.where("${HistoryTable.COL_LAST_READ} = ?")
|
||||||
.whereArgs(0)
|
.whereArgs(0)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ interface MangaCategoryQueries : DbProvider {
|
||||||
.table(MangaCategoryTable.TABLE)
|
.table(MangaCategoryTable.TABLE)
|
||||||
.where("${MangaCategoryTable.COL_MANGA_ID} IN (${Queries.placeholders(mangas.size)})")
|
.where("${MangaCategoryTable.COL_MANGA_ID} IN (${Queries.placeholders(mangas.size)})")
|
||||||
.whereArgs(*mangas.map { it.id }.toTypedArray())
|
.whereArgs(*mangas.map { it.id }.toTypedArray())
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ interface MangaQueries : DbProvider {
|
||||||
RawQuery.builder()
|
RawQuery.builder()
|
||||||
.query(libraryQuery)
|
.query(libraryQuery)
|
||||||
.observesTables(MangaTable.TABLE, ChapterTable.TABLE, MangaCategoryTable.TABLE, CategoryTable.TABLE)
|
.observesTables(MangaTable.TABLE, ChapterTable.TABLE, MangaCategoryTable.TABLE, CategoryTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.withGetResolver(LibraryMangaGetResolver.INSTANCE)
|
.withGetResolver(LibraryMangaGetResolver.INSTANCE)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
@ -42,10 +42,10 @@ interface MangaQueries : DbProvider {
|
||||||
.where("${MangaTable.COL_FAVORITE} = 1 AND LOWER(${MangaTable.COL_TITLE}) = ? AND ${MangaTable.COL_SOURCE} != ?")
|
.where("${MangaTable.COL_FAVORITE} = 1 AND LOWER(${MangaTable.COL_TITLE}) = ? AND ${MangaTable.COL_SOURCE} != ?")
|
||||||
.whereArgs(
|
.whereArgs(
|
||||||
manga.title.lowercase(),
|
manga.title.lowercase(),
|
||||||
manga.source
|
manga.source,
|
||||||
)
|
)
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ interface MangaQueries : DbProvider {
|
||||||
.table(MangaTable.TABLE)
|
.table(MangaTable.TABLE)
|
||||||
.where("${MangaTable.COL_URL} = ? AND ${MangaTable.COL_SOURCE} = ?")
|
.where("${MangaTable.COL_URL} = ? AND ${MangaTable.COL_SOURCE} = ?")
|
||||||
.whereArgs(url, sourceId)
|
.whereArgs(url, sourceId)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ interface MangaQueries : DbProvider {
|
||||||
.table(MangaTable.TABLE)
|
.table(MangaTable.TABLE)
|
||||||
.where("${MangaTable.COL_ID} = ?")
|
.where("${MangaTable.COL_ID} = ?")
|
||||||
.whereArgs(id)
|
.whereArgs(id)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ interface MangaQueries : DbProvider {
|
||||||
RawQuery.builder()
|
RawQuery.builder()
|
||||||
.query(getSourceIdsWithNonLibraryMangaQuery())
|
.query(getSourceIdsWithNonLibraryMangaQuery())
|
||||||
.observesTables(MangaTable.TABLE)
|
.observesTables(MangaTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.withGetResolver(SourceIdMangaCountGetResolver.INSTANCE)
|
.withGetResolver(SourceIdMangaCountGetResolver.INSTANCE)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
@ -152,7 +152,7 @@ interface MangaQueries : DbProvider {
|
||||||
.table(MangaTable.TABLE)
|
.table(MangaTable.TABLE)
|
||||||
.where("${MangaTable.COL_FAVORITE} = ? AND ${MangaTable.COL_SOURCE} IN (${Queries.placeholders(sourceIds.size)})")
|
.where("${MangaTable.COL_FAVORITE} = ? AND ${MangaTable.COL_SOURCE} IN (${Queries.placeholders(sourceIds.size)})")
|
||||||
.whereArgs(0, *sourceIds.toTypedArray())
|
.whereArgs(0, *sourceIds.toTypedArray())
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ interface MangaQueries : DbProvider {
|
||||||
.byQuery(
|
.byQuery(
|
||||||
DeleteQuery.builder()
|
DeleteQuery.builder()
|
||||||
.table(MangaTable.TABLE)
|
.table(MangaTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ interface MangaQueries : DbProvider {
|
||||||
RawQuery.builder()
|
RawQuery.builder()
|
||||||
.query(getLastReadMangaQuery())
|
.query(getLastReadMangaQuery())
|
||||||
.observesTables(MangaTable.TABLE)
|
.observesTables(MangaTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ interface MangaQueries : DbProvider {
|
||||||
RawQuery.builder()
|
RawQuery.builder()
|
||||||
.query(getTotalChapterMangaQuery())
|
.query(getTotalChapterMangaQuery())
|
||||||
.observesTables(MangaTable.TABLE)
|
.observesTables(MangaTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ interface MangaQueries : DbProvider {
|
||||||
RawQuery.builder()
|
RawQuery.builder()
|
||||||
.query(getLatestChapterMangaQuery())
|
.query(getLatestChapterMangaQuery())
|
||||||
.observesTables(MangaTable.TABLE)
|
.observesTables(MangaTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ interface MangaQueries : DbProvider {
|
||||||
RawQuery.builder()
|
RawQuery.builder()
|
||||||
.query(getChapterFetchDateMangaQuery())
|
.query(getChapterFetchDateMangaQuery())
|
||||||
.observesTables(MangaTable.TABLE)
|
.observesTables(MangaTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ interface TrackQueries : DbProvider {
|
||||||
.withQuery(
|
.withQuery(
|
||||||
Query.builder()
|
Query.builder()
|
||||||
.table(TrackTable.TABLE)
|
.table(TrackTable.TABLE)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ interface TrackQueries : DbProvider {
|
||||||
.table(TrackTable.TABLE)
|
.table(TrackTable.TABLE)
|
||||||
.where("${TrackTable.COL_MANGA_ID} = ?")
|
.where("${TrackTable.COL_MANGA_ID} = ?")
|
||||||
.whereArgs(manga.id)
|
.whereArgs(manga.id)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ interface TrackQueries : DbProvider {
|
||||||
.table(TrackTable.TABLE)
|
.table(TrackTable.TABLE)
|
||||||
.where("${TrackTable.COL_MANGA_ID} = ? AND ${TrackTable.COL_SYNC_ID} = ?")
|
.where("${TrackTable.COL_MANGA_ID} = ? AND ${TrackTable.COL_SYNC_ID} = ?")
|
||||||
.whereArgs(manga.id, sync.id)
|
.whereArgs(manga.id, sync.id)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ class ChapterBackupPutResolver : PutResolver<Chapter>() {
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
ChapterTable.COL_READ to chapter.read,
|
ChapterTable.COL_READ to chapter.read,
|
||||||
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
||||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
|
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ class ChapterKnownBackupPutResolver : PutResolver<Chapter>() {
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
ChapterTable.COL_READ to chapter.read,
|
ChapterTable.COL_READ to chapter.read,
|
||||||
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
||||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
|
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ class ChapterProgressPutResolver : PutResolver<Chapter>() {
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
ChapterTable.COL_READ to chapter.read,
|
ChapterTable.COL_READ to chapter.read,
|
||||||
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
||||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
|
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,6 @@ class ChapterSourceOrderPutResolver : PutResolver<Chapter>() {
|
||||||
|
|
||||||
fun mapToContentValues(chapter: Chapter) =
|
fun mapToContentValues(chapter: Chapter) =
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
ChapterTable.COL_SOURCE_ORDER to chapter.source_order
|
ChapterTable.COL_SOURCE_ORDER to chapter.source_order,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class HistoryLastReadPutResolver : HistoryPutResolver() {
|
||||||
.table(updateQuery.table())
|
.table(updateQuery.table())
|
||||||
.where(updateQuery.where())
|
.where(updateQuery.where())
|
||||||
.whereArgs(updateQuery.whereArgs())
|
.whereArgs(updateQuery.whereArgs())
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
||||||
cursor.use { putCursor ->
|
cursor.use { putCursor ->
|
||||||
|
@ -47,6 +47,6 @@ class HistoryLastReadPutResolver : HistoryPutResolver() {
|
||||||
|
|
||||||
private fun mapToUpdateContentValues(history: History) =
|
private fun mapToUpdateContentValues(history: History) =
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
HistoryTable.COL_LAST_READ to history.last_read
|
HistoryTable.COL_LAST_READ to history.last_read,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,6 @@ class MangaCoverLastModifiedPutResolver : PutResolver<Manga>() {
|
||||||
|
|
||||||
fun mapToContentValues(manga: Manga) =
|
fun mapToContentValues(manga: Manga) =
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
MangaTable.COL_COVER_LAST_MODIFIED to manga.cover_last_modified
|
MangaTable.COL_COVER_LAST_MODIFIED to manga.cover_last_modified,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,6 @@ class MangaFavoritePutResolver : PutResolver<Manga>() {
|
||||||
|
|
||||||
fun mapToContentValues(manga: Manga) =
|
fun mapToContentValues(manga: Manga) =
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
MangaTable.COL_FAVORITE to manga.favorite
|
MangaTable.COL_FAVORITE to manga.favorite,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ class MangaFlagsPutResolver(private val colName: String, private val fieldGetter
|
||||||
|
|
||||||
fun mapToContentValues(manga: Manga) =
|
fun mapToContentValues(manga: Manga) =
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
colName to fieldGetter.get(manga)
|
colName to fieldGetter.get(manga),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,6 @@ class MangaLastUpdatedPutResolver : PutResolver<Manga>() {
|
||||||
|
|
||||||
fun mapToContentValues(manga: Manga) =
|
fun mapToContentValues(manga: Manga) =
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
MangaTable.COL_LAST_UPDATE to manga.last_update
|
MangaTable.COL_LAST_UPDATE to manga.last_update,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,6 @@ class MangaTitlePutResolver : PutResolver<Manga>() {
|
||||||
|
|
||||||
fun mapToContentValues(manga: Manga) =
|
fun mapToContentValues(manga: Manga) =
|
||||||
contentValuesOf(
|
contentValuesOf(
|
||||||
MangaTable.COL_TITLE to manga.title
|
MangaTable.COL_TITLE to manga.title,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,14 +93,14 @@ internal class DownloadNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_pause_24dp,
|
R.drawable.ic_pause_24dp,
|
||||||
context.getString(R.string.action_pause),
|
context.getString(R.string.action_pause),
|
||||||
NotificationReceiver.pauseDownloadsPendingBroadcast(context)
|
NotificationReceiver.pauseDownloadsPendingBroadcast(context),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val downloadingProgressText = context.getString(
|
val downloadingProgressText = context.getString(
|
||||||
R.string.chapter_downloading_progress,
|
R.string.chapter_downloading_progress,
|
||||||
download.downloadedImages,
|
download.downloadedImages,
|
||||||
download.pages!!.size
|
download.pages!!.size,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (preferences.hideNotificationContent()) {
|
if (preferences.hideNotificationContent()) {
|
||||||
|
@ -138,13 +138,13 @@ internal class DownloadNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_play_arrow_24dp,
|
R.drawable.ic_play_arrow_24dp,
|
||||||
context.getString(R.string.action_resume),
|
context.getString(R.string.action_resume),
|
||||||
NotificationReceiver.resumeDownloadsPendingBroadcast(context)
|
NotificationReceiver.resumeDownloadsPendingBroadcast(context),
|
||||||
)
|
)
|
||||||
// Clear action
|
// Clear action
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_close_24dp,
|
R.drawable.ic_close_24dp,
|
||||||
context.getString(R.string.action_cancel_all),
|
context.getString(R.string.action_cancel_all),
|
||||||
NotificationReceiver.clearDownloadsPendingBroadcast(context)
|
NotificationReceiver.clearDownloadsPendingBroadcast(context),
|
||||||
)
|
)
|
||||||
|
|
||||||
show(Notifications.ID_DOWNLOAD_CHAPTER_PROGRESS)
|
show(Notifications.ID_DOWNLOAD_CHAPTER_PROGRESS)
|
||||||
|
@ -213,7 +213,7 @@ internal class DownloadNotifier(private val context: Context) {
|
||||||
// Create notification
|
// Create notification
|
||||||
with(errorNotificationBuilder) {
|
with(errorNotificationBuilder) {
|
||||||
setContentTitle(
|
setContentTitle(
|
||||||
mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title)
|
mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title),
|
||||||
)
|
)
|
||||||
setContentText(error ?: context.getString(R.string.download_notifier_unknown_error))
|
setContentText(error ?: context.getString(R.string.download_notifier_unknown_error))
|
||||||
setSmallIcon(R.drawable.ic_warning_white_24dp)
|
setSmallIcon(R.drawable.ic_warning_white_24dp)
|
||||||
|
|
|
@ -138,7 +138,7 @@ class DownloadProvider(private val context: Context) {
|
||||||
when {
|
when {
|
||||||
chapter.scanlator != null -> "${chapter.scanlator}_${chapter.name}"
|
chapter.scanlator != null -> "${chapter.scanlator}_${chapter.name}"
|
||||||
else -> chapter.name
|
else -> chapter.name
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class DownloadProvider(private val context: Context) {
|
||||||
"$chapterName.cbz",
|
"$chapterName.cbz",
|
||||||
|
|
||||||
// Legacy chapter directory name used in v0.9.2 and before
|
// Legacy chapter directory name used in v0.9.2 and before
|
||||||
DiskUtil.buildValidFilename(chapter.name)
|
DiskUtil.buildValidFilename(chapter.name),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ class Downloader(
|
||||||
downloadChapter(download).subscribeOn(Schedulers.io())
|
downloadChapter(download).subscribeOn(Schedulers.io())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
5
|
5,
|
||||||
)
|
)
|
||||||
.onBackpressureLatest()
|
.onBackpressureLatest()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
@ -223,7 +223,7 @@ class Downloader(
|
||||||
DownloadService.stop(context)
|
DownloadService.stop(context)
|
||||||
logcat(LogPriority.ERROR, error)
|
logcat(LogPriority.ERROR, error)
|
||||||
notifier.onError(error.message)
|
notifier.onError(error.message)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
||||||
interval.toLong(),
|
interval.toLong(),
|
||||||
TimeUnit.HOURS,
|
TimeUnit.HOURS,
|
||||||
10,
|
10,
|
||||||
TimeUnit.MINUTES
|
TimeUnit.MINUTES,
|
||||||
)
|
)
|
||||||
.addTag(TAG)
|
.addTag(TAG)
|
||||||
.setConstraints(constraints)
|
.setConstraints(constraints)
|
||||||
|
|
|
@ -86,7 +86,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
Notifications.ID_LIBRARY_PROGRESS,
|
Notifications.ID_LIBRARY_PROGRESS,
|
||||||
progressNotificationBuilder
|
progressNotificationBuilder
|
||||||
.setProgress(total, current, false)
|
.setProgress(total, current, false)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
|
|
||||||
setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
|
setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
|
||||||
}
|
}
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
setSmallIcon(R.drawable.ic_tachi)
|
setSmallIcon(R.drawable.ic_tachi)
|
||||||
addAction(R.drawable.ic_help_24dp, context.getString(R.string.learn_more), NotificationHandler.openUrl(context, HELP_SKIPPED_URL))
|
addAction(R.drawable.ic_help_24dp, context.getString(R.string.learn_more), NotificationHandler.openUrl(context, HELP_SKIPPED_URL))
|
||||||
}
|
}
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +161,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
NotificationCompat.BigTextStyle().bigText(
|
NotificationCompat.BigTextStyle().bigText(
|
||||||
updates.joinToString("\n") {
|
updates.joinToString("\n") {
|
||||||
it.first.title.chop(NOTIF_TITLE_MAX_LEN)
|
it.first.title.chop(NOTIF_TITLE_MAX_LEN)
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
|
|
||||||
setContentIntent(getNotificationIntent())
|
setContentIntent(getNotificationIntent())
|
||||||
setAutoCancel(true)
|
setAutoCancel(true)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// Per-manga notification
|
// Per-manga notification
|
||||||
|
@ -222,8 +222,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
context,
|
context,
|
||||||
manga,
|
manga,
|
||||||
chapters,
|
chapters,
|
||||||
Notifications.ID_NEW_CHAPTERS
|
Notifications.ID_NEW_CHAPTERS,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
// View chapters action
|
// View chapters action
|
||||||
addAction(
|
addAction(
|
||||||
|
@ -232,8 +232,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
NotificationReceiver.openChapterPendingActivity(
|
NotificationReceiver.openChapterPendingActivity(
|
||||||
context,
|
context,
|
||||||
manga,
|
manga,
|
||||||
Notifications.ID_NEW_CHAPTERS
|
Notifications.ID_NEW_CHAPTERS,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
// Download chapters action
|
// Download chapters action
|
||||||
// Only add the action when chapters is within threshold
|
// Only add the action when chapters is within threshold
|
||||||
|
@ -245,8 +245,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
context,
|
context,
|
||||||
manga,
|
manga,
|
||||||
chapters,
|
chapters,
|
||||||
Notifications.ID_NEW_CHAPTERS
|
Notifications.ID_NEW_CHAPTERS,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||||
val formatter = DecimalFormat(
|
val formatter = DecimalFormat(
|
||||||
"#.###",
|
"#.###",
|
||||||
DecimalFormatSymbols()
|
DecimalFormatSymbols()
|
||||||
.apply { decimalSeparator = '.' }
|
.apply { decimalSeparator = '.' },
|
||||||
)
|
)
|
||||||
|
|
||||||
val displayableChapterNumbers = chapters
|
val displayableChapterNumbers = chapters
|
||||||
|
|
|
@ -310,7 +310,7 @@ class LibraryUpdateService(
|
||||||
withUpdateNotification(
|
withUpdateNotification(
|
||||||
currentlyUpdatingManga,
|
currentlyUpdatingManga,
|
||||||
progressCount,
|
progressCount,
|
||||||
manga
|
manga,
|
||||||
) { manga ->
|
) { manga ->
|
||||||
try {
|
try {
|
||||||
when {
|
when {
|
||||||
|
@ -336,7 +336,7 @@ class LibraryUpdateService(
|
||||||
// Convert to the manga that contains new chapters
|
// Convert to the manga that contains new chapters
|
||||||
newUpdates.add(
|
newUpdates.add(
|
||||||
manga to newChapters.sortedByDescending { ch -> ch.source_order }
|
manga to newChapters.sortedByDescending { ch -> ch.source_order }
|
||||||
.toTypedArray()
|
.toTypedArray(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ class LibraryUpdateService(
|
||||||
val errorFile = writeErrorFile(failedUpdates)
|
val errorFile = writeErrorFile(failedUpdates)
|
||||||
notifier.showUpdateErrorNotification(
|
notifier.showUpdateErrorNotification(
|
||||||
failedUpdates.size,
|
failedUpdates.size,
|
||||||
errorFile.getUriCompat(this)
|
errorFile.getUriCompat(this),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (skippedUpdates.isNotEmpty()) {
|
if (skippedUpdates.isNotEmpty()) {
|
||||||
|
@ -446,7 +446,7 @@ class LibraryUpdateService(
|
||||||
withUpdateNotification(
|
withUpdateNotification(
|
||||||
currentlyUpdatingManga,
|
currentlyUpdatingManga,
|
||||||
progressCount,
|
progressCount,
|
||||||
manga
|
manga,
|
||||||
) { manga ->
|
) { manga ->
|
||||||
sourceManager.get(manga.source)?.let { source ->
|
sourceManager.get(manga.source)?.let { source ->
|
||||||
try {
|
try {
|
||||||
|
@ -536,7 +536,7 @@ class LibraryUpdateService(
|
||||||
notifier.showProgressNotification(
|
notifier.showProgressNotification(
|
||||||
updatingManga,
|
updatingManga,
|
||||||
completed.get(),
|
completed.get(),
|
||||||
mangaToUpdate.size
|
mangaToUpdate.size,
|
||||||
)
|
)
|
||||||
|
|
||||||
block(manga)
|
block(manga)
|
||||||
|
@ -550,7 +550,7 @@ class LibraryUpdateService(
|
||||||
notifier.showProgressNotification(
|
notifier.showProgressNotification(
|
||||||
updatingManga,
|
updatingManga,
|
||||||
completed.get(),
|
completed.get(),
|
||||||
mangaToUpdate.size
|
mangaToUpdate.size,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,14 +59,14 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||||
shareImage(
|
shareImage(
|
||||||
context,
|
context,
|
||||||
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
|
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
|
||||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||||
)
|
)
|
||||||
// Delete image from path and dismiss notification
|
// Delete image from path and dismiss notification
|
||||||
ACTION_DELETE_IMAGE ->
|
ACTION_DELETE_IMAGE ->
|
||||||
deleteImage(
|
deleteImage(
|
||||||
context,
|
context,
|
||||||
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
|
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
|
||||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||||
)
|
)
|
||||||
// Share backup file
|
// Share backup file
|
||||||
ACTION_SHARE_BACKUP ->
|
ACTION_SHARE_BACKUP ->
|
||||||
|
@ -74,11 +74,11 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||||
context,
|
context,
|
||||||
intent.getParcelableExtra(EXTRA_URI)!!,
|
intent.getParcelableExtra(EXTRA_URI)!!,
|
||||||
"application/x-protobuf+gzip",
|
"application/x-protobuf+gzip",
|
||||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||||
)
|
)
|
||||||
ACTION_CANCEL_RESTORE -> cancelRestore(
|
ACTION_CANCEL_RESTORE -> cancelRestore(
|
||||||
context,
|
context,
|
||||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||||
)
|
)
|
||||||
// Cancel library update and dismiss notification
|
// Cancel library update and dismiss notification
|
||||||
ACTION_CANCEL_LIBRARY_UPDATE -> cancelLibraryUpdate(context, Notifications.ID_LIBRARY_PROGRESS)
|
ACTION_CANCEL_LIBRARY_UPDATE -> cancelLibraryUpdate(context, Notifications.ID_LIBRARY_PROGRESS)
|
||||||
|
@ -87,7 +87,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||||
openChapter(
|
openChapter(
|
||||||
context,
|
context,
|
||||||
intent.getLongExtra(EXTRA_MANGA_ID, -1),
|
intent.getLongExtra(EXTRA_MANGA_ID, -1),
|
||||||
intent.getLongExtra(EXTRA_CHAPTER_ID, -1)
|
intent.getLongExtra(EXTRA_CHAPTER_ID, -1),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Mark updated manga chapters as read
|
// Mark updated manga chapters as read
|
||||||
|
@ -120,7 +120,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||||
context,
|
context,
|
||||||
intent.getParcelableExtra(EXTRA_URI)!!,
|
intent.getParcelableExtra(EXTRA_URI)!!,
|
||||||
"text/plain",
|
"text/plain",
|
||||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ object Notifications {
|
||||||
"backup_restore_complete_channel",
|
"backup_restore_complete_channel",
|
||||||
"library_channel",
|
"library_channel",
|
||||||
"library_progress_channel",
|
"library_progress_channel",
|
||||||
"updates_ext_channel"
|
"updates_ext_channel",
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,8 +115,8 @@ object Notifications {
|
||||||
},
|
},
|
||||||
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
|
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
|
||||||
setName(context.getString(R.string.label_recent_updates))
|
setName(context.getString(R.string.label_recent_updates))
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
notificationService.createNotificationChannelsCompat(
|
notificationService.createNotificationChannelsCompat(
|
||||||
|
@ -181,8 +181,8 @@ object Notifications {
|
||||||
buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) {
|
buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) {
|
||||||
setGroup(GROUP_APK_UPDATES)
|
setGroup(GROUP_APK_UPDATES)
|
||||||
setName(context.getString(R.string.channel_ext_updates))
|
setName(context.getString(R.string.channel_ext_updates))
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ class PreferencesHelper(val context: Context) {
|
||||||
private val defaultDownloadsDir = File(
|
private val defaultDownloadsDir = File(
|
||||||
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
||||||
context.getString(R.string.app_name),
|
context.getString(R.string.app_name),
|
||||||
"downloads"
|
"downloads",
|
||||||
).toUri()
|
).toUri()
|
||||||
|
|
||||||
private val defaultBackupDir = File(
|
private val defaultBackupDir = File(
|
||||||
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
||||||
context.getString(R.string.app_name),
|
context.getString(R.string.app_name),
|
||||||
"backup"
|
"backup",
|
||||||
).toUri()
|
).toUri()
|
||||||
|
|
||||||
fun startScreen() = prefs.getInt(Keys.startScreen, 1)
|
fun startScreen() = prefs.getInt(Keys.startScreen, 1)
|
||||||
|
@ -67,12 +67,12 @@ class PreferencesHelper(val context: Context) {
|
||||||
|
|
||||||
fun themeMode() = flowPrefs.getEnum(
|
fun themeMode() = flowPrefs.getEnum(
|
||||||
"pref_theme_mode_key",
|
"pref_theme_mode_key",
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light }
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light },
|
||||||
)
|
)
|
||||||
|
|
||||||
fun appTheme() = flowPrefs.getEnum(
|
fun appTheme() = flowPrefs.getEnum(
|
||||||
"pref_app_theme",
|
"pref_app_theme",
|
||||||
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT }
|
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT },
|
||||||
)
|
)
|
||||||
|
|
||||||
fun themeDarkAmoled() = flowPrefs.getBoolean("pref_theme_dark_amoled_key", false)
|
fun themeDarkAmoled() = flowPrefs.getBoolean("pref_theme_dark_amoled_key", false)
|
||||||
|
@ -137,8 +137,6 @@ class PreferencesHelper(val context: Context) {
|
||||||
|
|
||||||
fun webtoonSidePadding() = flowPrefs.getInt("webtoon_side_padding", 0)
|
fun webtoonSidePadding() = flowPrefs.getInt("webtoon_side_padding", 0)
|
||||||
|
|
||||||
fun readWithTapping() = flowPrefs.getBoolean("reader_tap", true)
|
|
||||||
|
|
||||||
fun pagerNavInverted() = flowPrefs.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE)
|
fun pagerNavInverted() = flowPrefs.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE)
|
||||||
|
|
||||||
fun webtoonNavInverted() = flowPrefs.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE)
|
fun webtoonNavInverted() = flowPrefs.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE)
|
||||||
|
@ -318,7 +316,7 @@ class PreferencesHelper(val context: Context) {
|
||||||
|
|
||||||
fun extensionInstaller() = flowPrefs.getEnum(
|
fun extensionInstaller() = flowPrefs.getEnum(
|
||||||
"extension_installer",
|
"extension_installer",
|
||||||
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER
|
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun verboseLogging() = prefs.getBoolean(Keys.verboseLogging, false)
|
fun verboseLogging() = prefs.getBoolean(Keys.verboseLogging, false)
|
||||||
|
|
|
@ -47,13 +47,13 @@ class ImageSaver(
|
||||||
put(
|
put(
|
||||||
MediaStore.Images.Media.RELATIVE_PATH,
|
MediaStore.Images.Media.RELATIVE_PATH,
|
||||||
"${Environment.DIRECTORY_PICTURES}/${context.getString(R.string.app_name)}/" +
|
"${Environment.DIRECTORY_PICTURES}/${context.getString(R.string.app_name)}/" +
|
||||||
(image.location as Location.Pictures).relativePath
|
(image.location as Location.Pictures).relativePath,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val picture = context.contentResolver.insert(
|
val picture = context.contentResolver.insert(
|
||||||
pictureDir,
|
pictureDir,
|
||||||
contentValues
|
contentValues,
|
||||||
) ?: throw IOException("Couldn't create file")
|
) ?: throw IOException("Couldn't create file")
|
||||||
|
|
||||||
data().use { input ->
|
data().use { input ->
|
||||||
|
@ -133,12 +133,12 @@ sealed class Location {
|
||||||
is Pictures -> {
|
is Pictures -> {
|
||||||
val file = File(
|
val file = File(
|
||||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
|
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
|
||||||
context.getString(R.string.app_name)
|
context.getString(R.string.app_name),
|
||||||
)
|
)
|
||||||
if (relativePath.isNotEmpty()) {
|
if (relativePath.isNotEmpty()) {
|
||||||
return File(
|
return File(
|
||||||
file,
|
file,
|
||||||
relativePath
|
relativePath,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
file
|
file
|
||||||
|
|
|
@ -56,8 +56,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
authClient.newCall(
|
authClient.newCall(
|
||||||
POST(
|
POST(
|
||||||
apiUrl,
|
apiUrl,
|
||||||
body = payload.toString().toRequestBody(jsonMime)
|
body = payload.toString().toRequestBody(jsonMime),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
.parseAs<JsonObject>()
|
.parseAs<JsonObject>()
|
||||||
|
@ -140,8 +140,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
authClient.newCall(
|
authClient.newCall(
|
||||||
POST(
|
POST(
|
||||||
apiUrl,
|
apiUrl,
|
||||||
body = payload.toString().toRequestBody(jsonMime)
|
body = payload.toString().toRequestBody(jsonMime),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
.parseAs<JsonObject>()
|
.parseAs<JsonObject>()
|
||||||
|
@ -208,8 +208,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
authClient.newCall(
|
authClient.newCall(
|
||||||
POST(
|
POST(
|
||||||
apiUrl,
|
apiUrl,
|
||||||
body = payload.toString().toRequestBody(jsonMime)
|
body = payload.toString().toRequestBody(jsonMime),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
.parseAs<JsonObject>()
|
.parseAs<JsonObject>()
|
||||||
|
@ -250,8 +250,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
authClient.newCall(
|
authClient.newCall(
|
||||||
POST(
|
POST(
|
||||||
apiUrl,
|
apiUrl,
|
||||||
body = payload.toString().toRequestBody(jsonMime)
|
body = payload.toString().toRequestBody(jsonMime),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
.parseAs<JsonObject>()
|
.parseAs<JsonObject>()
|
||||||
|
@ -260,7 +260,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
val viewer = data["Viewer"]!!.jsonObject
|
val viewer = data["Viewer"]!!.jsonObject
|
||||||
Pair(
|
Pair(
|
||||||
viewer["id"]!!.jsonPrimitive.int,
|
viewer["id"]!!.jsonPrimitive.int,
|
||||||
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content
|
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
struct["format"]!!.jsonPrimitive.content.replace("_", "-"),
|
struct["format"]!!.jsonPrimitive.content.replace("_", "-"),
|
||||||
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
|
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
|
||||||
parseDate(struct, "startDate"),
|
parseDate(struct, "startDate"),
|
||||||
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0
|
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
struct["progress"]!!.jsonPrimitive.int,
|
struct["progress"]!!.jsonPrimitive.int,
|
||||||
parseDate(struct, "startedAt"),
|
parseDate(struct, "startedAt"),
|
||||||
parseDate(struct, "completedAt"),
|
parseDate(struct, "completedAt"),
|
||||||
jsonToALManga(struct["media"]!!.jsonObject)
|
jsonToALManga(struct["media"]!!.jsonObject),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
date.set(
|
date.set(
|
||||||
struct[dateKey]!!.jsonObject["year"]!!.jsonPrimitive.int,
|
struct[dateKey]!!.jsonObject["year"]!!.jsonPrimitive.int,
|
||||||
struct[dateKey]!!.jsonObject["month"]!!.jsonPrimitive.int - 1,
|
struct[dateKey]!!.jsonObject["month"]!!.jsonPrimitive.int - 1,
|
||||||
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int
|
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int,
|
||||||
)
|
)
|
||||||
date.timeInMillis
|
date.timeInMillis
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
|
|
|
@ -61,8 +61,8 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
||||||
authClient.newCall(
|
authClient.newCall(
|
||||||
POST(
|
POST(
|
||||||
"$apiUrl/subject/${track.media_id}/update/watched_eps",
|
"$apiUrl/subject/${track.media_id}/update/watched_eps",
|
||||||
body = body
|
body = body,
|
||||||
)
|
),
|
||||||
).await()
|
).await()
|
||||||
|
|
||||||
track
|
track
|
||||||
|
@ -168,7 +168,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
||||||
.add("client_secret", clientSecret)
|
.add("client_secret", clientSecret)
|
||||||
.add("code", code)
|
.add("code", code)
|
||||||
.add("redirect_uri", redirectUrl)
|
.add("redirect_uri", redirectUrl)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -201,7 +201,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
||||||
.add("client_secret", clientSecret)
|
.add("client_secret", clientSecret)
|
||||||
.add("refresh_token", token)
|
.add("refresh_token", token)
|
||||||
.add("redirect_uri", redirectUrl)
|
.add("redirect_uri", redirectUrl)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
|
||||||
.header("User-Agent", "Tachiyomi")
|
.header("User-Agent", "Tachiyomi")
|
||||||
.url(
|
.url(
|
||||||
originalRequest.url.newBuilder()
|
originalRequest.url.newBuilder()
|
||||||
.addQueryParameter("access_token", currAuth.access_token).build()
|
.addQueryParameter("access_token", currAuth.access_token).build(),
|
||||||
)
|
)
|
||||||
.build() else originalRequest.newBuilder()
|
.build() else originalRequest.newBuilder()
|
||||||
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
|
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
|
||||||
|
@ -51,7 +51,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
|
||||||
System.currentTimeMillis() / 1000,
|
System.currentTimeMillis() / 1000,
|
||||||
oauth.expires_in,
|
oauth.expires_in,
|
||||||
oauth.refresh_token,
|
oauth.refresh_token,
|
||||||
this.oauth?.user_id
|
this.oauth?.user_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
bangumi.saveToken(oauth)
|
bangumi.saveToken(oauth)
|
||||||
|
|
|
@ -39,7 +39,7 @@ class DelayedTrackingStore(context: Context) {
|
||||||
DelayedTrackingItem(
|
DelayedTrackingItem(
|
||||||
trackId = it.key.toLong(),
|
trackId = it.key.toLong(),
|
||||||
mangaId = mangaId.toLong(),
|
mangaId = mangaId.toLong(),
|
||||||
lastChapterRead = lastChapterRead.toFloat()
|
lastChapterRead = lastChapterRead.toFloat(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,10 +62,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||||
"${baseUrl}library-entries",
|
"${baseUrl}library-entries",
|
||||||
headers = headersOf(
|
headers = headersOf(
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
"application/vnd.api+json"
|
"application/vnd.api+json",
|
||||||
|
),
|
||||||
|
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType()),
|
||||||
),
|
),
|
||||||
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType())
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
.parseAs<JsonObject>()
|
.parseAs<JsonObject>()
|
||||||
|
@ -98,11 +98,11 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||||
.headers(
|
.headers(
|
||||||
headersOf(
|
headersOf(
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
"application/vnd.api+json"
|
"application/vnd.api+json",
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.patch(data.toString().toRequestBody("application/vnd.api+json".toMediaType()))
|
.patch(data.toString().toRequestBody("application/vnd.api+json".toMediaType()))
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
.parseAs<JsonObject>()
|
.parseAs<JsonObject>()
|
||||||
|
@ -137,10 +137,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||||
"X-Algolia-Application-Id",
|
"X-Algolia-Application-Id",
|
||||||
algoliaAppId,
|
algoliaAppId,
|
||||||
"X-Algolia-API-Key",
|
"X-Algolia-API-Key",
|
||||||
key
|
key,
|
||||||
|
),
|
||||||
|
body = jsonObject.toString().toRequestBody(jsonMime),
|
||||||
),
|
),
|
||||||
body = jsonObject.toString().toRequestBody(jsonMime)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
.parseAs<JsonObject>()
|
.parseAs<JsonObject>()
|
||||||
|
@ -252,7 +252,7 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||||
.add("refresh_token", token)
|
.add("refresh_token", token)
|
||||||
.add("client_id", clientId)
|
.add("client_id", clientId)
|
||||||
.add("client_secret", clientSecret)
|
.add("client_secret", clientSecret)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class KomgaApi(private val client: OkHttpClient) {
|
||||||
Request.Builder()
|
Request.Builder()
|
||||||
.url("${track.tracking_url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi")
|
.url("${track.tracking_url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi")
|
||||||
.put(payload.toRequestBody("application/json".toMediaType()))
|
.put(payload.toRequestBody("application/json".toMediaType()))
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
.await()
|
.await()
|
||||||
return getTrackSearch(track.tracking_url)
|
return getTrackSearch(track.tracking_url)
|
||||||
|
|
|
@ -92,7 +92,7 @@ data class ReadProgressDto(
|
||||||
booksUnreadCount,
|
booksUnreadCount,
|
||||||
booksInProgressCount,
|
booksInProgressCount,
|
||||||
lastReadContinuousIndex.toFloat(),
|
lastReadContinuousIndex.toFloat(),
|
||||||
booksCount.toFloat()
|
booksCount.toFloat(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
||||||
.filter {
|
.filter {
|
||||||
it.jsonObject["node"]!!.jsonObject["title"]!!.jsonPrimitive.content.contains(
|
it.jsonObject["node"]!!.jsonObject["title"]!!.jsonPrimitive.content.contains(
|
||||||
query,
|
query,
|
||||||
ignoreCase = true
|
ignoreCase = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.map {
|
.map {
|
||||||
|
|
|
@ -44,8 +44,8 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
|
||||||
authClient.newCall(
|
authClient.newCall(
|
||||||
POST(
|
POST(
|
||||||
"$apiUrl/v2/user_rates",
|
"$apiUrl/v2/user_rates",
|
||||||
body = payload.toString().toRequestBody(jsonMime)
|
body = payload.toString().toRequestBody(jsonMime),
|
||||||
)
|
),
|
||||||
).await()
|
).await()
|
||||||
track
|
track
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
|
||||||
.add("client_secret", clientSecret)
|
.add("client_secret", clientSecret)
|
||||||
.add("code", code)
|
.add("code", code)
|
||||||
.add("redirect_uri", redirectUrl)
|
.add("redirect_uri", redirectUrl)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -186,7 +186,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
|
||||||
.add("client_id", clientId)
|
.add("client_id", clientId)
|
||||||
.add("client_secret", clientSecret)
|
.add("client_secret", clientSecret)
|
||||||
.add("refresh_token", token)
|
.add("refresh_token", token)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class AppUpdateJob(private val context: Context, workerParams: WorkerParameters)
|
||||||
7,
|
7,
|
||||||
TimeUnit.DAYS,
|
TimeUnit.DAYS,
|
||||||
3,
|
3,
|
||||||
TimeUnit.HOURS
|
TimeUnit.HOURS,
|
||||||
)
|
)
|
||||||
.addTag(TAG)
|
.addTag(TAG)
|
||||||
.setConstraints(constraints)
|
.setConstraints(constraints)
|
||||||
|
|
|
@ -47,12 +47,12 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
android.R.drawable.stat_sys_download_done,
|
android.R.drawable.stat_sys_download_done,
|
||||||
context.getString(R.string.action_download),
|
context.getString(R.string.action_download),
|
||||||
updateIntent
|
updateIntent,
|
||||||
)
|
)
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_info_24dp,
|
R.drawable.ic_info_24dp,
|
||||||
context.getString(R.string.whats_new),
|
context.getString(R.string.whats_new),
|
||||||
releaseInfoIntent
|
releaseInfoIntent,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
notificationBuilder.show()
|
notificationBuilder.show()
|
||||||
|
@ -105,12 +105,12 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_system_update_alt_white_24dp,
|
R.drawable.ic_system_update_alt_white_24dp,
|
||||||
context.getString(R.string.action_install),
|
context.getString(R.string.action_install),
|
||||||
installIntent
|
installIntent,
|
||||||
)
|
)
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_close_24dp,
|
R.drawable.ic_close_24dp,
|
||||||
context.getString(R.string.action_cancel),
|
context.getString(R.string.action_cancel),
|
||||||
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
|
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
notificationBuilder.show()
|
notificationBuilder.show()
|
||||||
|
@ -132,12 +132,12 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_refresh_24dp,
|
R.drawable.ic_refresh_24dp,
|
||||||
context.getString(R.string.action_retry),
|
context.getString(R.string.action_retry),
|
||||||
AppUpdateService.downloadApkPendingService(context, url)
|
AppUpdateService.downloadApkPendingService(context, url),
|
||||||
)
|
)
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_close_24dp,
|
R.drawable.ic_close_24dp,
|
||||||
context.getString(R.string.action_cancel),
|
context.getString(R.string.action_cancel),
|
||||||
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
|
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
notificationBuilder.show(Notifications.ID_APP_UPDATER)
|
notificationBuilder.show(Notifications.ID_APP_UPDATER)
|
||||||
|
|
|
@ -50,8 +50,8 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
|
||||||
context.resources.getQuantityString(
|
context.resources.getQuantityString(
|
||||||
R.plurals.update_check_notification_ext_updates,
|
R.plurals.update_check_notification_ext_updates,
|
||||||
names.size,
|
names.size,
|
||||||
names.size
|
names.size,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
val extNames = names.joinToString(", ")
|
val extNames = names.joinToString(", ")
|
||||||
setContentText(extNames)
|
setContentText(extNames)
|
||||||
|
@ -59,7 +59,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
|
||||||
setSmallIcon(R.drawable.ic_extension_24dp)
|
setSmallIcon(R.drawable.ic_extension_24dp)
|
||||||
setContentIntent(NotificationReceiver.openExtensionsPendingActivity(context))
|
setContentIntent(NotificationReceiver.openExtensionsPendingActivity(context))
|
||||||
setAutoCancel(true)
|
setAutoCancel(true)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
|
||||||
2,
|
2,
|
||||||
TimeUnit.DAYS,
|
TimeUnit.DAYS,
|
||||||
3,
|
3,
|
||||||
TimeUnit.HOURS
|
TimeUnit.HOURS,
|
||||||
)
|
)
|
||||||
.addTag(TAG)
|
.addTag(TAG)
|
||||||
.setConstraints(constraints)
|
.setConstraints(constraints)
|
||||||
|
|
|
@ -85,7 +85,7 @@ internal class ExtensionGithubApi {
|
||||||
hasChangelog = it.hasChangelog == 1,
|
hasChangelog = it.hasChangelog == 1,
|
||||||
sources = it.sources?.toExtensionSources() ?: emptyList(),
|
sources = it.sources?.toExtensionSources() ?: emptyList(),
|
||||||
apkName = it.apk,
|
apkName = it.apk,
|
||||||
iconUrl = "${REPO_URL_PREFIX}icon/${it.apk.replace(".apk", ".png")}"
|
iconUrl = "${REPO_URL_PREFIX}icon/${it.apk.replace(".apk", ".png")}",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ internal class ExtensionGithubApi {
|
||||||
AvailableExtensionSources(
|
AvailableExtensionSources(
|
||||||
name = it.name,
|
name = it.name,
|
||||||
id = it.id,
|
id = it.id,
|
||||||
baseUrl = it.baseUrl
|
baseUrl = it.baseUrl,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ class PackageInstallerInstaller(private val service: Service) : Installer(servic
|
||||||
service,
|
service,
|
||||||
activeSession!!.second,
|
activeSession!!.second,
|
||||||
Intent(INSTALL_ACTION),
|
Intent(INSTALL_ACTION),
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0,
|
||||||
).intentSender
|
).intentSender
|
||||||
session.commit(intentSender)
|
session.commit(intentSender)
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ internal class ExtensionInstaller(private val context: Context) {
|
||||||
downloadManager.query(query).use { cursor ->
|
downloadManager.query(query).use { cursor ->
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
val localUri = cursor.getString(
|
val localUri = cursor.getString(
|
||||||
cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_LOCAL_URI)
|
cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_LOCAL_URI),
|
||||||
).removePrefix(FILE_SCHEME)
|
).removePrefix(FILE_SCHEME)
|
||||||
|
|
||||||
installApk(id, File(localUri).getUriCompat(context))
|
installApk(id, File(localUri).getUriCompat(context))
|
||||||
|
|
|
@ -120,7 +120,7 @@ internal object ExtensionLoader {
|
||||||
if (libVersion < LIB_VERSION_MIN || libVersion > LIB_VERSION_MAX) {
|
if (libVersion < LIB_VERSION_MIN || libVersion > LIB_VERSION_MAX) {
|
||||||
val exception = Exception(
|
val exception = Exception(
|
||||||
"Lib version is $libVersion, while only versions " +
|
"Lib version is $libVersion, while only versions " +
|
||||||
"$LIB_VERSION_MIN to $LIB_VERSION_MAX are allowed"
|
"$LIB_VERSION_MIN to $LIB_VERSION_MAX are allowed",
|
||||||
)
|
)
|
||||||
logcat(LogPriority.WARN, exception)
|
logcat(LogPriority.WARN, exception)
|
||||||
return LoadResult.Error(exception)
|
return LoadResult.Error(exception)
|
||||||
|
@ -190,7 +190,7 @@ internal object ExtensionLoader {
|
||||||
sources = sources,
|
sources = sources,
|
||||||
pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY),
|
pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY),
|
||||||
isUnofficial = signatureHash != officialSignature,
|
isUnofficial = signatureHash != officialSignature,
|
||||||
icon = context.getApplicationIcon(pkgName)
|
icon = context.getApplicationIcon(pkgName),
|
||||||
)
|
)
|
||||||
return LoadResult.Success(extension)
|
return LoadResult.Success(extension)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ fun OkHttpClient.Builder.dohCloudflare() = dns(
|
||||||
InetAddress.getByName("2606:4700:4700::1111"),
|
InetAddress.getByName("2606:4700:4700::1111"),
|
||||||
InetAddress.getByName("2606:4700:4700::1001"),
|
InetAddress.getByName("2606:4700:4700::1001"),
|
||||||
InetAddress.getByName("2606:4700:4700::0064"),
|
InetAddress.getByName("2606:4700:4700::0064"),
|
||||||
InetAddress.getByName("2606:4700:4700::6400")
|
InetAddress.getByName("2606:4700:4700::6400"),
|
||||||
)
|
)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
||||||
fun OkHttpClient.Builder.dohGoogle() = dns(
|
fun OkHttpClient.Builder.dohGoogle() = dns(
|
||||||
|
@ -38,9 +38,9 @@ fun OkHttpClient.Builder.dohGoogle() = dns(
|
||||||
InetAddress.getByName("8.8.4.4"),
|
InetAddress.getByName("8.8.4.4"),
|
||||||
InetAddress.getByName("8.8.8.8"),
|
InetAddress.getByName("8.8.8.8"),
|
||||||
InetAddress.getByName("2001:4860:4860::8888"),
|
InetAddress.getByName("2001:4860:4860::8888"),
|
||||||
InetAddress.getByName("2001:4860:4860::8844")
|
InetAddress.getByName("2001:4860:4860::8844"),
|
||||||
)
|
)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
||||||
// AdGuard "Default" DNS works too but for the sake of making sure no site is blacklisted,
|
// AdGuard "Default" DNS works too but for the sake of making sure no site is blacklisted,
|
||||||
|
@ -52,9 +52,9 @@ fun OkHttpClient.Builder.dohAdGuard() = dns(
|
||||||
InetAddress.getByName("94.140.14.140"),
|
InetAddress.getByName("94.140.14.140"),
|
||||||
InetAddress.getByName("94.140.14.141"),
|
InetAddress.getByName("94.140.14.141"),
|
||||||
InetAddress.getByName("2a10:50c0::1:ff"),
|
InetAddress.getByName("2a10:50c0::1:ff"),
|
||||||
InetAddress.getByName("2a10:50c0::2:ff")
|
InetAddress.getByName("2a10:50c0::2:ff"),
|
||||||
)
|
)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
||||||
fun OkHttpClient.Builder.dohQuad9() = dns(
|
fun OkHttpClient.Builder.dohQuad9() = dns(
|
||||||
|
@ -64,7 +64,7 @@ fun OkHttpClient.Builder.dohQuad9() = dns(
|
||||||
InetAddress.getByName("9.9.9.9"),
|
InetAddress.getByName("9.9.9.9"),
|
||||||
InetAddress.getByName("149.112.112.112"),
|
InetAddress.getByName("149.112.112.112"),
|
||||||
InetAddress.getByName("2620:fe::fe"),
|
InetAddress.getByName("2620:fe::fe"),
|
||||||
InetAddress.getByName("2620:fe::9")
|
InetAddress.getByName("2620:fe::9"),
|
||||||
)
|
)
|
||||||
.build()
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -79,7 +79,7 @@ suspend fun Call.await(): Response {
|
||||||
if (continuation.isCancelled) return
|
if (continuation.isCancelled) return
|
||||||
continuation.resumeWithException(e)
|
continuation.resumeWithException(e)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
continuation.invokeOnCancellation {
|
continuation.invokeOnCancellation {
|
||||||
|
|
|
@ -186,7 +186,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
||||||
artist = obj["artist"]?.jsonPrimitive?.contentOrNull ?: manga.artist,
|
artist = obj["artist"]?.jsonPrimitive?.contentOrNull ?: manga.artist,
|
||||||
description = obj["description"]?.jsonPrimitive?.contentOrNull ?: manga.description,
|
description = obj["description"]?.jsonPrimitive?.contentOrNull ?: manga.description,
|
||||||
genres = obj["genre"]?.jsonArray?.map { it.jsonPrimitive.content } ?: manga.genres,
|
genres = obj["genre"]?.jsonArray?.map { it.jsonPrimitive.content } ?: manga.genres,
|
||||||
status = obj["status"]?.jsonPrimitive?.intOrNull ?: manga.status
|
status = obj["status"]?.jsonPrimitive?.intOrNull ?: manga.status,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
manga
|
manga
|
||||||
|
@ -314,7 +314,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
||||||
private class OrderBy(context: Context) : Filter.Sort(
|
private class OrderBy(context: Context) : Filter.Sort(
|
||||||
context.getString(R.string.local_filter_order_by),
|
context.getString(R.string.local_filter_order_by),
|
||||||
arrayOf(context.getString(R.string.title), context.getString(R.string.date)),
|
arrayOf(context.getString(R.string.title), context.getString(R.string.date)),
|
||||||
Selection(0, true)
|
Selection(0, true),
|
||||||
)
|
)
|
||||||
|
|
||||||
sealed class Format {
|
sealed class Format {
|
||||||
|
@ -353,5 +353,5 @@ private val WHITESPACE_CHARS = arrayOf(
|
||||||
'\u2029',
|
'\u2029',
|
||||||
'\u202F',
|
'\u202F',
|
||||||
'\u205F',
|
'\u205F',
|
||||||
'\u3000'
|
'\u3000',
|
||||||
)
|
)
|
||||||
|
|
|
@ -42,7 +42,7 @@ interface Source : tachiyomi.source.Source {
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"Use the 1.x API instead",
|
"Use the 1.x API instead",
|
||||||
ReplaceWith("getMangaDetails")
|
ReplaceWith("getMangaDetails"),
|
||||||
)
|
)
|
||||||
fun fetchMangaDetails(manga: SManga): Observable<SManga> = throw IllegalStateException("Not used")
|
fun fetchMangaDetails(manga: SManga): Observable<SManga> = throw IllegalStateException("Not used")
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ interface Source : tachiyomi.source.Source {
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"Use the 1.x API instead",
|
"Use the 1.x API instead",
|
||||||
ReplaceWith("getChapterList")
|
ReplaceWith("getChapterList"),
|
||||||
)
|
)
|
||||||
fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = throw IllegalStateException("Not used")
|
fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = throw IllegalStateException("Not used")
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ interface Source : tachiyomi.source.Source {
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"Use the 1.x API instead",
|
"Use the 1.x API instead",
|
||||||
ReplaceWith("getPageList")
|
ReplaceWith("getPageList"),
|
||||||
)
|
)
|
||||||
fun fetchPageList(chapter: SChapter): Observable<List<Page>> = Observable.empty()
|
fun fetchPageList(chapter: SChapter): Observable<List<Page>> = Observable.empty()
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ open class SourceManager(private val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createInternalSources(): List<Source> = listOf(
|
private fun createInternalSources(): List<Source> = listOf(
|
||||||
LocalSource(context)
|
LocalSource(context),
|
||||||
)
|
)
|
||||||
|
|
||||||
inner class StubSource(override val id: Long) : Source {
|
inner class StubSource(override val id: Long) : Source {
|
||||||
|
|
|
@ -68,13 +68,13 @@ open class Page(
|
||||||
|
|
||||||
fun Page.toPageUrl(): PageUrl {
|
fun Page.toPageUrl(): PageUrl {
|
||||||
return PageUrl(
|
return PageUrl(
|
||||||
url = this.imageUrl ?: this.url
|
url = this.imageUrl ?: this.url,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun PageUrl.toPage(index: Int): Page {
|
fun PageUrl.toPage(index: Int): Page {
|
||||||
return Page(
|
return Page(
|
||||||
index = index,
|
index = index,
|
||||||
imageUrl = this.url
|
imageUrl = this.url,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ fun SChapter.toChapterInfo(): ChapterInfo {
|
||||||
key = this.url,
|
key = this.url,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
number = this.chapter_number,
|
number = this.chapter_number,
|
||||||
scanlator = this.scanlator ?: ""
|
scanlator = this.scanlator ?: "",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ fun SManga.toMangaInfo(): MangaInfo {
|
||||||
description = this.description ?: "",
|
description = this.description ?: "",
|
||||||
genres = this.genre?.split(", ") ?: emptyList(),
|
genres = this.genre?.split(", ") ?: emptyList(),
|
||||||
status = this.status,
|
status = this.status,
|
||||||
cover = this.thumbnail_url ?: ""
|
cover = this.thumbnail_url ?: "",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) : Contro
|
||||||
viewScope.cancel()
|
viewScope.cancel()
|
||||||
logcat { "Destroy view for ${controller.instance()}" }
|
logcat { "Destroy view for ${controller.instance()}" }
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) : Contro
|
||||||
|
|
||||||
return onCollapse?.invoke(item) ?: true
|
return onCollapse?.invoke(item) ?: true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
if (expandActionViewFromInteraction) {
|
if (expandActionViewFromInteraction) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ abstract class DialogController : Controller {
|
||||||
RouterTransaction.with(this)
|
RouterTransaction.with(this)
|
||||||
.pushChangeHandler(SimpleSwapChangeHandler(false))
|
.pushChangeHandler(SimpleSwapChangeHandler(false))
|
||||||
.popChangeHandler(SimpleSwapChangeHandler(false))
|
.popChangeHandler(SimpleSwapChangeHandler(false))
|
||||||
.tag(tag)
|
.tag(tag),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class OneWayFadeChangeHandler : FadeChangeHandler {
|
||||||
constructor(duration: Long) : super(duration)
|
constructor(duration: Long) : super(duration)
|
||||||
constructor(duration: Long, removesFromViewOnPush: Boolean) : super(
|
constructor(duration: Long, removesFromViewOnPush: Boolean) : super(
|
||||||
duration,
|
duration,
|
||||||
removesFromViewOnPush
|
removesFromViewOnPush,
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun getAnimator(
|
override fun getAnimator(
|
||||||
|
|
|
@ -57,7 +57,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
|
||||||
|
|
||||||
// Remove formatting from pasted text
|
// Remove formatting from pasted text
|
||||||
val searchAutoComplete: SearchView.SearchAutoComplete = searchView.findViewById(
|
val searchAutoComplete: SearchView.SearchAutoComplete = searchView.findViewById(
|
||||||
R.id.search_src_text
|
R.id.search_src_text,
|
||||||
)
|
)
|
||||||
searchAutoComplete.addTextChangedListener(object : TextWatcher {
|
searchAutoComplete.addTextChangedListener(object : TextWatcher {
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
||||||
|
@ -68,7 +68,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
|
||||||
editable.getSpans(0, editable.length, CharacterStyle::class.java)
|
editable.getSpans(0, editable.length, CharacterStyle::class.java)
|
||||||
.forEach { editable.removeSpan(it) }
|
.forEach { editable.removeSpan(it) }
|
||||||
}
|
}
|
||||||
})
|
},)
|
||||||
|
|
||||||
searchView.queryTextEvents()
|
searchView.queryTextEvents()
|
||||||
.onEach {
|
.onEach {
|
||||||
|
@ -149,7 +149,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
|
||||||
onSearchMenuItemActionCollapse(item)
|
onSearchMenuItemActionCollapse(item)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class BrowseController :
|
||||||
TabbedController {
|
TabbedController {
|
||||||
|
|
||||||
constructor(toExtensions: Boolean = false) : super(
|
constructor(toExtensions: Boolean = false) : super(
|
||||||
bundleOf(TO_EXTENSIONS_EXTRA to toExtensions)
|
bundleOf(TO_EXTENSIONS_EXTRA to toExtensions),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
@ -114,7 +114,7 @@ class BrowseController :
|
||||||
private val tabTitles = listOf(
|
private val tabTitles = listOf(
|
||||||
R.string.label_sources,
|
R.string.label_sources,
|
||||||
R.string.label_extensions,
|
R.string.label_extensions,
|
||||||
R.string.label_migration
|
R.string.label_migration,
|
||||||
)
|
)
|
||||||
.map { resources!!.getString(it) }
|
.map { resources!!.getString(it) }
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ open class ExtensionController :
|
||||||
R.id.action_search -> expandActionViewFromInteraction = true
|
R.id.action_search -> expandActionViewFromInteraction = true
|
||||||
R.id.action_settings -> {
|
R.id.action_settings -> {
|
||||||
parentController!!.router.pushController(
|
parentController!!.router.pushController(
|
||||||
ExtensionFilterController().withFadeTransaction()
|
ExtensionFilterController().withFadeTransaction(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ open class ExtensionController :
|
||||||
is Extension.Untrusted -> it.extension.name.contains(query, ignoreCase = true)
|
is Extension.Untrusted -> it.extension.name.contains(query, ignoreCase = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
adapter?.updateDataSet(extensions)
|
adapter?.updateDataSet(extensions)
|
||||||
|
|
|
@ -73,7 +73,7 @@ class ExtensionHolder(view: View, val adapter: ExtensionAdapter) :
|
||||||
is Extension.Available -> R.string.ext_install
|
is Extension.Available -> R.string.ext_install
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
val isIdle = installStep == InstallStep.Idle || installStep == InstallStep.Error
|
val isIdle = installStep == InstallStep.Idle || installStep == InstallStep.Error
|
||||||
|
|
|
@ -69,7 +69,7 @@ open class ExtensionPresenter(
|
||||||
val installedSorted = installed.filter { !it.hasUpdate && (showNsfwSources || !it.isNsfw) }
|
val installedSorted = installed.filter { !it.hasUpdate && (showNsfwSources || !it.isNsfw) }
|
||||||
.sortedWith(
|
.sortedWith(
|
||||||
compareBy<Extension.Installed> { !it.isObsolete }
|
compareBy<Extension.Installed> { !it.isObsolete }
|
||||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
|
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
|
||||||
)
|
)
|
||||||
|
|
||||||
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
|
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
|
||||||
|
@ -163,7 +163,7 @@ open class ExtensionPresenter(
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
view.downloadUpdate(item)
|
view.downloadUpdate(item)
|
||||||
}
|
}
|
||||||
})
|
},)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun uninstallExtension(pkgName: String) {
|
fun uninstallExtension(pkgName: String) {
|
||||||
|
|
|
@ -14,8 +14,8 @@ class ExtensionTrustDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
|
||||||
constructor(target: T, signatureHash: String, pkgName: String) : this(
|
constructor(target: T, signatureHash: String, pkgName: String) : this(
|
||||||
bundleOf(
|
bundleOf(
|
||||||
SIGNATURE_KEY to signatureHash,
|
SIGNATURE_KEY to signatureHash,
|
||||||
PKGNAME_KEY to pkgName
|
PKGNAME_KEY to pkgName,
|
||||||
)
|
),
|
||||||
) {
|
) {
|
||||||
targetController = target
|
targetController = target
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||||
private var preferenceScreen: PreferenceScreen? = null
|
private var preferenceScreen: PreferenceScreen? = null
|
||||||
|
|
||||||
constructor(pkgName: String) : this(
|
constructor(pkgName: String) : this(
|
||||||
bundleOf(PKGNAME_KEY to pkgName)
|
bundleOf(PKGNAME_KEY to pkgName),
|
||||||
)
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
@ -91,7 +91,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||||
binding.extensionPrefsRecycler.layoutManager = LinearLayoutManager(context)
|
binding.extensionPrefsRecycler.layoutManager = LinearLayoutManager(context)
|
||||||
binding.extensionPrefsRecycler.adapter = ConcatAdapter(
|
binding.extensionPrefsRecycler.adapter = ConcatAdapter(
|
||||||
ExtensionDetailsHeaderAdapter(presenter),
|
ExtensionDetailsHeaderAdapter(presenter),
|
||||||
initPreferencesAdapter(context, extension)
|
initPreferencesAdapter(context, extension),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||||
block()
|
block()
|
||||||
onSettingsClick = View.OnClickListener {
|
onSettingsClick = View.OnClickListener {
|
||||||
router.pushController(
|
router.pushController(
|
||||||
SourcePreferencesController(source.id).withFadeTransaction()
|
SourcePreferencesController(source.id).withFadeTransaction(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ExtensionDetailsPresenter(
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeFirst({ view, _ ->
|
.subscribeFirst({ view, _ ->
|
||||||
view.onExtensionUninstalled()
|
view.onExtensionUninstalled()
|
||||||
})
|
},)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun uninstallExtension() {
|
fun uninstallExtension() {
|
||||||
|
|
|
@ -43,7 +43,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
||||||
private var preferenceScreen: PreferenceScreen? = null
|
private var preferenceScreen: PreferenceScreen? = null
|
||||||
|
|
||||||
constructor(sourceId: Long) : this(
|
constructor(sourceId: Long) : this(
|
||||||
bundleOf(SOURCE_ID to sourceId)
|
bundleOf(SOURCE_ID to sourceId),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createBinding(inflater: LayoutInflater): SourcePreferencesControllerBinding {
|
override fun createBinding(inflater: LayoutInflater): SourcePreferencesControllerBinding {
|
||||||
|
@ -69,7 +69,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
||||||
val themedContext by lazy { getPreferenceThemeContext() }
|
val themedContext by lazy { getPreferenceThemeContext() }
|
||||||
val manager = PreferenceManager(themedContext)
|
val manager = PreferenceManager(themedContext)
|
||||||
val dataStore = SharedPreferencesDataStore(
|
val dataStore = SharedPreferencesDataStore(
|
||||||
context.getSharedPreferences(source.getPreferenceKey(), Context.MODE_PRIVATE)
|
context.getSharedPreferences(source.getPreferenceKey(), Context.MODE_PRIVATE),
|
||||||
)
|
)
|
||||||
manager.preferenceDataStore = dataStore
|
manager.preferenceDataStore = dataStore
|
||||||
manager.onDisplayPreferenceDialogListener = this
|
manager.onDisplayPreferenceDialogListener = this
|
||||||
|
@ -158,7 +158,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
||||||
.newInstance(preference.getKey())
|
.newInstance(preference.getKey())
|
||||||
else -> throw IllegalArgumentException(
|
else -> throw IllegalArgumentException(
|
||||||
"Tried to display dialog for unknown " +
|
"Tried to display dialog for unknown " +
|
||||||
"preference type. Did you forget to override onDisplayPreferenceDialog()?"
|
"preference type. Did you forget to override onDisplayPreferenceDialog()?",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
f.targetController = this
|
f.targetController = this
|
||||||
|
|
|
@ -23,14 +23,14 @@ class MigrationMangaController :
|
||||||
constructor(sourceId: Long, sourceName: String?) : super(
|
constructor(sourceId: Long, sourceName: String?) : super(
|
||||||
bundleOf(
|
bundleOf(
|
||||||
SOURCE_ID_EXTRA to sourceId,
|
SOURCE_ID_EXTRA to sourceId,
|
||||||
SOURCE_NAME_EXTRA to sourceName
|
SOURCE_NAME_EXTRA to sourceName,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
constructor(bundle: Bundle) : this(
|
constructor(bundle: Bundle) : this(
|
||||||
bundle.getLong(SOURCE_ID_EXTRA),
|
bundle.getLong(SOURCE_ID_EXTRA),
|
||||||
bundle.getString(SOURCE_NAME_EXTRA)
|
bundle.getString(SOURCE_NAME_EXTRA),
|
||||||
)
|
)
|
||||||
|
|
||||||
private val sourceId: Long = args.getLong(SOURCE_ID_EXTRA)
|
private val sourceId: Long = args.getLong(SOURCE_ID_EXTRA)
|
||||||
|
|
|
@ -27,7 +27,7 @@ class SearchController(
|
||||||
override fun createPresenter(): GlobalSearchPresenter {
|
override fun createPresenter(): GlobalSearchPresenter {
|
||||||
return SearchPresenter(
|
return SearchPresenter(
|
||||||
initialQuery,
|
initialQuery,
|
||||||
manga!!
|
manga!!,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class SearchPresenter(
|
||||||
replacingMangaRelay.subscribeLatestCache(
|
replacingMangaRelay.subscribeLatestCache(
|
||||||
{ controller, (isReplacingManga, newManga) ->
|
{ controller, (isReplacingManga, newManga) ->
|
||||||
(controller as? SearchController)?.renderIsReplacingManga(isReplacingManga, newManga)
|
(controller as? SearchController)?.renderIsReplacingManga(isReplacingManga, newManga)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,15 +93,15 @@ class SearchPresenter(
|
||||||
val flags = preferences.migrateFlags().get()
|
val flags = preferences.migrateFlags().get()
|
||||||
val migrateChapters =
|
val migrateChapters =
|
||||||
MigrationFlags.hasChapters(
|
MigrationFlags.hasChapters(
|
||||||
flags
|
flags,
|
||||||
)
|
)
|
||||||
val migrateCategories =
|
val migrateCategories =
|
||||||
MigrationFlags.hasCategories(
|
MigrationFlags.hasCategories(
|
||||||
flags
|
flags,
|
||||||
)
|
)
|
||||||
val migrateTracks =
|
val migrateTracks =
|
||||||
MigrationFlags.hasTracks(
|
MigrationFlags.hasTracks(
|
||||||
flags
|
flags,
|
||||||
)
|
)
|
||||||
|
|
||||||
db.inTransaction {
|
db.inTransaction {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SourceSearchController(
|
||||||
if (searchQuery != null) {
|
if (searchQuery != null) {
|
||||||
putString(SEARCH_QUERY_KEY, searchQuery)
|
putString(SEARCH_QUERY_KEY, searchQuery)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
private var oldManga: Manga? = args.getSerializable(MANGA_KEY) as Manga?
|
private var oldManga: Manga? = args.getSerializable(MANGA_KEY) as Manga?
|
||||||
private var newManga: Manga? = null
|
private var newManga: Manga? = null
|
||||||
|
|
|
@ -27,7 +27,7 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
|
||||||
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): Holder {
|
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): Holder {
|
||||||
return Holder(
|
return Holder(
|
||||||
view,
|
view,
|
||||||
adapter
|
adapter,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ data class SourceItem(val source: Source, val mangaCount: Int, val header: Selec
|
||||||
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): SourceHolder {
|
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): SourceHolder {
|
||||||
return SourceHolder(
|
return SourceHolder(
|
||||||
view,
|
view,
|
||||||
adapter as SourceAdapter
|
adapter as SourceAdapter,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ class SourceController :
|
||||||
val isPinned = item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
|
val isPinned = item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
|
||||||
|
|
||||||
val items = mutableListOf(
|
val items = mutableListOf(
|
||||||
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin) to { toggleSourcePin(item.source) }
|
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin) to { toggleSourcePin(item.source) },
|
||||||
)
|
)
|
||||||
if (item.source !is LocalSource) {
|
if (item.source !is LocalSource) {
|
||||||
items.add(activity.getString(R.string.action_disable) to { disableSource(item.source) })
|
items.add(activity.getString(R.string.action_disable) to { disableSource(item.source) })
|
||||||
|
@ -195,7 +195,7 @@ class SourceController :
|
||||||
R.id.action_settings -> {
|
R.id.action_settings -> {
|
||||||
parentController!!.router.pushController(
|
parentController!!.router.pushController(
|
||||||
SourceFilterController()
|
SourceFilterController()
|
||||||
.withFadeTransaction()
|
.withFadeTransaction(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,13 +248,13 @@ class SourceController :
|
||||||
R.menu.browse_sources,
|
R.menu.browse_sources,
|
||||||
R.id.action_search,
|
R.id.action_search,
|
||||||
R.string.action_global_search_hint,
|
R.string.action_global_search_hint,
|
||||||
false // GlobalSearch handles the searching here
|
false, // GlobalSearch handles the searching here
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSearchViewQueryTextSubmit(query: String?) {
|
override fun onSearchViewQueryTextSubmit(query: String?) {
|
||||||
parentController!!.router.pushController(
|
parentController!!.router.pushController(
|
||||||
GlobalSearchController(query).withFadeTransaction()
|
GlobalSearchController(query).withFadeTransaction(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ class SourceFilterController : SettingsController() {
|
||||||
val orderedLangs = sourcesByLang.keys.sortedWith(
|
val orderedLangs = sourcesByLang.keys.sortedWith(
|
||||||
compareBy(
|
compareBy(
|
||||||
{ it !in activeLangsCodes },
|
{ it !in activeLangsCodes },
|
||||||
{ LocaleHelper.getSourceDisplayName(it, context) }
|
{ LocaleHelper.getSourceDisplayName(it, context) },
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
orderedLangs.forEach { lang ->
|
orderedLangs.forEach { lang ->
|
||||||
|
|
|
@ -76,7 +76,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||||
if (searchQuery != null) {
|
if (searchQuery != null) {
|
||||||
putString(SEARCH_QUERY_KEY, searchQuery)
|
putString(SEARCH_QUERY_KEY, searchQuery)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
private val preferences: PreferencesHelper by injectLazy()
|
private val preferences: PreferencesHelper by injectLazy()
|
||||||
|
@ -155,7 +155,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||||
val newFilters = presenter.source.getFilterList()
|
val newFilters = presenter.source.getFilterList()
|
||||||
presenter.sourceFilters = newFilters
|
presenter.sourceFilters = newFilters
|
||||||
filterSheet?.setFilters(presenter.filterItems)
|
filterSheet?.setFilters(presenter.filterItems)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
filterSheet?.setFilters(presenter.filterItems)
|
filterSheet?.setFilters(presenter.filterItems)
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
val displayItem = when (preferences.sourceDisplayMode().get()) {
|
val displayItem = when (preferences.sourceDisplayMode().get()) {
|
||||||
|
@ -426,13 +426,13 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||||
if (adapter.isEmpty) {
|
if (adapter.isEmpty) {
|
||||||
val actions = if (presenter.source is LocalSource) {
|
val actions = if (presenter.source is LocalSource) {
|
||||||
listOf(
|
listOf(
|
||||||
EmptyView.Action(R.string.local_source_help_guide, R.drawable.ic_help_24dp) { openLocalSourceHelpGuide() }
|
EmptyView.Action(R.string.local_source_help_guide, R.drawable.ic_help_24dp) { openLocalSourceHelpGuide() },
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
listOf(
|
listOf(
|
||||||
EmptyView.Action(R.string.action_retry, R.drawable.ic_refresh_24dp, retryAction),
|
EmptyView.Action(R.string.action_retry, R.drawable.ic_refresh_24dp, retryAction),
|
||||||
EmptyView.Action(R.string.action_open_in_web_view, R.drawable.ic_public_24dp) { openInWebView() },
|
EmptyView.Action(R.string.action_open_in_web_view, R.drawable.ic_public_24dp) { openInWebView() },
|
||||||
EmptyView.Action(R.string.label_help, R.drawable.ic_help_24dp) { activity?.openInBrowser(MoreController.URL_HELP) }
|
EmptyView.Action(R.string.label_help, R.drawable.ic_help_24dp) { activity?.openInBrowser(MoreController.URL_HELP) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ open class BrowseSourcePresenter(
|
||||||
},
|
},
|
||||||
{ _, error ->
|
{ _, error ->
|
||||||
logcat(LogPriority.ERROR, error)
|
logcat(LogPriority.ERROR, error)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// Request first page.
|
// Request first page.
|
||||||
|
|
|
@ -49,7 +49,7 @@ class SourceFilterSheet(
|
||||||
private val binding = SourceFilterSheetBinding.inflate(
|
private val binding = SourceFilterSheetBinding.inflate(
|
||||||
LayoutInflater.from(context),
|
LayoutInflater.from(context),
|
||||||
null,
|
null,
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue