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:
authorDmitry Yunitsky <yunik@mapswithme.com>2015-09-02 20:46:18 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:03:46 +0300
commit2e565ef2d7a86a51c5d1fdef7749547556fe18d0 (patch)
treea136fe1f729752c40faff848cb8e6f4eb8a5c892 /android
parentba2ff2fb90844cd72f5f6b7ce9b173990d7bca65 (diff)
[android] Fixed crash with dead ViewTreeObserver.
Diffstat (limited to 'android')
-rw-r--r--android/src/com/mapswithme/util/UiUtils.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/android/src/com/mapswithme/util/UiUtils.java b/android/src/com/mapswithme/util/UiUtils.java
index 8c86f91cc5..a5ed0adb8f 100644
--- a/android/src/com/mapswithme/util/UiUtils.java
+++ b/android/src/com/mapswithme/util/UiUtils.java
@@ -71,19 +71,19 @@ public final class UiUtils
}
- public static void waitLayout(View view, @NonNull final ViewTreeObserver.OnGlobalLayoutListener callback)
+ public static void waitLayout(final View view, @NonNull final ViewTreeObserver.OnGlobalLayoutListener callback)
{
- final ViewTreeObserver observer = view.getViewTreeObserver();
- observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
+ view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
{
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout()
{
+ // viewTreeObserver can be dead(isAlive() == false), we should get a new one here.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
- observer.removeGlobalOnLayoutListener(this);
+ view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
else
- observer.removeOnGlobalLayoutListener(this);
+ view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
callback.onGlobalLayout();
}