From 8e64ca134ffbf62ad80cce1f682dc240ad84f688 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Mon, 31 May 2021 00:01:54 +0200 Subject: [PATCH] ktlintFormat --- .../omnipod/dash/OmnipodDashPumpPlugin.kt | 5 ++-- .../dash/driver/OmnipodDashManagerImpl.kt | 2 +- .../driver/comm/OmnipodDashBleManagerImpl.kt | 2 +- .../dash/driver/comm/session/Connection.kt | 1 - .../dash/ui/OmnipodDashOverviewFragment.kt | 27 ++++++++++--------- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index 04a6f36b6e..860b3e0122 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -296,7 +296,7 @@ class OmnipodDashPumpPlugin @Inject constructor( val ret = pumpSync.syncTemporaryBasalWithPumpId( timestamp = historyEntry.createdAt, rate = record.rate, - duration = T.mins(record.duration.toLong()).msecs(), + duration = T.mins(record.duration.toLong()).msecs(), isAbsolute = true, type = tbrType, pumpId = historyEntry.pumpId(), @@ -408,7 +408,8 @@ class OmnipodDashPumpPlugin @Inject constructor( } else -> - aapsLogger.warn(LTag.PUMP, + aapsLogger.warn( + LTag.PUMP, "Will not sync confirmed command of type: $historyEntry and " + "succes: ${confirmation.success}" ) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt index e92f578b11..0d44fd4b3f 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt @@ -700,7 +700,7 @@ class OmnipodDashManagerImpl @Inject constructor( inner class ErrorInterceptor : Consumer { override fun accept(throwable: Throwable) { - logger.debug(LTag.PUMP, "Intercepted error in OmnipodDashManagerImpl: ${throwable}") + logger.debug(LTag.PUMP, "Intercepted error in OmnipodDashManagerImpl: $throwable") } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt index 4637d52b5c..622b3663a3 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/OmnipodDashBleManagerImpl.kt @@ -84,7 +84,7 @@ class OmnipodDashBleManagerImpl @Inject constructor( } override fun getStatus(): ConnectionState { - return connection?.let{ getStatus() } + return connection?.let { getStatus() } ?: NotConnected } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt index 71bccf91b6..fb3ddc1cb5 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt @@ -106,7 +106,6 @@ class Connection( } podState.bluetoothConnectionState = OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTED - val discoverer = ServiceDiscoverer(aapsLogger, gattConnection, bleCommCallbacks) val discovered = discoverer.discoverServices() dataBleIO.characteristic = discovered[CharacteristicType.DATA]!! diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 3fe453d235..9bd6f0015f 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -42,7 +42,6 @@ import info.nightscout.androidaps.utils.ui.UIRunnable import io.reactivex.disposables.CompositeDisposable import io.reactivex.rxkotlin.plusAssign import org.apache.commons.lang3.StringUtils -import org.joda.time.DateTime import org.joda.time.Duration import java.util.* import javax.inject.Inject @@ -62,7 +61,6 @@ class OmnipodDashOverviewFragment : DaggerFragment() { @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var pumpSync: PumpSync - companion object { private const val REFRESH_INTERVAL_MILLIS = 15 * 1000L // 15 seconds @@ -221,7 +219,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { updateQueueStatus() } - private fun updateBluetoothStatus(){ + private fun updateBluetoothStatus() { bluetoothStatusBinding.omnipodDashBluetoothAddress.text = podStateManager.bluetoothAddress ?: PLACEHOLDER bluetoothStatusBinding.omnipodDashBluetoothStatus.text = @@ -392,7 +390,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { resourceHelper.gs(R.string.omnipod_common_pod_status_suspended) } else { resourceHelper.gs(R.string.omnipod_common_pod_status_running) + - podStateManager.deliveryStatus?.let{ " " + podStateManager.deliveryStatus.toString() } + podStateManager.deliveryStatus?.let { " " + podStateManager.deliveryStatus.toString() } } // TODO /* @@ -586,36 +584,39 @@ class OmnipodDashOverviewFragment : DaggerFragment() { val minutes = duration.standardMinutes.toInt() val seconds = duration.standardSeconds.toInt() when { - seconds < 10 -> { + seconds < 10 -> { return resourceHelper.gs(R.string.omnipod_common_moments_ago) } - seconds < 60 -> { + seconds < 60 -> { return resourceHelper.gs(R.string.omnipod_common_less_than_a_minute_ago) } - seconds < 60 * 60 -> { // < 1 hour + seconds < 60 * 60 -> { // < 1 hour return resourceHelper.gs(R.string.omnipod_common_time_ago, resourceHelper.gq(R.plurals.omnipod_common_minutes, minutes, minutes)) } seconds < 24 * 60 * 60 -> { // < 1 day val minutesLeft = minutes % 60 if (minutesLeft > 0) - return resourceHelper.gs(R.string.omnipod_common_time_ago, - resourceHelper.gs(R.string.omnipod_common_composite_time, resourceHelper.gq(R.plurals.omnipod_common_hours, hours, hours), resourceHelper.gq(R.plurals.omnipod_common_minutes, minutesLeft, minutesLeft))) + return resourceHelper.gs( + R.string.omnipod_common_time_ago, + resourceHelper.gs(R.string.omnipod_common_composite_time, resourceHelper.gq(R.plurals.omnipod_common_hours, hours, hours), resourceHelper.gq(R.plurals.omnipod_common_minutes, minutesLeft, minutesLeft)) + ) return resourceHelper.gs(R.string.omnipod_common_time_ago, resourceHelper.gq(R.plurals.omnipod_common_hours, hours, hours)) } - else -> { + else -> { val days = hours / 24 val hoursLeft = hours % 24 if (hoursLeft > 0) - return resourceHelper.gs(R.string.omnipod_common_time_ago, - resourceHelper.gs(R.string.omnipod_common_composite_time, resourceHelper.gq(R.plurals.omnipod_common_days, days, days), resourceHelper.gq(R.plurals.omnipod_common_hours, hoursLeft, hoursLeft))) + return resourceHelper.gs( + R.string.omnipod_common_time_ago, + resourceHelper.gs(R.string.omnipod_common_composite_time, resourceHelper.gq(R.plurals.omnipod_common_days, days, days), resourceHelper.gq(R.plurals.omnipod_common_hours, hoursLeft, hoursLeft)) + ) return resourceHelper.gs(R.string.omnipod_common_time_ago, resourceHelper.gq(R.plurals.omnipod_common_days, days, days)) } } - } private fun isQueueEmpty(): Boolean {