diff options
author | Michael Jurka <mikejurka@google.com> | 2011-04-11 13:27:46 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-04-12 16:26:40 -0700 |
commit | e5fb0f27bca7afb996258a7163c76ca7390d7bff (patch) | |
tree | c70afef8c5591b9d3f0e63938d1c7bbe87be2b3e | |
parent | 8842d535408818aa10be66339d977a3589337d92 (diff) | |
download | android_packages_apps_Trebuchet-e5fb0f27bca7afb996258a7163c76ca7390d7bff.tar.gz android_packages_apps_Trebuchet-e5fb0f27bca7afb996258a7163c76ca7390d7bff.tar.bz2 android_packages_apps_Trebuchet-e5fb0f27bca7afb996258a7163c76ca7390d7bff.zip |
Minor cleanup and refactoring
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/ShortcutsAdapter.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 35 |
3 files changed, 11 insertions, 28 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 97518a5c5..ef83f2736 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 93c500a44..de73c3e3a 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<ShortcutInfo> { +public class ShortcutsAdapter extends ArrayAdapter<ShortcutInfo> { 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 61a0e4894..ac5e5107a 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); } |