mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added popup menu & meeting removal, hiding operation in progress for now
This commit is contained in:
parent
3ae9740336
commit
9d5474f352
16 changed files with 138 additions and 15 deletions
|
|
@ -110,7 +110,6 @@ class ConversationsListViewModel @UiThread constructor() : AbstractTopBarViewMod
|
|||
val list = arrayListOf<ConversationModel>()
|
||||
var count = 0
|
||||
|
||||
// TODO? : Add support for chat rooms in magic search
|
||||
val account = LinphoneUtils.getDefaultAccount()
|
||||
val chatRooms = account?.chatRooms ?: coreContext.core.chatRooms
|
||||
for (chatRoom in chatRooms) {
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ class ContactsListViewModel @UiThread constructor() : AbstractTopBarViewModel()
|
|||
val list = arrayListOf<ContactAvatarModel>()
|
||||
val favouritesList = arrayListOf<ContactAvatarModel>()
|
||||
var previousLetter = ""
|
||||
var count = 0
|
||||
|
||||
for (result in results) {
|
||||
val friend = result.friend
|
||||
|
|
@ -167,9 +168,16 @@ class ContactsListViewModel @UiThread constructor() : AbstractTopBarViewModel()
|
|||
model.firstContactStartingByThatLetter.postValue(displayLetter)
|
||||
|
||||
list.add(model)
|
||||
count += 1
|
||||
|
||||
if (friend?.starred == true) {
|
||||
favouritesList.add(model)
|
||||
}
|
||||
|
||||
if (count == 20) {
|
||||
contactsList.postValue(list)
|
||||
fetchInProgress.postValue(false)
|
||||
}
|
||||
}
|
||||
|
||||
favourites.postValue(favouritesList)
|
||||
|
|
|
|||
|
|
@ -23,16 +23,22 @@ import android.content.ActivityNotFoundException
|
|||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.provider.CalendarContract
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.PopupWindow
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.MeetingFragmentBinding
|
||||
import org.linphone.databinding.MeetingPopupMenuBinding
|
||||
import org.linphone.ui.main.MainActivity
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
import org.linphone.ui.main.meetings.viewmodel.MeetingViewModel
|
||||
import org.linphone.utils.Event
|
||||
|
|
@ -114,6 +120,10 @@ class MeetingFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
binding.setMenuClickListener {
|
||||
showPopupMenu()
|
||||
}
|
||||
|
||||
sharedViewModel.isSlidingPaneSlideable.observe(viewLifecycleOwner) { slideable ->
|
||||
viewModel.showBackButton.value = slideable
|
||||
}
|
||||
|
|
@ -133,5 +143,41 @@ class MeetingFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.conferenceInfoDeletedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG Meeting info has been deleted successfully")
|
||||
(requireActivity() as MainActivity).showGreenToast(
|
||||
getString(R.string.meeting_info_deleted_toast),
|
||||
R.drawable.trash_simple
|
||||
)
|
||||
sharedViewModel.forceRefreshMeetingsListEvent.value = Event(true)
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showPopupMenu() {
|
||||
val popupView: MeetingPopupMenuBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(requireContext()),
|
||||
R.layout.meeting_popup_menu,
|
||||
null,
|
||||
false
|
||||
)
|
||||
val popupWindow = PopupWindow(
|
||||
popupView.root,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
true
|
||||
)
|
||||
|
||||
popupView.setDeleteClickListener {
|
||||
viewModel.delete()
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
// Elevation is for showing a shadow around the popup
|
||||
popupWindow.elevation = 20f
|
||||
popupWindow.showAsDropDown(binding.menu, 0, 0, Gravity.BOTTOM)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,13 @@ class MeetingsListFragment : AbstractTopBarFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.forceRefreshMeetingsListEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG We were asked to refresh the meetings list, doing it now")
|
||||
listViewModel.applyFilter()
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.defaultAccountChangedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i(
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ class MeetingViewModel @UiThread constructor() : ViewModel() {
|
|||
val startTimeStamp = MutableLiveData<Long>()
|
||||
val endTimeStamp = MutableLiveData<Long>()
|
||||
|
||||
val conferenceInfoDeletedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
private lateinit var conferenceInfo: ConferenceInfo
|
||||
|
||||
init {
|
||||
|
|
@ -104,6 +108,17 @@ class MeetingViewModel @UiThread constructor() : ViewModel() {
|
|||
// TODO
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun delete() {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
if (::conferenceInfo.isInitialized) {
|
||||
Log.i("$TAG Deleting conference information [$conferenceInfo]")
|
||||
core.deleteConferenceInformation(conferenceInfo)
|
||||
conferenceInfoDeletedEvent.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun configureConferenceInfo() {
|
||||
if (::conferenceInfo.isInitialized) {
|
||||
|
|
|
|||
|
|
@ -118,4 +118,8 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
|
|||
val showMeetingEvent: MutableLiveData<Event<String>> by lazy {
|
||||
MutableLiveData<Event<String>>()
|
||||
}
|
||||
|
||||
val forceRefreshMeetingsListEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,9 +113,9 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
<!--<include
|
||||
layout="@layout/operation_in_progress"
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -167,9 +167,9 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
<!--<include
|
||||
layout="@layout/operation_in_progress"
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -128,9 +128,9 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
<!--<include
|
||||
layout="@layout/operation_in_progress"
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -113,9 +113,9 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
<!--<include
|
||||
layout="@layout/operation_in_progress"
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -169,9 +169,9 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
<!--<include
|
||||
layout="@layout/operation_in_progress"
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
<!--<include
|
||||
layout="@layout/operation_in_progress"
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
<variable
|
||||
name="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="menuClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="shareClickListener"
|
||||
type="View.OnClickListener" />
|
||||
|
|
@ -60,6 +63,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/menu"
|
||||
android:onClick="@{menuClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:padding="15dp"
|
||||
|
|
|
|||
38
app/src/main/res/layout/meeting_popup_menu.xml
Normal file
38
app/src/main/res/layout/meeting_popup_menu.xml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?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" />
|
||||
<import type="android.graphics.Typeface" />
|
||||
<variable
|
||||
name="deleteClickListener"
|
||||
type="View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_round_popup_menu_background">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{deleteClickListener}"
|
||||
style="@style/default_text_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="@string/meeting_info_delete"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/red_danger_500"
|
||||
android:drawableStart="@drawable/trash_simple"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableTint="@color/red_danger_500"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -128,9 +128,9 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
<!--<include
|
||||
layout="@layout/operation_in_progress"
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />
|
||||
bind:visibility="@{viewModel.fetchInProgress}" />-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -350,6 +350,8 @@
|
|||
<string name="meeting_schedule_send_invitations_title">Send invitation to participants</string>
|
||||
<string name="meeting_info_join_title">Join the meeting now</string>
|
||||
<string name="meeting_info_organizer_label">Organizer</string>
|
||||
<string name="meeting_info_delete">Delete meeting</string>
|
||||
<string name="meeting_info_deleted_toast">Meeting has been deleted</string>
|
||||
|
||||
<string name="operation_in_progress_overlay">Operation in progress, please wait</string>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue