[android] Skip location centering when activity is resumed.

This commit is contained in:
vng 2012-09-24 16:11:15 +03:00 committed by Alex Zolotarev
parent f6a0998f6e
commit 7760bc5ef5
2 changed files with 15 additions and 4 deletions

View file

@ -218,4 +218,11 @@ extern "C"
return false;
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_MWMActivity_nativeSkipLocationCentering(JNIEnv * env, jobject thiz)
{
g_framework->NativeFramework()->SkipLocationCentering();
}
} // extern "C"

View file

@ -586,11 +586,14 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
@Override
protected void onResume()
{
View button = findViewById(R.id.map_button_myposition);
if (button.isSelected())
final View v = findViewById(R.id.map_button_myposition);
if (v != null && v.isSelected())
{
// Change button appearance to "looking for position"
button.setBackgroundResource(R.drawable.myposition_button_normal);
// change button appearance to "looking for position"
v.setBackgroundResource(R.drawable.myposition_button_normal);
// do not move map's viewport to a location when this activity is resumed
nativeSkipLocationCentering();
// and remember to start locationService updates in OnRenderingInitialized
m_shouldStartLocationService = true;
@ -774,4 +777,5 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
private native void nativeCheckForProVersion(String serverURL);
private native boolean nativeIsInChina(double lat, double lon);
private native void nativeSkipLocationCentering();
}