Fix save button visibility

This commit is contained in:
PavelRatushny 2017-08-11 18:50:41 +03:00
parent 1392d73e07
commit 92a6e7932b
2 changed files with 15 additions and 3 deletions

View file

@ -829,6 +829,9 @@ public class MeasurementToolFragment extends Fragment {
setBgIds(R.drawable.gradient_toolbar, R.drawable.gradient_toolbar, setBgIds(R.drawable.gradient_toolbar, R.drawable.gradient_toolbar,
R.drawable.gradient_toolbar, R.drawable.gradient_toolbar); R.drawable.gradient_toolbar, R.drawable.gradient_toolbar);
setCloseBtnVisible(false); setCloseBtnVisible(false);
if (newGpxLine != null) {
setSaveViewVisible(true);
}
setBackBtnIconIds(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_dark); setBackBtnIconIds(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_dark);
setSingleLineTitle(false); setSingleLineTitle(false);
} }
@ -837,9 +840,6 @@ public class MeasurementToolFragment extends Fragment {
public void updateToolbar(MapInfoWidgetsFactory.TopToolbarView view) { public void updateToolbar(MapInfoWidgetsFactory.TopToolbarView view) {
super.updateToolbar(view); super.updateToolbar(view);
view.getShadowView().setVisibility(View.GONE); view.getShadowView().setVisibility(View.GONE);
if (newGpxLine != null) {
view.getSaveView().setVisibility(View.VISIBLE);
}
} }
} }
} }

View file

@ -230,6 +230,7 @@ public class MapInfoWidgetsFactory {
int refreshBtnIconClrLightId = R.color.icon_color; int refreshBtnIconClrLightId = R.color.icon_color;
int refreshBtnIconClrDarkId = 0; int refreshBtnIconClrDarkId = 0;
boolean refreshBtnVisible = false; boolean refreshBtnVisible = false;
boolean saveViewVisible = false;
int titleTextClrLightId = R.color.primary_text_light; int titleTextClrLightId = R.color.primary_text_light;
int titleTextClrDarkId = R.color.primary_text_dark; int titleTextClrDarkId = R.color.primary_text_dark;
@ -322,6 +323,10 @@ public class MapInfoWidgetsFactory {
this.refreshBtnVisible = visible; this.refreshBtnVisible = visible;
} }
public void setSaveViewVisible(boolean visible) {
this.saveViewVisible = visible;
}
public void setTitleTextClrIds(int titleTextClrLightId, int titleTextClrDarkId) { public void setTitleTextClrIds(int titleTextClrLightId, int titleTextClrDarkId) {
this.titleTextClrLightId = titleTextClrLightId; this.titleTextClrLightId = titleTextClrLightId;
this.titleTextClrDarkId = titleTextClrDarkId; this.titleTextClrDarkId = titleTextClrDarkId;
@ -609,6 +614,13 @@ public class MapInfoWidgetsFactory {
} else if (refreshButton.getVisibility() == View.VISIBLE) { } else if (refreshButton.getVisibility() == View.VISIBLE) {
refreshButton.setVisibility(View.GONE); refreshButton.setVisibility(View.GONE);
} }
if (controller.saveViewVisible) {
if (saveView.getVisibility() == View.GONE) {
saveView.setVisibility(View.VISIBLE);
}
} else if (saveView.getVisibility() == View.VISIBLE) {
saveView.setVisibility(View.GONE);
}
} }
public void updateColors() { public void updateColors() {