diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index fe3104f70..488669a1f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -225,22 +225,22 @@ class ReaderActivity : BaseRxActivity() { toast(error.message) } - fun onChapterAppendError() { - // Ignore - } - fun onLongPress(page: Page) { MaterialDialog.Builder(this) - .title(getString(R.string.options)) - .items(R.array.reader_image_options) - .itemsIds(R.array.reader_image_options_values) - .itemsCallback { materialDialog, view, i, charSequence -> - when (i) { - 0 -> presenter.setCover(page) - 1 -> shareImage(page) - 2 -> presenter.savePage(page) - } - }.show() + .title(getString(R.string.options)) + .items(R.array.reader_image_options) + .itemsIds(R.array.reader_image_options_values) + .itemsCallback { materialDialog, view, i, charSequence -> + when (i) { + 0 -> presenter.setCover(page) + 1 -> shareImage(page) + 2 -> presenter.savePage(page) + } + }.show() + } + + fun onChapterAppendError() { + // Ignore } /** @@ -408,16 +408,16 @@ class ReaderActivity : BaseRxActivity() { private fun setRotation(rotation: Int) { when (rotation) { - // Rotation free + // Rotation free 1 -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED - // Lock in current rotation + // Lock in current rotation 2 -> { val currentOrientation = resources.configuration.orientation setRotation(if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) 3 else 4) } - // Lock in portrait + // Lock in portrait 3 -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT - // Lock in landscape + // Lock in landscape 4 -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE } } @@ -476,6 +476,9 @@ class ReaderActivity : BaseRxActivity() { * @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)) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 1dd62da5f..cddcf0e23 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -383,11 +383,13 @@ class ReaderPresenter : BasePresenter() { if (chapter.read) { val removeAfterReadSlots = prefs.removeAfterReadSlots() when (removeAfterReadSlots) { - // Setting disabled - -1 -> { /**Empty function**/ } - // Remove current read chapter + // Setting disabled + -1 -> { + /**Empty function**/ + } + // Remove current read chapter 0 -> deleteChapter(chapter, manga) - // Remove previous chapter specified by user in settings. + // Remove previous chapter specified by user in settings. else -> getAdjacentChaptersStrategy(chapter, removeAfterReadSlots) .first?.let { deleteChapter(it, manga) } } @@ -531,6 +533,9 @@ class ReaderPresenter : BasePresenter() { * 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() { */ @Throws(IOException::class) internal fun savePage(page: Page) { + if (page.status != Page.READY) + return + // Used to show image notification val imageNotifier = ImageNotifier(context)