|
@@ -76,7 +76,9 @@ import eu.kanade.tachiyomi.util.chapter.NoChaptersException
|
|
|
import eu.kanade.tachiyomi.util.hasCustomCover
|
|
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
|
|
import eu.kanade.tachiyomi.util.lang.launchUI
|
|
|
+import eu.kanade.tachiyomi.util.storage.getUriCompat
|
|
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
|
|
+import eu.kanade.tachiyomi.util.system.toShareIntent
|
|
|
import eu.kanade.tachiyomi.util.system.toast
|
|
|
import eu.kanade.tachiyomi.util.view.getCoordinates
|
|
|
import eu.kanade.tachiyomi.util.view.shrinkOnScroll
|
|
@@ -400,8 +402,11 @@ class MangaController :
|
|
|
R.id.download_custom, R.id.download_unread, R.id.download_all
|
|
|
-> downloadChapters(item.itemId)
|
|
|
|
|
|
+ R.id.action_share_cover -> shareCover()
|
|
|
+ R.id.action_save_cover -> saveCover()
|
|
|
+ R.id.action_edit_cover -> changeCover()
|
|
|
+
|
|
|
R.id.action_edit_categories -> onCategoriesClick()
|
|
|
- R.id.action_edit_cover -> handleChangeCover()
|
|
|
R.id.action_migrate -> migrateManga()
|
|
|
}
|
|
|
return super.onOptionsItemSelected(item)
|
|
@@ -640,22 +645,37 @@ class MangaController :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun handleChangeCover() {
|
|
|
+ private fun shareCover() {
|
|
|
+ try {
|
|
|
+ val activity = activity!!
|
|
|
+ val cover = presenter.shareCover(activity)
|
|
|
+ val uri = cover.getUriCompat(activity)
|
|
|
+ startActivity(Intent.createChooser(uri.toShareIntent(), activity.getString(R.string.action_share)))
|
|
|
+ } catch (e: Exception) {
|
|
|
+ Timber.e(e)
|
|
|
+ activity?.toast(R.string.error_sharing_cover)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun saveCover() {
|
|
|
+ try {
|
|
|
+ presenter.saveCover(activity!!)
|
|
|
+ activity?.toast(R.string.cover_saved)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ Timber.e(e)
|
|
|
+ activity?.toast(R.string.error_saving_cover)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun changeCover() {
|
|
|
val manga = manga ?: return
|
|
|
if (manga.hasCustomCover(coverCache)) {
|
|
|
- showEditCoverDialog(manga)
|
|
|
+ ChangeMangaCoverDialog(this, manga).showDialog(router)
|
|
|
} else {
|
|
|
openMangaCoverPicker(manga)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Edit custom cover for selected manga.
|
|
|
- */
|
|
|
- private fun showEditCoverDialog(manga: Manga) {
|
|
|
- ChangeMangaCoverDialog(this, manga).showDialog(router)
|
|
|
- }
|
|
|
-
|
|
|
override fun openMangaCoverPicker(manga: Manga) {
|
|
|
if (manga.favorite) {
|
|
|
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
|