implementing a Select All menu button at Recents
This commit is contained in:
parent
a192c1b028
commit
4743fcd730
|
@ -16,24 +16,30 @@ import java.util.*
|
||||||
|
|
||||||
class RecentCallsAdapter(activity: SimpleActivity, var recentCalls: ArrayList<RecentCall>, recyclerView: MyRecyclerView, fastScroller: FastScroller,
|
class RecentCallsAdapter(activity: SimpleActivity, var recentCalls: ArrayList<RecentCall>, recyclerView: MyRecyclerView, fastScroller: FastScroller,
|
||||||
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
||||||
val showPhoneNumbers = activity.config.showPhoneNumbers
|
private val showPhoneNumbers = activity.config.showPhoneNumbers
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setupDragListener(true)
|
setupDragListener(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getActionMenuId() = 0
|
override fun getActionMenuId() = R.menu.cab_recent_calls
|
||||||
|
|
||||||
override fun prepareActionMode(menu: Menu) {}
|
override fun prepareActionMode(menu: Menu) {}
|
||||||
|
|
||||||
override fun prepareItemSelection(viewHolder: ViewHolder) {}
|
override fun prepareItemSelection(viewHolder: ViewHolder) {}
|
||||||
|
|
||||||
override fun markViewHolderSelection(select: Boolean, viewHolder: ViewHolder?) {}
|
override fun markViewHolderSelection(select: Boolean, viewHolder: ViewHolder?) {
|
||||||
|
viewHolder?.itemView?.recent_call_frame?.isSelected = select
|
||||||
|
}
|
||||||
|
|
||||||
override fun actionItemPressed(id: Int) {
|
override fun actionItemPressed(id: Int) {
|
||||||
if (selectedPositions.isEmpty()) {
|
if (selectedPositions.isEmpty()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
when (id) {
|
||||||
|
R.id.cab_select_all -> selectAll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSelectableItemCount() = recentCalls.size
|
override fun getSelectableItemCount() = recentCalls.size
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_delete"
|
||||||
|
android:icon="@drawable/ic_delete"
|
||||||
|
android:title="@string/delete"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_select_all"
|
||||||
|
android:icon="@drawable/ic_select_all"
|
||||||
|
android:title="@string/select_all"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
</menu>
|
Loading…
Reference in New Issue