hide overflow menu from ShowGroupedCallsDialog

This commit is contained in:
Pavel Poley 2022-06-08 11:26:48 +03:00
parent 8ea483b4b6
commit 4c1d125294
3 changed files with 17 additions and 11 deletions

View File

@ -8,6 +8,7 @@ import android.text.TextUtils
import android.util.TypedValue
import android.view.*
import android.widget.PopupMenu
import androidx.core.view.isVisible
import com.bumptech.glide.Glide
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
@ -26,7 +27,11 @@ import com.simplemobiletools.dialer.models.RecentCall
import kotlinx.android.synthetic.main.item_recent_call.view.*
class RecentCallsAdapter(
activity: SimpleActivity, var recentCalls: ArrayList<RecentCall>, recyclerView: MyRecyclerView, val refreshItemsListener: RefreshItemsListener?,
activity: SimpleActivity,
var recentCalls: ArrayList<RecentCall>,
recyclerView: MyRecyclerView,
private val refreshItemsListener: RefreshItemsListener?,
private val showOverflowMenu: Boolean,
itemClick: (Any) -> Unit
) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
@ -315,13 +320,15 @@ class RecentCallsAdapter(
item_recents_type.setImageDrawable(drawable)
overflow_menu_icon.drawable.apply {
mutate()
setTint(activity.getProperTextColor())
}
overflow_menu_icon.setOnClickListener {
showPopupMenu(overflow_menu_anchor, call)
overflow_menu_icon.isVisible = showOverflowMenu
if (showOverflowMenu) {
overflow_menu_icon.drawable.apply {
mutate()
setTint(activity.getProperTextColor())
}
overflow_menu_icon.setOnClickListener {
showPopupMenu(overflow_menu_anchor, call)
}
}
}
}

View File

@ -9,7 +9,6 @@ import com.simplemobiletools.dialer.adapters.RecentCallsAdapter
import com.simplemobiletools.dialer.helpers.RecentsHelper
import com.simplemobiletools.dialer.models.RecentCall
import kotlinx.android.synthetic.main.dialog_show_grouped_calls.view.*
import java.util.*
class ShowGroupedCallsDialog(val activity: BaseSimpleActivity, callIds: ArrayList<Int>) {
private var dialog: AlertDialog? = null
@ -20,7 +19,7 @@ class ShowGroupedCallsDialog(val activity: BaseSimpleActivity, callIds: ArrayLis
RecentsHelper(activity).getRecentCalls(false) { allRecents ->
val recents = allRecents.filter { callIds.contains(it.id) }.toMutableList() as ArrayList<RecentCall>
activity.runOnUiThread {
RecentCallsAdapter(activity as SimpleActivity, recents, select_grouped_calls_list, null) {
RecentCallsAdapter(activity as SimpleActivity, recents, select_grouped_calls_list, null, false) {
}.apply {
select_grouped_calls_list.adapter = this
}

View File

@ -90,7 +90,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
val currAdapter = recents_list.adapter
if (currAdapter == null) {
RecentCallsAdapter(activity as SimpleActivity, recents, recents_list, this) {
RecentCallsAdapter(activity as SimpleActivity, recents, recents_list, this, true) {
val recentCall = it as RecentCall
if (context.config.showCallConfirmation) {
CallConfirmationDialog(activity as SimpleActivity, recentCall.name) {