From 28750fba6a2d141eb9a1e566718c17236030b815 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Fri, 24 Sep 2010 17:43:49 -0700 Subject: fixed minor code review issues from change I0280c3be (it was submitted early accidentally) Change-Id: I3753366b4d5e1dc228baf02eba27a2c0d8fa42cf --- src/com/android/launcher2/CellLayout.java | 20 +++++++++----------- src/com/android/launcher2/Launcher.java | 6 ++++-- src/com/android/launcher2/LiveFolderInfo.java | 3 --- src/com/android/launcher2/PagedView.java | 2 +- src/com/android/launcher2/Workspace.java | 2 +- 5 files changed, 15 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 19b58529b..62e32d254 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -490,7 +490,7 @@ public class CellLayout extends ViewGroup { } @Override - public void onLayout(boolean changed, int l, int t, int r, int b) { + protected void onLayout(boolean changed, int l, int t, int r, int b) { int count = getChildCount(); for (int i = 0; i < count; i++) { @@ -578,18 +578,17 @@ public class CellLayout extends ViewGroup { if (ignoreView != null) { markCellsAsUnoccupiedForView(ignoreView); } + boolean isVacant = true; for (int i = 0; i < spanY; i++) { if (!isRowEmpty(originY + i, originX, originX + spanX - 1, mOccupied)) { - if (ignoreView != null) { - markCellsAsOccupiedForView(ignoreView); - } - return false; + isVacant = false; + break; } } if (ignoreView != null) { markCellsAsOccupiedForView(ignoreView); } - return true; + return isVacant; } private boolean isVacant(int originX, int originY, int spanX, int spanY) { @@ -801,6 +800,7 @@ public class CellLayout extends ViewGroup { markCellsAsUnoccupiedForView(ignoreView); } + boolean foundCell = false; while (true) { int startX = 0; if (intersectX >= 0) { @@ -836,10 +836,8 @@ public class CellLayout extends ViewGroup { cellXY[0] = x; cellXY[1] = y; } - if (ignoreView != null) { - markCellsAsOccupiedForView(ignoreView); - } - return true; + foundCell = true; + break; } } if (intersectX == -1 && intersectY == -1) { @@ -856,7 +854,7 @@ public class CellLayout extends ViewGroup { if (ignoreView != null) { markCellsAsOccupiedForView(ignoreView); } - return false; + return foundCell; } /** diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 5be78f97f..019cd7b33 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -655,7 +655,8 @@ public final class Launcher extends Activity if (resultCode == RESULT_OK && mAddScreen != -1) { switch (requestCode) { case REQUEST_PICK_APPLICATION: - completeAddApplication(this, data, mAddScreen, mAddIntersectCellX, mAddIntersectCellY); + completeAddApplication( + this, data, mAddScreen, mAddIntersectCellX, mAddIntersectCellY); break; case REQUEST_PICK_SHORTCUT: processShortcut(data); @@ -1532,7 +1533,8 @@ public final class Launcher extends Activity sFolders.remove(folder.id); } - private void completeAddLiveFolder(Intent data, int screen, int intersectCellX, int intersectCellY) { + private void completeAddLiveFolder( + Intent data, int screen, int intersectCellX, int intersectCellY) { final CellLayout layout = (CellLayout) mWorkspace.getChildAt(screen); final int[] cellXY = mTmpAddItemCellCoordinates; if (!layout.findCellForSpanThatIntersects(cellXY, 1, 1, intersectCellX, intersectCellY)) { diff --git a/src/com/android/launcher2/LiveFolderInfo.java b/src/com/android/launcher2/LiveFolderInfo.java index 7db321b59..74b021758 100644 --- a/src/com/android/launcher2/LiveFolderInfo.java +++ b/src/com/android/launcher2/LiveFolderInfo.java @@ -16,7 +16,6 @@ package com.android.launcher2; -import android.content.ComponentName; import android.content.ContentValues; import android.content.Intent; import android.graphics.Bitmap; @@ -29,8 +28,6 @@ class LiveFolderInfo extends FolderInfo { */ Intent baseIntent; - ComponentName componentName; - /** * The live folder's content uri. */ diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index f9fcd0291..9dbe61d11 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -334,7 +334,7 @@ public abstract class PagedView extends ViewGroup { } @Override - public void onLayout(boolean changed, int left, int top, int right, int bottom) { + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { setHorizontalScrollBarEnabled(false); int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 8f1630076..1934cd5bb 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -432,7 +432,7 @@ public class Workspace extends SmoothPagedView } @Override - public void onLayout(boolean changed, int left, int top, int right, int bottom) { + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // if shrinkToBottom() is called on initialization, it has to be deferred -- cgit v1.2.3