mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Reworked ephemeral lifetime configuration dialog into a dedicated fragment
This commit is contained in:
parent
fb05cf6280
commit
16dd423016
11 changed files with 365 additions and 308 deletions
|
|
@ -0,0 +1,68 @@
|
|||
package org.linphone.ui.main.chat.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.ChatEphemeralLifetimeFragmentBinding
|
||||
import org.linphone.ui.main.chat.viewmodel.ConversationEphemeralLifetimeViewModel
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
import org.linphone.utils.Event
|
||||
|
||||
@UiThread
|
||||
class ConversationEphemeralLifetimeFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Conversation Ephemeral Lifetime Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: ChatEphemeralLifetimeFragmentBinding
|
||||
|
||||
private lateinit var viewModel: ConversationEphemeralLifetimeViewModel
|
||||
|
||||
private val args: ConversationEphemeralLifetimeFragmentArgs by navArgs()
|
||||
|
||||
override fun goBack(): Boolean {
|
||||
return findNavController().popBackStack()
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = ChatEphemeralLifetimeFragmentBinding.inflate(layoutInflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
// This fragment is displayed in a SlidingPane "child" area
|
||||
isSlidingPaneChild = true
|
||||
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
viewModel = ViewModelProvider(this)[ConversationEphemeralLifetimeViewModel::class.java]
|
||||
binding.viewModel = viewModel
|
||||
|
||||
val lifetime = args.currentEphemeralLifetime
|
||||
Log.i("$TAG Current lifetime for ephemeral messages is [$lifetime]")
|
||||
viewModel.currentlySelectedValue.value = lifetime
|
||||
|
||||
binding.setBackClickListener {
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
sharedViewModel.newChatMessageEphemeralLifetimeToSet.value = Event(
|
||||
viewModel.currentlySelectedValue.value ?: 0L
|
||||
)
|
||||
super.onPause()
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,6 @@ import org.linphone.core.tools.Log
|
|||
import org.linphone.databinding.ChatInfoFragmentBinding
|
||||
import org.linphone.databinding.ChatParticipantAdminPopupMenuBinding
|
||||
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.ParticipantModel
|
||||
import org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel
|
||||
|
|
@ -158,6 +157,15 @@ class ConversationInfoFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.newChatMessageEphemeralLifetimeToSet.observe(viewLifecycleOwner) {
|
||||
it.consume { ephemeralLifetime ->
|
||||
Log.i(
|
||||
"$TAG Setting [$ephemeralLifetime] as new ephemeral lifetime for chat messages"
|
||||
)
|
||||
viewModel.updateEphemeralLifetime(ephemeralLifetime)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setBackClickListener {
|
||||
goBack()
|
||||
}
|
||||
|
|
@ -198,37 +206,15 @@ class ConversationInfoFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
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()
|
||||
}
|
||||
val currentValue = viewModel.ephemeralLifetime.value ?: 0L
|
||||
if (findNavController().currentDestination?.id == R.id.conversationInfoFragment) {
|
||||
Log.i("$TAG Going to ephemeral lifetime fragment (currently [$currentValue])")
|
||||
val action =
|
||||
ConversationInfoFragmentDirections.actionConversationInfoFragmentToConversationEphemeralLifetimeFragment(
|
||||
currentValue
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,22 +98,22 @@ class EventModel @WorkerThread constructor(private val eventLog: EventLog) {
|
|||
private fun formatEphemeralExpiration(duration: Long): String {
|
||||
return when (duration) {
|
||||
0L -> AppUtils.getString(
|
||||
R.string.dialog_conversation_message_ephemeral_duration_disabled
|
||||
R.string.conversation_ephemeral_messages_duration_disabled
|
||||
)
|
||||
60L -> AppUtils.getString(
|
||||
R.string.dialog_conversation_message_ephemeral_duration_one_minute
|
||||
R.string.conversation_ephemeral_messages_duration_one_minute
|
||||
)
|
||||
3600L -> AppUtils.getString(
|
||||
R.string.dialog_conversation_message_ephemeral_duration_one_hour
|
||||
R.string.conversation_ephemeral_messages_duration_one_hour
|
||||
)
|
||||
86400L -> AppUtils.getString(
|
||||
R.string.dialog_conversation_message_ephemeral_duration_one_day
|
||||
R.string.conversation_ephemeral_messages_duration_one_day
|
||||
)
|
||||
259200L -> AppUtils.getString(
|
||||
R.string.dialog_conversation_message_ephemeral_duration_three_days
|
||||
R.string.conversation_ephemeral_messages_duration_three_days
|
||||
)
|
||||
604800L -> AppUtils.getString(
|
||||
R.string.dialog_conversation_message_ephemeral_duration_one_week
|
||||
R.string.conversation_ephemeral_messages_duration_one_week
|
||||
)
|
||||
else -> "$duration s"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,26 +17,21 @@
|
|||
* 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
|
||||
package org.linphone.ui.main.chat.viewmodel
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.utils.Event
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class ConversationConfigureEphemeralDurationDialogModel @UiThread constructor(
|
||||
val currentlySelectedValue: Int
|
||||
) {
|
||||
val dismissEvent = MutableLiveData<Event<Boolean>>()
|
||||
class ConversationEphemeralLifetimeViewModel @UiThread constructor() : ViewModel() {
|
||||
val currentlySelectedValue = MutableLiveData<Long>()
|
||||
|
||||
val newValueSelectedEvent = MutableLiveData<Event<Int>>()
|
||||
|
||||
@UiThread
|
||||
fun dismiss() {
|
||||
dismissEvent.value = Event(true)
|
||||
init {
|
||||
currentlySelectedValue.value = 0
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun onValueSelected(value: Int) {
|
||||
newValueSelectedEvent.value = Event(value)
|
||||
fun onValueSelected(value: Long) {
|
||||
currentlySelectedValue.value = value
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val isMuted = MutableLiveData<Boolean>()
|
||||
|
||||
val ephemeralLifetime = MutableLiveData<Int>()
|
||||
val ephemeralLifetime = MutableLiveData<Long>()
|
||||
|
||||
val expandParticipants = MutableLiveData<Boolean>()
|
||||
|
||||
|
|
@ -335,9 +335,9 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
|||
}
|
||||
|
||||
@UiThread
|
||||
fun updateEphemeralLifetime(lifetime: Int) {
|
||||
fun updateEphemeralLifetime(lifetime: Long) {
|
||||
coreContext.postOnCoreThread {
|
||||
if (lifetime == 0) {
|
||||
if (lifetime == 0L) {
|
||||
if (chatRoom.isEphemeralEnabled) {
|
||||
Log.i("$TAG Disabling ephemeral messages")
|
||||
chatRoom.isEphemeralEnabled = false
|
||||
|
|
@ -348,14 +348,13 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
|||
chatRoom.isEphemeralEnabled = true
|
||||
}
|
||||
|
||||
val longLifetime = lifetime.toLong()
|
||||
if (chatRoom.ephemeralLifetime != longLifetime) {
|
||||
Log.i("$TAG Updating lifetime to [$longLifetime]")
|
||||
chatRoom.ephemeralLifetime = longLifetime
|
||||
if (chatRoom.ephemeralLifetime != lifetime) {
|
||||
Log.i("$TAG Updating lifetime to [$lifetime]")
|
||||
chatRoom.ephemeralLifetime = lifetime
|
||||
}
|
||||
}
|
||||
ephemeralLifetime.postValue(
|
||||
if (!chatRoom.isEphemeralEnabled) 0 else chatRoom.ephemeralLifetime.toInt()
|
||||
if (!chatRoom.isEphemeralEnabled) 0L else chatRoom.ephemeralLifetime
|
||||
)
|
||||
Log.i(
|
||||
"$TAG Ephemeral chat messages are [${if (chatRoom.isEphemeralEnabled) "enabled" else "disabled"}], lifetime is [${chatRoom.ephemeralLifetime}]"
|
||||
|
|
@ -383,7 +382,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
|||
sipUri.postValue(chatRoom.participants.firstOrNull()?.address?.asStringUriOnly())
|
||||
|
||||
ephemeralLifetime.postValue(
|
||||
if (!chatRoom.isEphemeralEnabled) 0 else chatRoom.ephemeralLifetime.toInt()
|
||||
if (!chatRoom.isEphemeralEnabled) 0L else chatRoom.ephemeralLifetime
|
||||
)
|
||||
|
||||
computeParticipantsList()
|
||||
|
|
|
|||
|
|
@ -114,6 +114,10 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
|
|||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val newChatMessageEphemeralLifetimeToSet: MutableLiveData<Event<Long>> by lazy {
|
||||
MutableLiveData<Event<Long>>()
|
||||
}
|
||||
|
||||
/* Meetings related */
|
||||
|
||||
val forceRefreshMeetingsListEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import org.linphone.databinding.DialogAccountModesExplanationBinding
|
|||
import org.linphone.databinding.DialogAssistantAcceptConditionsAndPolicyBinding
|
||||
import org.linphone.databinding.DialogAssistantCreateAccountConfirmPhoneNumberBinding
|
||||
import org.linphone.databinding.DialogCancelContactChangesBinding
|
||||
import org.linphone.databinding.DialogConfigureConversationEphemeralMessagesBinding
|
||||
import org.linphone.databinding.DialogConfirmZrtpSasBinding
|
||||
import org.linphone.databinding.DialogContactConfirmTrustCallBinding
|
||||
import org.linphone.databinding.DialogContactTrustProcessBinding
|
||||
|
|
@ -50,7 +49,6 @@ import org.linphone.databinding.DialogUpdateAvailableBinding
|
|||
import org.linphone.ui.assistant.model.AcceptConditionsAndPolicyDialogModel
|
||||
import org.linphone.ui.assistant.model.ConfirmPhoneNumberDialogModel
|
||||
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.contacts.model.NumberOrAddressPickerDialogModel
|
||||
import org.linphone.ui.main.contacts.model.TrustCallDialogModel
|
||||
|
|
@ -285,22 +283,6 @@ class DialogUtils {
|
|||
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
|
||||
fun getUpdateAvailableDialog(
|
||||
context: Context,
|
||||
|
|
|
|||
229
app/src/main/res/layout/chat_ephemeral_lifetime_fragment.xml
Normal file
229
app/src/main/res/layout/chat_ephemeral_lifetime_fragment.xml
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
<?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="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.chat.viewmodel.ConversationEphemeralLifetimeViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="15dp"
|
||||
android:onClick="@{backClickListener}"
|
||||
android:src="@drawable/caret_left"
|
||||
app:tint="@color/orange_main_500"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/main_page_title_style"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/conversation_ephemeral_messages_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
android:background="@color/gray_100"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="@string/conversation_ephemeral_messages_subtitle"
|
||||
android:textColor="@color/gray_main2_600"
|
||||
android:textSize="14sp"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/values"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/shape_squircle_white_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle">
|
||||
|
||||
<RadioButton
|
||||
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:checked="@{viewModel.currentlySelectedValue == 60}"
|
||||
android:text="@string/conversation_ephemeral_messages_duration_one_minute"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/gray_main2_500"
|
||||
android:textAlignment="textStart"
|
||||
app:useMaterialThemeColors="false"
|
||||
app:buttonTint="@color/orange_main_500" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@color/gray_main2_300"/>
|
||||
|
||||
<RadioButton
|
||||
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:checked="@{viewModel.currentlySelectedValue == 3600}"
|
||||
android:text="@string/conversation_ephemeral_messages_duration_one_hour"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/gray_main2_500"
|
||||
android:textAlignment="textStart"
|
||||
app:useMaterialThemeColors="false"
|
||||
app:buttonTint="@color/orange_main_500" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@color/gray_main2_300"/>
|
||||
|
||||
<RadioButton
|
||||
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:checked="@{viewModel.currentlySelectedValue == 86400}"
|
||||
android:text="@string/conversation_ephemeral_messages_duration_one_day"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/gray_main2_500"
|
||||
android:textAlignment="textStart"
|
||||
app:useMaterialThemeColors="false"
|
||||
app:buttonTint="@color/orange_main_500" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@color/gray_main2_300"/>
|
||||
|
||||
<RadioButton
|
||||
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:checked="@{viewModel.currentlySelectedValue == 259200}"
|
||||
android:text="@string/conversation_ephemeral_messages_duration_three_days"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/gray_main2_500"
|
||||
android:textAlignment="textStart"
|
||||
app:useMaterialThemeColors="false"
|
||||
app:buttonTint="@color/orange_main_500" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@color/gray_main2_300"/>
|
||||
|
||||
<RadioButton
|
||||
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:checked="@{viewModel.currentlySelectedValue == 604800}"
|
||||
android:text="@string/conversation_ephemeral_messages_duration_one_week"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/gray_main2_500"
|
||||
android:textAlignment="textStart"
|
||||
app:useMaterialThemeColors="false"
|
||||
app:buttonTint="@color/orange_main_500" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@color/gray_main2_300"/>
|
||||
|
||||
<RadioButton
|
||||
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:checked="@{viewModel.currentlySelectedValue == 0}"
|
||||
android:text="@string/conversation_ephemeral_messages_duration_disabled"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/gray_main2_500"
|
||||
android:textAlignment="textStart"
|
||||
app:useMaterialThemeColors="false"
|
||||
app:buttonTint="@color/orange_main_500" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -1,223 +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="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="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle"
|
||||
app:layout_constraintBottom_toTopOf="@id/cancel"
|
||||
app:layout_constraintStart_toStartOf="@id/dialog_background"
|
||||
app:layout_constraintEnd_toEndOf="@id/dialog_background">
|
||||
|
||||
<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: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: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: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: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: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: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>
|
||||
|
|
@ -54,6 +54,13 @@
|
|||
app:exitAnim="@anim/slide_out_left"
|
||||
app:popEnterAnim="@anim/slide_in_left"
|
||||
app:popExitAnim="@anim/slide_out_right" />
|
||||
<action
|
||||
android:id="@+id/action_conversationInfoFragment_to_conversationEphemeralLifetimeFragment"
|
||||
app:destination="@id/conversationEphemeralLifetimeFragment"
|
||||
app:enterAnim="@anim/slide_in_right"
|
||||
app:exitAnim="@anim/slide_out_left"
|
||||
app:popEnterAnim="@anim/slide_in_left"
|
||||
app:popExitAnim="@anim/slide_out_right" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
|
|
@ -62,4 +69,14 @@
|
|||
android:label="AddParticipantsFragment"
|
||||
tools:layout="@layout/generic_add_participants_fragment" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/conversationEphemeralLifetimeFragment"
|
||||
android:name="org.linphone.ui.main.chat.fragment.ConversationEphemeralLifetimeFragment"
|
||||
android:label="ConversationEphemeralLifetimeFragment"
|
||||
tools:layout="@layout/chat_ephemeral_lifetime_fragment">
|
||||
<argument
|
||||
android:name="currentEphemeralLifetime"
|
||||
app:argType="long" />
|
||||
</fragment>
|
||||
|
||||
</navigation>
|
||||
|
|
@ -120,14 +120,6 @@
|
|||
<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_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_sip_address_copied_to_clipboard">SIP address copied into clipboard</string>
|
||||
|
|
@ -362,6 +354,14 @@
|
|||
<string name="conversation_action_delete">Delete conversation</string>
|
||||
<string name="conversation_action_leave_group">Leave the group</string>
|
||||
<string name="conversation_action_configure_ephemeral_messages">Configure ephemeral messages</string>
|
||||
<string name="conversation_ephemeral_messages_title">Ephemeral messages</string>
|
||||
<string name="conversation_ephemeral_messages_subtitle">New messages will be automatically deleted once read by everyone.\nChoose a duration:</string>
|
||||
<string name="conversation_ephemeral_messages_duration_disabled">Disabled</string>
|
||||
<string name="conversation_ephemeral_messages_duration_one_minute">1 minute</string>
|
||||
<string name="conversation_ephemeral_messages_duration_one_hour">1 hour</string>
|
||||
<string name="conversation_ephemeral_messages_duration_one_day">1 day</string>
|
||||
<string name="conversation_ephemeral_messages_duration_three_days">3 days</string>
|
||||
<string name="conversation_ephemeral_messages_duration_one_week">1 week</string>
|
||||
<string name="new_conversation_title">New conversation</string>
|
||||
<string name="new_conversation_search_bar_filter_hint">Search contact</string>
|
||||
<string name="new_conversation_create_group">Create a group conversation</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue