Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorАлександр Зацепин <az@mapswithme.com>2017-11-01 14:42:15 +0300
committerArsentiy Milchakov <milcars@mapswithme.com>2017-11-01 14:59:17 +0300
commit41741f923c773339e969b6e8128fd4e3775bd1e8 (patch)
tree5f2a89debbfedbac8336f5c05c5c29961f96ab0d
parent9fd1a870cdd1e7a539d6bc33c3124a876571a622 (diff)
[android] Moved subscribing/unsubscribing global map object listeners to onStart/onStop activity methodsbeta-1091
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp2
-rw-r--r--android/src/com/mapswithme/maps/MwmActivity.java8
-rw-r--r--android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java8
3 files changed, 9 insertions, 9 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index fb1d22ce4b..d19a969dee 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -724,6 +724,7 @@ Java_com_mapswithme_maps_Framework_nativeGetParsedSearchRequest(JNIEnv * env, jc
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_Framework_nativeSetMapObjectListener(JNIEnv * env, jclass clazz, jobject jListener)
{
+ LOG(LINFO, ("Set global map object listener"));
g_mapObjectListener = env->NewGlobalRef(jListener);
// void onMapObjectActivated(MapObject object);
jmethodID const activatedId = jni::GetMethodID(env, g_mapObjectListener, "onMapObjectActivated",
@@ -751,6 +752,7 @@ Java_com_mapswithme_maps_Framework_nativeRemoveMapObjectListener(JNIEnv * env, j
return;
frm()->SetMapSelectionListeners({}, {});
+ LOG(LINFO, ("Remove global map object listener"));
env->DeleteGlobalRef(g_mapObjectListener);
}
diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java
index 28c9d57a20..5ce045cc6c 100644
--- a/android/src/com/mapswithme/maps/MwmActivity.java
+++ b/android/src/com/mapswithme/maps/MwmActivity.java
@@ -503,8 +503,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
Statistics.INSTANCE.trackConnectionState();
- Framework.nativeSetMapObjectListener(this);
-
mSearchController = new FloatingSearchToolbarController(this);
mSearchController.setVisibilityListener(this);
SearchEngine.INSTANCE.addListener(this);
@@ -913,14 +911,12 @@ public class MwmActivity extends BaseMwmFragmentActivity
@Override
public void onDestroy()
{
- if (!isInitializationComplete())
+ if (!isInitializationCompleted())
{
super.onDestroy();
return;
}
- // TODO move listeners attach-deattach to onStart-onStop since onDestroy isn't guaranteed.
- Framework.nativeRemoveMapObjectListener();
BottomSheetHelper.free();
SearchEngine.INSTANCE.removeListener(this);
super.onDestroy();
@@ -1178,6 +1174,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
protected void onStart()
{
super.onStart();
+ Framework.nativeSetMapObjectListener(this);
RoutingController.get().attach(this);
if (MapFragment.nativeIsEngineCreated())
LocationHelper.INSTANCE.attach(this);
@@ -1192,6 +1189,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
protected void onStop()
{
super.onStop();
+ Framework.nativeRemoveMapObjectListener();
LocationHelper.INSTANCE.detach(!isFinishing());
RoutingController.get().detach();
TrafficManager.INSTANCE.detachAll();
diff --git a/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java b/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java
index 2c2fe127bf..4f87ba135c 100644
--- a/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java
+++ b/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java
@@ -28,7 +28,7 @@ public class BaseMwmFragmentActivity extends AppCompatActivity
{
private final BaseActivityDelegate mBaseDelegate = new BaseActivityDelegate(this);
- private boolean mInitializationComplete = false;
+ private boolean mInitializationCompleted = false;
@Override
public Activity get()
@@ -60,7 +60,7 @@ public class BaseMwmFragmentActivity extends AppCompatActivity
goToSplashScreen();
return;
}
- mInitializationComplete = true;
+ mInitializationCompleted = true;
mBaseDelegate.onCreate();
super.onCreate(savedInstanceState);
@@ -91,9 +91,9 @@ public class BaseMwmFragmentActivity extends AppCompatActivity
attachDefaultFragment();
}
- protected boolean isInitializationComplete()
+ protected boolean isInitializationCompleted()
{
- return mInitializationComplete;
+ return mInitializationCompleted;
}
@ColorRes