Finished ViewModel to Data rework
This commit is contained in:
parent
b803ae9a61
commit
5d89d8b098
26 changed files with 113 additions and 110 deletions
|
@ -17,19 +17,19 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.activities.call.viewmodels
|
||||
package org.linphone.activities.call.data
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.contact.GenericContactViewModel
|
||||
import org.linphone.contact.GenericContactData
|
||||
import org.linphone.core.Conference
|
||||
import org.linphone.core.Participant
|
||||
import org.linphone.core.tools.Log
|
||||
|
||||
class ConferenceParticipantViewModel(
|
||||
class ConferenceParticipantData(
|
||||
private val conference: Conference,
|
||||
val participant: Participant
|
||||
) :
|
||||
GenericContactViewModel(participant.address) {
|
||||
GenericContactData(participant.address) {
|
||||
private val isAdmin = MutableLiveData<Boolean>()
|
||||
val isMeAdmin = MutableLiveData<Boolean>()
|
||||
|
|
@ -124,7 +124,6 @@ open class CallViewModel(val call: Call) : GenericContactViewModel(call.remoteAd
|
|||
}
|
||||
|
||||
fun destroy() {
|
||||
// TODO: call it from CallsViewModel (after conference rework merge)
|
||||
call.removeListener(listener)
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class CallsViewModel : ViewModel() {
|
|||
|
||||
val currentCall = core.currentCall
|
||||
if (currentCall == null) {
|
||||
currentCallViewModel.value?.destroy()
|
||||
currentCallViewModel.value = null
|
||||
} else if (currentCallViewModel.value == null) {
|
||||
currentCallViewModel.value = CallViewModel(currentCall)
|
||||
|
@ -89,6 +90,7 @@ class CallsViewModel : ViewModel() {
|
|||
|
||||
val currentCall = coreContext.core.currentCall
|
||||
if (currentCall != null) {
|
||||
currentCallViewModel.value?.destroy()
|
||||
currentCallViewModel.value = CallViewModel(currentCall)
|
||||
}
|
||||
|
||||
|
@ -142,6 +144,7 @@ class CallsViewModel : ViewModel() {
|
|||
|
||||
for (pausedCallViewModel in list) {
|
||||
if (pausedCallViewModel.call == call) {
|
||||
pausedCallViewModel.destroy()
|
||||
list.remove(pausedCallViewModel)
|
||||
break
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.linphone.activities.call.viewmodels
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.activities.call.data.ConferenceParticipantData
|
||||
import org.linphone.core.*
|
||||
import org.linphone.core.tools.Log
|
||||
|
||||
|
@ -32,7 +33,7 @@ class ConferenceViewModel : ViewModel() {
|
|||
|
||||
val conferenceAddress = MutableLiveData<Address>()
|
||||
|
||||
val conferenceParticipants = MutableLiveData<List<ConferenceParticipantViewModel>>()
|
||||
val conferenceParticipants = MutableLiveData<List<ConferenceParticipantData>>()
|
||||
|
||||
val isInConference = MutableLiveData<Boolean>()
|
||||
|
||||
|
@ -144,10 +145,10 @@ class ConferenceViewModel : ViewModel() {
|
|||
}
|
||||
|
||||
private fun updateParticipantsList(conference: Conference) {
|
||||
val participants = arrayListOf<ConferenceParticipantViewModel>()
|
||||
val participants = arrayListOf<ConferenceParticipantData>()
|
||||
for (participant in conference.participantList) {
|
||||
Log.i("[Conference VM] Participant found: ${participant.address.asStringUriOnly()}")
|
||||
val viewModel = ConferenceParticipantViewModel(conference, participant)
|
||||
val viewModel = ConferenceParticipantData(conference, participant)
|
||||
participants.add(viewModel)
|
||||
}
|
||||
conferenceParticipants.value = participants
|
||||
|
|
|
@ -26,7 +26,7 @@ import android.view.LayoutInflater
|
|||
import android.widget.LinearLayout
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import org.linphone.R
|
||||
import org.linphone.activities.call.viewmodels.ConferenceParticipantViewModel
|
||||
import org.linphone.activities.call.data.ConferenceParticipantData
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.CallConferenceParticipantBinding
|
||||
|
||||
|
@ -58,11 +58,11 @@ class ConferenceParticipantView : LinearLayout {
|
|||
)
|
||||
}
|
||||
|
||||
fun setViewModel(viewModel: ConferenceParticipantViewModel) {
|
||||
binding.viewModel = viewModel
|
||||
fun setData(data: ConferenceParticipantData) {
|
||||
binding.data = data
|
||||
|
||||
val currentTimeSecs = System.currentTimeMillis()
|
||||
val participantTime = viewModel.participant.creationTime * 1000 // Linphone timestamps are in seconds
|
||||
val participantTime = data.participant.creationTime * 1000 // Linphone timestamps are in seconds
|
||||
val diff = currentTimeSecs - participantTime
|
||||
Log.i("[Conference Participant] Participant joined conference at $participantTime == ${diff / 1000} seconds ago.")
|
||||
binding.callTimer.base = SystemClock.elapsedRealtime() - diff
|
||||
|
|
|
@ -119,7 +119,7 @@ class ChatMessagesListAdapter(
|
|||
|
||||
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
|
||||
when (holder) {
|
||||
is ChatMessageViewHolder -> holder.binding.viewModel?.destroy()
|
||||
is ChatMessageViewHolder -> holder.binding.data?.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ class ChatMessagesListAdapter(
|
|||
val chatMessage = eventLog.chatMessage
|
||||
chatMessage ?: return
|
||||
val chatMessageViewModel = ChatMessageData(chatMessage, contentClickedListener)
|
||||
viewModel = chatMessageViewModel
|
||||
data = chatMessageViewModel
|
||||
|
||||
lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
|
@ -248,7 +248,7 @@ class ChatMessagesListAdapter(
|
|||
}
|
||||
|
||||
private fun resendMessage() {
|
||||
val chatMessage = binding.viewModel?.chatMessage
|
||||
val chatMessage = binding.data?.chatMessage
|
||||
if (chatMessage != null) {
|
||||
chatMessage.userData = adapterPosition
|
||||
resendMessageEvent.value = Event(chatMessage)
|
||||
|
@ -256,7 +256,7 @@ class ChatMessagesListAdapter(
|
|||
}
|
||||
|
||||
private fun copyTextToClipboard() {
|
||||
val chatMessage = binding.viewModel?.chatMessage
|
||||
val chatMessage = binding.data?.chatMessage
|
||||
if (chatMessage != null) {
|
||||
val content = chatMessage.contents.find { content -> content.isText }
|
||||
if (content != null) {
|
||||
|
@ -269,21 +269,21 @@ class ChatMessagesListAdapter(
|
|||
}
|
||||
|
||||
private fun forwardMessage() {
|
||||
val chatMessage = binding.viewModel?.chatMessage
|
||||
val chatMessage = binding.data?.chatMessage
|
||||
if (chatMessage != null) {
|
||||
forwardMessageEvent.value = Event(chatMessage)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showImdnDeliveryFragment() {
|
||||
val chatMessage = binding.viewModel?.chatMessage
|
||||
val chatMessage = binding.data?.chatMessage
|
||||
if (chatMessage != null) {
|
||||
showImdnForMessageEvent.value = Event(chatMessage)
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteMessage() {
|
||||
val chatMessage = binding.viewModel?.chatMessage
|
||||
val chatMessage = binding.data?.chatMessage
|
||||
if (chatMessage != null) {
|
||||
chatMessage.userData = adapterPosition
|
||||
deleteMessageEvent.value = Event(chatMessage)
|
||||
|
@ -291,7 +291,7 @@ class ChatMessagesListAdapter(
|
|||
}
|
||||
|
||||
private fun addSenderToContacts() {
|
||||
val chatMessage = binding.viewModel?.chatMessage
|
||||
val chatMessage = binding.data?.chatMessage
|
||||
if (chatMessage != null) {
|
||||
val copy = chatMessage.fromAddress.clone()
|
||||
copy.clean() // To remove gruu if any
|
||||
|
@ -306,7 +306,7 @@ class ChatMessagesListAdapter(
|
|||
fun bind(eventLog: EventLog) {
|
||||
with(binding) {
|
||||
val eventViewModel = EventData(eventLog)
|
||||
viewModel = eventViewModel
|
||||
data = eventViewModel
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class ChatRoomCreationContactsAdapter(
|
|||
fun bind(searchResult: SearchResult) {
|
||||
with(binding) {
|
||||
val searchResultViewModel = ChatRoomCreationContactData(searchResult)
|
||||
viewModel = searchResultViewModel
|
||||
data = searchResultViewModel
|
||||
|
||||
lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class GroupInfoParticipantsAdapter(
|
|||
}
|
||||
|
||||
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
|
||||
(holder as ViewHolder).binding.viewModel?.destroy()
|
||||
(holder as ViewHolder).binding.data?.destroy()
|
||||
}
|
||||
|
||||
fun showAdminControls(show: Boolean) {
|
||||
|
@ -71,7 +71,7 @@ class GroupInfoParticipantsAdapter(
|
|||
with(binding) {
|
||||
val participantViewModel = GroupInfoParticipantData(participant)
|
||||
participantViewModel.showAdminControls.value = showAdmin
|
||||
viewModel = participantViewModel
|
||||
data = participantViewModel
|
||||
|
||||
lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class ImdnAdapter(
|
|||
}
|
||||
|
||||
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
|
||||
(holder as ViewHolder).binding.viewModel?.destroy()
|
||||
(holder as ViewHolder).binding.data?.destroy()
|
||||
}
|
||||
|
||||
inner class ViewHolder(
|
||||
|
@ -60,7 +60,7 @@ class ImdnAdapter(
|
|||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(participantImdnState: ParticipantImdnState) {
|
||||
with(binding) {
|
||||
viewModel = ImdnParticipantData(participantImdnState)
|
||||
data = ImdnParticipantData(participantImdnState)
|
||||
|
||||
lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class RecordingsListAdapter(
|
|||
}
|
||||
|
||||
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
|
||||
(holder as ViewHolder).binding.viewModel?.destroy()
|
||||
(holder as ViewHolder).binding.data?.destroy()
|
||||
}
|
||||
|
||||
inner class ViewHolder(
|
||||
|
@ -72,7 +72,7 @@ class RecordingsListAdapter(
|
|||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(recording: RecordingData) {
|
||||
with(binding) {
|
||||
viewModel = recording
|
||||
data = recording
|
||||
|
||||
lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
|
|
|
@ -51,27 +51,27 @@ class ContactAvatarView : LinearLayout {
|
|||
)
|
||||
}
|
||||
|
||||
fun setViewModel(viewModel: ContactDataInterface) {
|
||||
val contact: Contact? = viewModel.contact.value
|
||||
fun setData(data: ContactDataInterface) {
|
||||
val contact: Contact? = data.contact.value
|
||||
val initials = if (contact != null) {
|
||||
AppUtils.getInitials(contact.fullName ?: contact.firstName + " " + contact.lastName)
|
||||
} else {
|
||||
AppUtils.getInitials(viewModel.displayName)
|
||||
AppUtils.getInitials(data.displayName)
|
||||
}
|
||||
|
||||
binding.initials = initials
|
||||
binding.generatedAvatarVisibility = initials.isNotEmpty() && initials != "+"
|
||||
binding.groupChatAvatarVisibility = viewModel.showGroupChatAvatar
|
||||
binding.groupChatAvatarVisibility = data.showGroupChatAvatar
|
||||
|
||||
binding.imagePath = contact?.getContactThumbnailPictureUri()
|
||||
binding.borderVisibility = corePreferences.showBorderOnContactAvatar
|
||||
|
||||
binding.securityIcon = when (viewModel.securityLevel) {
|
||||
binding.securityIcon = when (data.securityLevel) {
|
||||
ChatRoomSecurityLevel.Safe -> R.drawable.security_2_indicator
|
||||
ChatRoomSecurityLevel.Encrypted -> R.drawable.security_1_indicator
|
||||
else -> R.drawable.security_alert_indicator
|
||||
}
|
||||
binding.securityContentDescription = when (viewModel.securityLevel) {
|
||||
binding.securityContentDescription = when (data.securityLevel) {
|
||||
ChatRoomSecurityLevel.Safe -> R.string.content_description_security_level_safe
|
||||
ChatRoomSecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
|
||||
else -> R.string.content_description_security_level_unsafe
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
<data>
|
||||
<variable
|
||||
name="data"
|
||||
type="org.linphone.activities.call.viewmodels.ConferenceParticipantViewModel" />
|
||||
type="org.linphone.activities.call.data.ConferenceParticipantData" />
|
||||
</data>
|
||||
|
||||
<org.linphone.activities.call.views.ConferenceParticipantView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
bind:viewModel="@{data}"/>
|
||||
bind:data="@{data}"/>
|
||||
|
||||
</layout>
|
|
@ -6,8 +6,8 @@
|
|||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.activities.call.viewmodels.ConferenceParticipantViewModel" />
|
||||
name="data"
|
||||
type="org.linphone.activities.call.data.ConferenceParticipantData" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -26,7 +26,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:data="@{data}"
|
||||
tools:layout="@layout/contact_avatar" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -39,7 +39,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<org.linphone.views.MarqueeTextView
|
||||
android:text="@{viewModel.contact.fullName ?? viewModel.displayName}"
|
||||
android:text="@{data.contact.fullName ?? data.displayName}"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -57,8 +57,8 @@
|
|||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:onClick="@{() -> viewModel.removeFromConference()}"
|
||||
android:visibility="@{viewModel.isMeAdmin ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:onClick="@{() -> data.removeFromConference()}"
|
||||
android:visibility="@{data.isMeAdmin ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:contentDescription="@string/content_description_remove_from_conference"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:data="@{viewModel}"
|
||||
tools:layout="@layout/contact_avatar" />
|
||||
|
||||
<org.linphone.views.MarqueeTextView
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/contact_avatar"
|
||||
app:viewModel="@{data}"/>
|
||||
app:data="@{data}"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
name="clickListener"
|
||||
type="android.view.View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
name="data"
|
||||
type="org.linphone.activities.main.chat.data.EventData" />
|
||||
<variable
|
||||
name="selectionListViewModel"
|
||||
|
@ -42,17 +42,17 @@
|
|||
android:layout_marginBottom="5dp"
|
||||
android:layout_toLeftOf="@id/select"
|
||||
android:gravity="center"
|
||||
android:background="@{viewModel.security ? @drawable/event_decoration_red : @drawable/event_decoration_gray, default=@drawable/event_decoration_gray}"
|
||||
android:background="@{data.security ? @drawable/event_decoration_red : @drawable/event_decoration_gray, default=@drawable/event_decoration_gray}"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Ugly hack to prevent last character to be missing half of it, don't know why yet -->
|
||||
<TextView
|
||||
android:text="@{viewModel.text + ' '}"
|
||||
android:text="@{data.text + ' '}"
|
||||
android:textSize="13sp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:lineSpacingExtra="0sp"
|
||||
android:textStyle="italic"
|
||||
android:textColor="@{viewModel.security ? @color/red_color : @color/light_grey_color}"
|
||||
android:textColor="@{data.security ? @color/red_color : @color/light_grey_color}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
name="position"
|
||||
type="Integer"/>
|
||||
<variable
|
||||
name="viewModel"
|
||||
name="data"
|
||||
type="org.linphone.activities.main.chat.data.ChatMessageData" />
|
||||
<variable
|
||||
name="selectionListViewModel"
|
||||
|
@ -55,8 +55,8 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/imdn"
|
||||
android:visibility="@{viewModel.chatMessage.outgoing ? (viewModel.showImdn ? View.VISIBLE : View.INVISIBLE) : View.INVISIBLE}"
|
||||
android:src="@{viewModel.imdnIcon, default=@drawable/chat_delivered}"
|
||||
android:visibility="@{data.chatMessage.outgoing ? (data.showImdn ? View.VISIBLE : View.INVISIBLE) : View.INVISIBLE}"
|
||||
android:src="@{data.imdnIcon, default=@drawable/chat_delivered}"
|
||||
android:contentDescription="@string/content_description_delivery_status"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
|
@ -65,36 +65,36 @@
|
|||
|
||||
<org.linphone.contact.ContactAvatarView
|
||||
android:id="@+id/avatar"
|
||||
android:visibility="@{viewModel.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? View.GONE : (viewModel.hideAvatar ? View.INVISIBLE : View.VISIBLE)}"
|
||||
android:visibility="@{data.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? View.GONE : (data.hideAvatar ? View.INVISIBLE : View.VISIBLE)}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/time"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:data="@{data}"
|
||||
tools:layout="@layout/contact_avatar" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/background"
|
||||
android:onClick="@{clickListener}"
|
||||
android:onLongClick="@{contextMenuClickListener}"
|
||||
android:background="@{viewModel.backgroundRes, default=@drawable/chat_bubble_outgoing_full}"
|
||||
android:background="@{data.backgroundRes, default=@drawable/chat_bubble_outgoing_full}"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_toLeftOf="@{viewModel.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? @id/imdn : 0}"
|
||||
android:layout_toLeftOf="@{data.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? @id/imdn : 0}"
|
||||
android:layout_toRightOf="@id/avatar"
|
||||
android:layout_below="@id/time"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:layout_marginRight="@{viewModel.chatMessage.outgoing ? @dimen/outgoing_chat_message_bubble_right_margin : @dimen/incoming_chat_message_bubble_right_margin}"
|
||||
android:layout_marginLeft="@{selectionListViewModel.isEditionEnabled ? @dimen/edit_chat_message_bubble_left_margin : !viewModel.chatMessage.outgoing ? @dimen/incoming_chat_message_bubble_left_margin : @dimen/outgoing_chat_message_bubble_left_margin}"
|
||||
android:layout_marginRight="@{data.chatMessage.outgoing ? @dimen/outgoing_chat_message_bubble_right_margin : @dimen/incoming_chat_message_bubble_right_margin}"
|
||||
android:layout_marginLeft="@{selectionListViewModel.isEditionEnabled ? @dimen/edit_chat_message_bubble_left_margin : !data.chatMessage.outgoing ? @dimen/incoming_chat_message_bubble_left_margin : @dimen/outgoing_chat_message_bubble_left_margin}"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="@{viewModel.chatMessage.forward ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:visibility="@{data.chatMessage.forward ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
@ -129,20 +129,20 @@
|
|||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:longClickable="true"
|
||||
app:entries="@{viewModel.contents}"
|
||||
app:entries="@{data.contents}"
|
||||
app:layout="@{@layout/chat_message_content_cell}"
|
||||
app:onLongClick="@{contextMenuClickListener}"
|
||||
app:flexWrap="wrap"
|
||||
app:alignItems="center"
|
||||
app:justifyContent="@{viewModel.chatMessage.outgoing ? JustifyContent.FLEX_END : JustifyContent.FLEX_START}"/>
|
||||
app:justifyContent="@{data.chatMessage.outgoing ? JustifyContent.FLEX_END : JustifyContent.FLEX_START}"/>
|
||||
|
||||
<org.linphone.activities.main.chat.views.MultiLineWrapContentWidthTextView
|
||||
android:onClick="@{clickListener}"
|
||||
android:onLongClick="@{contextMenuClickListener}"
|
||||
android:text="@{viewModel.text}"
|
||||
android:visibility="@{viewModel.text.length > 0 ? View.VISIBLE : View.GONE}"
|
||||
android:text="@{data.text}"
|
||||
android:visibility="@{data.text.length > 0 ? View.VISIBLE : View.GONE}"
|
||||
android:autoLink="web"
|
||||
android:layout_gravity="@{viewModel.chatMessage.outgoing ? Gravity.RIGHT : Gravity.LEFT}"
|
||||
android:layout_gravity="@{data.chatMessage.outgoing ? Gravity.RIGHT : Gravity.LEFT}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
|
@ -157,7 +157,7 @@
|
|||
android:lineSpacingExtra="-1.7sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="@{viewModel.chatMessage.ephemeral ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:visibility="@{data.chatMessage.ephemeral ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
@ -167,7 +167,7 @@
|
|||
android:layout_marginLeft="5dp">
|
||||
|
||||
<TextView
|
||||
android:text="@{viewModel.ephemeralLifetime}"
|
||||
android:text="@{data.ephemeralLifetime}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
|
@ -190,13 +190,13 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:text="@{viewModel.chatMessage.outgoing ? viewModel.time : viewModel.time + ` - ` + (viewModel.contact.fullName ?? viewModel.displayName)}"
|
||||
android:visibility="@{viewModel.hideTime ? View.GONE : View.VISIBLE}"
|
||||
android:text="@{data.chatMessage.outgoing ? data.time : data.time + ` - ` + (data.contact.fullName ?? data.displayName)}"
|
||||
android:visibility="@{data.hideTime ? View.GONE : View.VISIBLE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignLeft="@{viewModel.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? 0 : @id/background}"
|
||||
android:layout_alignRight="@{viewModel.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? @id/background : 0}"
|
||||
android:layout_alignLeft="@{data.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? 0 : @id/background}"
|
||||
android:layout_alignRight="@{data.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? @id/background : 0}"
|
||||
android:layout_marginTop="7dp"
|
||||
android:textColor="@color/chat_bubble_text_color"
|
||||
android:textSize="13sp"
|
||||
|
@ -205,7 +205,7 @@
|
|||
android:lineSpacingExtra="0sp" />
|
||||
|
||||
<ProgressBar
|
||||
android:visibility="@{viewModel.transferInProgress || viewModel.sendInProgress ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{data.transferInProgress || data.sendInProgress ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_toRightOf="@id/background"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
name="clickListener"
|
||||
type="android.view.View.OnClickListener"/>
|
||||
<variable
|
||||
name="viewModel"
|
||||
name="data"
|
||||
type="org.linphone.activities.main.chat.data.ChatRoomCreationContactData" />
|
||||
</data>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:onClick="@{clickListener}"
|
||||
android:enabled="@{!viewModel.isDisabled}"
|
||||
android:enabled="@{!data.isDisabled}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
|
@ -32,8 +32,8 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
tools:layout="@layout/contact_avatar"
|
||||
app:showLimeCapability="@{viewModel.hasLimeX3DHCapability}"
|
||||
app:viewModel="@{viewModel}"/>
|
||||
app:showLimeCapability="@{data.hasLimeX3DHCapability}"
|
||||
app:data="@{data}"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -47,7 +47,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:text="@{viewModel.contact.fullName ?? viewModel.displayName}"
|
||||
android:text="@{data.contact.fullName ?? data.displayName}"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -55,7 +55,7 @@
|
|||
android:lines="1" />
|
||||
|
||||
<TextView
|
||||
android:text="@{viewModel.sipUri}"
|
||||
android:text="@{data.sipUri}"
|
||||
style="@style/sip_uri_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -66,7 +66,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:visibility="@{viewModel.linphoneUser ? View.VISIBLE : View.INVISIBLE}"
|
||||
android:visibility="@{data.linphoneUser ? View.VISIBLE : View.INVISIBLE}"
|
||||
android:id="@+id/linphone_user"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
|
@ -77,7 +77,7 @@
|
|||
android:src="@drawable/linphone_logo_tinted" />
|
||||
|
||||
<ImageView
|
||||
android:visibility="@{viewModel.isSelected ? View.VISIBLE : View.INVISIBLE}"
|
||||
android:visibility="@{data.isSelected ? View.VISIBLE : View.INVISIBLE}"
|
||||
android:id="@+id/contact_is_select"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
|
@ -91,7 +91,7 @@
|
|||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:visibility="@{viewModel.isDisabled ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{data.isDisabled ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/contact_disabled_color"/>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
android:layout_margin="5dp"
|
||||
android:gravity="center"
|
||||
app:showSecurityLevel="@{true}"
|
||||
app:viewModel="@{data}"
|
||||
app:data="@{data}"
|
||||
tools:layout="@layout/contact_avatar" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
name="removeClickListener"
|
||||
type="android.view.View.OnClickListener"/>
|
||||
<variable
|
||||
name="viewModel"
|
||||
name="data"
|
||||
type="org.linphone.activities.main.chat.data.GroupInfoParticipantData" />
|
||||
<variable
|
||||
name="isEncrypted"
|
||||
|
@ -28,14 +28,14 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
app:showSecurityLevel="@{isEncrypted && viewModel.securityLevel != ChatRoomSecurityLevel.ClearText}"
|
||||
app:showLimeCapability="@{isEncrypted && viewModel.securityLevel == ChatRoomSecurityLevel.ClearText}"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:showSecurityLevel="@{isEncrypted && data.securityLevel != ChatRoomSecurityLevel.ClearText}"
|
||||
app:showLimeCapability="@{isEncrypted && data.securityLevel == ChatRoomSecurityLevel.ClearText}"
|
||||
app:data="@{data}"
|
||||
tools:layout="@layout/contact_avatar"/>
|
||||
|
||||
<ImageView
|
||||
android:onClick="@{removeClickListener}"
|
||||
android:visibility="@{viewModel.showAdminControls ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{data.showAdminControls ? View.VISIBLE : View.GONE}"
|
||||
android:contentDescription="@string/content_description_remove_contact_from_chat_room"
|
||||
android:id="@+id/delete"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -47,7 +47,7 @@
|
|||
android:src="@drawable/chat_group_delete" />
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="@{viewModel.showAdminControls ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{data.showAdminControls ? View.VISIBLE : View.GONE}"
|
||||
android:id="@+id/adminLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -56,8 +56,8 @@
|
|||
|
||||
<LinearLayout
|
||||
android:id="@+id/isAdminLayout"
|
||||
android:onClick="@{() -> viewModel.unSetAdmin()}"
|
||||
android:visibility="@{viewModel.admin ? View.VISIBLE : View.GONE}"
|
||||
android:onClick="@{() -> data.unSetAdmin()}"
|
||||
android:visibility="@{data.admin ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp">
|
||||
|
@ -84,8 +84,8 @@
|
|||
|
||||
<LinearLayout
|
||||
android:id="@+id/isNotAdminLayout"
|
||||
android:onClick="@{() -> viewModel.setAdmin()}"
|
||||
android:visibility="@{viewModel.admin ? View.GONE : View.VISIBLE}"
|
||||
android:onClick="@{() -> data.setAdmin()}"
|
||||
android:visibility="@{data.admin ? View.GONE : View.VISIBLE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp">
|
||||
|
@ -121,14 +121,14 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<org.linphone.views.MarqueeTextView
|
||||
android:text="@{viewModel.contact.fullName ?? viewModel.displayName}"
|
||||
android:text="@{data.contact.fullName ?? data.displayName}"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
|
||||
<org.linphone.views.MarqueeTextView
|
||||
android:text="@{viewModel.sipUri}"
|
||||
android:text="@{data.sipUri}"
|
||||
android:id="@+id/sipUri"
|
||||
style="@style/sip_uri_small_font"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
layout="@layout/chat_message_list_cell"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:viewModel="@{viewModel.chatMessageViewModel}"
|
||||
app:data="@{viewModel.chatMessageViewModel}"
|
||||
android:layout_margin="20dp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<data>
|
||||
<import type="android.view.View"/>
|
||||
<variable
|
||||
name="viewModel"
|
||||
name="data"
|
||||
type="org.linphone.activities.main.chat.data.ImdnParticipantData" />
|
||||
</data>
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
tools:layout="@layout/contact_avatar"
|
||||
app:viewModel="@{viewModel}"/>
|
||||
app:data="@{data}"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:text="@{viewModel.time}"
|
||||
android:text="@{data.time}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
|
@ -44,14 +44,14 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<org.linphone.views.MarqueeTextView
|
||||
android:text="@{viewModel.contact.fullName ?? viewModel.displayName}"
|
||||
android:text="@{data.contact.fullName ?? data.displayName}"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
|
||||
<org.linphone.views.MarqueeTextView
|
||||
android:text="@{viewModel.sipUri}"
|
||||
android:text="@{data.sipUri}"
|
||||
style="@style/sip_uri_small_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
tools:layout="@layout/contact_avatar"
|
||||
android:layout_centerHorizontal="true"
|
||||
app:showSecurityLevel="@{viewModel.encryptedChatRoom}"
|
||||
app:viewModel="@{viewModel}"/>
|
||||
app:data="@{viewModel}"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
tools:layout="@layout/contact_avatar"
|
||||
app:viewModel="@{viewModel}"/>
|
||||
app:data="@{viewModel}"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/right"
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:gravity="center"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:data="@{viewModel}"
|
||||
tools:layout="@layout/contact_avatar" />
|
||||
|
||||
<org.linphone.views.MarqueeTextView
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
name="position"
|
||||
type="Integer"/>
|
||||
<variable
|
||||
name="viewModel"
|
||||
name="data"
|
||||
type="org.linphone.activities.main.recordings.data.RecordingData" />
|
||||
<variable
|
||||
name="selectionListViewModel"
|
||||
|
@ -32,7 +32,7 @@
|
|||
<ImageView
|
||||
android:id="@+id/record_play_pause"
|
||||
android:onClick="@{playListener}"
|
||||
android:selected="@{viewModel.isPlaying}"
|
||||
android:selected="@{data.isPlaying}"
|
||||
android:contentDescription="@string/content_description_recording_toggle_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -69,7 +69,7 @@
|
|||
android:layout_alignParentTop="true">
|
||||
|
||||
<TextView
|
||||
android:text="@{viewModel.name}"
|
||||
android:text="@{data.name}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
|||
android:text=" - " />
|
||||
|
||||
<TextView
|
||||
android:text="@{viewModel.formattedDate}"
|
||||
android:text="@{data.formattedDate}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:text="@{viewModel.formattedPosition}"
|
||||
android:text="@{data.formattedPosition}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
@ -106,7 +106,7 @@
|
|||
android:text="/" />
|
||||
|
||||
<TextView
|
||||
android:text="@{viewModel.formattedDuration}"
|
||||
android:text="@{data.formattedDuration}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
@ -114,9 +114,9 @@
|
|||
|
||||
<SeekBar
|
||||
android:id="@+id/record_progression_bar"
|
||||
onProgressChanged="@{(progress) -> viewModel.onProgressChanged(progress)}"
|
||||
android:max="@{viewModel.duration}"
|
||||
android:progress="@{viewModel.position}"
|
||||
onProgressChanged="@{(progress) -> data.onProgressChanged(progress)}"
|
||||
android:max="@{data.duration}"
|
||||
android:progress="@{data.position}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
|
|
Loading…
Reference in a new issue