diff options
author | Winson Chung <winsonc@google.com> | 2011-01-27 16:46:51 -0800 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-01-27 17:35:43 -0800 |
commit | 6e3140865d3f0def2e55934d8b0b2c1503386e54 (patch) | |
tree | 8d24c9e1c76bd5cbd39fb7b394e94a655f583826 /src/com | |
parent | 65af56cf9d8d63e10cf961e1468a5e86d4081405 (diff) | |
download | packages_apps_trebuchet-6e3140865d3f0def2e55934d8b0b2c1503386e54.zip packages_apps_trebuchet-6e3140865d3f0def2e55934d8b0b2c1503386e54.tar.gz packages_apps_trebuchet-6e3140865d3f0def2e55934d8b0b2c1503386e54.tar.bz2 |
Fixes for other places where we expect CellLayoutChildren instead of CellLayout. (3392097)
Change-Id: I9df13c413ce62a2760ce6a8ebafed1e948088de2
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 7 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 14 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index de75fd3..448b766 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -267,6 +267,13 @@ public class CellLayout extends ViewGroup { addView(mChildren); } + public CellLayoutChildren getChildrenLayout() { + if (getChildCount() > 0) { + return (CellLayoutChildren) getChildAt(0); + } + return null; + } + public void setIsDefaultDropTarget(boolean isDefaultDropTarget) { if (mIsDefaultDropTarget != isDefaultDropTarget) { mIsDefaultDropTarget = isDefaultDropTarget; diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 8614865..a5799ae 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -3331,7 +3331,8 @@ public final class Launcher extends Activity int count = workspace.getChildCount(); for (int i = 0; i < count; i++) { // Use removeAllViewsInLayout() to avoid an extra requestLayout() and invalidate(). - ((ViewGroup) workspace.getChildAt(i)).removeAllViewsInLayout(); + final ViewGroup layout = ((CellLayout) workspace.getChildAt(i)).getChildrenLayout(); + layout.removeAllViewsInLayout(); } if (DEBUG_USER_INTERFACE) { diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 7021c6a..4ff9f40 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -60,6 +60,7 @@ import android.view.Display; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; +import android.view.ViewGroup; import android.view.animation.DecelerateInterpolator; import android.widget.TextView; import android.widget.Toast; @@ -376,7 +377,7 @@ public class Workspace extends SmoothPagedView * @return The open folder on the current screen, or null if there is none */ Folder getOpenFolder() { - CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage); + ViewGroup currentPage = ((CellLayout) getChildAt(mCurrentPage)).getChildrenLayout(); int count = currentPage.getChildCount(); for (int i = 0; i < count; i++) { View child = currentPage.getChildAt(i); @@ -394,7 +395,7 @@ public class Workspace extends SmoothPagedView ArrayList<Folder> folders = new ArrayList<Folder>(screenCount); for (int screen = 0; screen < screenCount; screen++) { - CellLayout currentPage = (CellLayout) getChildAt(screen); + ViewGroup currentPage = ((CellLayout) getChildAt(screen)).getChildrenLayout(); int count = currentPage.getChildCount(); for (int i = 0; i < count; i++) { View child = currentPage.getChildAt(i); @@ -2771,7 +2772,7 @@ public class Workspace extends SmoothPagedView public Folder getFolderForTag(Object tag) { final int screenCount = getChildCount(); for (int screen = 0; screen < screenCount; screen++) { - CellLayout currentScreen = ((CellLayout) getChildAt(screen)); + ViewGroup currentScreen = ((CellLayout) getChildAt(screen)).getChildrenLayout(); int count = currentScreen.getChildCount(); for (int i = 0; i < count; i++) { View child = currentScreen.getChildAt(i); @@ -2790,7 +2791,7 @@ public class Workspace extends SmoothPagedView public View getViewForTag(Object tag) { int screenCount = getChildCount(); for (int screen = 0; screen < screenCount; screen++) { - CellLayout currentScreen = ((CellLayout) getChildAt(screen)); + ViewGroup currentScreen = ((CellLayout) getChildAt(screen)).getChildrenLayout(); int count = currentScreen.getChildCount(); for (int i = 0; i < count; i++) { View child = currentScreen.getChildAt(i); @@ -2815,8 +2816,7 @@ public class Workspace extends SmoothPagedView } for (int i = 0; i < screenCount; i++) { - final CellLayoutChildren layout = - (CellLayoutChildren) ((CellLayout) getChildAt(i)).getChildAt(0); + final ViewGroup layout = ((CellLayout) getChildAt(i)).getChildrenLayout(); // Avoid ANRs by treating each screen separately post(new Runnable() { @@ -2921,7 +2921,7 @@ public class Workspace extends SmoothPagedView void updateShortcuts(ArrayList<ApplicationInfo> apps) { final int screenCount = getChildCount(); for (int i = 0; i < screenCount; i++) { - final CellLayout layout = (CellLayout) getChildAt(i); + final ViewGroup layout = ((CellLayout) getChildAt(i)).getChildrenLayout(); int childCount = layout.getChildCount(); for (int j = 0; j < childCount; j++) { final View view = layout.getChildAt(j); |