[android] fix: Restart looking for location after MyPosition button pressed.

This commit is contained in:
Alexander Marchuk 2016-05-17 19:36:39 +03:00 committed by Ilya Grechuhin
parent 9616846414
commit 3c08e381ce
3 changed files with 8 additions and 1 deletions

View file

@ -838,6 +838,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
mNavigationController.updateNorth(mLastCompassData.north);
}
public static void enableLocation()
{
sLocationStopped = false;
}
@Override
public void onMyPositionModeChangedCallback(final int newMode, final boolean routingActive)
{

View file

@ -49,7 +49,7 @@ public class LocationPredictor
public void myPositionModeChanged(final int mode)
{
if (mode < LocationState.NOT_FOLLOW)
if (!LocationState.isTurnedOn(mode))
mLastLocation = null;
mGeneratePredictions = (mode == LocationState.FOLLOW_AND_ROTATE);

View file

@ -6,6 +6,7 @@ import android.view.View;
import android.widget.ImageView;
import com.mapswithme.maps.LocationState;
import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.R;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.util.Graphics;
@ -29,6 +30,7 @@ public class MyPositionButton
AlohaHelper.logClick(AlohaHelper.TOOLBAR_MY_POSITION);
if (!LocationState.isTurnedOn())
{
MwmActivity.enableLocation();
LocationHelper.INSTANCE.setShouldResolveErrors(true);
LocationHelper.INSTANCE.restart(); // restart to check location settings again.
}