mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-30 18:56:23 +00:00
Added ephemeral messages to conversation info
This commit is contained in:
parent
80994ffafb
commit
bd38c7dc49
9 changed files with 471 additions and 14 deletions
|
|
@ -37,6 +37,7 @@ import org.linphone.core.tools.Log
|
||||||
import org.linphone.databinding.ChatInfoFragmentBinding
|
import org.linphone.databinding.ChatInfoFragmentBinding
|
||||||
import org.linphone.databinding.ChatParticipantAdminPopupMenuBinding
|
import org.linphone.databinding.ChatParticipantAdminPopupMenuBinding
|
||||||
import org.linphone.ui.main.chat.adapter.ConversationParticipantsAdapter
|
import org.linphone.ui.main.chat.adapter.ConversationParticipantsAdapter
|
||||||
|
import org.linphone.ui.main.chat.model.ConversationConfigureEphemeralDurationDialogModel
|
||||||
import org.linphone.ui.main.chat.model.ConversationEditSubjectDialogModel
|
import org.linphone.ui.main.chat.model.ConversationEditSubjectDialogModel
|
||||||
import org.linphone.ui.main.chat.model.ParticipantModel
|
import org.linphone.ui.main.chat.model.ParticipantModel
|
||||||
import org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel
|
import org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel
|
||||||
|
|
@ -193,6 +194,40 @@ class ConversationInfoFragment : GenericFragment() {
|
||||||
Log.i("$TAG Showing dialog to edit conversation subject")
|
Log.i("$TAG Showing dialog to edit conversation subject")
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.setConfigureEphemeralMessagesClickListener {
|
||||||
|
val currentValue = viewModel.ephemeralLifetime.value ?: 0
|
||||||
|
val model = ConversationConfigureEphemeralDurationDialogModel(currentValue)
|
||||||
|
|
||||||
|
val dialog = DialogUtils.getConfigureChatMessagesEphemeralDurationDialog(
|
||||||
|
requireContext(),
|
||||||
|
model
|
||||||
|
)
|
||||||
|
|
||||||
|
model.dismissEvent.observe(viewLifecycleOwner) {
|
||||||
|
it.consume {
|
||||||
|
Log.i("$TAG Ephemeral lifetime value wasn't changed")
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model.newValueSelectedEvent.observe(viewLifecycleOwner) {
|
||||||
|
it.consume { duration ->
|
||||||
|
if (duration != currentValue) {
|
||||||
|
Log.i(
|
||||||
|
"$TAG Conversation chat message lifetime updated to [$duration] (previous one was [$currentValue])"
|
||||||
|
)
|
||||||
|
viewModel.updateEphemeralLifetime(duration)
|
||||||
|
}
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.i(
|
||||||
|
"$TAG Showing dialog to change chat messages ephemeral duration (currently [$currentValue])"
|
||||||
|
)
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showParticipantAdminPopupMenu(view: View, participantModel: ParticipantModel) {
|
private fun showParticipantAdminPopupMenu(view: View, participantModel: ParticipantModel) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||||
|
*
|
||||||
|
* This file is part of linphone-android
|
||||||
|
* (see https://www.linphone.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* 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.ui.main.chat.model
|
||||||
|
|
||||||
|
import androidx.annotation.UiThread
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import org.linphone.utils.Event
|
||||||
|
|
||||||
|
class ConversationConfigureEphemeralDurationDialogModel @UiThread constructor(
|
||||||
|
val currentlySelectedValue: Int
|
||||||
|
) {
|
||||||
|
val dismissEvent = MutableLiveData<Event<Boolean>>()
|
||||||
|
|
||||||
|
val newValueSelectedEvent = MutableLiveData<Event<Int>>()
|
||||||
|
|
||||||
|
@UiThread
|
||||||
|
fun dismiss() {
|
||||||
|
dismissEvent.value = Event(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiThread
|
||||||
|
fun onValueSelected(value: Int) {
|
||||||
|
newValueSelectedEvent.value = Event(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
package org.linphone.ui.main.chat.model
|
package org.linphone.ui.main.chat.model
|
||||||
|
|
||||||
import androidx.annotation.WorkerThread
|
import androidx.annotation.WorkerThread
|
||||||
|
import java.util.Locale
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.core.EventLog
|
import org.linphone.core.EventLog
|
||||||
|
|
@ -64,6 +65,18 @@ class EventModel @WorkerThread constructor(private val eventLog: EventLog) {
|
||||||
R.string.conversation_event_device_removed,
|
R.string.conversation_event_device_removed,
|
||||||
getName()
|
getName()
|
||||||
)
|
)
|
||||||
|
EventLog.Type.ConferenceEphemeralMessageEnabled -> AppUtils.getString(
|
||||||
|
R.string.conversation_event_ephemeral_messages_enabled
|
||||||
|
)
|
||||||
|
EventLog.Type.ConferenceEphemeralMessageDisabled -> AppUtils.getString(
|
||||||
|
R.string.conversation_event_ephemeral_messages_disabled
|
||||||
|
)
|
||||||
|
EventLog.Type.ConferenceEphemeralMessageLifetimeChanged -> AppUtils.getFormattedString(
|
||||||
|
R.string.conversation_event_ephemeral_messages_lifetime_changed,
|
||||||
|
formatEphemeralExpiration(eventLog.ephemeralMessageLifetime).lowercase(
|
||||||
|
Locale.getDefault()
|
||||||
|
)
|
||||||
|
)
|
||||||
else -> {
|
else -> {
|
||||||
eventLog.type.name
|
eventLog.type.name
|
||||||
}
|
}
|
||||||
|
|
@ -80,4 +93,29 @@ class EventModel @WorkerThread constructor(private val eventLog: EventLog) {
|
||||||
}
|
}
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WorkerThread
|
||||||
|
private fun formatEphemeralExpiration(duration: Long): String {
|
||||||
|
return when (duration) {
|
||||||
|
0L -> AppUtils.getString(
|
||||||
|
R.string.dialog_conversation_message_ephemeral_duration_disabled
|
||||||
|
)
|
||||||
|
60L -> AppUtils.getString(
|
||||||
|
R.string.dialog_conversation_message_ephemeral_duration_one_minute
|
||||||
|
)
|
||||||
|
3600L -> AppUtils.getString(
|
||||||
|
R.string.dialog_conversation_message_ephemeral_duration_one_hour
|
||||||
|
)
|
||||||
|
86400L -> AppUtils.getString(
|
||||||
|
R.string.dialog_conversation_message_ephemeral_duration_one_day
|
||||||
|
)
|
||||||
|
259200L -> AppUtils.getString(
|
||||||
|
R.string.dialog_conversation_message_ephemeral_duration_three_days
|
||||||
|
)
|
||||||
|
604800L -> AppUtils.getString(
|
||||||
|
R.string.dialog_conversation_message_ephemeral_duration_one_week
|
||||||
|
)
|
||||||
|
else -> "$duration s"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,16 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
||||||
|
|
||||||
val subject = MutableLiveData<String>()
|
val subject = MutableLiveData<String>()
|
||||||
|
|
||||||
|
val sipUri = MutableLiveData<String>()
|
||||||
|
|
||||||
val isReadOnly = MutableLiveData<Boolean>()
|
val isReadOnly = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val isMyselfAdmin = MutableLiveData<Boolean>()
|
val isMyselfAdmin = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val isMuted = MutableLiveData<Boolean>()
|
val isMuted = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val ephemeralLifetime = MutableLiveData<Int>()
|
||||||
|
|
||||||
val expandParticipants = MutableLiveData<Boolean>()
|
val expandParticipants = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val chatRoomFoundEvent = MutableLiveData<Event<Boolean>>()
|
val chatRoomFoundEvent = MutableLiveData<Event<Boolean>>()
|
||||||
|
|
@ -324,6 +328,16 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UiThread
|
||||||
|
fun updateEphemeralLifetime(lifetime: Int) {
|
||||||
|
coreContext.postOnCoreThread {
|
||||||
|
Log.i("$TAG Updating chat messages ephemeral lifetime to [$lifetime]")
|
||||||
|
chatRoom.ephemeralLifetime = lifetime.toLong()
|
||||||
|
chatRoom.isEphemeralEnabled = lifetime != 0
|
||||||
|
ephemeralLifetime.postValue(chatRoom.ephemeralLifetime.toInt())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
private fun configureChatRoom() {
|
private fun configureChatRoom() {
|
||||||
isMuted.postValue(chatRoom.muted)
|
isMuted.postValue(chatRoom.muted)
|
||||||
|
|
@ -341,6 +355,9 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
subject.postValue(chatRoom.subject)
|
subject.postValue(chatRoom.subject)
|
||||||
|
sipUri.postValue(chatRoom.participants.firstOrNull()?.address?.asStringUriOnly())
|
||||||
|
|
||||||
|
ephemeralLifetime.postValue(chatRoom.ephemeralLifetime.toInt())
|
||||||
|
|
||||||
computeParticipantsList()
|
computeParticipantsList()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import org.linphone.databinding.DialogAccountModesExplanationBinding
|
||||||
import org.linphone.databinding.DialogAssistantAcceptConditionsAndPolicyBinding
|
import org.linphone.databinding.DialogAssistantAcceptConditionsAndPolicyBinding
|
||||||
import org.linphone.databinding.DialogAssistantCreateAccountConfirmPhoneNumberBinding
|
import org.linphone.databinding.DialogAssistantCreateAccountConfirmPhoneNumberBinding
|
||||||
import org.linphone.databinding.DialogCancelContactChangesBinding
|
import org.linphone.databinding.DialogCancelContactChangesBinding
|
||||||
|
import org.linphone.databinding.DialogConfigureConversationEphemeralMessagesBinding
|
||||||
import org.linphone.databinding.DialogConfirmZrtpSasBinding
|
import org.linphone.databinding.DialogConfirmZrtpSasBinding
|
||||||
import org.linphone.databinding.DialogContactConfirmTrustCallBinding
|
import org.linphone.databinding.DialogContactConfirmTrustCallBinding
|
||||||
import org.linphone.databinding.DialogContactTrustProcessBinding
|
import org.linphone.databinding.DialogContactTrustProcessBinding
|
||||||
|
|
@ -49,6 +50,7 @@ import org.linphone.databinding.DialogUpdateAvailableBinding
|
||||||
import org.linphone.ui.assistant.model.AcceptConditionsAndPolicyDialogModel
|
import org.linphone.ui.assistant.model.AcceptConditionsAndPolicyDialogModel
|
||||||
import org.linphone.ui.assistant.model.ConfirmPhoneNumberDialogModel
|
import org.linphone.ui.assistant.model.ConfirmPhoneNumberDialogModel
|
||||||
import org.linphone.ui.call.model.ZrtpSasConfirmationDialogModel
|
import org.linphone.ui.call.model.ZrtpSasConfirmationDialogModel
|
||||||
|
import org.linphone.ui.main.chat.model.ConversationConfigureEphemeralDurationDialogModel
|
||||||
import org.linphone.ui.main.chat.model.ConversationEditSubjectDialogModel
|
import org.linphone.ui.main.chat.model.ConversationEditSubjectDialogModel
|
||||||
import org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel
|
import org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel
|
||||||
import org.linphone.ui.main.contacts.model.TrustCallDialogModel
|
import org.linphone.ui.main.contacts.model.TrustCallDialogModel
|
||||||
|
|
@ -283,6 +285,22 @@ class DialogUtils {
|
||||||
return getDialog(context, binding)
|
return getDialog(context, binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UiThread
|
||||||
|
fun getConfigureChatMessagesEphemeralDurationDialog(
|
||||||
|
context: Context,
|
||||||
|
viewModel: ConversationConfigureEphemeralDurationDialogModel
|
||||||
|
): Dialog {
|
||||||
|
val binding: DialogConfigureConversationEphemeralMessagesBinding = DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
R.layout.dialog_configure_conversation_ephemeral_messages,
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
|
return getDialog(context, binding)
|
||||||
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun getUpdateAvailableDialog(
|
fun getUpdateAvailableDialog(
|
||||||
context: Context,
|
context: Context,
|
||||||
|
|
@ -329,7 +347,7 @@ class DialogUtils {
|
||||||
WindowManager.LayoutParams.MATCH_PARENT
|
WindowManager.LayoutParams.MATCH_PARENT
|
||||||
)
|
)
|
||||||
val d: Drawable = ColorDrawable(
|
val d: Drawable = ColorDrawable(
|
||||||
AppUtils.getColor(R.color.gray_300)
|
AppUtils.getColor(R.color.gray_main2_800)
|
||||||
)
|
)
|
||||||
d.alpha = 102
|
d.alpha = 102
|
||||||
dialog.window?.setBackgroundDrawable(d)
|
dialog.window?.setBackgroundDrawable(d)
|
||||||
|
|
|
||||||
|
|
@ -145,13 +145,6 @@ class TimestampUtils {
|
||||||
return dateFormat.format(cal.time)
|
return dateFormat.format(cal.time)
|
||||||
}
|
}
|
||||||
|
|
||||||
@AnyThread
|
|
||||||
private fun isSameYear(timestamp: Long, timestampInSecs: Boolean = true): Boolean {
|
|
||||||
val cal = Calendar.getInstance()
|
|
||||||
cal.timeInMillis = if (timestampInSecs) timestamp * 1000 else timestamp
|
|
||||||
return isSameYear(cal, Calendar.getInstance())
|
|
||||||
}
|
|
||||||
|
|
||||||
@AnyThread
|
@AnyThread
|
||||||
fun toString(
|
fun toString(
|
||||||
timestamp: Long,
|
timestamp: Long,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@
|
||||||
<variable
|
<variable
|
||||||
name="addParticipantsClickListener"
|
name="addParticipantsClickListener"
|
||||||
type="View.OnClickListener" />
|
type="View.OnClickListener" />
|
||||||
|
<variable
|
||||||
|
name="configureEphemeralMessagesClickListener"
|
||||||
|
type="View.OnClickListener" />
|
||||||
<variable
|
<variable
|
||||||
name="viewModel"
|
name="viewModel"
|
||||||
type="org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel" />
|
type="org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel" />
|
||||||
|
|
@ -80,6 +83,18 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/presence_badge"
|
||||||
|
android:layout_width="@dimen/avatar_presence_badge_big_size"
|
||||||
|
android:layout_height="@dimen/avatar_presence_badge_big_size"
|
||||||
|
android:layout_marginEnd="@dimen/avatar_presence_badge_big_end_margin"
|
||||||
|
android:background="@drawable/led_background"
|
||||||
|
android:padding="@dimen/avatar_presence_badge_big_padding"
|
||||||
|
app:presenceIcon="@{viewModel.avatarModel.presenceStatus}"
|
||||||
|
android:visibility="@{viewModel.avatarModel.presenceStatus == ConsolidatedPresence.Offline ? View.GONE : View.VISIBLE, default=gone}"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/avatar"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/default_text_style"
|
style="@style/default_text_style"
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
|
|
@ -111,6 +126,36 @@
|
||||||
app:layout_constraintStart_toEndOf="@id/title"
|
app:layout_constraintStart_toEndOf="@id/title"
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:id="@+id/address"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:text="@{viewModel.sipUri, default=`sip:john.doe@sip.example.org`}"
|
||||||
|
android:textColor="@color/gray_main2_700"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:visibility="@{viewModel.isGroup ? View.GONE : View.VISIBLE, default=gone}"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style_300"
|
||||||
|
android:id="@+id/status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{viewModel.avatarModel.lastPresenceInfo, default=@string/friend_presence_status_online}"
|
||||||
|
android:textColor="@{viewModel.avatarModel.presenceStatus == ConsolidatedPresence.Online ? @color/green_success_500 : @color/orange_warning_600, default=@color/green_success_500}"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="@{viewModel.isGroup || viewModel.avatarModel.presenceStatus == ConsolidatedPresence.Offline ? View.GONE : View.VISIBLE, default=gone}"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/address" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/mute"
|
android:id="@+id/mute"
|
||||||
android:onClick="@{() -> viewModel.toggleMute()}"
|
android:onClick="@{() -> viewModel.toggleMute()}"
|
||||||
|
|
@ -123,7 +168,7 @@
|
||||||
app:tint="@color/gray_main2_500"
|
app:tint="@color/gray_main2_500"
|
||||||
app:layout_constraintEnd_toStartOf="@id/call"
|
app:layout_constraintEnd_toStartOf="@id/call"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
app:layout_constraintTop_toBottomOf="@id/status" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/default_text_style"
|
style="@style/default_text_style"
|
||||||
|
|
@ -150,7 +195,7 @@
|
||||||
app:tint="@color/gray_main2_500"
|
app:tint="@color/gray_main2_500"
|
||||||
app:layout_constraintStart_toEndOf="@id/mute"
|
app:layout_constraintStart_toEndOf="@id/mute"
|
||||||
app:layout_constraintEnd_toStartOf="@id/meeting"
|
app:layout_constraintEnd_toStartOf="@id/meeting"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
app:layout_constraintTop_toBottomOf="@id/status" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/default_text_style"
|
style="@style/default_text_style"
|
||||||
|
|
@ -177,7 +222,7 @@
|
||||||
app:tint="@color/gray_main2_500"
|
app:tint="@color/gray_main2_500"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/call"
|
app:layout_constraintStart_toEndOf="@id/call"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
app:layout_constraintTop_toBottomOf="@id/status" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/default_text_style"
|
style="@style/default_text_style"
|
||||||
|
|
@ -226,7 +271,7 @@
|
||||||
android:id="@+id/participants"
|
android:id="@+id/participants"
|
||||||
android:visibility="@{viewModel.expandParticipants && viewModel.isGroup ? View.VISIBLE : View.GONE}"
|
android:visibility="@{viewModel.expandParticipants && viewModel.isGroup ? View.VISIBLE : View.GONE}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
|
@ -234,7 +279,7 @@
|
||||||
android:background="@drawable/shape_squircle_white_background"
|
android:background="@drawable/shape_squircle_white_background"
|
||||||
android:nestedScrollingEnabled="true"
|
android:nestedScrollingEnabled="true"
|
||||||
app:layout_constraintVertical_weight="1"
|
app:layout_constraintVertical_weight="1"
|
||||||
app:layout_constraintHeight_min="@dimen/recycler_view_min_height"
|
app:layout_constraintHeight_max="@dimen/chat_room_participants_list_max_height"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/participants_label"
|
app:layout_constraintTop_toBottomOf="@id/participants_label"
|
||||||
|
|
@ -294,6 +339,30 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/actions"
|
app:layout_constraintTop_toBottomOf="@id/actions"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/action_delete" />
|
app:layout_constraintBottom_toBottomOf="@id/action_delete" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/context_menu_action_label_style"
|
||||||
|
android:id="@+id/action_ephemeral_messages"
|
||||||
|
android:onClick="@{configureEphemeralMessagesClickListener}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:text="@string/conversation_action_configure_ephemeral_messages"
|
||||||
|
android:drawableStart="@drawable/clock_countdown"
|
||||||
|
android:background="@drawable/action_background"
|
||||||
|
android:visibility="@{!viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/actions_background"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/actions_background"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/actions_background"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_200"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/action_ephemeral_messages"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/action_ephemeral_messages"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/action_ephemeral_messages"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/context_menu_action_label_style"
|
style="@style/context_menu_action_label_style"
|
||||||
android:id="@+id/action_leave_group"
|
android:id="@+id/action_leave_group"
|
||||||
|
|
@ -306,7 +375,7 @@
|
||||||
android:drawableStart="@drawable/sign_out"
|
android:drawableStart="@drawable/sign_out"
|
||||||
android:background="@drawable/action_background"
|
android:background="@drawable/action_background"
|
||||||
android:visibility="@{viewModel.isGroup && !viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
|
android:visibility="@{viewModel.isGroup && !viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
|
||||||
app:layout_constraintTop_toTopOf="@id/actions_background"
|
app:layout_constraintTop_toBottomOf="@id/action_ephemeral_messages"
|
||||||
app:layout_constraintStart_toStartOf="@id/actions_background"
|
app:layout_constraintStart_toStartOf="@id/actions_background"
|
||||||
app:layout_constraintEnd_toEndOf="@id/actions_background"/>
|
app:layout_constraintEnd_toEndOf="@id/actions_background"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
<?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="viewModel"
|
||||||
|
type="org.linphone.ui.main.chat.model.ConversationConfigureEphemeralDurationDialogModel" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:onClick="@{() -> viewModel.dismiss()}">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/dialog_background"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:src="@drawable/shape_dialog_background"
|
||||||
|
app:layout_constraintWidth_max="@dimen/dialog_max_width"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/anchor"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/title" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/section_header_style"
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:paddingTop="@dimen/dialog_top_bottom_margin"
|
||||||
|
android:text="@string/dialog_configure_conversation_messages_ephemeral_duration_title"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/subtitle"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/dialog_background"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/dialog_background"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:id="@+id/subtitle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="@string/dialog_configure_conversation_messages_ephemeral_duration_subtitle"
|
||||||
|
android:textColor="@color/gray_main2_600"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/title"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/dialog_background"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/dialog_background"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/possible_values"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/possible_values"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/subtitle"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/cancel"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_300"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:onClick="@{() -> viewModel.onValueSelected(0)}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@drawable/primary_cell_background"
|
||||||
|
android:selected="@{viewModel.currentlySelectedValue == 0}"
|
||||||
|
android:text="@string/dialog_conversation_message_ephemeral_duration_disabled"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textColor="@color/gray_main2_500"
|
||||||
|
android:textAlignment="center"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_300"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:onClick="@{() -> viewModel.onValueSelected(60)}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@drawable/primary_cell_background"
|
||||||
|
android:selected="@{viewModel.currentlySelectedValue == 60}"
|
||||||
|
android:text="@string/dialog_conversation_message_ephemeral_duration_one_minute"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textColor="@color/gray_main2_500"
|
||||||
|
android:textAlignment="center"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_300"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:onClick="@{() -> viewModel.onValueSelected(3600)}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@drawable/primary_cell_background"
|
||||||
|
android:selected="@{viewModel.currentlySelectedValue == 3600}"
|
||||||
|
android:text="@string/dialog_conversation_message_ephemeral_duration_one_hour"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textColor="@color/gray_main2_500"
|
||||||
|
android:textAlignment="center"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_300"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:onClick="@{() -> viewModel.onValueSelected(86400)}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@drawable/primary_cell_background"
|
||||||
|
android:selected="@{viewModel.currentlySelectedValue == 86400}"
|
||||||
|
android:text="@string/dialog_conversation_message_ephemeral_duration_one_day"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textColor="@color/gray_main2_500"
|
||||||
|
android:textAlignment="center"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_300"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:onClick="@{() -> viewModel.onValueSelected(259200)}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@drawable/primary_cell_background"
|
||||||
|
android:selected="@{viewModel.currentlySelectedValue == 259200}"
|
||||||
|
android:text="@string/dialog_conversation_message_ephemeral_duration_three_days"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textColor="@color/gray_main2_500"
|
||||||
|
android:textAlignment="center"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_300"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/default_text_style"
|
||||||
|
android:onClick="@{() -> viewModel.onValueSelected(604800)}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@drawable/primary_cell_background"
|
||||||
|
android:selected="@{viewModel.currentlySelectedValue == 604800}"
|
||||||
|
android:text="@string/dialog_conversation_message_ephemeral_duration_one_week"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textColor="@color/gray_main2_500"
|
||||||
|
android:textAlignment="center"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/gray_main2_300"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/secondary_button_label_style"
|
||||||
|
android:id="@+id/cancel"
|
||||||
|
android:onClick="@{() -> viewModel.dismiss()}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:text="@string/dialog_cancel"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/dialog_background"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/dialog_background"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/possible_values"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/anchor"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/anchor"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dialog_top_bottom_margin"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/dialog_background"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/dialog_background"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/cancel"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</layout>
|
||||||
|
|
@ -116,6 +116,14 @@
|
||||||
<string name="dialog_account_international_prefix_help_message">Blah blah blah</string>
|
<string name="dialog_account_international_prefix_help_message">Blah blah blah</string>
|
||||||
<string name="dialog_group_conversation_edit_subject">Edit conversation subject</string>
|
<string name="dialog_group_conversation_edit_subject">Edit conversation subject</string>
|
||||||
<string name="dialog_group_conversation_edit_subject_confirm_button">Confirm</string>
|
<string name="dialog_group_conversation_edit_subject_confirm_button">Confirm</string>
|
||||||
|
<string name="dialog_configure_conversation_messages_ephemeral_duration_title">Enable ephemeral messages</string>
|
||||||
|
<string name="dialog_configure_conversation_messages_ephemeral_duration_subtitle">New messages will be automatically deleted once read by everyone.\nChoose a duration:</string>
|
||||||
|
<string name="dialog_conversation_message_ephemeral_duration_disabled">Disabled</string>
|
||||||
|
<string name="dialog_conversation_message_ephemeral_duration_one_minute">1 minute</string>
|
||||||
|
<string name="dialog_conversation_message_ephemeral_duration_one_hour">1 hour</string>
|
||||||
|
<string name="dialog_conversation_message_ephemeral_duration_one_day">1 day</string>
|
||||||
|
<string name="dialog_conversation_message_ephemeral_duration_three_days">3 days</string>
|
||||||
|
<string name="dialog_conversation_message_ephemeral_duration_one_week">1 week</string>
|
||||||
|
|
||||||
<string name="toast_assistant_qr_code_invalid">Invalid QR code!</string>
|
<string name="toast_assistant_qr_code_invalid">Invalid QR code!</string>
|
||||||
<string name="toast_sip_address_copied_to_clipboard">SIP address copied into clipboard</string>
|
<string name="toast_sip_address_copied_to_clipboard">SIP address copied into clipboard</string>
|
||||||
|
|
@ -350,6 +358,7 @@
|
||||||
<string name="conversation_action_call">Call</string>
|
<string name="conversation_action_call">Call</string>
|
||||||
<string name="conversation_action_delete">Delete conversation</string>
|
<string name="conversation_action_delete">Delete conversation</string>
|
||||||
<string name="conversation_action_leave_group">Leave the group</string>
|
<string name="conversation_action_leave_group">Leave the group</string>
|
||||||
|
<string name="conversation_action_configure_ephemeral_messages">Configure ephemeral messages</string>
|
||||||
<string name="new_conversation_title">New conversation</string>
|
<string name="new_conversation_title">New conversation</string>
|
||||||
<string name="new_conversation_search_bar_filter_hint">Search contact</string>
|
<string name="new_conversation_search_bar_filter_hint">Search contact</string>
|
||||||
<string name="new_conversation_create_group">Create a group conversation</string>
|
<string name="new_conversation_create_group">Create a group conversation</string>
|
||||||
|
|
@ -383,6 +392,9 @@
|
||||||
<string name="conversation_event_subject_changed">new subject: %s</string>
|
<string name="conversation_event_subject_changed">new subject: %s</string>
|
||||||
<string name="conversation_event_admin_set">%s is admin</string>
|
<string name="conversation_event_admin_set">%s is admin</string>
|
||||||
<string name="conversation_event_admin_unset">%s is no longer admin</string>
|
<string name="conversation_event_admin_unset">%s is no longer admin</string>
|
||||||
|
<string name="conversation_event_ephemeral_messages_enabled">Ephemeral messages have been enabled</string>
|
||||||
|
<string name="conversation_event_ephemeral_messages_disabled">Ephemeral messages have been disabled</string>
|
||||||
|
<string name="conversation_event_ephemeral_messages_lifetime_changed">Ephemeral lifetime is now %s</string>
|
||||||
|
|
||||||
<string name="message_delivery_info_read_title">Read %s</string>
|
<string name="message_delivery_info_read_title">Read %s</string>
|
||||||
<string name="message_delivery_info_received_title">Received %s</string>
|
<string name="message_delivery_info_received_title">Received %s</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue