Improved texts/layout related to file/text sharing & message forward

This commit is contained in:
Sylvain Berfini 2021-06-04 11:04:26 +02:00
parent ad7b56c2c7
commit 37ed867bf1
6 changed files with 24 additions and 36 deletions

View file

@ -183,7 +183,8 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
Log.i("[Chat] Cancelling text/files sharing")
sharedViewModel.textToShare.value = ""
sharedViewModel.filesToShare.value = arrayListOf()
listViewModel.sharingPending.value = false
listViewModel.fileSharingPending.value = false
listViewModel.textSharingPending.value = false
}
binding.setNewOneToOneChatRoomClickListener {
@ -224,10 +225,10 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
Log.i("[Chat] Found text to share")
// val activity = requireActivity() as MainActivity
// activity.showSnackBar(R.string.chat_room_toast_choose_for_sharing)
listViewModel.sharingPending.value = true
listViewModel.textSharingPending.value = true
} else {
if (sharedViewModel.filesToShare.value.isNullOrEmpty()) {
listViewModel.sharingPending.value = false
listViewModel.textSharingPending.value = false
}
}
})
@ -236,10 +237,10 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
Log.i("[Chat] Found ${it.size} files to share")
// val activity = requireActivity() as MainActivity
// activity.showSnackBar(R.string.chat_room_toast_choose_for_sharing)
listViewModel.sharingPending.value = true
listViewModel.fileSharingPending.value = true
} else {
if (sharedViewModel.textToShare.value.isNullOrEmpty()) {
listViewModel.sharingPending.value = false
listViewModel.fileSharingPending.value = false
}
}
})

View file

@ -39,7 +39,9 @@ class ChatRoomsListViewModel : ErrorReportingViewModel() {
MutableLiveData<Event<Boolean>>()
}
val sharingPending = MutableLiveData<Boolean>()
val fileSharingPending = MutableLiveData<Boolean>()
val textSharingPending = MutableLiveData<Boolean>()
val forwardPending = MutableLiveData<Boolean>()

View file

@ -64,7 +64,7 @@
<ImageView
android:onClick="@{cancelSharingClickListener}"
android:visibility="@{viewModel.sharingPending ? View.VISIBLE : View.GONE}"
android:visibility="@{viewModel.fileSharingPending || viewModel.textSharingPending ? View.VISIBLE : View.GONE}"
android:contentDescription="@string/content_description_cancel_sharing"
android:layout_width="0dp"
android:layout_height="match_parent"
@ -102,7 +102,7 @@
<ImageView
android:onClick="@{editClickListener}"
android:enabled="@{!viewModel.chatRooms.empty}"
android:visibility="@{viewModel.forwardPending || viewModel.sharingPending ? View.GONE : View.VISIBLE}"
android:visibility="@{viewModel.forwardPending || viewModel.fileSharingPending || viewModel.textSharingPending ? View.GONE : View.VISIBLE}"
android:contentDescription="@string/content_description_enter_edition_mode"
android:layout_width="0dp"
android:layout_height="match_parent"
@ -114,22 +114,13 @@
</LinearLayout>
<TextView
android:visibility="@{viewModel.sharingPending ? View.VISIBLE : View.GONE, default=gone}"
android:visibility="@{viewModel.fileSharingPending || viewModel.textSharingPending || viewModel.forwardPending ? View.VISIBLE : View.GONE, default=gone}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/backgroundContrastColor"
android:textColor="?attr/secondaryTextColor"
android:padding="10dp"
android:text="@string/chat_room_choose_conversation_for_file_sharing" />
<TextView
android:visibility="@{viewModel.forwardPending ? View.VISIBLE : View.GONE, default=gone}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/backgroundContrastColor"
android:textColor="?attr/secondaryTextColor"
android:padding="10dp"
android:text="@string/chat_room_choose_conversation_for_message_forward" />
android:text="@{viewModel.fileSharingPending ? @string/chat_room_choose_conversation_for_file_sharing : (viewModel.textSharingPending ? @string/chat_room_choose_conversation_for_text_sharing : @string/chat_room_choose_conversation_for_message_forward)}" />
</LinearLayout>

View file

@ -53,7 +53,7 @@
<ImageView
android:onClick="@{cancelSharingClickListener}"
android:visibility="@{viewModel.sharingPending ? View.VISIBLE : View.GONE}"
android:visibility="@{viewModel.fileSharingPending || viewModel.textSharingPending ? View.VISIBLE : View.GONE}"
android:contentDescription="@string/content_description_cancel_sharing"
android:layout_width="0dp"
android:layout_height="match_parent"
@ -91,7 +91,7 @@
<ImageView
android:onClick="@{editClickListener}"
android:enabled="@{!viewModel.chatRooms.empty}"
android:visibility="@{viewModel.forwardPending || viewModel.sharingPending ? View.GONE : View.VISIBLE}"
android:visibility="@{viewModel.forwardPending || viewModel.fileSharingPending || viewModel.textSharingPending ? View.GONE : View.VISIBLE}"
android:contentDescription="@string/content_description_enter_edition_mode"
android:layout_width="0dp"
android:layout_height="match_parent"
@ -103,22 +103,13 @@
</LinearLayout>
<TextView
android:visibility="@{viewModel.sharingPending ? View.VISIBLE : View.GONE, default=gone}"
android:visibility="@{viewModel.fileSharingPending || viewModel.textSharingPending || viewModel.forwardPending ? View.VISIBLE : View.GONE, default=gone}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/backgroundContrastColor"
android:textColor="?attr/secondaryTextColor"
android:padding="10dp"
android:text="@string/chat_room_choose_conversation_for_file_sharing" />
<TextView
android:visibility="@{viewModel.forwardPending ? View.VISIBLE : View.GONE, default=gone}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/backgroundContrastColor"
android:textColor="?attr/secondaryTextColor"
android:padding="10dp"
android:text="@string/chat_room_choose_conversation_for_message_forward" />
android:text="@{viewModel.fileSharingPending ? @string/chat_room_choose_conversation_for_file_sharing : (viewModel.textSharingPending ? @string/chat_room_choose_conversation_for_text_sharing : @string/chat_room_choose_conversation_for_message_forward)}" />
</LinearLayout>

View file

@ -600,6 +600,8 @@
<string name="call_settings_pause_calls_lost_audio_focus_title">Mettre en pause les appels quand le focus audio est perdu</string>
<string name="content_description_cancel_forward">Annuler le transfert de message</string>
<string name="content_description_cancel_sharing">Annuler le partage</string>
<string name="chat_room_choose_conversation_for_message_forward">Sélectionnez une conversation ou créez-en une nouvelle</string>
<string name="chat_room_choose_conversation_for_file_sharing">Sélectionnez une conversation ou créez-en une nouvelle</string>
<string name="content_description_forward_message">Transférer le message dans cette conversation</string>
<string name="chat_room_choose_conversation_for_message_forward">Sélectionnez ou créez une conversation pour transférer le message</string>
<string name="chat_room_choose_conversation_for_file_sharing">Sélectionnez ou créez une conversation pour partager le(s) fichier(s)</string>
<string name="chat_room_choose_conversation_for_text_sharing">Sélectionnez ou créez une conversation pour partager le texte</string>
</resources>

View file

@ -177,8 +177,9 @@
<string name="chat_message_forward_confirmation_dialog">Do you want to forward the message in this room?</string>
<string name="chat_room_dummy_subject" translatable="false">dummy subject</string>
<string name="chat_room_toast_choose_for_sharing">Select a conversation or create a new one</string>
<string name="chat_room_choose_conversation_for_message_forward">Select a conversation or create a new one</string>
<string name="chat_room_choose_conversation_for_file_sharing">Select a conversation or create a new one</string>
<string name="chat_room_choose_conversation_for_message_forward">Select or create a conversation to forward the message</string>
<string name="chat_room_choose_conversation_for_file_sharing">Select or create a conversation to share the file(s)</string>
<string name="chat_room_choose_conversation_for_text_sharing">Select or create a conversation to share the text</string>
<string name="chat_room_cant_open_file_no_app_found">Can\'t open file, no application available for this format.</string>
<string name="chat_room_file_not_found">File not found</string>
<string name="chat_room_creation_failed">Chat room creation failed</string>