DiaconnG8UserOptionsActivity: toolbar
This commit is contained in:
parent
b0d6580f9a
commit
e342df2a2b
7 changed files with 33 additions and 62 deletions
|
@ -14,7 +14,7 @@
|
|||
<activity
|
||||
android:name=".activities.DiaconnG8UserOptionsActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
android:name=".activities.DiaconnG8BLEScanActivity"
|
||||
android:exported="false"
|
||||
|
|
|
@ -69,13 +69,7 @@ class DiaconnG8Pump @Inject constructor(
|
|||
var tempBasalStart: Long = 0
|
||||
var tempBasalDuration: Long = 0 // in milliseconds
|
||||
var tempBasalAbsoluteRate: Double = 0.0
|
||||
var tempBasalPercent: Int = 0
|
||||
|
||||
var tempBasalTotalSec: Long
|
||||
set(durationInSec) {
|
||||
tempBasalDuration = T.secs(durationInSec).msecs()
|
||||
}
|
||||
get() = T.msecs(tempBasalDuration).mins()
|
||||
var isTempBasalInProgress: Boolean
|
||||
get() = tempBasalStart != 0L && dateUtil.now() in tempBasalStart..tempBasalStart + tempBasalDuration
|
||||
set(isRunning) {
|
||||
|
@ -161,7 +155,6 @@ class DiaconnG8Pump @Inject constructor(
|
|||
}
|
||||
}
|
||||
// Profile
|
||||
var units = 0
|
||||
var activeProfile = 0
|
||||
var pumpProfiles: Array<Array<Double>>? = null
|
||||
|
||||
|
@ -172,7 +165,7 @@ class DiaconnG8Pump @Inject constructor(
|
|||
// User settings
|
||||
var setUserOptionType = 0 // ALARM:0, LCD:1, LANG:2, BOLUS_SPEED:3
|
||||
var beepAndAlarm = 0
|
||||
var alarmIntesity = 0
|
||||
var alarmIntensity = 0
|
||||
var lcdOnTimeSec = 0
|
||||
var selectedLanguage = 0
|
||||
var bolusSpeed = 0
|
||||
|
@ -180,7 +173,6 @@ class DiaconnG8Pump @Inject constructor(
|
|||
var resultErrorCode: Int = 0 // last start bolus erroCode
|
||||
|
||||
// Bolus settings
|
||||
var historyDoneReceived: Boolean = false // true when last history message is received
|
||||
var bolusingTreatment: EventOverviewBolusProgress.Treatment? = null // actually delivered treatment
|
||||
var bolusAmountToBeDelivered = 0.0 // amount to be delivered
|
||||
var bolusProgressLastTimeStamp: Long = 0 // timestamp of last bolus progress message
|
||||
|
@ -188,11 +180,6 @@ class DiaconnG8Pump @Inject constructor(
|
|||
var bolusStopForced = false // bolus forced to stop by user
|
||||
var bolusDone = false // success end
|
||||
|
||||
// LGS Status
|
||||
var lgsStatus: Int = 0 // LGS Status(1=LGS_ON, 2=LGS_OFF)
|
||||
var lgsTime:Int = 0 // LGS Setting time (0~255 min)
|
||||
var lgsElapsedTime:Int = 0 // LGS Passed Time (0~255 min)
|
||||
|
||||
val pumpUid: String
|
||||
get() = "$country-$productType-$makeYear-${makeMonth.toString().padStart(2,'0')}-${makeDay.toString().padStart(2, '0')}-${lotNo.toString().padStart(3,'0')}-${serialNo.toString().padStart(5,'0')}"
|
||||
|
||||
|
@ -259,7 +246,6 @@ class DiaconnG8Pump @Inject constructor(
|
|||
var pumpWrappingCount = 0 // wrapping 카운트(0~255)
|
||||
var apslastLogNum = 0 // 앱에서 처리한 마지막 로그 번호.
|
||||
var apsWrappingCount = 0 // 앱에서 처리한 마지막 로그 번호.
|
||||
var isProgressPumpLogSync = false // 로그 동기화 진행 여부
|
||||
var isPlatformUploadStarted = false // 플랫폼 로그 동기화 진행 여부
|
||||
|
||||
// 6. bolus speed status.
|
||||
|
@ -271,7 +257,6 @@ class DiaconnG8Pump @Inject constructor(
|
|||
var tbTime = 0 // 임시기저 시간
|
||||
var tbInjectRateRatio = 0 // 임시기저 주입량/률 1000(0.00U)~1600(6.00U), 50000(0%)~50250(250%), 50000이상이면 주입률로 판정
|
||||
var tbElapsedTime = 0 // 임시기저 경과 시간(0~1425분)
|
||||
var tbInjectAbsoluteValue = 0.0 // 임시기저 주입량/률 1000(0.00U)~2500(15.00U)
|
||||
|
||||
// 8. Basal status
|
||||
var baseStatus = 0 // 주입상태
|
||||
|
|
|
@ -2,9 +2,13 @@ package info.nightscout.pump.diaconn.activities
|
|||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import androidx.core.view.MenuProvider
|
||||
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
|
@ -55,6 +59,10 @@ class DiaconnG8UserOptionsActivity : TranslatedDaggerAppCompatActivity() {
|
|||
binding = DiaconnG8UserOptionsActivityBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
title = rh.gs(R.string.diaconng8_pump_settings)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
||||
binding.saveAlarm.setOnClickListener { onSaveAlarmClick() }
|
||||
binding.saveLcdOnTime.setOnClickListener { onSaveLcdOnTimeClick() }
|
||||
binding.saveLang.setOnClickListener { onSaveLangClick() }
|
||||
|
@ -69,7 +77,7 @@ class DiaconnG8UserOptionsActivity : TranslatedDaggerAppCompatActivity() {
|
|||
LTag.PUMP,
|
||||
"UserOptionsLoaded:" + (System.currentTimeMillis() - diaconnG8Pump.lastConnection) / 1000 + " s ago"
|
||||
+ "\nbeepAndAlarm:" + diaconnG8Pump.beepAndAlarm
|
||||
+ "\nalarmIntesity:" + diaconnG8Pump.alarmIntesity
|
||||
+ "\nalarmIntensity:" + diaconnG8Pump.alarmIntensity
|
||||
+ "\nlanguage:" + diaconnG8Pump.selectedLanguage
|
||||
+ "\nlcdOnTimeSec:" + diaconnG8Pump.lcdOnTimeSec
|
||||
)
|
||||
|
@ -78,7 +86,7 @@ class DiaconnG8UserOptionsActivity : TranslatedDaggerAppCompatActivity() {
|
|||
fillSoundSubCategory()
|
||||
|
||||
binding.beepAndAlarm.setSelection(diaconnG8Pump.beepAndAlarm - 1)
|
||||
binding.alarmIntesity.setSelection(diaconnG8Pump.alarmIntesity - 1)
|
||||
binding.alarmIntesity.setSelection(diaconnG8Pump.alarmIntensity - 1)
|
||||
|
||||
binding.beepAndAlarm.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
|
@ -99,6 +107,20 @@ class DiaconnG8UserOptionsActivity : TranslatedDaggerAppCompatActivity() {
|
|||
2 -> binding.pumplangKorean.isChecked = true
|
||||
3 -> binding.pumplangEnglish.isChecked = true
|
||||
}
|
||||
// Add menu items without overriding methods in the Activity
|
||||
addMenuProvider(object : MenuProvider {
|
||||
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {}
|
||||
|
||||
override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
|
||||
when (menuItem.itemId) {
|
||||
android.R.id.home -> {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun onSaveAlarmClick() {
|
||||
|
@ -106,7 +128,7 @@ class DiaconnG8UserOptionsActivity : TranslatedDaggerAppCompatActivity() {
|
|||
diaconnG8Pump.setUserOptionType = DiaconnG8Pump.ALARM
|
||||
|
||||
diaconnG8Pump.beepAndAlarm = binding.beepAndAlarm.selectedItemPosition + 1
|
||||
diaconnG8Pump.alarmIntesity = binding.alarmIntesity.selectedItemPosition + 1
|
||||
diaconnG8Pump.alarmIntensity = binding.alarmIntesity.selectedItemPosition + 1
|
||||
|
||||
onSaveClick()
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ class BigAPSMainInfoInquireResponsePacket(
|
|||
|
||||
// 18. pump sound
|
||||
diaconnG8Pump.beepAndAlarm = getByteToInt(bufferData) -1
|
||||
diaconnG8Pump.alarmIntesity = getByteToInt(bufferData) -1
|
||||
diaconnG8Pump.alarmIntensity = getByteToInt(bufferData) -1
|
||||
|
||||
// 19. pump light time
|
||||
diaconnG8Pump.lcdOnTimeSec = getByteToInt(bufferData) // kind (1=30 sec, 2=40 sec, 3=50 sec)
|
||||
|
@ -324,7 +324,7 @@ class BigAPSMainInfoInquireResponsePacket(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "maxBolusePerDay > " + diaconnG8Pump.maxBolusePerDay)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "mealLimitTime > " + diaconnG8Pump.mealLimitTime)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "beepAndAlarm > " + diaconnG8Pump.beepAndAlarm)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "alarmIntesity > " + diaconnG8Pump.alarmIntesity)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "alarmIntesity > " + diaconnG8Pump.alarmIntensity)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "lcdOnTimeSec > " + diaconnG8Pump.lcdOnTimeSec)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "selectedLanguage > " + diaconnG8Pump.selectedLanguage)
|
||||
}
|
||||
|
|
|
@ -34,11 +34,11 @@ class SoundInquireResponsePacket(injector: HasAndroidInjector) : DiaconnG8Packet
|
|||
}
|
||||
|
||||
diaconnG8Pump.beepAndAlarm = getByteToInt(bufferData) -1
|
||||
diaconnG8Pump.alarmIntesity = getByteToInt(bufferData) -1
|
||||
diaconnG8Pump.alarmIntensity = getByteToInt(bufferData) -1
|
||||
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Result --> ${diaconnG8Pump.result}")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "beepAndAlarm --> ${diaconnG8Pump.beepAndAlarm}")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "alarmIntesity --> ${diaconnG8Pump.alarmIntesity}")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "alarmIntensity --> ${diaconnG8Pump.alarmIntensity}")
|
||||
}
|
||||
|
||||
override fun getFriendlyName(): String {
|
||||
|
|
|
@ -275,7 +275,7 @@ class DiaconnG8Service : DaggerService() {
|
|||
val result = PumpEnactResult(injector)
|
||||
var apsLastLogNum = 9999
|
||||
var apsWrappingCount = -1
|
||||
// get saved last loginfo
|
||||
// get saved last log info
|
||||
val diaconnHistoryRecord = diaconnHistoryRecordDao.getLastRecord(diaconnG8Pump.pumpUid)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "diaconnHistoryRecord :: $diaconnHistoryRecord")
|
||||
|
||||
|
@ -421,7 +421,7 @@ class DiaconnG8Service : DaggerService() {
|
|||
val result = PumpEnactResult(injector)
|
||||
|
||||
val msg: DiaconnG8Packet = when (diaconnG8Pump.setUserOptionType) {
|
||||
DiaconnG8Pump.ALARM -> SoundSettingPacket(injector, diaconnG8Pump.beepAndAlarm, diaconnG8Pump.alarmIntesity)
|
||||
DiaconnG8Pump.ALARM -> SoundSettingPacket(injector, diaconnG8Pump.beepAndAlarm, diaconnG8Pump.alarmIntensity)
|
||||
DiaconnG8Pump.LCD -> DisplayTimeoutSettingPacket(injector, diaconnG8Pump.lcdOnTimeSec)
|
||||
DiaconnG8Pump.LANG -> LanguageSettingPacket(injector, diaconnG8Pump.selectedLanguage)
|
||||
DiaconnG8Pump.BOLUS_SPEED -> BolusSpeedSettingPacket(injector, diaconnG8Pump.bolusSpeed)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -13,41 +12,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?attr/activity_title_backgroundColor"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAccessibility="no"
|
||||
app:srcCompat="@drawable/ic_user_options" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/diaconng8_pump_settings"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/spacer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue