From 7f63e318f1a741df038e466b200fc6d81bcdaa91 Mon Sep 17 00:00:00 2001 From: Carlos Date: Tue, 23 Jan 2018 12:50:48 -0500 Subject: [PATCH] Catalog visuals update 1155 (#1167) * adjusted search to be lower in navview * close drawer on search moved search and reset to bottom * switched sort icon to arrow * allow secondary drawer to swipe open and close * fixed click to collapse for sortgroup, and group item updated to rc4 flexibleadapter * added header to drawer * changed string to Search filters * collapsed sort group * fixed arrow size * added divider line * fixed vector size * add divider id and tools text --- app/build.gradle | 3 +- .../browse/BrowseCatalogueController.kt | 14 +--- .../browse/CatalogueNavigationView.kt | 2 +- .../ui/catalogue/filter/GroupItem.kt | 9 +++ .../ui/catalogue/filter/SortGroup.kt | 7 ++ .../tachiyomi/ui/catalogue/filter/SortItem.kt | 4 +- .../ui/category/CategoryController.kt | 6 +- .../main/res/drawable/ic_arrow_down_32dp.xml | 16 +++++ .../main/res/drawable/ic_arrow_up_32dp.xml | 16 +++++ .../res/layout/catalogue_drawer_content.xml | 66 ++++++++++++++----- app/src/main/res/values/strings.xml | 1 + 11 files changed, 107 insertions(+), 37 deletions(-) create mode 100644 app/src/main/res/drawable/ic_arrow_down_32dp.xml create mode 100644 app/src/main/res/drawable/ic_arrow_up_32dp.xml diff --git a/app/build.gradle b/app/build.gradle index c503566e9..a3b816a48 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -193,7 +193,8 @@ dependencies { // UI implementation 'com.dmitrymalkovich.android:material-design-dimens:1.4' implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4' - implementation 'eu.davidea:flexible-adapter:5.0.0-rc3' + implementation 'eu.davidea:flexible-adapter:5.0.0-rc4' + implementation 'eu.davidea:flexible-adapter-ui:1.0.0-b1' implementation 'com.nononsenseapps:filepicker:2.5.2' implementation 'com.github.amulyakhare:TextDrawable:558677e' implementation('com.afollestad.material-dialogs:core:0.9.4.7') { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt index 64b6d6c39..80f284204 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt @@ -24,7 +24,6 @@ import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.util.* import eu.kanade.tachiyomi.widget.AutofitRecyclerView -import eu.kanade.tachiyomi.widget.DrawerSwipeCloseListener import kotlinx.android.synthetic.main.catalogue_controller.* import kotlinx.android.synthetic.main.main_activity.* import rx.Observable @@ -75,11 +74,6 @@ open class BrowseCatalogueController(bundle: Bundle) : */ private var recycler: RecyclerView? = null - /** - * Drawer listener to allow swipe only for closing the drawer. - */ - private var drawerListener: DrawerLayout.DrawerListener? = null - /** * Subscription for the search view. */ @@ -138,17 +132,15 @@ open class BrowseCatalogueController(bundle: Bundle) : // Inflate and prepare drawer val navView = drawer.inflate(R.layout.catalogue_drawer) as CatalogueNavigationView this.navView = navView - drawerListener = DrawerSwipeCloseListener(drawer, navView).also { - drawer.addDrawerListener(it) - } navView.setFilters(presenter.filterItems) - drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.END) + drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.END) navView.onSearchClicked = { val allDefault = presenter.sourceFilters == presenter.source.getFilterList() showProgressBar() adapter?.clear() + drawer.closeDrawer(Gravity.END) presenter.setSourceFilter(if (allDefault) FilterList() else presenter.sourceFilters) } @@ -162,8 +154,6 @@ open class BrowseCatalogueController(bundle: Bundle) : } override fun cleanupSecondaryDrawer(drawer: DrawerLayout) { - drawerListener?.let { drawer.removeDrawerListener(it) } - drawerListener = null navView = null } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt index fd2d2685a..1f06fc407 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt @@ -28,7 +28,7 @@ class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: val view = inflate(R.layout.catalogue_drawer_content) ((view as ViewGroup).getChildAt(1) as ViewGroup).addView(recycler) addView(view) - + title.text = context?.getString(R.string.source_search_options) search_btn.setOnClickListener { onSearchClicked() } reset_btn.setOnClickListener { onResetClicked() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt index f5839fa98..325371d94 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt @@ -13,6 +13,10 @@ import eu.kanade.tachiyomi.util.setVectorCompat class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem>() { + init { + isExpanded = false + } + override fun getLayoutRes(): Int { return R.layout.navigation_view_group } @@ -32,6 +36,9 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem) : AbstractExpandableHeaderItem) : ExpandableViewHolder(view, adapter, true) { val title: TextView = itemView.findViewById(R.id.title) @@ -52,5 +60,6 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem>() { + init { + isExpanded = false + } + override fun getLayoutRes(): Int { return R.layout.navigation_view_group } @@ -29,6 +33,9 @@ class SortGroup(val filter: Filter.Sort) : AbstractExpandableHeaderItem VectorDrawableCompat.create(view.resources, R.drawable.ic_keyboard_arrow_down_black_32dp, null) + Filter.Sort.Selection(i, false) -> VectorDrawableCompat.create(view.resources, R.drawable.ic_arrow_down_32dp, null) ?.apply { setTint(view.context.getResourceColor(R.attr.colorAccent)) } - Filter.Sort.Selection(i, true) -> VectorDrawableCompat.create(view.resources, R.drawable.ic_keyboard_arrow_up_black_32dp, null) + Filter.Sort.Selection(i, true) -> VectorDrawableCompat.create(view.resources, R.drawable.ic_arrow_up_32dp, null) ?.apply { setTint(view.context.getResourceColor(R.attr.colorAccent)) } else -> ContextCompat.getDrawable(view.context, R.drawable.empty_drawable_32dp) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt index 843a83e71..c698c2d6e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt @@ -26,7 +26,7 @@ class CategoryController : NucleusController(), CategoryAdapter.OnItemReleaseListener, CategoryCreateDialog.Listener, CategoryRenameDialog.Listener, - UndoHelper.OnUndoListener { + UndoHelper.OnActionListener { /** * Object used to show ActionMode toolbar. @@ -168,7 +168,7 @@ class CategoryController : NucleusController(), R.id.action_delete -> { undoHelper = UndoHelper(adapter, this) undoHelper?.start(adapter.selectedPositions, view!!, - R.string.snack_categories_deleted, R.string.action_undo, 3000) + R.string.snack_categories_deleted, R.string.action_undo, 3000) mode.finish() } @@ -268,7 +268,7 @@ class CategoryController : NucleusController(), * * @param action The action performed. */ - override fun onActionCanceled(action: Int) { + override fun onActionCanceled(action: Int, positions: MutableList?) { adapter?.restoreDeletedItems() undoHelper = null } diff --git a/app/src/main/res/drawable/ic_arrow_down_32dp.xml b/app/src/main/res/drawable/ic_arrow_down_32dp.xml new file mode 100644 index 000000000..47d9d1ca0 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_down_32dp.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_arrow_up_32dp.xml b/app/src/main/res/drawable/ic_arrow_up_32dp.xml new file mode 100644 index 000000000..5068a47bc --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_up_32dp.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/catalogue_drawer_content.xml b/app/src/main/res/layout/catalogue_drawer_content.xml index a9310079a..b2b621a9c 100644 --- a/app/src/main/res/layout/catalogue_drawer_content.xml +++ b/app/src/main/res/layout/catalogue_drawer_content.xml @@ -1,36 +1,66 @@ - + android:clickable="true" + android:orientation="vertical"> + android:layout_height="?attr/listPreferredItemHeightSmall" + android:background="?colorPrimary" + android:elevation="2dp" + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="?attr/listPreferredItemPaddingLeft" + android:paddingRight="?attr/listPreferredItemPaddingRight" + > -