2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Use kotlin's apply

This commit is contained in:
Albert Vaca Cintora
2023-05-30 17:15:09 +02:00
parent 457721e8c7
commit 550e9b0c8b

View File

@@ -118,7 +118,7 @@ class DeviceFragment : Fragment() {
}
requirePairingBinding().rejectButton.setOnClickListener {
device?.apply {
//Remove listener so buttons don't show for a while before changing the view
// Remove listener so buttons don't show for an instant before changing the view
removePluginsChangedListener(pluginsChangedListener)
removePairingCallback(pairingCallback)
rejectPairing()
@@ -207,10 +207,12 @@ class DeviceFragment : Fragment() {
}
if (device.isPaired) {
menu.add(R.string.device_menu_unpair).setOnMenuItemClickListener {
//Remove listener so buttons don't show for a while before changing the view
device.removePluginsChangedListener(pluginsChangedListener)
device.removePairingCallback(pairingCallback)
device.unpair()
// Remove listener so buttons don't show for an instant before changing the view
device.apply {
removePairingCallback(pairingCallback)
removePluginsChangedListener(pluginsChangedListener)
unpair()
}
mActivity?.onDeviceSelected(null)
true
}