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
This commit is contained in:
Carlos 2018-01-23 12:50:48 -05:00 committed by inorichi
parent 6c749319cf
commit 7f63e318f1
11 changed files with 107 additions and 37 deletions

View File

@ -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') {

View File

@ -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
}

View File

@ -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() }
}

View File

@ -13,6 +13,10 @@ import eu.kanade.tachiyomi.util.setVectorCompat
class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<GroupItem.Holder, ISectionable<*, *>>() {
init {
isExpanded = false
}
override fun getLayoutRes(): Int {
return R.layout.navigation_view_group
}
@ -32,6 +36,9 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
R.drawable.ic_expand_more_white_24dp
else
R.drawable.ic_chevron_right_white_24dp)
holder.itemView.setOnClickListener(holder)
}
override fun equals(other: Any?): Boolean {
@ -44,6 +51,7 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
return filter.hashCode()
}
open class Holder(view: View, adapter: FlexibleAdapter<*>) : ExpandableViewHolder(view, adapter, true) {
val title: TextView = itemView.findViewById(R.id.title)
@ -52,5 +60,6 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
override fun shouldNotifyParentOnClick(): Boolean {
return true
}
}
}

View File

@ -10,6 +10,10 @@ import eu.kanade.tachiyomi.util.setVectorCompat
class SortGroup(val filter: Filter.Sort) : AbstractExpandableHeaderItem<SortGroup.Holder, ISectionable<*, *>>() {
init {
isExpanded = false
}
override fun getLayoutRes(): Int {
return R.layout.navigation_view_group
}
@ -29,6 +33,9 @@ class SortGroup(val filter: Filter.Sort) : AbstractExpandableHeaderItem<SortGrou
R.drawable.ic_expand_more_white_24dp
else
R.drawable.ic_chevron_right_white_24dp)
holder.itemView.setOnClickListener(holder)
}
override fun equals(other: Any?): Boolean {

View File

@ -33,9 +33,9 @@ class SortItem(val name: String, val group: SortGroup) : AbstractSectionableItem
val i = filter.values.indexOf(name)
fun getIcon() = when (filter.state) {
Filter.Sort.Selection(i, false) -> 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)
}

View File

@ -26,7 +26,7 @@ class CategoryController : NucleusController<CategoryPresenter>(),
CategoryAdapter.OnItemReleaseListener,
CategoryCreateDialog.Listener,
CategoryRenameDialog.Listener,
UndoHelper.OnUndoListener {
UndoHelper.OnActionListener {
/**
* Object used to show ActionMode toolbar.
@ -268,7 +268,7 @@ class CategoryController : NucleusController<CategoryPresenter>(),
*
* @param action The action performed.
*/
override fun onActionCanceled(action: Int) {
override fun onActionCanceled(action: Int, positions: MutableList<Int>?) {
adapter?.restoreDeletedItems()
undoHelper = null
}

View File

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportHeight="32"
android:viewportWidth="32">
<group
android:scaleX="0.8"
android:scaleY="0.8"
android:pivotX="32"
android:pivotY="32"
>
<path
android:fillColor="#FFFFFF"
android:pathData="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z"/>
</group>
</vector>

View File

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportHeight="32"
android:viewportWidth="32">
<group
android:scaleX="0.8"
android:scaleY="0.8"
android:pivotX="32"
android:pivotY="32"
>
<path
android:fillColor="#FFFFFF"
android:pathData="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z"/>
</group>
</vector>

View File

@ -1,36 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true">
android:clickable="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/title_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">
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"
>
<Button
style="@style/Theme.Widget.Button.Colored"
android:id="@+id/search_btn"
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/action_search"/>
<Button
style="@style/Theme.Widget.Button.Borderless"
android:id="@+id/reset_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/action_reset"/>
android:ellipsize="end"
android:maxLines="1"
tools:text="Title"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textColor="@color/textColorPrimaryDark"/>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="0dp"
android:layout_weight="3"
android:layout_gravity="top"/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/divider"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="8dp">
<Button
android:id="@+id/reset_btn"
style="@style/Theme.Widget.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/action_reset"/>
<Button
android:id="@+id/search_btn"
style="@style/Theme.Widget.Button.Colored"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/action_search"/>
</LinearLayout>
</LinearLayout>

View File

@ -277,6 +277,7 @@
<string name="also_delete_chapters">Also delete downloaded chapters</string>
<!-- Catalogue fragment -->
<string name="source_search_options">Search filters</string>
<string name="source_requires_login">This source requires you to log in</string>
<string name="select_source">Select a source</string>
<string name="no_valid_sources">Please enable at least one valid source</string>