diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 97518a5c59..ef83f27367 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -1600,7 +1600,7 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) { // 2. When long clicking on an empty cell in a CellLayout, we save information about the // cellX and cellY coordinates and which page was clicked. We then set this as a tag on // the CellLayout that was long clicked - static final class CellInfo implements ContextMenu.ContextMenuInfo { + static final class CellInfo { View cell; int cellX = -1; int cellY = -1; diff --git a/src/com/android/launcher2/ShortcutsAdapter.java b/src/com/android/launcher2/ShortcutsAdapter.java index 93c500a44f..de73c3e3a5 100644 --- a/src/com/android/launcher2/ShortcutsAdapter.java +++ b/src/com/android/launcher2/ShortcutsAdapter.java @@ -30,7 +30,7 @@ import com.android.launcher.R; /** * GridView adapter to show the list of applications and shortcuts */ -public class ShortcutsAdapter extends ArrayAdapter { +public class ShortcutsAdapter extends ArrayAdapter { private final LayoutInflater mInflater; private final IconCache mIconCache; diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 61a0e48946..ac5e5107aa 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -341,58 +341,41 @@ public class Workspace extends SmoothPagedView } } - @Override - public void addView(View child, int index, LayoutParams params) { + private void onAddView(View child) { if (!(child instanceof CellLayout)) { throw new IllegalArgumentException("A Workspace can only have CellLayout children."); } ((CellLayout) child).setOnInterceptTouchListener(this); child.setOnClickListener(this); child.setClickable(true); + } + @Override + public void addView(View child, int index, LayoutParams params) { + onAddView(child); super.addView(child, index, params); } @Override public void addView(View child) { - if (!(child instanceof CellLayout)) { - throw new IllegalArgumentException("A Workspace can only have CellLayout children."); - } - ((CellLayout) child).setOnInterceptTouchListener(this); - child.setOnClickListener(this); - child.setClickable(true); + onAddView(child); super.addView(child); } @Override public void addView(View child, int index) { - if (!(child instanceof CellLayout)) { - throw new IllegalArgumentException("A Workspace can only have CellLayout children."); - } - ((CellLayout) child).setOnInterceptTouchListener(this); - child.setOnClickListener(this); - child.setClickable(true); + onAddView(child); super.addView(child, index); } @Override public void addView(View child, int width, int height) { - if (!(child instanceof CellLayout)) { - throw new IllegalArgumentException("A Workspace can only have CellLayout children."); - } - ((CellLayout) child).setOnInterceptTouchListener(this); - child.setOnClickListener(this); - child.setClickable(true); + onAddView(child); super.addView(child, width, height); } @Override public void addView(View child, LayoutParams params) { - if (!(child instanceof CellLayout)) { - throw new IllegalArgumentException("A Workspace can only have CellLayout children."); - } - ((CellLayout) child).setOnInterceptTouchListener(this); - child.setOnClickListener(this); - child.setClickable(true); + onAddView(child); super.addView(child, params); }