mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-17 21:38:29 +00:00
Removed history list popup menu that only contained 1 item
This commit is contained in:
parent
c03f1120d3
commit
d41ad88590
4 changed files with 10 additions and 86 deletions
|
|
@ -20,15 +20,12 @@
|
|||
package org.linphone.ui.main.history.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.PopupWindow
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
|
@ -38,7 +35,6 @@ import org.linphone.LinphoneApplication.Companion.coreContext
|
|||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.HistoryListFragmentBinding
|
||||
import org.linphone.databinding.HistoryListPopupMenuBinding
|
||||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.AbstractMainFragment
|
||||
import org.linphone.ui.main.history.adapter.HistoryListAdapter
|
||||
|
|
@ -235,8 +231,8 @@ class HistoryListFragment : AbstractMainFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
binding.setMenuClickListener {
|
||||
showPopupMenu()
|
||||
binding.setDeleteAllClickListener {
|
||||
showDeleteConfirmationDialog()
|
||||
}
|
||||
|
||||
binding.setStartCallClickListener {
|
||||
|
|
@ -289,30 +285,6 @@ class HistoryListFragment : AbstractMainFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun showPopupMenu() {
|
||||
val popupView: HistoryListPopupMenuBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(requireContext()),
|
||||
R.layout.history_list_popup_menu,
|
||||
null,
|
||||
false
|
||||
)
|
||||
val popupWindow = PopupWindow(
|
||||
popupView.root,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
true
|
||||
)
|
||||
|
||||
popupView.setDeleteAllHistoryClickListener {
|
||||
showDeleteConfirmationDialog()
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
// Elevation is for showing a shadow around the popup
|
||||
popupWindow.elevation = 20f
|
||||
popupWindow.showAsDropDown(binding.topBar.extraAction, 0, 0, Gravity.BOTTOM)
|
||||
}
|
||||
|
||||
private fun showDeleteConfirmationDialog() {
|
||||
val model = ConfirmationDialogModel()
|
||||
val dialog = DialogUtils.getRemoveAllCallLogsConfirmationDialog(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
name="onConversationsClicked"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="menuClickListener"
|
||||
name="deleteAllClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="startCallClickListener"
|
||||
|
|
@ -56,9 +56,9 @@
|
|||
layout="@layout/main_activity_top_bar"
|
||||
bind:viewModel="@{viewModel}"
|
||||
bind:enableExtraAction="@{true}"
|
||||
bind:extraActionIcon="@{@drawable/dots_three_vertical}"
|
||||
bind:extraActionClickListener="@{menuClickListener}"
|
||||
bind:extraActionContentDescription="@{@string/content_description_show_popup_menu}"
|
||||
bind:extraActionIcon="@{@drawable/trash_simple}"
|
||||
bind:extraActionClickListener="@{deleteAllClickListener}"
|
||||
bind:extraActionContentDescription="@{@string/menu_delete_history}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
name="onConversationsClicked"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="menuClickListener"
|
||||
name="deleteAllClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="startCallClickListener"
|
||||
|
|
@ -47,9 +47,9 @@
|
|||
layout="@layout/main_activity_top_bar"
|
||||
bind:viewModel="@{viewModel}"
|
||||
bind:enableExtraAction="@{true}"
|
||||
bind:extraActionIcon="@{@drawable/dots_three_vertical}"
|
||||
bind:extraActionClickListener="@{menuClickListener}"
|
||||
bind:extraActionContentDescription="@{@string/content_description_show_popup_menu}"
|
||||
bind:extraActionIcon="@{@drawable/trash_simple}"
|
||||
bind:extraActionClickListener="@{deleteAllClickListener}"
|
||||
bind:extraActionContentDescription="@{@string/menu_delete_history}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="deleteAllHistoryClickListener"
|
||||
type="View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="@dimen/popup_menu_padding"
|
||||
android:paddingStart="@dimen/popup_menu_padding"
|
||||
android:background="@drawable/shape_round_popup_menu_background">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/popup_menu_item"
|
||||
android:id="@+id/delete"
|
||||
android:onClick="@{deleteAllHistoryClickListener}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_delete_history"
|
||||
android:textColor="?attr/color_danger_500"
|
||||
android:drawableStart="@drawable/trash_simple"
|
||||
app:drawableTint="?attr/color_danger_500"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_anchor"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="@dimen/popup_menu_padding"
|
||||
app:layout_constraintWidth_max="@dimen/popup_menu_width"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/delete"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
Loading…
Add table
Reference in a new issue