am 6e314086: Fixes for other places where we expect CellLayoutChildren instead of CellLayout. (3392097)

* commit '6e3140865d3f0def2e55934d8b0b2c1503386e54':
  Fixes for other places where we expect CellLayoutChildren instead of CellLayout. (3392097)
This commit is contained in:
Winson Chung
2011-01-27 18:26:29 -08:00
committed by Android Git Automerger
3 changed files with 16 additions and 8 deletions
@@ -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;
+2 -1
View File
@@ -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) {
+7 -7
View File
@@ -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);