Better code
This commit is contained in:
parent
31d5578063
commit
ca0cd9e97d
|
@ -263,6 +263,9 @@ abstract class VectorBaseFragment : BaseMvRxFragment(), HasScreenInjector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This should be provided by the framework
|
||||||
|
protected fun invalidateOptionsMenu() = requireActivity().invalidateOptionsMenu()
|
||||||
|
|
||||||
/* ==========================================================================================
|
/* ==========================================================================================
|
||||||
* Common Dialogs
|
* Common Dialogs
|
||||||
* ========================================================================================== */
|
* ========================================================================================== */
|
||||||
|
|
|
@ -127,7 +127,7 @@ class AttachmentsPreviewFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
requireActivity().invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
if (state.attachments.isEmpty()) {
|
if (state.attachments.isEmpty()) {
|
||||||
requireActivity().setResult(RESULT_CANCELED)
|
requireActivity().setResult(RESULT_CANCELED)
|
||||||
requireActivity().finish()
|
requireActivity().finish()
|
||||||
|
|
|
@ -149,7 +149,7 @@ class CreateDirectRoomKnownUsersFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderSelectedUsers(selectedUsers: Set<User>) {
|
private fun renderSelectedUsers(selectedUsers: Set<User>) {
|
||||||
vectorBaseActivity.invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
if (selectedUsers.isNotEmpty() && chipGroup.size == 0) {
|
if (selectedUsers.isNotEmpty() && chipGroup.size == 0) {
|
||||||
selectedUsers.forEach { addChipToGroup(it, chipGroup) }
|
selectedUsers.forEach { addChipToGroup(it, chipGroup) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ class RoomListFragment @Inject constructor(
|
||||||
val newValue = state.hasUnread
|
val newValue = state.hasUnread
|
||||||
if (hasUnreadRooms != newValue) {
|
if (hasUnreadRooms != newValue) {
|
||||||
hasUnreadRooms = newValue
|
hasUnreadRooms = newValue
|
||||||
requireActivity().invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> Unit
|
else -> Unit
|
||||||
|
|
Loading…
Reference in New Issue