Fixes to notifactions icons and loading reader

This commit is contained in:
Jay 2019-11-06 20:56:50 -08:00
parent 24d2245972
commit f63db1cc2c
4 changed files with 12 additions and 3 deletions

View File

@ -52,6 +52,14 @@ interface ChapterQueries : DbProvider {
.build()) .build())
.prepare() .prepare()
fun getChapter(url: String, mangaId: Long) = db.get()
.`object`(Chapter::class.java)
.withQuery(Query.builder()
.table(ChapterTable.TABLE)
.where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?")
.whereArgs(url, mangaId)
.build())
.prepare()
fun insertChapter(chapter: Chapter) = db.put().`object`(chapter).prepare() fun insertChapter(chapter: Chapter) = db.put().`object`(chapter).prepare()

View File

@ -456,7 +456,8 @@ class LibraryUpdateService(
setSmallIcon(R.drawable.ic_book_white_24dp) setSmallIcon(R.drawable.ic_book_white_24dp)
try { try {
val icon = GlideApp.with(this@LibraryUpdateService) val icon = GlideApp.with(this@LibraryUpdateService)
.asBitmap().load(manga).centerCrop().circleCrop().submit().get() .asBitmap().load(manga).dontTransform().centerCrop().circleCrop()
.override(256, 256).submit().get()
setLargeIcon(icon) setLargeIcon(icon)
} }
catch (e: Exception) { } catch (e: Exception) { }

View File

@ -153,7 +153,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
return return
} }
if (chapterUrl.isEmpty()) presenter.init(manga, chapter) if (chapter > -1) presenter.init(manga, chapter)
else presenter.init(manga, chapterUrl) else presenter.init(manga, chapterUrl)
} }

View File

@ -189,7 +189,7 @@ class ReaderPresenter(
if (!needsInit()) return if (!needsInit()) return
val context = Injekt.get<Application>() val context = Injekt.get<Application>()
val db = DatabaseHelper(context) val db = DatabaseHelper(context)
val chapterId = db.getChapter(chapterUrl).executeAsBlocking()?.id val chapterId = db.getChapter(chapterUrl, mangaId).executeAsBlocking()?.id
if (chapterId != null) if (chapterId != null)
init(mangaId, chapterId) init(mangaId, chapterId)
} }