ProfileViewerDialog -> ui
This commit is contained in:
parent
18204d06b9
commit
e4ccc78a7d
19 changed files with 121 additions and 110 deletions
|
@ -14,6 +14,7 @@ import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.ui.activities.BolusProgressHelperActivity
|
import info.nightscout.ui.activities.BolusProgressHelperActivity
|
||||||
import info.nightscout.ui.activities.ErrorHelperActivity
|
import info.nightscout.ui.activities.ErrorHelperActivity
|
||||||
import info.nightscout.ui.activities.TDDStatsActivity
|
import info.nightscout.ui.activities.TDDStatsActivity
|
||||||
|
import info.nightscout.ui.dialogs.ProfileViewerDialog
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ActivityNamesImpl @Inject constructor() : ActivityNames {
|
class ActivityNamesImpl @Inject constructor() : ActivityNames {
|
||||||
|
@ -24,7 +25,6 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
|
||||||
override val bolusProgressHelperActivity: Class<*> = BolusProgressHelperActivity::class.java
|
override val bolusProgressHelperActivity: Class<*> = BolusProgressHelperActivity::class.java
|
||||||
override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java
|
override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java
|
||||||
|
|
||||||
|
|
||||||
override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) {
|
override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) {
|
||||||
val i = Intent(ctx, errorHelperActivity)
|
val i = Intent(ctx, errorHelperActivity)
|
||||||
i.putExtra(AlarmSoundService.SOUND_ID, soundId)
|
i.putExtra(AlarmSoundService.SOUND_ID, soundId)
|
||||||
|
@ -49,4 +49,18 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
|
||||||
.also { it.arguments = Bundle().also { bundle -> bundle.putString("profileName", profileName) } }
|
.also { it.arguments = Bundle().also { bundle -> bundle.putString("profileName", profileName) } }
|
||||||
.show(fragmentManager, "ProfileSwitchDialog")
|
.show(fragmentManager, "ProfileSwitchDialog")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: ActivityNames.Mode, customProfile: String?, customProfilename: String?, customProfile2: String?) {
|
||||||
|
ProfileViewerDialog()
|
||||||
|
.also {
|
||||||
|
it.arguments = Bundle().also { bundle ->
|
||||||
|
bundle.putLong("time", time)
|
||||||
|
bundle.putInt("mode", mode.ordinal)
|
||||||
|
bundle.putString("customProfile", customProfile)
|
||||||
|
bundle.putString("customProfileName", customProfilename)
|
||||||
|
bundle.putString("customProfile2", customProfile2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.show(fragmentManager, "ProfileSwitchDialog")
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -237,8 +237,8 @@ class LoopPlugin @Inject constructor(
|
||||||
if (!isEnabled(PluginType.LOOP)) return
|
if (!isEnabled(PluginType.LOOP)) return
|
||||||
val profile = profileFunction.getProfile()
|
val profile = profileFunction.getProfile()
|
||||||
if (profile == null || !profileFunction.isProfileValid("Loop")) {
|
if (profile == null || !profileFunction.isProfileValid("Loop")) {
|
||||||
aapsLogger.debug(LTag.APS, rh.gs(R.string.noprofileset))
|
aapsLogger.debug(LTag.APS, rh.gs(R.string.no_profile_set))
|
||||||
rxBus.send(EventLoopSetLastRunGui(rh.gs(R.string.noprofileset)))
|
rxBus.send(EventLoopSetLastRunGui(rh.gs(R.string.no_profile_set)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,8 @@ class OpenAPSAMAPlugin @Inject constructor(
|
||||||
val profile = profileFunction.getProfile()
|
val profile = profileFunction.getProfile()
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
rxBus.send(EventOpenAPSUpdateResultGui(rh.gs(R.string.noprofileset)))
|
rxBus.send(EventOpenAPSUpdateResultGui(rh.gs(R.string.no_profile_set)))
|
||||||
aapsLogger.debug(LTag.APS, rh.gs(R.string.noprofileset))
|
aapsLogger.debug(LTag.APS, rh.gs(R.string.no_profile_set))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
|
|
|
@ -106,8 +106,8 @@ class OpenAPSSMBPlugin @Inject constructor(
|
||||||
val profile = profileFunction.getProfile()
|
val profile = profileFunction.getProfile()
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
rxBus.send(EventOpenAPSUpdateResultGui(rh.gs(R.string.noprofileset)))
|
rxBus.send(EventOpenAPSUpdateResultGui(rh.gs(R.string.no_profile_set)))
|
||||||
aapsLogger.debug(LTag.APS, rh.gs(R.string.noprofileset))
|
aapsLogger.debug(LTag.APS, rh.gs(R.string.no_profile_set))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ class ProfileFunctionImpl @Inject constructor(
|
||||||
getProfileName(System.currentTimeMillis(), customized = true, showRemainingTime = true)
|
getProfileName(System.currentTimeMillis(), customized = true, showRemainingTime = true)
|
||||||
|
|
||||||
fun getProfileName(time: Long, customized: Boolean, showRemainingTime: Boolean): String {
|
fun getProfileName(time: Long, customized: Boolean, showRemainingTime: Boolean): String {
|
||||||
var profileName = rh.gs(R.string.noprofileset)
|
var profileName = rh.gs(R.string.no_profile_set)
|
||||||
|
|
||||||
val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet()
|
val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet()
|
||||||
if (profileSwitch is ValueWrapper.Existing) {
|
if (profileSwitch is ValueWrapper.Existing) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import info.nightscout.androidaps.databinding.OverviewFragmentBinding
|
||||||
import info.nightscout.androidaps.dialogs.InsulinDialog
|
import info.nightscout.androidaps.dialogs.InsulinDialog
|
||||||
import info.nightscout.androidaps.dialogs.LoopDialog
|
import info.nightscout.androidaps.dialogs.LoopDialog
|
||||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
|
||||||
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
||||||
import info.nightscout.androidaps.dialogs.TreatmentDialog
|
import info.nightscout.androidaps.dialogs.TreatmentDialog
|
||||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||||
|
@ -88,6 +87,7 @@ import info.nightscout.interfaces.constraints.Constraint
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
import info.nightscout.interfaces.plugin.PluginBase
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.pump.defs.PumpType
|
import info.nightscout.interfaces.pump.defs.PumpType
|
||||||
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.interfaces.utils.JsonHelper
|
import info.nightscout.interfaces.utils.JsonHelper
|
||||||
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||||
import info.nightscout.plugins.general.overview.notifications.NotificationStore
|
import info.nightscout.plugins.general.overview.notifications.NotificationStore
|
||||||
|
@ -157,6 +157,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
@Inject lateinit var overviewData: OverviewData
|
@Inject lateinit var overviewData: OverviewData
|
||||||
@Inject lateinit var automationPlugin: AutomationPlugin
|
@Inject lateinit var automationPlugin: AutomationPlugin
|
||||||
@Inject lateinit var bgQualityCheckPlugin: BgQualityCheckPlugin
|
@Inject lateinit var bgQualityCheckPlugin: BgQualityCheckPlugin
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -403,12 +404,11 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
UIRunnable { if (isAdded) TempTargetDialog().show(childFragmentManager, "Overview") })
|
UIRunnable { if (isAdded) TempTargetDialog().show(childFragmentManager, "Overview") })
|
||||||
|
|
||||||
R.id.active_profile -> {
|
R.id.active_profile -> {
|
||||||
ProfileViewerDialog().also { pvd ->
|
activityNames.runProfileViewerDialog(
|
||||||
pvd.arguments = Bundle().also {
|
childFragmentManager,
|
||||||
it.putLong("time", dateUtil.now())
|
dateUtil.now(),
|
||||||
it.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
|
ActivityNames.Mode.RUNNING_PROFILE
|
||||||
}
|
)
|
||||||
}.show(childFragmentManager, "ProfileViewDialog")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.cgm_button -> {
|
R.id.cgm_button -> {
|
||||||
|
|
|
@ -194,7 +194,7 @@ class PersistentNotificationPlugin @Inject constructor(
|
||||||
unreadConversationBuilder.addMessage(line3aa)
|
unreadConversationBuilder.addMessage(line3aa)
|
||||||
/// End Android Auto
|
/// End Android Auto
|
||||||
} else {
|
} else {
|
||||||
line1 = rh.gs(R.string.noprofileset)
|
line1 = rh.gs(R.string.no_profile_set)
|
||||||
}
|
}
|
||||||
val builder = NotificationCompat.Builder(context, notificationHolder.channelID)
|
val builder = NotificationCompat.Builder(context, notificationHolder.channelID)
|
||||||
builder.setOngoing(true)
|
builder.setOngoing(true)
|
||||||
|
|
|
@ -4,7 +4,6 @@ import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
||||||
import info.nightscout.androidaps.dialogs.ErrorDialog
|
import info.nightscout.androidaps.dialogs.ErrorDialog
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
|
import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
|
||||||
import info.nightscout.androidaps.utils.ui.SingleClickButton
|
import info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||||
|
|
||||||
|
@ -15,8 +14,6 @@ abstract class CoreFragmentsModule {
|
||||||
@ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
|
@ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog
|
@ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog
|
@ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesProfileViewerDialog(): ProfileViewerDialog
|
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesSingleClickButton(): SingleClickButton
|
@ContributesAndroidInjector abstract fun contributesSingleClickButton(): SingleClickButton
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,8 +131,8 @@
|
||||||
<string name="stoppressed">STOP PRESSED</string>
|
<string name="stoppressed">STOP PRESSED</string>
|
||||||
<string name="stop">Stop</string>
|
<string name="stop">Stop</string>
|
||||||
<string name="carbs">Carbs</string>
|
<string name="carbs">Carbs</string>
|
||||||
<string name="invalidprofile">Invalid profile!</string>
|
<string name="invalid_profile">Invalid profile!</string>
|
||||||
<string name="noprofileset">NO PROFILE SET</string>
|
<string name="no_profile_set">NO PROFILE SET</string>
|
||||||
<string name="active"><![CDATA[<Active>]]></string>
|
<string name="active"><![CDATA[<Active>]]></string>
|
||||||
<string name="date">Date</string>
|
<string name="date">Date</string>
|
||||||
<string name="units_label">Units</string>
|
<string name="units_label">Units</string>
|
||||||
|
|
|
@ -26,4 +26,12 @@ interface ActivityNames {
|
||||||
fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0)
|
fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0)
|
||||||
fun runWizard(fragmentManager: FragmentManager, carbs: Int, name: String)
|
fun runWizard(fragmentManager: FragmentManager, carbs: Int, name: String)
|
||||||
fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String?)
|
fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String?)
|
||||||
|
|
||||||
|
enum class Mode(val i: Int) {
|
||||||
|
RUNNING_PROFILE(1),
|
||||||
|
CUSTOM_PROFILE(2),
|
||||||
|
DB_PROFILE(3),
|
||||||
|
PROFILE_COMPARE(4)
|
||||||
|
}
|
||||||
|
fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: Mode, customProfile: String?= null, customProfileName: String? = null, customProfile2: String? = null)
|
||||||
}
|
}
|
|
@ -20,7 +20,6 @@ import android.widget.TextView
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
|
@ -34,6 +33,7 @@ import info.nightscout.interfaces.Constants
|
||||||
import info.nightscout.interfaces.GlucoseUnit
|
import info.nightscout.interfaces.GlucoseUnit
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.profile.ProfileStore
|
import info.nightscout.interfaces.profile.ProfileStore
|
||||||
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.interfaces.utils.MidnightTime
|
import info.nightscout.interfaces.utils.MidnightTime
|
||||||
import info.nightscout.interfaces.utils.Round
|
import info.nightscout.interfaces.utils.Round
|
||||||
import info.nightscout.plugins.R
|
import info.nightscout.plugins.R
|
||||||
|
@ -72,6 +72,7 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
private var handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
private var handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
||||||
|
@ -200,15 +201,13 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pumpProfile?.let {
|
pumpProfile?.let {
|
||||||
ProfileViewerDialog().also { pvd ->
|
activityNames.runProfileViewerDialog(
|
||||||
pvd.arguments = Bundle().also {
|
fragmentManager = childFragmentManager,
|
||||||
it.putLong("time", dateUtil.now())
|
time = dateUtil.now(),
|
||||||
it.putInt("mode", ProfileViewerDialog.Mode.CUSTOM_PROFILE.ordinal)
|
mode = ActivityNames.Mode.CUSTOM_PROFILE,
|
||||||
it.putString("customProfile", pumpProfile.profile.toPureNsJson(dateUtil).toString())
|
customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(),
|
||||||
it.putString("customProfileUnits", profileFunction.getUnits().asText)
|
customProfileName = pumpProfile.profilename
|
||||||
it.putString("customProfileName", pumpProfile.profilename)
|
)
|
||||||
}
|
|
||||||
}.show(childFragmentManager, "ProfileViewDialog")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,16 +215,14 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
val pumpProfile = autotunePlugin.pumpProfile
|
val pumpProfile = autotunePlugin.pumpProfile
|
||||||
val circadian = sp.getBoolean(R.string.key_autotune_circadian_ic_isf, false)
|
val circadian = sp.getBoolean(R.string.key_autotune_circadian_ic_isf, false)
|
||||||
val tunedProfile = if (circadian) autotunePlugin.tunedProfile?.circadianProfile else autotunePlugin.tunedProfile?.profile
|
val tunedProfile = if (circadian) autotunePlugin.tunedProfile?.circadianProfile else autotunePlugin.tunedProfile?.profile
|
||||||
ProfileViewerDialog().also { pvd ->
|
activityNames.runProfileViewerDialog(
|
||||||
pvd.arguments = Bundle().also {
|
fragmentManager = childFragmentManager,
|
||||||
it.putLong("time", dateUtil.now())
|
time = dateUtil.now(),
|
||||||
it.putInt("mode", ProfileViewerDialog.Mode.PROFILE_COMPARE.ordinal)
|
mode = ActivityNames.Mode.PROFILE_COMPARE,
|
||||||
it.putString("customProfile", pumpProfile.profile.toPureNsJson(dateUtil).toString())
|
customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(),
|
||||||
it.putString("customProfile2", tunedProfile?.toPureNsJson(dateUtil).toString())
|
customProfileName = pumpProfile.profilename + "\n" + rh.gs(R.string.autotune_tunedprofile_name),
|
||||||
it.putString("customProfileUnits", profileFunction.getUnits().asText)
|
customProfile2 = tunedProfile?.toPureNsJson(dateUtil).toString()
|
||||||
it.putString("customProfileName", pumpProfile.profilename + "\n" + rh.gs(R.string.autotune_tunedprofile_name))
|
)
|
||||||
}
|
|
||||||
}.show(childFragmentManager, "ProfileViewDialog")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.autotuneProfileswitch.setOnClickListener {
|
binding.autotuneProfileswitch.setOnClickListener {
|
||||||
|
|
|
@ -620,7 +620,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
if (divided[1].uppercase(Locale.getDefault()) == "STATUS") {
|
if (divided[1].uppercase(Locale.getDefault()) == "STATUS") {
|
||||||
sendSMS(Sms(receivedSms.phoneNumber, profileName))
|
sendSMS(Sms(receivedSms.phoneNumber, profileName))
|
||||||
} else if (divided[1].uppercase(Locale.getDefault()) == "LIST") {
|
} else if (divided[1].uppercase(Locale.getDefault()) == "LIST") {
|
||||||
if (list.isEmpty()) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.invalidprofile)))
|
if (list.isEmpty()) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.invalid_profile)))
|
||||||
else {
|
else {
|
||||||
var reply = ""
|
var reply = ""
|
||||||
for (i in list.indices) {
|
for (i in list.indices) {
|
||||||
|
@ -655,7 +655,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.sms_profile_switch_created))
|
ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.sms_profile_switch_created))
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.invalidprofile)))
|
sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.invalid_profile)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,7 +14,6 @@ import info.nightscout.androidaps.dana.activities.DanaHistoryActivity
|
||||||
import info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity
|
import info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity
|
||||||
import info.nightscout.androidaps.dana.databinding.DanarFragmentBinding
|
import info.nightscout.androidaps.dana.databinding.DanarFragmentBinding
|
||||||
import info.nightscout.androidaps.dana.events.EventDanaRNewStatus
|
import info.nightscout.androidaps.dana.events.EventDanaRNewStatus
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
@ -98,15 +97,13 @@ class DanaFragment : DaggerFragment() {
|
||||||
?: return@setOnClickListener
|
?: return@setOnClickListener
|
||||||
val profileName = danaPump.createConvertedProfile()?.getDefaultProfileName()
|
val profileName = danaPump.createConvertedProfile()?.getDefaultProfileName()
|
||||||
?: return@setOnClickListener
|
?: return@setOnClickListener
|
||||||
ProfileViewerDialog().also { pvd ->
|
activityNames.runProfileViewerDialog(
|
||||||
pvd.arguments = Bundle().also { args ->
|
fragmentManager = childFragmentManager,
|
||||||
args.putLong("time", dateUtil.now())
|
time = dateUtil.now(),
|
||||||
args.putInt("mode", ProfileViewerDialog.Mode.CUSTOM_PROFILE.ordinal)
|
mode = ActivityNames.Mode.CUSTOM_PROFILE,
|
||||||
args.putString("customProfile", profile.toString())
|
customProfile = profile.toString(),
|
||||||
args.putString("customProfileName", profileName)
|
customProfileName = profileName
|
||||||
}
|
)
|
||||||
|
|
||||||
}.show(childFragmentManager, "ProfileViewDialog")
|
|
||||||
}
|
}
|
||||||
binding.stats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity)) }
|
binding.stats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity)) }
|
||||||
binding.userOptions.setOnClickListener { startActivity(Intent(context, DanaUserOptionsActivity::class.java)) }
|
binding.userOptions.setOnClickListener { startActivity(Intent(context, DanaUserOptionsActivity::class.java)) }
|
||||||
|
@ -160,8 +157,10 @@ class DanaFragment : DaggerFragment() {
|
||||||
pumpStatusIcon = when (it.status) {
|
pumpStatusIcon = when (it.status) {
|
||||||
EventPumpStatusChanged.Status.CONNECTING ->
|
EventPumpStatusChanged.Status.CONNECTING ->
|
||||||
"{fa-bluetooth-b spin} ${it.secondsElapsed}s"
|
"{fa-bluetooth-b spin} ${it.secondsElapsed}s"
|
||||||
|
|
||||||
EventPumpStatusChanged.Status.CONNECTED ->
|
EventPumpStatusChanged.Status.CONNECTED ->
|
||||||
"{fa-bluetooth}"
|
"{fa-bluetooth}"
|
||||||
|
|
||||||
EventPumpStatusChanged.Status.DISCONNECTED ->
|
EventPumpStatusChanged.Status.DISCONNECTED ->
|
||||||
"{fa-bluetooth-b}"
|
"{fa-bluetooth-b}"
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.google.android.material.tabs.TabLayout
|
||||||
import com.google.common.collect.Lists
|
import com.google.common.collect.Lists
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.interfaces.stats.TddCalculator
|
import info.nightscout.androidaps.interfaces.stats.TddCalculator
|
||||||
|
@ -20,6 +19,7 @@ import info.nightscout.core.fabric.FabricPrivacy
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
import info.nightscout.database.entities.EffectiveProfileSwitch
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.profile.PureProfile
|
import info.nightscout.interfaces.profile.PureProfile
|
||||||
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.events.EventLocalProfileChanged
|
import info.nightscout.rx.events.EventLocalProfileChanged
|
||||||
import info.nightscout.shared.extensions.toVisibility
|
import info.nightscout.shared.extensions.toVisibility
|
||||||
|
@ -29,6 +29,7 @@ import info.nightscout.ui.R
|
||||||
import info.nightscout.ui.databinding.ActivityProfilehelperBinding
|
import info.nightscout.ui.databinding.ActivityProfilehelperBinding
|
||||||
import info.nightscout.ui.defaultProfile.DefaultProfile
|
import info.nightscout.ui.defaultProfile.DefaultProfile
|
||||||
import info.nightscout.ui.defaultProfile.DefaultProfileDPV
|
import info.nightscout.ui.defaultProfile.DefaultProfileDPV
|
||||||
|
import info.nightscout.ui.dialogs.ProfileViewerDialog
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
|
@ -215,7 +216,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
||||||
ProfileViewerDialog().also { pvd ->
|
ProfileViewerDialog().also { pvd ->
|
||||||
pvd.arguments = Bundle().also {
|
pvd.arguments = Bundle().also {
|
||||||
it.putLong("time", dateUtil.now())
|
it.putLong("time", dateUtil.now())
|
||||||
it.putInt("mode", ProfileViewerDialog.Mode.PROFILE_COMPARE.ordinal)
|
it.putInt("mode", ActivityNames.Mode.PROFILE_COMPARE.ordinal)
|
||||||
it.putString("customProfile", profile0.jsonObject.toString())
|
it.putString("customProfile", profile0.jsonObject.toString())
|
||||||
it.putString("customProfile2", profile1.jsonObject.toString())
|
it.putString("customProfile2", profile1.jsonObject.toString())
|
||||||
it.putString(
|
it.putString(
|
||||||
|
|
|
@ -3,11 +3,10 @@ package info.nightscout.ui.activities
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.interfaces.stats.TddCalculator
|
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.shared.SafeParse
|
import info.nightscout.shared.SafeParse
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
import info.nightscout.ui.R
|
import info.nightscout.ui.R
|
||||||
|
@ -18,10 +17,10 @@ import javax.inject.Inject
|
||||||
class SurveyActivity : NoSplashAppCompatActivity() {
|
class SurveyActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var tddCalculator: TddCalculator
|
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var defaultProfile: DefaultProfile
|
@Inject lateinit var defaultProfile: DefaultProfile
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private lateinit var binding: ActivitySurveyBinding
|
private lateinit var binding: ActivitySurveyBinding
|
||||||
|
|
||||||
|
@ -54,15 +53,14 @@ class SurveyActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
profileFunction.getProfile()?.let { runningProfile ->
|
profileFunction.getProfile()?.let { runningProfile ->
|
||||||
defaultProfile.profile(age, tdd, weight, profileFunction.getUnits())?.let { profile ->
|
defaultProfile.profile(age, tdd, weight, profileFunction.getUnits())?.let { profile ->
|
||||||
ProfileViewerDialog().also { pvd ->
|
activityNames.runProfileViewerDialog(
|
||||||
pvd.arguments = Bundle().also {
|
fragmentManager = supportFragmentManager,
|
||||||
it.putLong("time", dateUtil.now())
|
time = dateUtil.now(),
|
||||||
it.putInt("mode", ProfileViewerDialog.Mode.PROFILE_COMPARE.ordinal)
|
mode = ActivityNames.Mode.PROFILE_COMPARE,
|
||||||
it.putString("customProfile", runningProfile.toPureNsJson(dateUtil).toString())
|
customProfile = runningProfile.toPureNsJson(dateUtil).toString(),
|
||||||
it.putString("customProfile2", profile.jsonObject.toString())
|
customProfileName = "Age: $age TDD: $tdd Weight: $weight",
|
||||||
it.putString("customProfileName", "Age: $age TDD: $tdd Weight: $weight")
|
customProfile2 = profile.jsonObject.toString()
|
||||||
}
|
)
|
||||||
}.show(supportFragmentManager, "ProfileViewDialog")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
||||||
import info.nightscout.androidaps.events.EventNewHistoryData
|
import info.nightscout.androidaps.events.EventNewHistoryData
|
||||||
import info.nightscout.androidaps.extensions.getCustomizedName
|
import info.nightscout.androidaps.extensions.getCustomizedName
|
||||||
|
@ -33,6 +32,7 @@ import info.nightscout.database.entities.ValueWithUnit
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.InvalidateProfileSwitchTransaction
|
import info.nightscout.database.impl.transactions.InvalidateProfileSwitchTransaction
|
||||||
import info.nightscout.interfaces.BuildHelper
|
import info.nightscout.interfaces.BuildHelper
|
||||||
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventLocalProfileChanged
|
import info.nightscout.rx.events.EventLocalProfileChanged
|
||||||
|
@ -49,6 +49,7 @@ import info.nightscout.ui.R
|
||||||
import info.nightscout.ui.activities.fragments.TreatmentsProfileSwitchFragment.RecyclerProfileViewAdapter.ProfileSwitchViewHolder
|
import info.nightscout.ui.activities.fragments.TreatmentsProfileSwitchFragment.RecyclerProfileViewAdapter.ProfileSwitchViewHolder
|
||||||
import info.nightscout.ui.databinding.TreatmentsProfileswitchFragmentBinding
|
import info.nightscout.ui.databinding.TreatmentsProfileswitchFragmentBinding
|
||||||
import info.nightscout.ui.databinding.TreatmentsProfileswitchItemBinding
|
import info.nightscout.ui.databinding.TreatmentsProfileswitchItemBinding
|
||||||
|
import info.nightscout.ui.dialogs.ProfileViewerDialog
|
||||||
import io.reactivex.rxjava3.core.Completable
|
import io.reactivex.rxjava3.core.Completable
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
|
@ -261,7 +262,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
|
||||||
ProfileViewerDialog().also { pvd ->
|
ProfileViewerDialog().also { pvd ->
|
||||||
pvd.arguments = Bundle().also { args ->
|
pvd.arguments = Bundle().also { args ->
|
||||||
args.putLong("time", (it.tag as ProfileSealed).timestamp)
|
args.putLong("time", (it.tag as ProfileSealed).timestamp)
|
||||||
args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
|
args.putInt("mode", ActivityNames.Mode.RUNNING_PROFILE.ordinal)
|
||||||
}
|
}
|
||||||
pvd.show(childFragmentManager, "ProfileViewDialog")
|
pvd.show(childFragmentManager, "ProfileViewDialog")
|
||||||
}
|
}
|
||||||
|
@ -270,7 +271,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
|
||||||
ProfileViewerDialog().also { pvd ->
|
ProfileViewerDialog().also { pvd ->
|
||||||
pvd.arguments = Bundle().also { args ->
|
pvd.arguments = Bundle().also { args ->
|
||||||
args.putLong("time", (it.tag as ProfileSealed).timestamp)
|
args.putLong("time", (it.tag as ProfileSealed).timestamp)
|
||||||
args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
|
args.putInt("mode", ActivityNames.Mode.RUNNING_PROFILE.ordinal)
|
||||||
}
|
}
|
||||||
pvd.show(childFragmentManager, "ProfileViewDialog")
|
pvd.show(childFragmentManager, "ProfileViewDialog")
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import info.nightscout.ui.activities.fragments.TreatmentsUserEntryFragment
|
||||||
import info.nightscout.ui.dialogs.CalibrationDialog
|
import info.nightscout.ui.dialogs.CalibrationDialog
|
||||||
import info.nightscout.ui.dialogs.CarbsDialog
|
import info.nightscout.ui.dialogs.CarbsDialog
|
||||||
import info.nightscout.ui.dialogs.CareDialog
|
import info.nightscout.ui.dialogs.CareDialog
|
||||||
|
import info.nightscout.ui.dialogs.ProfileViewerDialog
|
||||||
import info.nightscout.ui.dialogs.WizardInfoDialog
|
import info.nightscout.ui.dialogs.WizardInfoDialog
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@ -29,6 +30,7 @@ abstract class UiModule {
|
||||||
@ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog
|
@ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
|
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesWizardInfoDialog(): WizardInfoDialog
|
@ContributesAndroidInjector abstract fun contributesWizardInfoDialog(): WizardInfoDialog
|
||||||
|
@ContributesAndroidInjector abstract fun contributesProfileViewerDialog(): ProfileViewerDialog
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
|
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
|
||||||
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
|
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.dialogs
|
package info.nightscout.ui.dialogs
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
|
@ -15,7 +15,6 @@ import info.nightscout.androidaps.extensions.pureProfileFromJson
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.core.main.R
|
import info.nightscout.core.main.R
|
||||||
import info.nightscout.core.main.databinding.DialogProfileviewerBinding
|
|
||||||
import info.nightscout.core.profile.fromMgdlToUnits
|
import info.nightscout.core.profile.fromMgdlToUnits
|
||||||
import info.nightscout.core.profile.toUnitsString
|
import info.nightscout.core.profile.toUnitsString
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
|
@ -23,12 +22,14 @@ import info.nightscout.database.impl.ValueWrapper
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.Constants
|
import info.nightscout.interfaces.Constants
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.interfaces.utils.HardLimits
|
import info.nightscout.interfaces.utils.HardLimits
|
||||||
import info.nightscout.interfaces.utils.HtmlHelper
|
import info.nightscout.interfaces.utils.HtmlHelper
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.shared.extensions.toVisibility
|
import info.nightscout.shared.extensions.toVisibility
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
|
import info.nightscout.ui.databinding.DialogProfileviewerBinding
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -47,14 +48,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
|
|
||||||
private var time: Long = 0
|
private var time: Long = 0
|
||||||
|
|
||||||
enum class Mode(val i: Int) {
|
private var mode: ActivityNames.Mode = ActivityNames.Mode.RUNNING_PROFILE
|
||||||
RUNNING_PROFILE(1),
|
|
||||||
CUSTOM_PROFILE(2),
|
|
||||||
DB_PROFILE(3),
|
|
||||||
PROFILE_COMPARE(4)
|
|
||||||
}
|
|
||||||
|
|
||||||
private var mode: Mode = Mode.RUNNING_PROFILE
|
|
||||||
private var customProfileJson: String = ""
|
private var customProfileJson: String = ""
|
||||||
private var customProfileJson2: String = ""
|
private var customProfileJson2: String = ""
|
||||||
private var customProfileName: String = ""
|
private var customProfileName: String = ""
|
||||||
|
@ -72,10 +66,10 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
// load data from bundle
|
// load data from bundle
|
||||||
(savedInstanceState ?: arguments)?.let { bundle ->
|
(savedInstanceState ?: arguments)?.let { bundle ->
|
||||||
time = bundle.getLong("time", 0)
|
time = bundle.getLong("time", 0)
|
||||||
mode = Mode.values()[bundle.getInt("mode", Mode.RUNNING_PROFILE.ordinal)]
|
mode = ActivityNames.Mode.values()[bundle.getInt("mode", ActivityNames.Mode.RUNNING_PROFILE.ordinal)]
|
||||||
customProfileJson = bundle.getString("customProfile", "")
|
customProfileJson = bundle.getString("customProfile", "")
|
||||||
customProfileName = bundle.getString("customProfileName", "")
|
customProfileName = bundle.getString("customProfileName", "")
|
||||||
if (mode == Mode.PROFILE_COMPARE)
|
if (mode == ActivityNames.Mode.PROFILE_COMPARE)
|
||||||
customProfileJson2 = bundle.getString("customProfile2", "")
|
customProfileJson2 = bundle.getString("customProfile2", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +92,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
val profileName: String?
|
val profileName: String?
|
||||||
val date: String?
|
val date: String?
|
||||||
when (mode) {
|
when (mode) {
|
||||||
Mode.RUNNING_PROFILE -> {
|
ActivityNames.Mode.RUNNING_PROFILE -> {
|
||||||
val eps = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet()
|
val eps = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet()
|
||||||
if (eps !is ValueWrapper.Existing) {
|
if (eps !is ValueWrapper.Existing) {
|
||||||
dismiss()
|
dismiss()
|
||||||
|
@ -108,45 +102,45 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
profile2 = null
|
profile2 = null
|
||||||
profileName = eps.value.originalCustomizedName
|
profileName = eps.value.originalCustomizedName
|
||||||
date = dateUtil.dateAndTimeString(eps.value.timestamp)
|
date = dateUtil.dateAndTimeString(eps.value.timestamp)
|
||||||
binding.datelayout.visibility = View.VISIBLE
|
binding.dateLayout.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode.CUSTOM_PROFILE -> {
|
ActivityNames.Mode.CUSTOM_PROFILE -> {
|
||||||
profile = pureProfileFromJson(JSONObject(customProfileJson), dateUtil)?.let { ProfileSealed.Pure(it) }
|
profile = pureProfileFromJson(JSONObject(customProfileJson), dateUtil)?.let { ProfileSealed.Pure(it) }
|
||||||
profile2 = null
|
profile2 = null
|
||||||
profileName = customProfileName
|
profileName = customProfileName
|
||||||
date = ""
|
date = ""
|
||||||
binding.datelayout.visibility = View.GONE
|
binding.dateLayout.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode.PROFILE_COMPARE -> {
|
ActivityNames.Mode.PROFILE_COMPARE -> {
|
||||||
profile = pureProfileFromJson(JSONObject(customProfileJson), dateUtil)?.let { ProfileSealed.Pure(it) }
|
profile = pureProfileFromJson(JSONObject(customProfileJson), dateUtil)?.let { ProfileSealed.Pure(it) }
|
||||||
profile2 = pureProfileFromJson(JSONObject(customProfileJson2), dateUtil)?.let { ProfileSealed.Pure(it) }
|
profile2 = pureProfileFromJson(JSONObject(customProfileJson2), dateUtil)?.let { ProfileSealed.Pure(it) }
|
||||||
profileName = customProfileName
|
profileName = customProfileName
|
||||||
binding.headerIcon.setImageResource(R.drawable.ic_compare_profiles)
|
binding.headerIcon.setImageResource(R.drawable.ic_compare_profiles)
|
||||||
date = ""
|
date = ""
|
||||||
binding.datelayout.visibility = View.GONE
|
binding.dateLayout.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode.DB_PROFILE -> {
|
ActivityNames.Mode.DB_PROFILE -> {
|
||||||
//val profileList = databaseHelper.getProfileSwitchData(time, true)
|
//val profileList = databaseHelper.getProfileSwitchData(time, true)
|
||||||
val profileList = repository.getAllProfileSwitches().blockingGet()
|
val profileList = repository.getAllProfileSwitches().blockingGet()
|
||||||
profile = if (profileList.isNotEmpty()) ProfileSealed.PS(profileList[0]) else null
|
profile = if (profileList.isNotEmpty()) ProfileSealed.PS(profileList[0]) else null
|
||||||
profile2 = null
|
profile2 = null
|
||||||
profileName = if (profileList.isNotEmpty()) profileList[0].getCustomizedName() else null
|
profileName = if (profileList.isNotEmpty()) profileList[0].getCustomizedName() else null
|
||||||
date = if (profileList.isNotEmpty()) dateUtil.dateAndTimeString(profileList[0].timestamp) else null
|
date = if (profileList.isNotEmpty()) dateUtil.dateAndTimeString(profileList[0].timestamp) else null
|
||||||
binding.datelayout.visibility = View.VISIBLE
|
binding.dateLayout.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.noprofile.visibility = View.VISIBLE
|
binding.noProfile.visibility = View.VISIBLE
|
||||||
|
|
||||||
if (mode == Mode.PROFILE_COMPARE)
|
if (mode == ActivityNames.Mode.PROFILE_COMPARE)
|
||||||
profile?.let { profile1 ->
|
profile?.let { profile1 ->
|
||||||
profile2?.let { profile2 ->
|
profile2?.let { profile2 ->
|
||||||
binding.units.text = profileFunction.getUnits().asText
|
binding.units.text = profileFunction.getUnits().asText
|
||||||
binding.dia.text = HtmlHelper.fromHtml(formatColors("", profile1.dia, profile2.dia, DecimalFormat("0.00"), rh.gs(R.string.shorthour)))
|
binding.dia.text = HtmlHelper.fromHtml(formatColors("", profile1.dia, profile2.dia, DecimalFormat("0.00"), rh.gs(R.string.shorthour)))
|
||||||
val profileNames = profileName!!.split("\n").toTypedArray()
|
val profileNames = profileName!!.split("\n").toTypedArray()
|
||||||
binding.activeprofile.text = HtmlHelper.fromHtml(formatColors(profileNames[0], profileNames[1]))
|
binding.activeProfile.text = HtmlHelper.fromHtml(formatColors(profileNames[0], profileNames[1]))
|
||||||
binding.date.text = date
|
binding.date.text = date
|
||||||
binding.ic.text = ics(profile1, profile2)
|
binding.ic.text = ics(profile1, profile2)
|
||||||
binding.isf.text = isfs(profile1, profile2)
|
binding.isf.text = isfs(profile1, profile2)
|
||||||
|
@ -158,16 +152,16 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
binding.targetGraph.show(profile1, profile2)
|
binding.targetGraph.show(profile1, profile2)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.noprofile.visibility = View.GONE
|
binding.noProfile.visibility = View.GONE
|
||||||
val validity = profile1.isValid("ProfileViewDialog", activePlugin.activePump, config, rh, rxBus, hardLimits, false)
|
val validity = profile1.isValid("ProfileViewDialog", activePlugin.activePump, config, rh, rxBus, hardLimits, false)
|
||||||
binding.invalidprofile.text = rh.gs(R.string.invalidprofile) + "\n" + validity.reasons.joinToString(separator = "\n")
|
binding.invalidProfile.text = rh.gs(R.string.invalid_profile) + "\n" + validity.reasons.joinToString(separator = "\n")
|
||||||
binding.invalidprofile.visibility = validity.isValid.not().toVisibility()
|
binding.invalidProfile.visibility = validity.isValid.not().toVisibility()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
profile?.let {
|
profile?.let {
|
||||||
binding.units.text = it.units.asText
|
binding.units.text = it.units.asText
|
||||||
binding.dia.text = rh.gs(R.string.format_hours, it.dia)
|
binding.dia.text = rh.gs(R.string.format_hours, it.dia)
|
||||||
binding.activeprofile.text = profileName
|
binding.activeProfile.text = profileName
|
||||||
binding.date.text = date
|
binding.date.text = date
|
||||||
binding.ic.text = it.getIcList(rh, dateUtil)
|
binding.ic.text = it.getIcList(rh, dateUtil)
|
||||||
binding.isf.text = it.getIsfList(rh, dateUtil)
|
binding.isf.text = it.getIsfList(rh, dateUtil)
|
||||||
|
@ -178,10 +172,10 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
binding.icGraph.show(it)
|
binding.icGraph.show(it)
|
||||||
binding.targetGraph.show(it)
|
binding.targetGraph.show(it)
|
||||||
|
|
||||||
binding.noprofile.visibility = View.GONE
|
binding.noProfile.visibility = View.GONE
|
||||||
val validity = it.isValid("ProfileViewDialog", activePlugin.activePump, config, rh, rxBus, hardLimits, false)
|
val validity = it.isValid("ProfileViewDialog", activePlugin.activePump, config, rh, rxBus, hardLimits, false)
|
||||||
binding.invalidprofile.text = rh.gs(R.string.invalidprofile) + "\n" + validity.reasons.joinToString(separator = "\n")
|
binding.invalidProfile.text = rh.gs(R.string.invalid_profile) + "\n" + validity.reasons.joinToString(separator = "\n")
|
||||||
binding.invalidprofile.visibility = validity.isValid.not().toVisibility()
|
binding.invalidProfile.visibility = validity.isValid.not().toVisibility()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +190,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
bundle.putInt("mode", mode.ordinal)
|
bundle.putInt("mode", mode.ordinal)
|
||||||
bundle.putString("customProfile", customProfileJson)
|
bundle.putString("customProfile", customProfileJson)
|
||||||
bundle.putString("customProfileName", customProfileName)
|
bundle.putString("customProfileName", customProfileName)
|
||||||
if (mode == Mode.PROFILE_COMPARE)
|
if (mode == ActivityNames.Mode.PROFILE_COMPARE)
|
||||||
bundle.putString("customProfile2", customProfileJson2)
|
bundle.putString("customProfile2", customProfileJson2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
tools:context="info.nightscout.androidaps.dialogs.ProfileViewerDialog">
|
tools:context=".dialogs.ProfileViewerDialog">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
app:srcCompat="@drawable/ic_home_profile" />
|
app:srcCompat="@drawable/ic_home_profile" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/activeprofile"
|
android:id="@+id/active_profile"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
|
@ -49,29 +49,29 @@
|
||||||
android:padding="5dp" />
|
android:padding="5dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/invalidprofile"
|
android:id="@+id/invalid_profile"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="@string/invalidprofile"
|
android:text="@string/invalid_profile"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:textColor="?attr/alarmColor"
|
android:textColor="?attr/alarmColor"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/noprofile"
|
android:id="@+id/no_profile"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="@string/noprofileset"
|
android:text="@string/no_profile_set"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:textColor="?attr/alarmColor"
|
android:textColor="?attr/alarmColor"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/datelayout"
|
android:id="@+id/date_layout"
|
||||||
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"
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/basaltotal"
|
android:id="@+id/basal_total"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="17dp"
|
android:layout_marginStart="17dp"
|
Loading…
Reference in a new issue