Move edit categories to overflow

This commit is contained in:
arkon 2020-07-16 22:22:06 -04:00
parent 4bc2288806
commit 88ee86b7ef
5 changed files with 11 additions and 25 deletions

View file

@ -315,7 +315,8 @@ class MangaController :
// Hide download options for local manga // Hide download options for local manga
menu.findItem(R.id.download_group).isVisible = !isLocalSource menu.findItem(R.id.download_group).isVisible = !isLocalSource
// Hide edit cover and migrate 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_cover).isVisible = presenter.manga.favorite menu.findItem(R.id.action_edit_cover).isVisible = presenter.manga.favorite
menu.findItem(R.id.action_migrate).isVisible = presenter.manga.favorite menu.findItem(R.id.action_migrate).isVisible = presenter.manga.favorite
} }
@ -377,6 +378,7 @@ class MangaController :
activity?.invalidateOptionsMenu() activity?.invalidateOptionsMenu()
} }
R.id.action_edit_categories -> onCategoriesClick()
R.id.action_edit_cover -> handleChangeCover() R.id.action_edit_cover -> handleChangeCover()
R.id.action_migrate -> migrateManga() R.id.action_migrate -> migrateManga()
} }
@ -526,7 +528,7 @@ class MangaController :
mangaInfoAdapter?.notifyDataSetChanged() mangaInfoAdapter?.notifyDataSetChanged()
} }
fun onCategoriesClick() { private fun onCategoriesClick() {
val manga = presenter.manga val manga = presenter.manga
val categories = presenter.getCategories() val categories = presenter.getCategories()

View file

@ -94,16 +94,6 @@ class MangaInfoHeaderAdapter(
binding.btnTracking.gone() binding.btnTracking.gone()
} }
if (controller.presenter.manga.favorite && controller.presenter.getCategories().isNotEmpty()) {
binding.btnCategories.visible()
binding.btnCategories.clicks()
.onEach { controller.onCategoriesClick() }
.launchIn(scope)
binding.btnCategories.setTooltip(R.string.action_move_category)
} else {
binding.btnCategories.gone()
}
if (controller.presenter.source is HttpSource) { if (controller.presenter.source is HttpSource) {
binding.btnWebview.visible() binding.btnWebview.visible()
binding.btnWebview.clicks() binding.btnWebview.clicks()
@ -286,8 +276,6 @@ class MangaInfoHeaderAdapter(
initialLoad = false initialLoad = false
} }
} }
binding.btnCategories.visibleIf { manga.favorite && controller.presenter.getCategories().isNotEmpty() }
} }
private fun showMangaInfo(visible: Boolean) { private fun showMangaInfo(visible: Boolean) {

View file

@ -142,17 +142,6 @@
app:icon="@drawable/ic_sync_24dp" app:icon="@drawable/ic_sync_24dp"
tools:visibility="visible" /> tools:visibility="visible" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_categories"
style="@style/Theme.Widget.Button.Icon.Textless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:contentDescription="@string/action_edit_categories"
android:visibility="gone"
app:icon="@drawable/ic_label_24dp"
tools:visibility="visible" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_share" android:id="@+id/btn_share"
style="@style/Theme.Widget.Button.Icon.Textless" style="@style/Theme.Widget.Button.Icon.Textless"

View file

@ -97,6 +97,11 @@
</menu> </menu>
</item> </item>
<item
android:id="@+id/action_edit_categories"
android:title="@string/action_edit_categories"
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"

View file

@ -255,6 +255,8 @@
<style name="Theme.Widget.Button.Icon" parent="Widget.MaterialComponents.Button.OutlinedButton.Icon"> <style name="Theme.Widget.Button.Icon" parent="Widget.MaterialComponents.Button.OutlinedButton.Icon">
<item name="android:minHeight">0dp</item> <item name="android:minHeight">0dp</item>
<item name="android:paddingBottom">4dp</item> <item name="android:paddingBottom">4dp</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">16dp</item>
<item name="elevation">0dp</item> <item name="elevation">0dp</item>