ktlintFormat

This commit is contained in:
Andrei Vereha 2021-05-31 00:01:54 +02:00
parent c989c6a1c5
commit 8e64ca134f
5 changed files with 19 additions and 18 deletions

View file

@ -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}"
)

View file

@ -700,7 +700,7 @@ class OmnipodDashManagerImpl @Inject constructor(
inner class ErrorInterceptor : Consumer<Throwable> {
override fun accept(throwable: Throwable) {
logger.debug(LTag.PUMP, "Intercepted error in OmnipodDashManagerImpl: ${throwable}")
logger.debug(LTag.PUMP, "Intercepted error in OmnipodDashManagerImpl: $throwable")
}
}

View file

@ -84,7 +84,7 @@ class OmnipodDashBleManagerImpl @Inject constructor(
}
override fun getStatus(): ConnectionState {
return connection?.let{ getStatus() }
return connection?.let { getStatus() }
?: NotConnected
}

View file

@ -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]!!

View file

@ -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 {