Merge branch 'dev' into wear
This commit is contained in:
commit
78ac6e1a38
|
@ -1,15 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.aps.loop
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.*
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.LoopFragmentBinding
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
|
@ -18,6 +15,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
|
@ -34,6 +32,8 @@ class LoopFragment : DaggerFragment() {
|
|||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private val ID_MENU_RUN = 1
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
private var _binding: LoopFragmentBinding? = null
|
||||
|
@ -42,8 +42,11 @@ class LoopFragment : DaggerFragment() {
|
|||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
setHasOptionsMenu(true)
|
||||
_binding = LoopFragmentBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
@ -51,12 +54,33 @@ class LoopFragment : DaggerFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.run.setOnClickListener {
|
||||
binding.lastrun.text = rh.gs(R.string.executing)
|
||||
Thread { loop.invoke("Loop button", true) }.start()
|
||||
with(binding.swipeRefresh) {
|
||||
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
|
||||
setOnRefreshListener {
|
||||
binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
|
||||
Thread { loop.invoke("Loop swiperefresh", true) }.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater)
|
||||
menu.removeItem(ID_MENU_RUN)
|
||||
menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
menu.setGroupDividerEnabled(true)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean =
|
||||
when (item.itemId) {
|
||||
ID_MENU_RUN -> {
|
||||
binding.lastrun.text = rh.gs(R.string.executing)
|
||||
Thread { loop.invoke("Loop menu", true) }.start()
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
@ -64,16 +88,16 @@ class LoopFragment : DaggerFragment() {
|
|||
.toObservable(EventLoopUpdateGui::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
updateGUI()
|
||||
}, fabricPrivacy::logException)
|
||||
updateGUI()
|
||||
}, fabricPrivacy::logException)
|
||||
|
||||
disposable += rxBus
|
||||
.toObservable(EventLoopSetLastRunGui::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
clearGUI()
|
||||
binding.lastrun.text = it.text
|
||||
}, fabricPrivacy::logException)
|
||||
clearGUI()
|
||||
binding.lastrun.text = it.text
|
||||
}, fabricPrivacy::logException)
|
||||
|
||||
updateGUI()
|
||||
sp.putBoolean(R.string.key_objectiveuseloop, true)
|
||||
|
@ -117,6 +141,7 @@ class LoopFragment : DaggerFragment() {
|
|||
allConstraints.getMostLimitedReasons(aapsLogger)
|
||||
} ?: ""
|
||||
binding.constraints.text = constraints
|
||||
binding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,5 +158,6 @@ class LoopFragment : DaggerFragment() {
|
|||
binding.tbrexecutionTime.text = ""
|
||||
binding.tbrsetbypump.text = ""
|
||||
binding.smbsetbypump.text = ""
|
||||
binding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,10 @@ package info.nightscout.androidaps.plugins.aps.openAPSAMA
|
|||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.*
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.OpenapsamaFragmentBinding
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui
|
||||
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateResultGui
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
|
@ -18,6 +14,8 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.JSONFormatter
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import org.json.JSONArray
|
||||
|
@ -37,14 +35,19 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
|||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var jsonFormatter: JSONFormatter
|
||||
|
||||
private val ID_MENU_RUN = 1
|
||||
|
||||
private var _binding: OpenapsamaFragmentBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
setHasOptionsMenu(true)
|
||||
_binding = OpenapsamaFragmentBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
@ -52,11 +55,34 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.run.setOnClickListener {
|
||||
openAPSAMAPlugin.invoke("OpenAPSAMA button", false)
|
||||
with(binding.swipeRefresh) {
|
||||
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
|
||||
setOnRefreshListener {
|
||||
binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
|
||||
openAPSAMAPlugin.invoke("OpenAPSAMA swiperefresh", false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater)
|
||||
menu.removeItem(ID_MENU_RUN)
|
||||
menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
menu.setGroupDividerEnabled(true)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean =
|
||||
when (item.itemId) {
|
||||
ID_MENU_RUN -> {
|
||||
binding.lastrun.text = rh.gs(R.string.executing)
|
||||
openAPSAMAPlugin.invoke("OpenAPSAMA menu", false)
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
@ -65,14 +91,14 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
|||
.toObservable(EventOpenAPSUpdateGui::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
updateGUI()
|
||||
}, fabricPrivacy::logException)
|
||||
updateGUI()
|
||||
}, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventOpenAPSUpdateResultGui::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
updateResultGUI(it.text)
|
||||
}, fabricPrivacy::logException)
|
||||
updateResultGUI(it.text)
|
||||
}, fabricPrivacy::logException)
|
||||
|
||||
updateGUI()
|
||||
}
|
||||
|
@ -118,6 +144,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
|||
openAPSAMAPlugin.lastAutosensResult.let {
|
||||
binding.autosensdata.text = jsonFormatter.format(it.json())
|
||||
}
|
||||
binding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
|
||||
private fun updateResultGUI(text: String) {
|
||||
|
@ -131,5 +158,6 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
|||
binding.scriptdebugdata.text = ""
|
||||
binding.request.text = ""
|
||||
binding.lastrun.text = ""
|
||||
binding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ package info.nightscout.androidaps.plugins.aps.openAPSSMB
|
|||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.*
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.OpenapsamaFragmentBinding
|
||||
|
@ -39,13 +37,16 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
|||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var jsonFormatter: JSONFormatter
|
||||
|
||||
private val ID_MENU_RUN = 1
|
||||
|
||||
private var _binding: OpenapsamaFragmentBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
setHasOptionsMenu(true)
|
||||
_binding = OpenapsamaFragmentBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
@ -53,11 +54,34 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.run.setOnClickListener {
|
||||
activePlugin.activeAPS.invoke("OpenAPSSMB button", false)
|
||||
with(binding.swipeRefresh) {
|
||||
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
|
||||
setOnRefreshListener {
|
||||
binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
|
||||
activePlugin.activeAPS.invoke("OpenAPSSMB swiperefresh", false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater)
|
||||
menu.removeItem(ID_MENU_RUN)
|
||||
menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
menu.setGroupDividerEnabled(true)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean =
|
||||
when (item.itemId) {
|
||||
ID_MENU_RUN -> {
|
||||
binding.lastrun.text = rh.gs(R.string.executing)
|
||||
activePlugin.activeAPS.invoke("OpenAPSSMB menu", false)
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
@ -65,14 +89,14 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
|||
.toObservable(EventOpenAPSUpdateGui::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
updateGUI()
|
||||
}, fabricPrivacy::logException)
|
||||
updateGUI()
|
||||
}, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventOpenAPSUpdateResultGui::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
updateResultGUI(it.text)
|
||||
}, fabricPrivacy::logException)
|
||||
updateResultGUI(it.text)
|
||||
}, fabricPrivacy::logException)
|
||||
|
||||
updateGUI()
|
||||
}
|
||||
|
@ -122,6 +146,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
|||
openAPSSMBPlugin.lastAutosensResult.let {
|
||||
binding.autosensdata.text = jsonFormatter.format(it.json())
|
||||
}
|
||||
binding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
@ -137,5 +162,6 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
|||
binding.scriptdebugdata.text = ""
|
||||
binding.request.text = ""
|
||||
binding.lastrun.text = ""
|
||||
binding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import info.nightscout.androidaps.database.AppRepository
|
|||
import info.nightscout.androidaps.database.entities.Food
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateFoodTransaction
|
||||
import info.nightscout.androidaps.databinding.FoodFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.FoodItemBinding
|
||||
|
@ -26,7 +25,6 @@ import info.nightscout.androidaps.events.EventFoodDatabaseChanged
|
|||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
|
@ -35,10 +33,8 @@ import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
|||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import io.reactivex.rxjava3.core.Completable
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import io.reactivex.rxjava3.kotlin.subscribeBy
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
@ -73,27 +69,7 @@ class FoodFragment : DaggerFragment() {
|
|||
binding.recyclerview.setHasFixedSize(true)
|
||||
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
|
||||
|
||||
binding.refreshFromNightscout.setOnClickListener {
|
||||
context?.let { context ->
|
||||
OKDialog.showConfirmation(context, rh.gs(R.string.refresheventsfromnightscout) + " ?", {
|
||||
uel.log(
|
||||
Action.FOOD, Sources.Food, rh.gs(R.string.refresheventsfromnightscout),
|
||||
ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.refresheventsfromnightscout))
|
||||
)
|
||||
disposable += Completable.fromAction { repository.deleteAllFoods() }
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribeBy(
|
||||
onError = { aapsLogger.error("Error removing foods", it) },
|
||||
onComplete = { rxBus.send(EventFoodDatabaseChanged()) }
|
||||
)
|
||||
|
||||
rxBus.send(EventNSClientRestart())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
binding.filterinputLayout.setEndIconOnClickListener {
|
||||
binding.filterInputLayout.setEndIconOnClickListener {
|
||||
binding.filter.setText("")
|
||||
binding.categoryList.setText(rh.gs(R.string.none), false)
|
||||
binding.subcategoryList.setText(rh.gs(R.string.none), false)
|
||||
|
@ -220,7 +196,6 @@ class FoodFragment : DaggerFragment() {
|
|||
holder.binding.energy.text = rh.gs(R.string.shortenergy) + ": " + food.energy + rh.gs(R.string.shortkilojoul)
|
||||
holder.binding.energy.visibility = food.energy.isNotZero().toVisibility()
|
||||
holder.binding.icRemove.tag = food
|
||||
holder.binding.foodItem.tag = food
|
||||
holder.binding.icCalculator.tag = food
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,11 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
@ -31,19 +32,21 @@ class OverviewMenus @Inject constructor(
|
|||
private val rxBus: RxBus,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val loop: Loop,
|
||||
private val config: Config
|
||||
private val config: Config,
|
||||
private val fabricPrivacy: FabricPrivacy
|
||||
) {
|
||||
|
||||
enum class CharType(@StringRes val nameId: Int, @AttrRes val attrId: Int, @AttrRes val attrTextId: Int, val primary: Boolean, val secondary: Boolean, @StringRes val shortnameId: Int) {
|
||||
PRE(R.string.overview_show_predictions, R.attr.predictionColor, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.prediction_shortname),
|
||||
TREAT(R.string.overview_show_treatments, R.attr.predictionColor, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.treatments_shortname),
|
||||
BAS(R.string.overview_show_basals, R.attr.basal, R.attr.menuTextColor, primary = true, secondary = false,shortnameId = R.string.basal_shortname),
|
||||
ABS(R.string.overview_show_absinsulin, R.attr.iobColor, R.attr.menuTextColor, primary = false, secondary = true,shortnameId = R.string.abs_insulin_shortname),
|
||||
IOB(R.string.overview_show_iob, R.attr.iobColor, R.attr.menuTextColor, primary = false, secondary = true,shortnameId = R.string.iob),
|
||||
COB(R.string.overview_show_cob, R.attr.cobColor, R.attr.menuTextColor, primary = false, secondary = true,shortnameId = R.string.cob),
|
||||
DEV(R.string.overview_show_deviations, R.attr.bgiColor, R.attr.menuTextColor, primary = false, secondary = true,shortnameId = R.string.deviation_shortname),
|
||||
BGI(R.string.overview_show_bgi, R.attr.bgiColor, R.attr.menuTextColor, primary = false, secondary = true,shortnameId = R.string.bgi_shortname),
|
||||
SEN(R.string.overview_show_sensitivity, R.attr.ratioColor, R.attr.menuTextColorInverse, primary = false, secondary = true,shortnameId = R.string.sensitivity_shortname),
|
||||
ACT(R.string.overview_show_activity, R.attr.activityColor, R.attr.menuTextColor, primary = true, secondary = false,shortnameId = R.string.activity_shortname),
|
||||
TREAT(R.string.overview_show_treatments, R.attr.predictionColor, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.treatments_shortname),
|
||||
BAS(R.string.overview_show_basals, R.attr.basal, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.basal_shortname),
|
||||
ABS(R.string.overview_show_absinsulin, R.attr.iobColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.abs_insulin_shortname),
|
||||
IOB(R.string.overview_show_iob, R.attr.iobColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.iob),
|
||||
COB(R.string.overview_show_cob, R.attr.cobColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.cob),
|
||||
DEV(R.string.overview_show_deviations, R.attr.bgiColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.deviation_shortname),
|
||||
BGI(R.string.overview_show_bgi, R.attr.bgiColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.bgi_shortname),
|
||||
SEN(R.string.overview_show_sensitivity, R.attr.ratioColor, R.attr.menuTextColorInverse, primary = false, secondary = true, shortnameId = R.string.sensitivity_shortname),
|
||||
ACT(R.string.overview_show_activity, R.attr.activityColor, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.activity_shortname),
|
||||
DEVSLOPE(R.string.overview_show_deviationslope, R.attr.devSlopePosColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.devslope_shortname)
|
||||
}
|
||||
|
||||
|
@ -138,21 +141,27 @@ class OverviewMenus @Inject constructor(
|
|||
}
|
||||
|
||||
popup.setOnMenuItemClickListener {
|
||||
// id < 100 graph header - divider 1, 2, 3 .....
|
||||
when {
|
||||
it.itemId == numOfGraphs -> {
|
||||
// add new empty
|
||||
_setting.add(Array(CharType.values().size) { false })
|
||||
}
|
||||
it.itemId < 100 -> {
|
||||
// remove graph
|
||||
_setting.removeAt(it.itemId)
|
||||
}
|
||||
else -> {
|
||||
val graphNumber = it.itemId / 100 - 1
|
||||
val item = it.itemId % 100
|
||||
_setting[graphNumber][item] = !it.isChecked
|
||||
try {
|
||||
// id < 100 graph header - divider 1, 2, 3 .....
|
||||
when {
|
||||
it.itemId == numOfGraphs -> {
|
||||
// add new empty
|
||||
_setting.add(Array(CharType.values().size) { false })
|
||||
}
|
||||
|
||||
it.itemId < 100 -> {
|
||||
// remove graph
|
||||
_setting.removeAt(it.itemId)
|
||||
}
|
||||
|
||||
else -> {
|
||||
val graphNumber = it.itemId / 100 - 1
|
||||
val item = it.itemId % 100
|
||||
_setting[graphNumber][item] = !it.isChecked
|
||||
}
|
||||
}
|
||||
} catch (exception: Exception) {
|
||||
fabricPrivacy.logException(exception)
|
||||
}
|
||||
storeGraphConfig()
|
||||
setupChartMenu(context, chartButton)
|
||||
|
|
|
@ -14,27 +14,27 @@ import info.nightscout.androidaps.interfaces.BgSource
|
|||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.receivers.DataWorker
|
||||
import info.nightscout.androidaps.services.Intents
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
import kotlin.math.log
|
||||
|
||||
@Singleton
|
||||
class AidexPlugin @Inject constructor(
|
||||
injector: HasAndroidInjector,
|
||||
rh: ResourceHelper,
|
||||
aapsLogger: AAPSLogger
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
.fragmentClass(BGSourceFragment::class.java.name)
|
||||
.pluginIcon((R.drawable.ic_blooddrop_48))
|
||||
.pluginName(R.string.aidex)
|
||||
.shortName(R.string.aidex_short)
|
||||
.description(R.string.description_source_aidex),
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
.fragmentClass(BGSourceFragment::class.java.name)
|
||||
.pluginIcon((R.drawable.ic_blooddrop_48))
|
||||
.pluginName(R.string.aidex)
|
||||
.shortName(R.string.aidex_short)
|
||||
.description(R.string.description_source_aidex),
|
||||
aapsLogger, rh, injector
|
||||
), BgSource {
|
||||
|
||||
|
@ -43,7 +43,7 @@ class AidexPlugin @Inject constructor(
|
|||
/**
|
||||
* Aidex App doesn't have upload to NS
|
||||
*/
|
||||
override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = true
|
||||
override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean = true
|
||||
|
||||
override fun advancedFilteringSupported(): Boolean {
|
||||
return advancedFiltering
|
||||
|
|
|
@ -6,39 +6,29 @@
|
|||
android:orientation="vertical"
|
||||
tools:context="info.nightscout.androidaps.plugins.general.food.FoodFragment">
|
||||
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/refresh_from_nightscout"
|
||||
style="@style/GrayButton"
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/filter_input_layout"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:drawableStart="@drawable/ic_refresh"
|
||||
android:text="@string/refresheventsfromnightscout"
|
||||
tools:visibility="visible" />
|
||||
android:hint="@string/filter"
|
||||
app:endIconMode="clear_text"
|
||||
app:startIconDrawable="@android:drawable/ic_menu_search">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/filterinputLayout"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/filter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/filter"
|
||||
app:startIconDrawable="@android:drawable/ic_menu_search"
|
||||
app:endIconMode="clear_text">
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1"
|
||||
android:autofillHints="@string/notes_label"
|
||||
android:gravity="start"
|
||||
android:inputType="text|textCapSentences"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/filter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:autofillHints="@string/notes_label"
|
||||
android:gravity="start"
|
||||
android:textStyle="bold"
|
||||
android:inputType="text|textCapSentences" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||
|
|
|
@ -1,148 +1,111 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.google.android.material.card.MaterialCardView 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"
|
||||
style="@style/Widget.MaterialComponents.CardView"
|
||||
android:id="@+id/food_card"
|
||||
style="@style/Widget.MaterialComponents.CardView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
app:strokeWidth="1dp"
|
||||
android:layout_gravity="center"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:contentPadding="2dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardUseCompatPadding="true"
|
||||
android:layout_gravity="center">
|
||||
app:cardElevation="2dp"
|
||||
app:cardUseCompatPadding="true" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/food_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/left_right_split"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="3dp">
|
||||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Name"
|
||||
android:textSize="@dimen/twenty_four_dp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/name_and_info_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="start">
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="start"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/name_container"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@+id/carbs"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
android:text="Carbs"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Name"
|
||||
android:textStyle="bold"
|
||||
android:textSize="@dimen/twenty_four_dp"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/info_container"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@+id/portion"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="5dp">
|
||||
android:gravity="center"
|
||||
android:text="Portion"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/carbs"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Carbs"
|
||||
tools:ignore="HardcodedText" />
|
||||
<TextView
|
||||
android:id="@+id/fat"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Fat"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/portion"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Portion"
|
||||
tools:ignore="HardcodedText" />
|
||||
<TextView
|
||||
android:id="@+id/protein"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Protein"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fat"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Fat"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protein"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Protein"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/energy"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Energy"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/energy"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Energy"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="end">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_calculator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:padding="2dp"
|
||||
android:orientation="horizontal"
|
||||
android:src="@drawable/ic_calculator" />
|
||||
<ImageView
|
||||
android:id="@+id/ic_remove"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:padding="2dp"
|
||||
android:orientation="horizontal"
|
||||
android:src="@drawable/ic_trash_outline" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_calculator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/overview_calculator_label"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="-5dp"
|
||||
android:paddingEnd="-5dp"
|
||||
android:scaleX=".5"
|
||||
android:scaleY=".5"
|
||||
android:src="@drawable/ic_calculator" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dip"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="?android:attr/dividerHorizontal" />
|
||||
<ImageView
|
||||
android:id="@+id/ic_remove"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/remove_label"
|
||||
android:orientation="horizontal"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/ic_trash_outline" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android = "http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools = "http://schemas.android.com/tools"
|
||||
android:id = "@+id/swipeRefresh"
|
||||
android:layout_width = "match_parent"
|
||||
android:layout_height = "match_parent"
|
||||
tools:context=".plugins.aps.loop.LoopFragment">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="2dp"
|
||||
tools:context=".plugins.aps.loop.LoopFragment">
|
||||
android:paddingTop="2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/GrayButton"
|
||||
android:id="@+id/run"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/openapsma_run" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -515,4 +513,7 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
|
|
@ -1,29 +1,20 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android = "http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools = "http://schemas.android.com/tools"
|
||||
android:id = "@+id/swipeRefresh"
|
||||
android:layout_width = "match_parent"
|
||||
android:layout_height = "match_parent"
|
||||
tools:context=".plugins.aps.openAPSAMA.OpenAPSAMAFragment">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="2dp"
|
||||
tools:context=".plugins.aps.openAPSAMA.OpenAPSAMAFragment">
|
||||
android:paddingTop="2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/GrayButton"
|
||||
android:id="@+id/run"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/openapsma_run" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -580,4 +571,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
|
|
@ -72,7 +72,8 @@
|
|||
android:layout_marginEnd="5dp"
|
||||
android:maxHeight="5dp"
|
||||
android:minHeight="3dp"
|
||||
tools:progress="50"/>
|
||||
android:scaleY="5"
|
||||
tools:progress="50" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/GrayButton"
|
||||
|
|
|
@ -348,7 +348,7 @@
|
|||
<color name="aaps_theme_dark_onErrorContainer">#F9DEDC</color>
|
||||
<color name="aaps_theme_dark_background">#1D1B1E</color>
|
||||
<color name="aaps_theme_dark_onBackground">#E7E1E5</color>
|
||||
<color name="aaps_theme_dark_surface">#1D1B1E</color>
|
||||
<color name="aaps_theme_dark_surface">#0F0F0F</color>
|
||||
<color name="aaps_theme_dark_onSurface">#E7E1E5</color>
|
||||
<color name="aaps_theme_dark_surfaceVariant">#49454F</color>
|
||||
<color name="aaps_theme_dark_onSurfaceVariant">#CAC4D0</color>
|
||||
|
|
Loading…
Reference in a new issue