diff --git a/library/src/main/java/com/goyourfly/multiple/adapter/MultipleAdapter.kt b/library/src/main/java/com/goyourfly/multiple/adapter/MultipleAdapter.kt index 186f6a1..9c01caa 100644 --- a/library/src/main/java/com/goyourfly/multiple/adapter/MultipleAdapter.kt +++ b/library/src/main/java/com/goyourfly/multiple/adapter/MultipleAdapter.kt @@ -154,17 +154,17 @@ class MultipleAdapter(val adapter: RecyclerView.Adapter 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 } @@ -183,13 +183,14 @@ class MultipleAdapter(val adapter: RecyclerView.Adapter } 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 {