Prevent multiple attach file dialogs
This commit is contained in:
parent
4d1adf6227
commit
a68a816cff
3 changed files with 5 additions and 1 deletions
|
@ -820,6 +820,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
chatSendingViewModel.attachFilePending.value = false
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.Main) {
|
||||
|
@ -1126,6 +1127,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
}
|
||||
|
||||
private fun pickFile() {
|
||||
chatSendingViewModel.attachFilePending.value = true
|
||||
val intentsList = ArrayList<Intent>()
|
||||
|
||||
val pickerIntent = Intent(Intent.ACTION_GET_CONTENT)
|
||||
|
|
|
@ -60,6 +60,8 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
|||
|
||||
val attachFileEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val attachFilePending = MutableLiveData<Boolean>()
|
||||
|
||||
val sendMessageEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val attachingFileInProgress = MutableLiveData<Boolean>()
|
||||
|
|
|
@ -246,7 +246,7 @@
|
|||
android:layout_marginStart="@dimen/chat_message_sending_icons_margin"
|
||||
android:layout_marginEnd="@dimen/chat_message_sending_icons_margin"
|
||||
android:contentDescription="@string/content_description_attach_file"
|
||||
android:enabled="@{chatSendingViewModel.attachFileEnabled}"
|
||||
android:enabled="@{chatSendingViewModel.attachFileEnabled && !chatSendingViewModel.attachFilePending}"
|
||||
android:onClick="@{attachFileClickListener}"
|
||||
android:paddingTop="@dimen/chat_message_sending_icons_margin"
|
||||
android:paddingBottom="@dimen/chat_message_sending_icons_margin"
|
||||
|
|
Loading…
Reference in a new issue