Merge pull request #74 from 0pen-dash/adrian/build-helper
Adrian/build helper
This commit is contained in:
commit
9e739bc1a3
8 changed files with 82 additions and 70 deletions
|
@ -3,27 +3,10 @@
|
||||||
<option name="AUTODETECT_INDENTS" value="false" />
|
<option name="AUTODETECT_INDENTS" value="false" />
|
||||||
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
|
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
|
||||||
<value>
|
|
||||||
<package name="java.util" alias="false" withSubpackages="false" />
|
|
||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
|
||||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="6" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="6" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="6" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="6" />
|
||||||
<option name="BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES" value="1" />
|
<option name="BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES" value="1" />
|
||||||
<option name="WRAP_EXPRESSION_BODY_FUNCTIONS" value="1" />
|
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
|
@ -143,8 +126,8 @@
|
||||||
</arrangement>
|
</arrangement>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
<codeStyleSettings language="kotlin">
|
<codeStyleSettings language="kotlin">
|
||||||
<option name="RIGHT_MARGIN" value="120" />
|
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
<option name="RIGHT_MARGIN" value="120" />
|
||||||
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
|
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
|
||||||
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
|
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
|
||||||
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||||
|
@ -152,13 +135,6 @@
|
||||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
|
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
|
||||||
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
|
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
|
||||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||||
<option name="CALL_PARAMETERS_WRAP" value="5" />
|
|
||||||
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
|
|
||||||
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
|
||||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
|
||||||
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
|
|
||||||
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
|
||||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
|
||||||
<option name="ASSIGNMENT_WRAP" value="5" />
|
<option name="ASSIGNMENT_WRAP" value="5" />
|
||||||
<option name="METHOD_ANNOTATION_WRAP" value="5" />
|
<option name="METHOD_ANNOTATION_WRAP" value="5" />
|
||||||
<option name="CLASS_ANNOTATION_WRAP" value="1" />
|
<option name="CLASS_ANNOTATION_WRAP" value="1" />
|
||||||
|
@ -171,4 +147,4 @@
|
||||||
</indentOptions>
|
</indentOptions>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
</code_scheme>
|
</code_scheme>
|
||||||
</component>
|
</component>
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl
|
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl
|
||||||
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.DataSyncSelectorImplementation
|
import info.nightscout.androidaps.plugins.general.nsclient.DataSyncSelectorImplementation
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
|
@ -22,6 +23,8 @@ import info.nightscout.androidaps.plugins.pump.PumpSyncImplementation
|
||||||
import info.nightscout.androidaps.queue.CommandQueue
|
import info.nightscout.androidaps.queue.CommandQueue
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.androidNotification.NotificationHolderImpl
|
import info.nightscout.androidaps.utils.androidNotification.NotificationHolderImpl
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
|
||||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||||
import info.nightscout.androidaps.utils.resources.IconsProviderImplementation
|
import info.nightscout.androidaps.utils.resources.IconsProviderImplementation
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
@ -56,6 +59,10 @@ open class AppModule {
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideStorage(): Storage = FileStorage()
|
fun provideStorage(): Storage = FileStorage()
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideBuildHelper(config: Config, fileListProvider: PrefFileListProvider): BuildHelper = BuildHelperImpl(config, fileListProvider)
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
internal fun provideSchedulers(): AapsSchedulers = DefaultAapsSchedulers()
|
internal fun provideSchedulers(): AapsSchedulers = DefaultAapsSchedulers()
|
||||||
|
|
|
@ -4,14 +4,11 @@ import info.nightscout.androidaps.BuildConfig
|
||||||
import info.nightscout.androidaps.interfaces.Config
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
class BuildHelperImpl constructor(
|
||||||
class BuildHelper @Inject constructor(
|
|
||||||
private val config: Config,
|
private val config: Config,
|
||||||
fileListProvider: PrefFileListProvider
|
fileListProvider: PrefFileListProvider
|
||||||
) {
|
) : BuildHelper {
|
||||||
|
|
||||||
private var devBranch = false
|
private var devBranch = false
|
||||||
private var engineeringMode = false
|
private var engineeringMode = false
|
||||||
|
@ -23,11 +20,10 @@ class BuildHelper @Inject constructor(
|
||||||
devBranch = BuildConfig.VERSION.contains("-") || BuildConfig.VERSION.matches(Regex(".*[a-zA-Z]+.*"))
|
devBranch = BuildConfig.VERSION.contains("-") || BuildConfig.VERSION.matches(Regex(".*[a-zA-Z]+.*"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isEngineeringModeOrRelease(): Boolean =
|
override fun isEngineeringModeOrRelease(): Boolean =
|
||||||
if (!config.APS) true else engineeringMode || !devBranch
|
if (!config.APS) true else engineeringMode || !devBranch
|
||||||
|
|
||||||
fun isEngineeringMode(): Boolean =
|
override fun isEngineeringMode(): Boolean = engineeringMode
|
||||||
engineeringMode
|
|
||||||
|
|
||||||
fun isDev(): Boolean = devBranch
|
override fun isDev(): Boolean = devBranch
|
||||||
}
|
}
|
|
@ -19,7 +19,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
|
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
|
||||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||||
|
|
|
@ -12,7 +12,6 @@ import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.queue.commands.Command
|
import info.nightscout.androidaps.queue.commands.Command
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package info.nightscout.androidaps.utils.buildHelper
|
||||||
|
|
||||||
|
interface BuildHelper {
|
||||||
|
|
||||||
|
fun isEngineeringModeOrRelease(): Boolean
|
||||||
|
fun isEngineeringMode(): Boolean
|
||||||
|
fun isDev(): Boolean
|
||||||
|
}
|
|
@ -36,6 +36,7 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
|
@ -62,6 +63,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var pumpSync: PumpSync
|
@Inject lateinit var pumpSync: PumpSync
|
||||||
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@ -165,6 +167,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
.messageOnSuccess(resourceHelper.gs(R.string.omnipod_common_confirmation_time_on_pod_updated))
|
.messageOnSuccess(resourceHelper.gs(R.string.omnipod_common_confirmation_time_on_pod_updated))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if (buildHelper.isEngineeringMode()) {
|
||||||
|
bluetoothStatusBinding.deliveryStatus.visibility = View.VISIBLE
|
||||||
|
bluetoothStatusBinding.connectionQuality.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -226,18 +232,19 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
?: PLACEHOLDER
|
?: PLACEHOLDER
|
||||||
bluetoothStatusBinding.omnipodDashBluetoothStatus.text =
|
bluetoothStatusBinding.omnipodDashBluetoothStatus.text =
|
||||||
when (podStateManager.bluetoothConnectionState) {
|
when (podStateManager.bluetoothConnectionState) {
|
||||||
OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTED ->
|
OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTED ->
|
||||||
"{fa-bluetooth}"
|
"{fa-bluetooth}"
|
||||||
OmnipodDashPodStateManager.BluetoothConnectionState.DISCONNECTED ->
|
OmnipodDashPodStateManager.BluetoothConnectionState.DISCONNECTED ->
|
||||||
"{fa-bluetooth-b}"
|
"{fa-bluetooth-b}"
|
||||||
OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTING ->
|
OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTING ->
|
||||||
"{fa-bluetooth-b spin}"
|
"{fa-bluetooth-b spin}"
|
||||||
}
|
}
|
||||||
|
|
||||||
val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100
|
val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100
|
||||||
val successPercentageString = String.format("%.2f %", podStateManager.connectionSuccessRatio())
|
val successPercentageString = String.format("%.2f %%", podStateManager.connectionSuccessRatio())
|
||||||
val connectionQuality = "${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString"
|
val quality =
|
||||||
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = connectionQuality
|
"${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString"
|
||||||
|
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
|
||||||
val connectionStatsColor = when {
|
val connectionStatsColor = when {
|
||||||
connectionSuccessPercentage > 90 ->
|
connectionSuccessPercentage > 90 ->
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
|
@ -301,9 +308,9 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
when {
|
when {
|
||||||
!podStateManager.sameTimeZone ->
|
!podStateManager.sameTimeZone ->
|
||||||
Color.MAGENTA
|
Color.MAGENTA
|
||||||
timeDeviationTooBig ->
|
timeDeviationTooBig ->
|
||||||
Color.YELLOW
|
Color.YELLOW
|
||||||
else ->
|
else ->
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -332,15 +339,16 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// base basal rate
|
// base basal rate
|
||||||
podInfoBinding.baseBasalRate.text = if (podStateManager.basalProgram != null && !podStateManager.isSuspended) {
|
podInfoBinding.baseBasalRate.text =
|
||||||
resourceHelper.gs(
|
if (podStateManager.basalProgram != null && !podStateManager.isSuspended) {
|
||||||
R.string.pump_basebasalrate,
|
resourceHelper.gs(
|
||||||
omnipodDashPumpPlugin.model()
|
R.string.pump_basebasalrate,
|
||||||
.determineCorrectBasalSize(podStateManager.basalProgram!!.rateAt(Date()))
|
omnipodDashPumpPlugin.model()
|
||||||
)
|
.determineCorrectBasalSize(podStateManager.basalProgram!!.rateAt(Date()))
|
||||||
} else {
|
)
|
||||||
PLACEHOLDER
|
} else {
|
||||||
}
|
PLACEHOLDER
|
||||||
|
}
|
||||||
|
|
||||||
// total delivered
|
// total delivered
|
||||||
podInfoBinding.totalDelivered.text =
|
podInfoBinding.totalDelivered.text =
|
||||||
|
@ -398,7 +406,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
System.currentTimeMillis() -
|
System.currentTimeMillis() -
|
||||||
podStateManager.lastUpdatedSystem,
|
podStateManager.lastUpdatedSystem,
|
||||||
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val lastConnectionColor =
|
val lastConnectionColor =
|
||||||
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
|
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
|
||||||
|
@ -447,9 +455,9 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
val podStatusColor = when {
|
val podStatusColor = when {
|
||||||
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
|
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
|
||||||
Color.RED
|
Color.RED
|
||||||
podStateManager.activeCommand != null ->
|
podStateManager.activeCommand != null ->
|
||||||
Color.YELLOW
|
Color.YELLOW
|
||||||
else ->
|
else ->
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
}
|
}
|
||||||
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
||||||
|
@ -544,7 +552,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
private fun updateRefreshStatusButton() {
|
private fun updateRefreshStatusButton() {
|
||||||
buttonBinding.buttonRefreshStatus.isEnabled =
|
buttonBinding.buttonRefreshStatus.isEnabled =
|
||||||
podStateManager.isUniqueIdSet &&
|
podStateManager.isUniqueIdSet &&
|
||||||
isQueueEmpty()
|
isQueueEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateResumeDeliveryButton() {
|
private fun updateResumeDeliveryButton() {
|
||||||
|
@ -626,16 +634,19 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
val minutes = duration.toMinutes().toInt()
|
val minutes = duration.toMinutes().toInt()
|
||||||
val seconds = duration.seconds
|
val seconds = duration.seconds
|
||||||
when {
|
when {
|
||||||
seconds < 10 -> {
|
seconds < 10 -> {
|
||||||
return resourceHelper.gs(R.string.omnipod_common_moments_ago)
|
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)
|
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))
|
return resourceHelper.gs(
|
||||||
|
R.string.omnipod_common_time_ago,
|
||||||
|
resourceHelper.gq(R.plurals.omnipod_common_minutes, minutes, minutes)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
seconds < 24 * 60 * 60 -> { // < 1 day
|
seconds < 24 * 60 * 60 -> { // < 1 day
|
||||||
|
@ -643,20 +654,34 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
if (minutesLeft > 0)
|
if (minutesLeft > 0)
|
||||||
return resourceHelper.gs(
|
return resourceHelper.gs(
|
||||||
R.string.omnipod_common_time_ago,
|
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))
|
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))
|
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 days = hours / 24
|
||||||
val hoursLeft = hours % 24
|
val hoursLeft = hours % 24
|
||||||
if (hoursLeft > 0)
|
if (hoursLeft > 0)
|
||||||
return resourceHelper.gs(
|
return resourceHelper.gs(
|
||||||
R.string.omnipod_common_time_ago,
|
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))
|
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))
|
return resourceHelper.gs(
|
||||||
|
R.string.omnipod_common_time_ago,
|
||||||
|
resourceHelper.gq(R.plurals.omnipod_common_days, days, days)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,11 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/connectionQuality"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -112,15 +114,16 @@
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:paddingStart="5dp"
|
android:paddingStart="5dp"
|
||||||
android:paddingEnd="5dp"
|
android:paddingEnd="5dp"
|
||||||
android:text="{fa-bluetooth-b} "
|
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/deliveryStatus"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -151,7 +154,6 @@
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:paddingStart="5dp"
|
android:paddingStart="5dp"
|
||||||
android:paddingEnd="5dp"
|
android:paddingEnd="5dp"
|
||||||
android:text="{fa-bluetooth-b} "
|
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue