Use debouncedClicks every where, for faster UI (it uses throttleFirst operator instead of debounce)

This commit is contained in:
Benoit Marty 2020-05-13 23:52:47 +02:00
parent 9520aff848
commit 22955e6b34
11 changed files with 16 additions and 16 deletions

View file

@ -123,7 +123,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
.joinToString(" ")
}
it.setOnClickListener {
it.debouncedClicks {
copyToClipboard(activity!!, recoveryKey)
}
}

View file

@ -209,7 +209,7 @@ class HomeDetailFragment @Inject constructor(
parentActivity.configure(groupToolbar)
}
groupToolbar.title = ""
groupToolbarAvatarImageView.setOnClickListener {
groupToolbarAvatarImageView.debouncedClicks {
sharedActionViewModel.post(HomeActivitySharedAction.OpenDrawer)
}
}

View file

@ -53,13 +53,13 @@ class HomeDrawerFragment @Inject constructor(
homeDrawerUserIdView.text = user.userId
}
}
homeDrawerHeaderSettingsView.setOnClickListener {
homeDrawerHeaderSettingsView.debouncedClicks {
sharedActionViewModel.post(HomeActivitySharedAction.CloseDrawer)
navigator.openSettings(requireActivity())
}
// Debug menu
homeDrawerHeaderDebugView.setOnClickListener {
homeDrawerHeaderDebugView.debouncedClicks {
sharedActionViewModel.post(HomeActivitySharedAction.CloseDrawer)
navigator.openDebug(requireActivity())
}

View file

@ -264,7 +264,7 @@ class RoomDetailFragment @Inject constructor(
setupNotificationView()
setupJumpToReadMarkerView()
setupJumpToBottomView()
roomToolbarContentView.setOnClickListener {
roomToolbarContentView.debouncedClicks {
navigator.openRoomProfile(requireActivity(), roomDetailArgs.roomId)
}
roomDetailViewModel.subscribe { renderState(it) }
@ -348,7 +348,7 @@ class RoomDetailFragment @Inject constructor(
private fun setupJumpToBottomView() {
jumpToBottomView.visibility = View.INVISIBLE
jumpToBottomView.setOnClickListener {
jumpToBottomView.debouncedClicks {
roomDetailViewModel.handle(RoomDetailAction.ExitTrackingUnreadMessagesState)
jumpToBottomView.visibility = View.INVISIBLE
if (!roomDetailViewModel.timeline.isLive) {

View file

@ -142,10 +142,10 @@ class RoomListFragment @Inject constructor(
else -> Unit // No button in this mode
}
createChatRoomButton.setOnClickListener {
createChatRoomButton.debouncedClicks {
createDirectChat()
}
createGroupRoomButton.setOnClickListener {
createGroupRoomButton.debouncedClicks {
openRoomDirectory()
}

View file

@ -71,7 +71,7 @@ class PublicRoomsFragment @Inject constructor(
}
.disposeOnDestroyView()
publicRoomsCreateNewRoom.setOnClickListener {
publicRoomsCreateNewRoom.debouncedClicks {
sharedActionViewModel.post(RoomDirectorySharedAction.CreateRoom)
}

View file

@ -46,7 +46,7 @@ class CreateRoomFragment @Inject constructor(private val createRoomController: C
vectorBaseActivity.setSupportActionBar(createRoomToolbar)
sharedActionViewModel = activityViewModelProvider.get(RoomDirectorySharedActionViewModel::class.java)
setupRecyclerView()
createRoomClose.setOnClickListener {
createRoomClose.debouncedClicks {
sharedActionViewModel.post(RoomDirectorySharedAction.Back)
}
}

View file

@ -71,11 +71,11 @@ class VectorSettingsNotificationsTroubleshootFragment @Inject constructor(
layoutManager.orientation)
mRecyclerView.addItemDecoration(dividerItemDecoration)
mSummaryButton.setOnClickListener {
mSummaryButton.debouncedClicks {
bugReporter.openBugReportScreen(activity!!)
}
mRunButton.setOnClickListener {
mRunButton.debouncedClicks {
testManager?.retry()
}
startUI()

View file

@ -80,7 +80,7 @@ class DeactivateAccountFragment @Inject constructor(
viewModel.handle(DeactivateAccountAction.TogglePassword)
}
deactivateAccountSubmit.setOnClickListener {
deactivateAccountSubmit.debouncedClicks {
viewModel.handle(DeactivateAccountAction.DeactivateAccount(
deactivateAccountPassword.text.toString(),
deactivateAccountEraseCheckbox.isChecked))

View file

@ -91,7 +91,7 @@ class KnownUsersFragment @Inject constructor(
}
private fun setupAddByMatrixIdView() {
addByMatrixId.setOnClickListener {
addByMatrixId.debouncedClicks {
sharedActionViewModel.post(UserDirectorySharedAction.OpenUsersDirectory)
}
}
@ -122,7 +122,7 @@ class KnownUsersFragment @Inject constructor(
}
private fun setupCloseView() {
knownUsersClose.setOnClickListener {
knownUsersClose.debouncedClicks {
requireActivity().finish()
}
}

View file

@ -73,7 +73,7 @@ class UserDirectoryFragment @Inject constructor(
}
private fun setupCloseView() {
userDirectoryClose.setOnClickListener {
userDirectoryClose.debouncedClicks {
sharedActionViewModel.post(UserDirectorySharedAction.GoBack)
}
}