fix "selected graph changed after recalculation"
This commit is contained in:
parent
f158381f5f
commit
c75aa594ea
1 changed files with 15 additions and 9 deletions
|
@ -101,6 +101,15 @@ public class MtGraphFragment extends BaseCard
|
||||||
return R.layout.fragment_measurement_tool_graph;
|
return R.layout.fragment_measurement_tool_graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateAdditionalInfo() {
|
||||||
|
if (!isRouteCalculating()) {
|
||||||
|
updateGraphData();
|
||||||
|
refreshGraphTypesSelectionMenu();
|
||||||
|
}
|
||||||
|
updateDataView();
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshGraphTypesSelectionMenu() {
|
private void refreshGraphTypesSelectionMenu() {
|
||||||
rvGraphTypesMenu.removeAllViews();
|
rvGraphTypesMenu.removeAllViews();
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
|
@ -112,7 +121,7 @@ public class MtGraphFragment extends BaseCard
|
||||||
if (type.isCustom()) {
|
if (type.isCustom()) {
|
||||||
item.setTitleColorId(activeColorId);
|
item.setTitleColorId(activeColorId);
|
||||||
}
|
}
|
||||||
if (type.hasData() || type.canBeCalculated) {
|
if (type.isAvailable()) {
|
||||||
items.add(item);
|
items.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,13 +143,6 @@ public class MtGraphFragment extends BaseCard
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdateAdditionalInfo() {
|
|
||||||
updateGraphData();
|
|
||||||
refreshGraphTypesSelectionMenu();
|
|
||||||
updateDataView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupVisibleGraphType(GraphType type) {
|
private void setupVisibleGraphType(GraphType type) {
|
||||||
visibleGraphType = type;
|
visibleGraphType = type;
|
||||||
updateDataView();
|
updateDataView();
|
||||||
|
@ -163,7 +165,7 @@ public class MtGraphFragment extends BaseCard
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDataView() {
|
private void updateDataView() {
|
||||||
if (mtf.isProgressBarVisible()) {
|
if (isRouteCalculating()) {
|
||||||
showProgressMessage();
|
showProgressMessage();
|
||||||
} else if (visibleGraphType.hasData()) {
|
} else if (visibleGraphType.hasData()) {
|
||||||
showGraph();
|
showGraph();
|
||||||
|
@ -358,6 +360,10 @@ public class MtGraphFragment extends BaseCard
|
||||||
defaultRender, currentSearchRequest, defaultSearchRequest);
|
defaultRender, currentSearchRequest, defaultSearchRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isRouteCalculating() {
|
||||||
|
return mtf.isProgressBarVisible();
|
||||||
|
}
|
||||||
|
|
||||||
private static class GraphType {
|
private static class GraphType {
|
||||||
private String title;
|
private String title;
|
||||||
private boolean isCustom;
|
private boolean isCustom;
|
||||||
|
|
Loading…
Reference in a new issue