Fix saving cover putting it in a weird folder, cleanup
This commit is contained in:
parent
5e531ba469
commit
9a45891ed6
@ -154,10 +154,10 @@ class MangaController :
|
|||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
constructor(redirect: MangaPresenter.EXHRedirect) : super(
|
constructor(redirect: MangaPresenter.EXHRedirect) : super(
|
||||||
Bundle().apply {
|
bundleOf(
|
||||||
putLong(MANGA_EXTRA, redirect.manga.id!!)
|
MANGA_EXTRA to (redirect.manga.id ?: 0),
|
||||||
putBoolean(UPDATE_EXTRA, redirect.update)
|
UPDATE_EXTRA to redirect.update
|
||||||
}
|
)
|
||||||
) {
|
) {
|
||||||
this.manga = redirect.manga
|
this.manga = redirect.manga
|
||||||
if (manga != null) {
|
if (manga != null) {
|
||||||
@ -451,21 +451,24 @@ class MangaController :
|
|||||||
|
|
||||||
// Hide options for non-library manga
|
// Hide options for non-library manga
|
||||||
menu.findItem(R.id.action_edit_categories).isVisible = presenter.manga.favorite && presenter.getCategories().isNotEmpty()
|
menu.findItem(R.id.action_edit_categories).isVisible = presenter.manga.favorite && presenter.getCategories().isNotEmpty()
|
||||||
/* SY --> menu.findItem(R.id.action_edit_cover).isVisible = presenter.manga.favorite SY <-- */
|
menu.findItem(R.id.action_edit_cover).isVisible = /* SY --> */ false /* presenter.manga.favorite SY <-- */
|
||||||
/* SY --> menu.findItem(R.id.action_migrate).isVisible = presenter.manga.favorite SY <-- */
|
menu.findItem(R.id.action_migrate).isVisible = presenter.manga.favorite
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
if (presenter.manga.favorite) menu.findItem(R.id.action_edit).isVisible = true
|
menu.findItem(R.id.action_edit).isVisible = presenter.manga.favorite
|
||||||
if (preferences.recommendsInOverflow().get()) menu.findItem(R.id.action_recommend).isVisible = true
|
menu.findItem(R.id.action_recommend).isVisible = preferences.recommendsInOverflow().get()
|
||||||
menu.findItem(R.id.action_merged).isVisible = presenter.manga.source == MERGED_SOURCE_ID
|
menu.findItem(R.id.action_merged).isVisible = presenter.manga.source == MERGED_SOURCE_ID
|
||||||
menu.findItem(R.id.action_toggle_dedupe).isVisible = false // presenter.manga.source == MERGED_SOURCE_ID
|
menu.findItem(R.id.action_toggle_dedupe).isVisible = false // presenter.manga.source == MERGED_SOURCE_ID
|
||||||
|
val shareCoverItem = menu.findItem(R.id.action_share_cover)
|
||||||
|
val saveCoverItem = menu.findItem(R.id.action_save)
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
menu.forEach {
|
menu.forEach {
|
||||||
it.isVisible = false
|
it.isVisible = it == shareCoverItem || it == saveCoverItem
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
shareCoverItem.isVisible = false
|
||||||
|
saveCoverItem.isVisible = false
|
||||||
}
|
}
|
||||||
menu.findItem(R.id.action_share_cover).isVisible = isExpanded
|
|
||||||
menu.findItem(R.id.action_save).isVisible = isExpanded
|
|
||||||
// SY <--
|
// SY <--
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,7 +509,7 @@ class MangaController :
|
|||||||
R.id.action_migrate -> migrateManga()
|
R.id.action_migrate -> migrateManga()
|
||||||
// SY -->
|
// SY -->
|
||||||
R.id.action_save -> {
|
R.id.action_save -> {
|
||||||
if (presenter.saveCover()) {
|
if (presenter.saveCover(activity!!)) {
|
||||||
activity?.toast(R.string.cover_saved)
|
activity?.toast(R.string.cover_saved)
|
||||||
} else {
|
} else {
|
||||||
activity?.toast(R.string.error_saving_cover)
|
activity?.toast(R.string.error_saving_cover)
|
||||||
|
@ -513,12 +513,12 @@ class MangaPresenter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveCover(): Boolean {
|
fun saveCover(context: Context): Boolean {
|
||||||
return try {
|
return try {
|
||||||
val directory = File(
|
val directory = File(
|
||||||
Environment.getExternalStorageDirectory().absolutePath +
|
Environment.getExternalStorageDirectory().absolutePath +
|
||||||
File.separator + Environment.DIRECTORY_PICTURES +
|
File.separator + Environment.DIRECTORY_PICTURES +
|
||||||
File.separator + R.string.app_name
|
File.separator + context.getString(R.string.app_name)
|
||||||
)
|
)
|
||||||
saveCover(directory)
|
saveCover(directory)
|
||||||
true
|
true
|
||||||
|
@ -42,10 +42,10 @@
|
|||||||
android:title="@string/action_edit_categories"
|
android:title="@string/action_edit_categories"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<!--<item
|
<item
|
||||||
android:id="@+id/action_edit_cover"
|
android:id="@+id/action_edit_cover"
|
||||||
android:title="@string/action_edit_cover"
|
android:title="@string/action_edit_cover"
|
||||||
app:showAsAction="never" />-->
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_migrate"
|
android:id="@+id/action_migrate"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user