Loading src/com/android/launcher3/AppsCustomizePagedView.java +1 −5 Original line number Diff line number Diff line Loading @@ -366,11 +366,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // This code triggers requestLayout so must be posted outside of the // layout pass. public void run() { boolean attached = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { attached = isAttachedToWindow(); } if (attached) { if (Utilities.isViewAttachedToWindow(AppsCustomizePagedView.this)) { setDataIsReady(); onDataReady(getMeasuredWidth(), getMeasuredHeight()); } Loading src/com/android/launcher3/Launcher.java +2 −10 Original line number Diff line number Diff line Loading @@ -3597,11 +3597,7 @@ public class Launcher extends Activity for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { boolean attached = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { attached = v.isAttachedToWindow(); } if (attached) v.buildLayer(); if (Utilities.isViewAttachedToWindow(v)) v.buildLayer(); } } } Loading Loading @@ -3877,11 +3873,7 @@ public class Launcher extends Activity for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { boolean attached = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { attached = v.isAttachedToWindow(); } if (attached) v.buildLayer(); if (Utilities.isViewAttachedToWindow(v)) v.buildLayer(); } } } Loading src/com/android/launcher3/Utilities.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.launcher3; import android.annotation.TargetApi; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.ComponentName; Loading @@ -38,6 +39,8 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; import android.os.Build; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.util.Log; import android.util.Pair; import android.util.SparseArray; Loading Loading @@ -495,4 +498,14 @@ public final class Utilities { } return null; } @TargetApi(Build.VERSION_CODES.KITKAT) public static boolean isViewAttachedToWindow(View v) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { return v.isAttachedToWindow(); } else { // A proxy call which returns null, if the view is not attached to the window. return v.getKeyDispatcherState() != null; } } } Loading
src/com/android/launcher3/AppsCustomizePagedView.java +1 −5 Original line number Diff line number Diff line Loading @@ -366,11 +366,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // This code triggers requestLayout so must be posted outside of the // layout pass. public void run() { boolean attached = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { attached = isAttachedToWindow(); } if (attached) { if (Utilities.isViewAttachedToWindow(AppsCustomizePagedView.this)) { setDataIsReady(); onDataReady(getMeasuredWidth(), getMeasuredHeight()); } Loading
src/com/android/launcher3/Launcher.java +2 −10 Original line number Diff line number Diff line Loading @@ -3597,11 +3597,7 @@ public class Launcher extends Activity for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { boolean attached = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { attached = v.isAttachedToWindow(); } if (attached) v.buildLayer(); if (Utilities.isViewAttachedToWindow(v)) v.buildLayer(); } } } Loading Loading @@ -3877,11 +3873,7 @@ public class Launcher extends Activity for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { boolean attached = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { attached = v.isAttachedToWindow(); } if (attached) v.buildLayer(); if (Utilities.isViewAttachedToWindow(v)) v.buildLayer(); } } } Loading
src/com/android/launcher3/Utilities.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.launcher3; import android.annotation.TargetApi; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.ComponentName; Loading @@ -38,6 +39,8 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; import android.os.Build; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.util.Log; import android.util.Pair; import android.util.SparseArray; Loading Loading @@ -495,4 +498,14 @@ public final class Utilities { } return null; } @TargetApi(Build.VERSION_CODES.KITKAT) public static boolean isViewAttachedToWindow(View v) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { return v.isAttachedToWindow(); } else { // A proxy call which returns null, if the view is not attached to the window. return v.getKeyDispatcherState() != null; } } }