fix menu crash and make graph label translatable
This commit is contained in:
parent
ddb6e1c007
commit
301c44627f
|
@ -88,7 +88,8 @@ class OverviewMenus @Inject constructor(
|
||||||
|
|
||||||
fun setupChartMenu(chartButton: ImageButton) {
|
fun setupChartMenu(chartButton: ImageButton) {
|
||||||
loadGraphConfig()
|
loadGraphConfig()
|
||||||
val numOfGraphs = _setting.size // 1 main + x secondary
|
val settingsCopy = setting
|
||||||
|
val numOfGraphs = settingsCopy.size // 1 main + x secondary
|
||||||
|
|
||||||
chartButton.setOnClickListener { v: View ->
|
chartButton.setOnClickListener { v: View ->
|
||||||
val predictionsAvailable: Boolean = when {
|
val predictionsAvailable: Boolean = when {
|
||||||
|
@ -100,7 +101,7 @@ class OverviewMenus @Inject constructor(
|
||||||
|
|
||||||
for (g in 0 until numOfGraphs) {
|
for (g in 0 until numOfGraphs) {
|
||||||
if (g != 0 && g < numOfGraphs) {
|
if (g != 0 && g < numOfGraphs) {
|
||||||
val dividerItem = popup.menu.add(Menu.NONE, g, Menu.NONE, "------- " + "Graph" + " " + g + " -------")
|
val dividerItem = popup.menu.add(Menu.NONE, g, Menu.NONE, "------- ${resourceHelper.gs(R.string.graph_menu_divider_header)} $g -------")
|
||||||
dividerItem.isCheckable = true
|
dividerItem.isCheckable = true
|
||||||
dividerItem.isChecked = true
|
dividerItem.isChecked = true
|
||||||
}
|
}
|
||||||
|
@ -117,12 +118,12 @@ class OverviewMenus @Inject constructor(
|
||||||
s.setSpan(ForegroundColorSpan(resourceHelper.gc(m.colorId)), 0, s.length, 0)
|
s.setSpan(ForegroundColorSpan(resourceHelper.gc(m.colorId)), 0, s.length, 0)
|
||||||
item.title = s
|
item.title = s
|
||||||
item.isCheckable = true
|
item.isCheckable = true
|
||||||
item.isChecked = _setting[g][m.ordinal]
|
item.isChecked = settingsCopy[g][m.ordinal]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (numOfGraphs < MAX_GRAPHS) {
|
if (numOfGraphs < MAX_GRAPHS) {
|
||||||
val dividerItem = popup.menu.add(Menu.NONE, numOfGraphs, Menu.NONE, "------- " + "Graph" + " " + numOfGraphs + " -------")
|
val dividerItem = popup.menu.add(Menu.NONE, numOfGraphs, Menu.NONE, "------- ${resourceHelper.gs(R.string.graph_menu_divider_header)} $numOfGraphs -------")
|
||||||
dividerItem.isCheckable = true
|
dividerItem.isCheckable = true
|
||||||
dividerItem.isChecked = false
|
dividerItem.isChecked = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1429,5 +1429,6 @@
|
||||||
<string name="time_to_eat">Time to eat!\nRun Bolus wizard and do calculation again.</string>
|
<string name="time_to_eat">Time to eat!\nRun Bolus wizard and do calculation again.</string>
|
||||||
<string name="timetoeat">Time to eat</string>
|
<string name="timetoeat">Time to eat</string>
|
||||||
<string name="fabric_upload_disabled">Crash logs upload disabled!</string>
|
<string name="fabric_upload_disabled">Crash logs upload disabled!</string>
|
||||||
|
<string name="graph_menu_divider_header">Graph</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue