NSC: show n/a instead of zero when no queue data available
This commit is contained in:
parent
faca82f6e8
commit
b5b6432b13
2 changed files with 19 additions and 18 deletions
|
@ -29,19 +29,19 @@ class DataSyncSelectorImplementation @Inject constructor(
|
||||||
) : DataSyncSelector {
|
) : DataSyncSelector {
|
||||||
|
|
||||||
class QueueCounter(
|
class QueueCounter(
|
||||||
var bolusesRemaining: Long = 0L,
|
var bolusesRemaining: Long = -1L,
|
||||||
var carbsRemaining: Long = 0L,
|
var carbsRemaining: Long = -1L,
|
||||||
var bcrRemaining: Long = 0L,
|
var bcrRemaining: Long = -1L,
|
||||||
var ttsRemaining: Long = 0L,
|
var ttsRemaining: Long = -1L,
|
||||||
var foodsRemaining: Long = 0L,
|
var foodsRemaining: Long = -1L,
|
||||||
var gvsRemaining: Long = 0L,
|
var gvsRemaining: Long = -1L,
|
||||||
var tesRemaining: Long = 0L,
|
var tesRemaining: Long = -1L,
|
||||||
var dssRemaining: Long = 0L,
|
var dssRemaining: Long = -1L,
|
||||||
var tbrsRemaining: Long = 0L,
|
var tbrsRemaining: Long = -1L,
|
||||||
var ebsRemaining: Long = 0L,
|
var ebsRemaining: Long = -1L,
|
||||||
var pssRemaining: Long = 0L,
|
var pssRemaining: Long = -1L,
|
||||||
var epssRemaining: Long = 0L,
|
var epssRemaining: Long = -1L,
|
||||||
var oesRemaining: Long = 0L
|
var oesRemaining: Long = -1L
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun size(): Long =
|
fun size(): Long =
|
||||||
|
|
|
@ -22,6 +22,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
|
import io.reactivex.rxkotlin.plusAssign
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class NSClientFragment : DaggerFragment() {
|
class NSClientFragment : DaggerFragment() {
|
||||||
|
@ -72,8 +73,8 @@ class NSClientFragment : DaggerFragment() {
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
OKDialog.showConfirmation(context, rh.gs(R.string.nsclientinternal),
|
OKDialog.showConfirmation(context, rh.gs(R.string.nsclientinternal),
|
||||||
rh.gs(R.string.full_sync_comment), Runnable {
|
rh.gs(R.string.full_sync_comment), Runnable {
|
||||||
dataSyncSelector.resetToNextFullSync()
|
dataSyncSelector.resetToNextFullSync()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.fullSync.paintFlags = binding.fullSync.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
binding.fullSync.paintFlags = binding.fullSync.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||||
|
@ -81,11 +82,10 @@ class NSClientFragment : DaggerFragment() {
|
||||||
|
|
||||||
@Synchronized override fun onResume() {
|
@Synchronized override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
disposable.add(rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventNSClientUpdateGUI::class.java)
|
.toObservable(EventNSClientUpdateGUI::class.java)
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({ updateGui() }, fabricPrivacy::logException)
|
.subscribe({ updateGui() }, fabricPrivacy::logException)
|
||||||
)
|
|
||||||
updateGui()
|
updateGui()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ class NSClientFragment : DaggerFragment() {
|
||||||
if (nsClientPlugin.autoscroll) binding.logScrollview.fullScroll(ScrollView.FOCUS_DOWN)
|
if (nsClientPlugin.autoscroll) binding.logScrollview.fullScroll(ScrollView.FOCUS_DOWN)
|
||||||
binding.url.text = nsClientPlugin.url()
|
binding.url.text = nsClientPlugin.url()
|
||||||
binding.status.text = nsClientPlugin.status
|
binding.status.text = nsClientPlugin.status
|
||||||
binding.queue.text = dataSyncSelector.queueSize().toString()
|
val size = dataSyncSelector.queueSize()
|
||||||
|
binding.queue.text = if (size >= 0) size.toString() else rh.gs(R.string.notavailable)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue