mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:25:08 +01:00
Fix options when tapping on a cover in manga details
This commit is contained in:
parent
c5f592bbe7
commit
9dbeab3458
@ -30,6 +30,7 @@ import androidx.appcompat.view.ActionMode
|
|||||||
import androidx.appcompat.widget.PopupMenu
|
import androidx.appcompat.widget.PopupMenu
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat.setTint
|
||||||
import androidx.core.view.iterator
|
import androidx.core.view.iterator
|
||||||
import androidx.palette.graphics.Palette
|
import androidx.palette.graphics.Palette
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper
|
import androidx.recyclerview.widget.ItemTouchHelper
|
||||||
@ -88,6 +89,7 @@ import eu.kanade.tachiyomi.util.isLocal
|
|||||||
import eu.kanade.tachiyomi.util.moveCategories
|
import eu.kanade.tachiyomi.util.moveCategories
|
||||||
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
||||||
import eu.kanade.tachiyomi.util.system.ThemeUtil
|
import eu.kanade.tachiyomi.util.system.ThemeUtil
|
||||||
|
import eu.kanade.tachiyomi.util.system.contextCompatDrawable
|
||||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||||
import eu.kanade.tachiyomi.util.system.getPrefTheme
|
import eu.kanade.tachiyomi.util.system.getPrefTheme
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
@ -727,6 +729,19 @@ class MangaDetailsController :
|
|||||||
|
|
||||||
//region action bar menu methods
|
//region action bar menu methods
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
|
if (fullCoverActive) {
|
||||||
|
activityBinding?.toolbar?.navigationIcon =
|
||||||
|
view?.context?.contextCompatDrawable(R.drawable.ic_arrow_back_24dp)?.apply {
|
||||||
|
setTint(Color.WHITE)
|
||||||
|
}
|
||||||
|
inflater.inflate(R.menu.manga_details_cover, menu)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
activityBinding?.toolbar?.navigationIcon =
|
||||||
|
activityBinding?.toolbar?.navigationIcon?.mutate()?.apply {
|
||||||
|
setTint(view?.context?.getResourceColor(R.attr.actionBarTintColor) ?: Color.WHITE)
|
||||||
|
}
|
||||||
|
activityBinding?.toolbar?.invalidateDrawable(activityBinding?.toolbar?.navigationIcon!!)
|
||||||
inflater.inflate(R.menu.manga_details, menu)
|
inflater.inflate(R.menu.manga_details, menu)
|
||||||
val editItem = menu.findItem(R.id.action_edit)
|
val editItem = menu.findItem(R.id.action_edit)
|
||||||
editItem.isVisible = presenter.manga.favorite && !presenter.isLockedFromSearch
|
editItem.isVisible = presenter.manga.favorite && !presenter.isLockedFromSearch
|
||||||
@ -763,20 +778,6 @@ class MangaDetailsController :
|
|||||||
searchView.clearFocus()
|
searchView.clearFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
val menuItems = menu.iterator()
|
|
||||||
while (menuItems.hasNext()) {
|
|
||||||
val menuItem = menuItems.next()
|
|
||||||
menuItems.next().isVisible = !fullCoverActive && menuItem.isVisible
|
|
||||||
}
|
|
||||||
val saveItem = menu.findItem(R.id.save)
|
|
||||||
val shareItem = menu.findItem(R.id.share)
|
|
||||||
saveItem.isVisible = fullCoverActive
|
|
||||||
shareItem.isVisible = fullCoverActive
|
|
||||||
if (fullCoverActive) {
|
|
||||||
saveItem.icon.setTint(Color.WHITE)
|
|
||||||
shareItem.icon.setTint(Color.WHITE)
|
|
||||||
}
|
|
||||||
|
|
||||||
setOnQueryTextChangeListener(searchView) {
|
setOnQueryTextChangeListener(searchView) {
|
||||||
query = it ?: ""
|
query = it ?: ""
|
||||||
if (query.isNotEmpty()) getHeader()?.collapse()
|
if (query.isNotEmpty()) getHeader()?.collapse()
|
||||||
|
@ -78,17 +78,4 @@
|
|||||||
android:title="@string/migrate"
|
android:title="@string/migrate"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/save"
|
|
||||||
android:icon="@drawable/ic_save_24dp"
|
|
||||||
android:title="@string/save"
|
|
||||||
android:visible="false"
|
|
||||||
app:showAsAction="ifRoom" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/share"
|
|
||||||
android:icon="@drawable/ic_share_24dp"
|
|
||||||
android:title="@string/share"
|
|
||||||
android:visible="false"
|
|
||||||
app:showAsAction="ifRoom" />
|
|
||||||
</menu>
|
</menu>
|
||||||
|
18
app/src/main/res/menu/manga_details_cover.xml
Normal file
18
app/src/main/res/menu/manga_details_cover.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/save"
|
||||||
|
android:icon="@drawable/ic_save_24dp"
|
||||||
|
android:title="@string/save"
|
||||||
|
app:iconTint="@android:color/white"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/share"
|
||||||
|
android:icon="@drawable/ic_share_24dp"
|
||||||
|
android:title="@string/share"
|
||||||
|
app:iconTint="@android:color/white"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
</menu>
|
Loading…
Reference in New Issue
Block a user