fix tablet mode
This commit is contained in:
parent
b02992e46b
commit
91bc31ba1b
2 changed files with 16 additions and 17 deletions
|
@ -158,7 +158,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
private val secondaryGraphs = ArrayList<GraphView>()
|
private val secondaryGraphs = ArrayList<GraphView>()
|
||||||
private val secondaryGraphsLabel = ArrayList<TextView>()
|
private val secondaryGraphsLabel = ArrayList<TextView>()
|
||||||
|
|
||||||
private lateinit var carbAnimation: AnimationDrawable
|
private var carbAnimation: AnimationDrawable? = null
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
|
@ -190,9 +190,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
overview_bggraph?.gridLabelRenderer?.labelVerticalWidth = axisWidth
|
overview_bggraph?.gridLabelRenderer?.labelVerticalWidth = axisWidth
|
||||||
overview_bggraph?.layoutParams?.height = resourceHelper.dpToPx(skinProvider.activeSkin().mainGraphHeight)
|
overview_bggraph?.layoutParams?.height = resourceHelper.dpToPx(skinProvider.activeSkin().mainGraphHeight)
|
||||||
|
|
||||||
carbAnimation = overview_carbs_icon.background as AnimationDrawable
|
carbAnimation = overview_carbs_icon?.background as AnimationDrawable?
|
||||||
carbAnimation.setEnterFadeDuration(1200)
|
carbAnimation?.setEnterFadeDuration(1200)
|
||||||
carbAnimation.setExitFadeDuration(1200)
|
carbAnimation?.setExitFadeDuration(1200)
|
||||||
|
|
||||||
rangeToDisplay = sp.getInt(R.string.key_rangetodisplay, 6)
|
rangeToDisplay = sp.getInt(R.string.key_rangetodisplay, 6)
|
||||||
|
|
||||||
|
@ -643,6 +643,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
overview_apsmode_text?.visibility = View.GONE
|
overview_apsmode_text?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
val lastRun = loopPlugin.lastRun
|
val lastRun = loopPlugin.lastRun
|
||||||
|
val predictionsAvailable = if (config.APS) lastRun?.request?.hasPredictions == true else config.NSCLIENT
|
||||||
|
|
||||||
// temp target
|
// temp target
|
||||||
val tempTarget = treatmentsPlugin.tempTargetFromHistory
|
val tempTarget = treatmentsPlugin.tempTargetFromHistory
|
||||||
|
@ -682,9 +683,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
?: resourceHelper.gc(R.color.defaulttextcolor))
|
?: resourceHelper.gc(R.color.defaulttextcolor))
|
||||||
|
|
||||||
if (activeTemp != null)
|
if (activeTemp != null)
|
||||||
overview_basebasal_icon.setImageResource(if (activeTemp.tempBasalConvertedToPercent(System.currentTimeMillis(), profile) > 100) R.drawable.ic_cp_basal_tbr_high else R.drawable.ic_cp_basal_tbr_low)
|
overview_basebasal_icon?.setImageResource(if (activeTemp.tempBasalConvertedToPercent(System.currentTimeMillis(), profile) > 100) R.drawable.ic_cp_basal_tbr_high else R.drawable.ic_cp_basal_tbr_low)
|
||||||
else
|
else
|
||||||
overview_basebasal_icon.setImageResource(R.drawable.ic_cp_basal_no_tbr)
|
overview_basebasal_icon?.setImageResource(R.drawable.ic_cp_basal_no_tbr)
|
||||||
|
|
||||||
// Extended bolus
|
// Extended bolus
|
||||||
val extendedBolus = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis())
|
val extendedBolus = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis())
|
||||||
|
@ -754,17 +755,15 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
cobText = cobText + " | " + lastRun.constraintsProcessed!!.carbsReq + " " + resourceHelper.gs(R.string.required)
|
cobText = cobText + " | " + lastRun.constraintsProcessed!!.carbsReq + " " + resourceHelper.gs(R.string.required)
|
||||||
}
|
}
|
||||||
overview_cob?.text = cobText
|
overview_cob?.text = cobText
|
||||||
if (!carbAnimation.isRunning)
|
if (carbAnimation?.isRunning == false)
|
||||||
carbAnimation.start()
|
carbAnimation?.start()
|
||||||
} else {
|
} else {
|
||||||
overview_cob?.text = cobText
|
overview_cob?.text = cobText
|
||||||
carbAnimation.stop()
|
carbAnimation?.stop()
|
||||||
carbAnimation.selectDrawable(0);
|
carbAnimation?.selectDrawable(0)
|
||||||
}
|
}
|
||||||
} else overview_cob?.text = cobText
|
} else overview_cob?.text = cobText
|
||||||
|
|
||||||
val predictionsAvailable = if (config.APS) lastRun?.request?.hasPredictions == true else config.NSCLIENT
|
|
||||||
|
|
||||||
// pump status from ns
|
// pump status from ns
|
||||||
overview_pump?.text = nsDeviceStatus.pumpStatus
|
overview_pump?.text = nsDeviceStatus.pumpStatus
|
||||||
overview_pump?.setOnClickListener { activity?.let { OKDialog.show(it, resourceHelper.gs(R.string.pump), nsDeviceStatus.extendedPumpStatus) } }
|
overview_pump?.setOnClickListener { activity?.let { OKDialog.show(it, resourceHelper.gs(R.string.pump), nsDeviceStatus.extendedPumpStatus) } }
|
||||||
|
@ -779,9 +778,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
|
|
||||||
// Sensitivity
|
// Sensitivity
|
||||||
if (sp.getBoolean(R.string.key_openapsama_useautosens, false) && constraintChecker.isAutosensModeEnabled().value()) {
|
if (sp.getBoolean(R.string.key_openapsama_useautosens, false) && constraintChecker.isAutosensModeEnabled().value()) {
|
||||||
overview_sensitivity_icon.setImageResource(R.drawable.ic_swap_vert_black_48dp_green)
|
overview_sensitivity_icon?.setImageResource(R.drawable.ic_swap_vert_black_48dp_green)
|
||||||
} else {
|
} else {
|
||||||
overview_sensitivity_icon.setImageResource(R.drawable.ic_x_swap_vert)
|
overview_sensitivity_icon?.setImageResource(R.drawable.ic_x_swap_vert)
|
||||||
}
|
}
|
||||||
|
|
||||||
overview_sensitivity?.text =
|
overview_sensitivity?.text =
|
||||||
|
|
|
@ -109,7 +109,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
danar_history_spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
|
danar_history_spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
|
||||||
|
|
||||||
danar_history_reload.setOnClickListener {
|
danar_history_reload.setOnClickListener {
|
||||||
val selected = danar_history_spinner.selectedItem as TypeList
|
val selected = danar_history_spinner.selectedItem as TypeList? ?: return@setOnClickListener
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
danar_history_reload?.visibility = View.GONE
|
danar_history_reload?.visibility = View.GONE
|
||||||
danar_history_status?.visibility = View.VISIBLE
|
danar_history_status?.visibility = View.VISIBLE
|
||||||
|
@ -127,7 +127,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
danar_history_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
danar_history_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
|
override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
|
||||||
val selected = danar_history_spinner?.selectedItem as TypeList? ?: return
|
val selected = typeList[position]
|
||||||
loadDataFromDB(selected.type)
|
loadDataFromDB(selected.type)
|
||||||
showingType = selected.type
|
showingType = selected.type
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue