fixed minor code review issues from change I0280c3be
(it was submitted early accidentally)
Change-Id: I3753366b4d5e1dc228baf02eba27a2c0d8fa42cf
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 19b5852..62e32d2 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -490,7 +490,7 @@
}
@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 @@
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 @@
markCellsAsUnoccupiedForView(ignoreView);
}
+ boolean foundCell = false;
while (true) {
int startX = 0;
if (intersectX >= 0) {
@@ -836,10 +836,8 @@
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 @@
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 5be78f9..019cd7b 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -655,7 +655,8 @@
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 @@
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 7db321b..74b0217 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 @@
*/
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 f9fcd02..9dbe61d 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -334,7 +334,7 @@
}
@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 8f16300..1934cd5 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -432,7 +432,7 @@
}
@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