mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Improve choose chats save button enabled state.
This commit is contained in:
@@ -325,12 +325,6 @@ class ChatFoldersViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun enableButton(): Boolean {
|
||||
return internalState.value.pendingIncludedRecipients.isNotEmpty() ||
|
||||
internalState.value.pendingChatTypes.isNotEmpty() ||
|
||||
internalState.value.pendingExcludedRecipients.isNotEmpty()
|
||||
}
|
||||
|
||||
fun hasChanges(): Boolean {
|
||||
val currentFolder = state.value.currentFolder
|
||||
val originalFolder = state.value.originalFolder
|
||||
|
||||
@@ -84,7 +84,7 @@ class ChooseChatsFragment : LoggingFragment(), ContactSelectionListFragment.OnCo
|
||||
viewModel.savePendingChats()
|
||||
findNavController().popBackStack()
|
||||
}
|
||||
updateEnabledButton()
|
||||
doneButton.isEnabled = false
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
@@ -120,7 +120,7 @@ class ChooseChatsFragment : LoggingFragment(), ContactSelectionListFragment.OnCo
|
||||
} else {
|
||||
callback.accept(false)
|
||||
}
|
||||
updateEnabledButton()
|
||||
doneButton.isEnabled = true
|
||||
}
|
||||
|
||||
override fun onContactDeselected(recipientId: Optional<RecipientId>, number: String?, chatType: Optional<ChatType>) {
|
||||
@@ -133,7 +133,7 @@ class ChooseChatsFragment : LoggingFragment(), ContactSelectionListFragment.OnCo
|
||||
} else if (chatType.isPresent) {
|
||||
viewModel.removeChatType(chatType.get())
|
||||
}
|
||||
updateEnabledButton()
|
||||
doneButton.isEnabled = true
|
||||
}
|
||||
|
||||
override fun onSelectionChanged() = Unit
|
||||
@@ -147,10 +147,6 @@ class ChooseChatsFragment : LoggingFragment(), ContactSelectionListFragment.OnCo
|
||||
ContactSelectionDisplayMode.FLAG_SELF
|
||||
}
|
||||
|
||||
private fun updateEnabledButton() {
|
||||
doneButton.isEnabled = viewModel.enableButton()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = Log.tag(ChooseChatsFragment::class.java)
|
||||
private val KEY_INCLUDE_CHATS = "include_chats"
|
||||
|
||||
Reference in New Issue
Block a user