Added page.ready check

This commit is contained in:
Bram van de Kerkhof 2016-11-13 14:07:20 +01:00
parent 7d3d0999f3
commit 13954ffe01
2 changed files with 33 additions and 22 deletions

View file

@ -225,10 +225,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
toast(error.message)
}
fun onChapterAppendError() {
// Ignore
}
fun onLongPress(page: Page) {
MaterialDialog.Builder(this)
.title(getString(R.string.options))
@ -243,6 +239,10 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
}.show()
}
fun onChapterAppendError() {
// Ignore
}
/**
* Called from the presenter at startup, allowing to prepare the selected reader.
*/
@ -476,6 +476,9 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
* @param page page object containing image information.
*/
fun shareImage(page: Page) {
if (page.status != Page.READY)
return
val shareIntent = Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_STREAM, Uri.parse(page.imagePath))

View file

@ -384,7 +384,9 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
val removeAfterReadSlots = prefs.removeAfterReadSlots()
when (removeAfterReadSlots) {
// Setting disabled
-1 -> { /**Empty function**/ }
-1 -> {
/**Empty function**/
}
// Remove current read chapter
0 -> deleteChapter(chapter, manga)
// Remove previous chapter specified by user in settings.
@ -531,6 +533,9 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
* Update cover with page file.
*/
internal fun setCover(page: Page) {
if (page.status != Page.READY)
return
try {
if (manga.favorite) {
if (manga.thumbnail_url != null) {
@ -554,6 +559,9 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
*/
@Throws(IOException::class)
internal fun savePage(page: Page) {
if (page.status != Page.READY)
return
// Used to show image notification
val imageNotifier = ImageNotifier(context)