Skip to content

Commit

Permalink
fix select mode not work
Browse files Browse the repository at this point in the history
  • Loading branch information
goyourfly committed Jul 20, 2017
1 parent 9dd02b8 commit aaa6402
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,17 @@ class MultipleAdapter(val adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>
fun onItemLongClick(position: Int): Boolean {
if (isIgnore(position))
return false
selectIndex.clear()
if (showState == ViewState.DEFAULT) {
selectMode(false)
selectIndex.put(position, true)
selectNum = 1
stateChangeListener?.onSelect(position, selectNum)
popupToolbar?.onUpdateTitle(selectNum, getTotal())
} else if (showState == ViewState.SELECT) {
selectNum = 0
cancel()
cancel(false)
}
notifyDataSetChanged()
handler.postDelayed(run, duration)
return true
}

Expand All @@ -183,13 +183,14 @@ class MultipleAdapter(val adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>
}

override fun selectMode(refresh: Boolean) {
selectNum = 1
selectIndex.clear()
showState = ViewState.DEFAULT_TO_SELECT
popupToolbar?.show()
popupToolbar?.onUpdateTitle(selectNum, getTotal())
stateChangeListener?.onSelectMode()
if (refresh)
notifyDataSetChanged()
stateChangeListener?.onSelectMode()
handler.postDelayed(run, duration)
}

override fun getTotal(): Int {
Expand Down

0 comments on commit aaa6402

Please sign in to comment.