use the new way of adding vertical dividers to recyclerview adapters
This commit is contained in:
parent
554ea6512b
commit
d80f9a3698
|
@ -46,7 +46,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.0.3'
|
||||
implementation 'com.simplemobiletools:commons:3.0.5'
|
||||
|
||||
implementation files('../libs/RootTools.jar')
|
||||
|
||||
|
|
|
@ -24,9 +24,12 @@ class FavoritesActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
manage_favorites_placeholder.beVisibleIf(favorites.isEmpty())
|
||||
manage_favorites_placeholder.setTextColor(config.textColor)
|
||||
|
||||
val adapter = ManageFavoritesAdapter(this, favorites, this, manage_favorites_list) {}
|
||||
adapter.setupDragListener(true)
|
||||
manage_favorites_list.adapter = adapter
|
||||
ManageFavoritesAdapter(this, favorites, this, manage_favorites_list) {
|
||||
|
||||
}.apply {
|
||||
setupDragListener(true)
|
||||
manage_favorites_list.adapter = this
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
|
|
|
@ -87,8 +87,8 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
|
||||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
||||
val fileDirItem = fileDirItems[position]
|
||||
val view = holder.bindView(fileDirItem) {
|
||||
setupView(it, fileDirItem)
|
||||
val view = holder.bindView(fileDirItem, true) { itemView, layoutPosition ->
|
||||
setupView(itemView, fileDirItem)
|
||||
}
|
||||
bindViewHolder(holder, position, view)
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ class ManageFavoritesAdapter(activity: BaseSimpleActivity, var favorites: ArrayL
|
|||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val favorite = favorites[position]
|
||||
val view = holder.bindView(favorite) {
|
||||
setupView(it, favorite)
|
||||
val view = holder.bindView(favorite) { itemView, layoutPosition ->
|
||||
setupView(itemView, favorite)
|
||||
}
|
||||
bindViewHolder(holder, position, view)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.filemanager.fragments
|
|||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v7.widget.DividerItemDecoration
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -134,16 +133,13 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
storedItems = items
|
||||
val currAdapter = items_list.adapter
|
||||
if (currAdapter == null) {
|
||||
val adapter = ItemsAdapter(activity as SimpleActivity, storedItems, this@ItemsFragment, items_list, isPickMultipleIntent) {
|
||||
ItemsAdapter(activity as SimpleActivity, storedItems, this@ItemsFragment, items_list, isPickMultipleIntent) {
|
||||
itemClicked(it as FileDirItem)
|
||||
}.apply {
|
||||
setupDragListener(true)
|
||||
addVerticalDividers(true)
|
||||
items_list.adapter = this
|
||||
}
|
||||
adapter.setupDragListener(true)
|
||||
|
||||
DividerItemDecoration(context, DividerItemDecoration.VERTICAL).apply {
|
||||
setDrawable(context.resources.getDrawable(com.simplemobiletools.commons.R.drawable.divider))
|
||||
items_list.addItemDecoration(this)
|
||||
}
|
||||
items_list.adapter = adapter
|
||||
items_fastscroller.setViews(items_list, items_swipe_refresh)
|
||||
} else {
|
||||
(currAdapter as ItemsAdapter).updateItems(storedItems)
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/breadcrumbs"
|
||||
android:clipToPadding="false"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="android.support.v7.widget.LinearLayoutManager"/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue