- pod management another extension
This commit is contained in:
parent
bdb3bc0b8e
commit
6a979a1f29
|
@ -26,7 +26,7 @@ import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
||||||
*/
|
*/
|
||||||
class PodManagementActivity : NoSplashActivity() {
|
class PodManagementActivity : NoSplashActivity() {
|
||||||
|
|
||||||
private var podSessionActiveOnStart:Boolean? = null
|
private var initPodChanged = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -34,14 +34,17 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
|
|
||||||
initpod_init_pod.setOnClickListener {
|
initpod_init_pod.setOnClickListener {
|
||||||
initPodAction()
|
initPodAction()
|
||||||
|
initPodChanged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
initpod_remove_pod.setOnClickListener {
|
initpod_remove_pod.setOnClickListener {
|
||||||
removePodAction()
|
removePodAction()
|
||||||
|
initPodChanged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
initpod_reset_pod.setOnClickListener {
|
initpod_reset_pod.setOnClickListener {
|
||||||
resetPodAction()
|
resetPodAction()
|
||||||
|
initPodChanged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,9 +59,9 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
|
||||||
if (podSessionActiveOnStart!=(OmnipodUtil.getPodSessionState()!=null)) {
|
if (initPodChanged) {
|
||||||
RxBus.send(EventOmnipodPumpValuesChanged())
|
RxBus.send(EventOmnipodPumpValuesChanged())
|
||||||
RxBus.send(EventRefreshOverview())
|
RxBus.send(EventRefreshOverview("Omnipod Pod Management"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +127,8 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
|
|
||||||
|
|
||||||
fun refreshButtons() {
|
fun refreshButtons() {
|
||||||
|
|
||||||
val isPodSessionActive = (OmnipodUtil.getPodSessionState()!=null)
|
val isPodSessionActive = (OmnipodUtil.getPodSessionState()!=null)
|
||||||
|
|
||||||
if (podSessionActiveOnStart==null) {
|
|
||||||
podSessionActiveOnStart = isPodSessionActive
|
|
||||||
}
|
|
||||||
|
|
||||||
initpod_init_pod.isEnabled = !isPodSessionActive
|
initpod_init_pod.isEnabled = !isPodSessionActive
|
||||||
initpod_remove_pod.isEnabled = isPodSessionActive
|
initpod_remove_pod.isEnabled = isPodSessionActive
|
||||||
initpod_reset_pod.isEnabled = isPodSessionActive
|
initpod_reset_pod.isEnabled = isPodSessionActive
|
||||||
|
|
Loading…
Reference in a new issue