combov2: Minor cleanup to reduce some code smell

* Kotlin code convention specifies that ignored exceptions must be named
  "_", not "ignored."
* Add explanation about empty overridden method implementations.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
Carlos Rafael Giani 2022-11-06 16:29:07 +01:00
parent 8fda1ab0b8
commit cdfb197c54
2 changed files with 8 additions and 4 deletions

View file

@ -619,7 +619,7 @@ class ComboV2Plugin @Inject constructor (
} }
} catch (e: CancellationException) { } catch (e: CancellationException) {
throw e throw e
} catch (ignored: Exception) { } catch (_: Exception) {
} }
} }
@ -1370,7 +1370,7 @@ class ComboV2Plugin @Inject constructor (
suspend fun providePairingPIN(pairingPIN: PairingPIN) { suspend fun providePairingPIN(pairingPIN: PairingPIN) {
try { try {
pairingPINChannel?.send(pairingPIN) pairingPINChannel?.send(pairingPIN)
} catch (ignored: ClosedSendChannelException) { } catch (_: ClosedSendChannelException) {
} }
} }
@ -1384,8 +1384,8 @@ class ComboV2Plugin @Inject constructor (
val pump = pumpManager?.acquirePump(bluetoothAddress) ?: return@runBlocking val pump = pumpManager?.acquirePump(bluetoothAddress) ?: return@runBlocking
pump.unpair() pump.unpair()
pumpManager?.releasePump(bluetoothAddress) pumpManager?.releasePump(bluetoothAddress)
} catch (ignored: ComboException) { } catch (_: ComboException) {
} catch (ignored: BluetoothException) { } catch (_: BluetoothException) {
} }
} }

View file

@ -69,9 +69,13 @@ class ComboV2PairingActivity : NoSplashAppCompatActivity() {
// xxx xxx xxxx // xxx xxx xxxx
binding.combov2PinEntryEdit.addTextChangedListener(object : TextWatcher { binding.combov2PinEntryEdit.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
// Nothing needs to be done here; overridden method only exists
// to properly and fully implement the TextWatcher interface.
} }
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
// Nothing needs to be done here; overridden method only exists
// to properly and fully implement the TextWatcher interface.
} }
override fun afterTextChanged(s: Editable?) { override fun afterTextChanged(s: Editable?) {