Merge pull request #6396 from alexzatsepin/MAPSME-4787-change-use-current-location-button

[android] Added hiding the USE button if location is not determined
This commit is contained in:
Roman Romanov 2017-06-27 07:55:07 +04:00 committed by GitHub
commit 8b72b202bb
3 changed files with 21 additions and 5 deletions

View file

@ -1945,6 +1945,10 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
if (mNavMyPosition != null)
mNavMyPosition.update(newMode);
RoutingController controller = RoutingController.get();
if (controller.isPlanning())
showAddStartOrFinishFrame(controller, true);
}
@Override

View file

@ -177,12 +177,20 @@ final class RoutingBottomMenuController implements View.OnClickListener
void showAddStartFrame()
{
UiUtils.show(mActionFrame, mActionButton);
UiUtils.show(mActionFrame);
mActionMessage.setText(R.string.routing_add_start_point);
Drawable icon = ContextCompat.getDrawable(mContext, R.drawable.ic_my_location);
int colorAccent = ContextCompat.getColor(mContext,
UiUtils.getStyledResourceId(mContext, R.attr.colorAccent));
mActionIcon.setImageDrawable(Graphics.tint(icon, colorAccent));
if (LocationHelper.INSTANCE.getMyPosition() != null)
{
UiUtils.show(mActionButton);
Drawable icon = ContextCompat.getDrawable(mContext, R.drawable.ic_my_location);
int colorAccent = ContextCompat.getColor(mContext,
UiUtils.getStyledResourceId(mContext, R.attr.colorAccent));
mActionIcon.setImageDrawable(Graphics.tint(icon, colorAccent));
}
else
{
UiUtils.hide(mActionButton);
}
}
void showAddFinishFrame()

View file

@ -672,6 +672,8 @@ public class RoutingController
Framework.nativeAddRoutePoint("", RoutePointInfo.ROUTE_MARK_START, 0,
MapObject.isOfType(MapObject.MY_POSITION, mStartPoint),
mStartPoint.getLat(), mStartPoint.getLon());
if (mContainer != null)
mContainer.updateMenu();
}
if (mEndPoint == null)
@ -683,6 +685,8 @@ public class RoutingController
Framework.nativeAddRoutePoint("", RoutePointInfo.ROUTE_MARK_FINISH, 0,
MapObject.isOfType(MapObject.MY_POSITION, mEndPoint),
mEndPoint.getLat(), mEndPoint.getLon());
if (mContainer != null)
mContainer.updateMenu();
}
}