mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Added delete call log + started top dots menu
This commit is contained in:
parent
8d74b8f133
commit
2ef56c0cbb
6 changed files with 59 additions and 4 deletions
|
|
@ -49,6 +49,11 @@ class CallsListAdapter(
|
|||
selectedAdapterPosition = -1
|
||||
}
|
||||
|
||||
fun deleteSelection() {
|
||||
notifyItemRemoved(selectedAdapterPosition)
|
||||
selectedAdapterPosition = -1
|
||||
}
|
||||
|
||||
inner class ViewHolder(
|
||||
val binding: CallListCellBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ class CallsListFragment : GenericFragment() {
|
|||
}, {
|
||||
// onCopyNumberOrAddressToClipboard
|
||||
copyNumberOrAddressToClipboard(model.displayedAddress)
|
||||
}, {
|
||||
// onDeleteCallLog
|
||||
model.delete()
|
||||
adapter.deleteSelection()
|
||||
})
|
||||
modalBottomSheet.show(parentFragmentManager, CallsListMenuDialogFragment.TAG)
|
||||
}
|
||||
|
|
@ -119,6 +123,10 @@ class CallsListFragment : GenericFragment() {
|
|||
listViewModel.applyFilter(filter)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setMenuClickListener {
|
||||
// TODO show popup menu with delete all history button
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyNumberOrAddressToClipboard(value: String) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ import org.linphone.databinding.CallsListLongPressMenuBinding
|
|||
|
||||
class CallsListMenuDialogFragment(
|
||||
private val onDismiss: (() -> Unit)? = null,
|
||||
private val onCopyNumberOrAddressToClipboard: (() -> Unit)? = null
|
||||
private val onCopyNumberOrAddressToClipboard: (() -> Unit)? = null,
|
||||
private val onDeleteCallLog: (() -> Unit)? = null
|
||||
) : BottomSheetDialogFragment() {
|
||||
companion object {
|
||||
const val TAG = "CallsListMenuDialogFragment"
|
||||
|
|
@ -58,7 +59,7 @@ class CallsListMenuDialogFragment(
|
|||
}
|
||||
|
||||
view.setDeleteClickListener {
|
||||
// TODO
|
||||
onDeleteCallLog?.invoke()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,4 +43,11 @@ class CallLogModel(val callLog: CallLog) {
|
|||
avatarModel = ContactAvatarModel(fakeFriend)
|
||||
}
|
||||
}
|
||||
|
||||
fun delete() {
|
||||
// UI thread
|
||||
coreContext.postOnCoreThread { core ->
|
||||
core.removeCallLog(callLog)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@
|
|||
<variable
|
||||
name="onConversationsClicked"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="menuClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.calls.viewmodel.CallsListViewModel" />
|
||||
|
|
@ -26,10 +29,24 @@
|
|||
android:name="org.linphone.ui.main.fragment.TopBarFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_search_bar_height"
|
||||
android:layout_marginEnd="9dp"
|
||||
bind:layout="@layout/top_search_bar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
app:layout_constraintEnd_toStartOf="@id/menu"/>
|
||||
|
||||
<ImageView
|
||||
android:onClick="@{menuClickListener}"
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="9dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/dot_menu"
|
||||
app:tint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/top_bar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@
|
|||
<variable
|
||||
name="onConversationsClicked"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="menuClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.calls.viewmodel.CallsListViewModel" />
|
||||
|
|
@ -26,10 +29,24 @@
|
|||
android:name="org.linphone.ui.main.fragment.TopBarFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_search_bar_height"
|
||||
android:layout_marginEnd="9dp"
|
||||
bind:layout="@layout/top_search_bar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
app:layout_constraintEnd_toStartOf="@id/menu"/>
|
||||
|
||||
<ImageView
|
||||
android:onClick="@{menuClickListener}"
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="9dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/dot_menu"
|
||||
app:tint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/top_bar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue