blob: 8d4ddba7fe3e1ff7247177ee6c015bd4d8815c55 [file] [log] [blame]
Winson Chung321e9ee2010-08-09 13:37:56 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.launcher2;
18
Michael Jurkaaf91de02010-11-23 16:23:58 -080019import com.android.launcher.R;
Winson Chung321e9ee2010-08-09 13:37:56 -070020
21import android.content.ComponentName;
22import android.content.Context;
23import android.content.res.TypedArray;
Winson Chung321e9ee2010-08-09 13:37:56 -070024import android.util.AttributeSet;
25import android.view.LayoutInflater;
26import android.view.View;
Winson Chung321e9ee2010-08-09 13:37:56 -070027import android.view.animation.AnimationUtils;
Winson Chung5f2aa4e2010-08-20 14:49:25 -070028import android.widget.Checkable;
Winson Chung321e9ee2010-08-09 13:37:56 -070029import android.widget.TextView;
30
Michael Jurkaaf91de02010-11-23 16:23:58 -080031import java.util.ArrayList;
32import java.util.Collections;
33import java.util.HashSet;
Winson Chung321e9ee2010-08-09 13:37:56 -070034
35/**
36 * An implementation of PagedView that populates the pages of the workspace
37 * with all of the user's applications.
38 */
39public class AllAppsPagedView extends PagedView
Winson Chung5f2aa4e2010-08-20 14:49:25 -070040 implements AllAppsView, View.OnClickListener, View.OnLongClickListener, DragSource,
Adam Cohencdc30d52010-12-01 15:09:47 -080041 DropTarget {
Winson Chung321e9ee2010-08-09 13:37:56 -070042
43 private static final String TAG = "AllAppsPagedView";
44 private static final boolean DEBUG = false;
45
46 private Launcher mLauncher;
47 private DragController mDragController;
48
49 // preserve compatibility with 3D all apps:
50 // 0.0 -> hidden
51 // 1.0 -> shown and opaque
52 // intermediate values -> partially shown & partially opaque
53 private float mZoom;
54
55 // set of all applications
56 private ArrayList<ApplicationInfo> mApps;
57 private ArrayList<ApplicationInfo> mFilteredApps;
58
59 // the types of applications to filter
60 static final int ALL_APPS_FLAG = -1;
61 private int mAppFilter = ALL_APPS_FLAG;
62
Winson Chung321e9ee2010-08-09 13:37:56 -070063 private final LayoutInflater mInflater;
64
Patrick Dubroydea9e932010-09-22 15:04:29 -070065
Winson Chung321e9ee2010-08-09 13:37:56 -070066 public AllAppsPagedView(Context context) {
67 this(context, null);
68 }
69
70 public AllAppsPagedView(Context context, AttributeSet attrs) {
71 this(context, attrs, 0);
72 }
73
74 public AllAppsPagedView(Context context, AttributeSet attrs, int defStyle) {
75 super(context, attrs, defStyle);
76 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, defStyle, 0);
77 mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 6);
78 mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4);
79 mInflater = LayoutInflater.from(context);
80 a.recycle();
81 setSoundEffectsEnabled(false);
82 }
83
84 @Override
Winson Chung7da10252010-10-28 16:07:04 -070085 protected void init() {
86 super.init();
87 mCenterPagesVertically = false;
88 }
89
90 @Override
Winson Chung321e9ee2010-08-09 13:37:56 -070091 public void setLauncher(Launcher launcher) {
92 mLauncher = launcher;
Patrick Dubroy2b9ff372010-09-07 17:49:27 -070093 mLauncher.setAllAppsPagedView(this);
Winson Chung321e9ee2010-08-09 13:37:56 -070094 }
95
96 @Override
97 public void setDragController(DragController dragger) {
98 mDragController = dragger;
99 }
100
101 public void setAppFilter(int filterType) {
102 mAppFilter = filterType;
Winson Chung80baf5a2010-08-09 16:03:15 -0700103 if (mApps != null) {
104 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung86f77532010-08-24 11:08:22 -0700105 setCurrentPage(0);
Winson Chung80baf5a2010-08-09 16:03:15 -0700106 invalidatePageData();
107 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700108 }
109
110 @Override
111 public void zoom(float zoom, boolean animate) {
112 mZoom = zoom;
113 cancelLongPress();
114
115 if (isVisible()) {
116 getParent().bringChildToFront(this);
117 setVisibility(View.VISIBLE);
118 if (animate) {
119 startAnimation(AnimationUtils.loadAnimation(getContext(),
120 R.anim.all_apps_2d_fade_in));
121 } else {
122 onAnimationEnd();
123 }
124 } else {
125 if (animate) {
126 startAnimation(AnimationUtils.loadAnimation(getContext(),
127 R.anim.all_apps_2d_fade_out));
128 } else {
129 onAnimationEnd();
130 }
131 }
132 }
133
134 protected void onAnimationEnd() {
135 if (!isVisible()) {
136 setVisibility(View.GONE);
137 mZoom = 0.0f;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700138
139 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700140 } else {
141 mZoom = 1.0f;
142 }
143
144 if (mLauncher != null)
145 mLauncher.zoomed(mZoom);
146 }
147
148 private int getChildIndexForGrandChild(View v) {
149 final int childCount = getChildCount();
150 for (int i = 0; i < childCount; ++i) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700151 final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(i);
Winson Chung321e9ee2010-08-09 13:37:56 -0700152 if (layout.indexOfChild(v) > -1) {
153 return i;
154 }
155 }
156 return -1;
157 }
158
159 @Override
160 public void onClick(View v) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700161 // if we are already in a choice mode, then just change the selection
162 if (v instanceof Checkable) {
163 if (!isChoiceMode(CHOICE_MODE_NONE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700164 Checkable c = (Checkable) v;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700165 if (isChoiceMode(CHOICE_MODE_SINGLE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700166 // Uncheck all the other grandchildren, and toggle the clicked one
167 boolean wasChecked = c.isChecked();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700168 resetCheckedGrandchildren();
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700169 c.setChecked(!wasChecked);
170 } else {
171 c.toggle();
172 }
173 if (getCheckedGrandchildren().size() == 0) {
174 endChoiceMode();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700175 }
176
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700177 return;
178 }
179 }
180
181 // otherwise continue and launch the application
Winson Chung321e9ee2010-08-09 13:37:56 -0700182 int childIndex = getChildIndexForGrandChild(v);
Winson Chung86f77532010-08-24 11:08:22 -0700183 if (childIndex == getCurrentPage()) {
Winson Chung321e9ee2010-08-09 13:37:56 -0700184 final ApplicationInfo app = (ApplicationInfo) v.getTag();
185
Winson Chung80baf5a2010-08-09 16:03:15 -0700186 // animate some feedback to the click
187 animateClickFeedback(v, new Runnable() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700188 @Override
Winson Chung80baf5a2010-08-09 16:03:15 -0700189 public void run() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700190 mLauncher.startActivitySafely(app.intent, app);
191 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700192 });
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700193
194 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700195 }
196 }
197
Adam Cohencdc30d52010-12-01 15:09:47 -0800198 private void setupDragMode() {
Michael Jurkaaf91de02010-11-23 16:23:58 -0800199 mLauncher.getWorkspace().shrink(Workspace.ShrinkState.BOTTOM_VISIBLE);
Adam Cohencdc30d52010-12-01 15:09:47 -0800200
201 ApplicationInfoDropTarget infoButton =
202 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
203 infoButton.setDragAndDropEnabled(false);
204 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
205 deleteZone.setDragAndDropEnabled(false);
206
207 ApplicationInfoDropTarget allAppsInfoButton =
208 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
209 allAppsInfoButton.setDragAndDropEnabled(true);
210 DeleteZone allAppsDeleteZone = (DeleteZone)
211 mLauncher.findViewById(R.id.all_apps_delete_zone);
212 allAppsDeleteZone.setDragAndDropEnabled(true);
213 }
214
215 private void tearDownDragMode() {
216 post(new Runnable() {
217 // Once the drag operation has fully completed, hence the post, we want to disable the
218 // deleteZone and the appInfoButton in all apps, and re-enable the instance which
219 // live in the workspace
220 public void run() {
221 ApplicationInfoDropTarget infoButton =
222 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
223 infoButton.setDragAndDropEnabled(true);
224 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
225 deleteZone.setDragAndDropEnabled(true);
226
227 ApplicationInfoDropTarget allAppsInfoButton =
228 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
229 allAppsInfoButton.setDragAndDropEnabled(false);
230 DeleteZone allAppsDeleteZone =
231 (DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone);
232 allAppsDeleteZone.setDragAndDropEnabled(false);
233 }
234 });
235 resetCheckedGrandchildren();
236 mDragController.removeDropTarget(this);
237 }
238
Winson Chung321e9ee2010-08-09 13:37:56 -0700239 @Override
240 public boolean onLongClick(View v) {
241 if (!v.isInTouchMode()) {
242 return false;
243 }
244
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700245 if (v instanceof Checkable) {
246 // In preparation for drag, we always reset the checked grand children regardless of
247 // what choice mode we are in
248 resetCheckedGrandchildren();
249
250 // Toggle the selection on the dragged app
251 Checkable c = (Checkable) v;
252 c.toggle();
253 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700254
Adam Cohencdc30d52010-12-01 15:09:47 -0800255 // Start drag mode after the item is selected
256 setupDragMode();
Patrick Dubroy430c53b2010-09-08 16:01:19 -0700257
Winson Chung321e9ee2010-08-09 13:37:56 -0700258 ApplicationInfo app = (ApplicationInfo) v.getTag();
259 app = new ApplicationInfo(app);
260
Michael Jurka3e7c7632010-10-02 16:01:03 -0700261 mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1);
Winson Chung321e9ee2010-08-09 13:37:56 -0700262 mDragController.startDrag(v, this, app, DragController.DRAG_ACTION_COPY);
Winson Chung321e9ee2010-08-09 13:37:56 -0700263 return true;
264 }
265
266 @Override
Patrick Dubroya669d792010-11-23 14:40:33 -0800267 public void onDragViewVisible() {
268 }
269
270 @Override
Winson Chung321e9ee2010-08-09 13:37:56 -0700271 public void onDropCompleted(View target, boolean success) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700272 // close the choice action mode if we have a proper drop
273 if (target != this) {
274 endChoiceMode();
275 }
Adam Cohencdc30d52010-12-01 15:09:47 -0800276 tearDownDragMode();
Michael Jurka3e7c7632010-10-02 16:01:03 -0700277 mLauncher.getWorkspace().onDragStopped();
Winson Chung321e9ee2010-08-09 13:37:56 -0700278 }
279
280 @Override
281 public boolean isVisible() {
282 return mZoom > 0.001f;
283 }
284
285 @Override
286 public boolean isAnimating() {
287 return (getAnimation() != null);
288 }
289
290 private ArrayList<ApplicationInfo> rebuildFilteredApps(ArrayList<ApplicationInfo> apps) {
291 ArrayList<ApplicationInfo> filteredApps = new ArrayList<ApplicationInfo>();
292 if (mAppFilter == ALL_APPS_FLAG) {
293 return apps;
294 } else {
295 final int length = apps.size();
296 for (int i = 0; i < length; ++i) {
297 ApplicationInfo info = apps.get(i);
298 if ((info.flags & mAppFilter) > 0) {
299 filteredApps.add(info);
300 }
301 }
302 }
303 return filteredApps;
304 }
305
306 @Override
307 public void setApps(ArrayList<ApplicationInfo> list) {
308 mApps = list;
Winson Chung80baf5a2010-08-09 16:03:15 -0700309 Collections.sort(mApps, LauncherModel.APP_NAME_COMPARATOR);
Winson Chung321e9ee2010-08-09 13:37:56 -0700310 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung241c3b42010-08-25 16:53:03 -0700311 mPageViewIconCache.clear();
Winson Chung321e9ee2010-08-09 13:37:56 -0700312 invalidatePageData();
313 }
314
Winson Chung80baf5a2010-08-09 16:03:15 -0700315 private void addAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
316 // we add it in place, in alphabetical order
317 final int count = list.size();
318 for (int i = 0; i < count; ++i) {
319 final ApplicationInfo info = list.get(i);
320 final int index = Collections.binarySearch(mApps, info, LauncherModel.APP_NAME_COMPARATOR);
321 if (index < 0) {
322 mApps.add(-(index + 1), info);
323 }
324 }
325 mFilteredApps = rebuildFilteredApps(mApps);
326 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700327 @Override
328 public void addApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700329 addAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700330 invalidatePageData();
331 }
332
Winson Chung80baf5a2010-08-09 16:03:15 -0700333 private void removeAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
Winson Chung10fefb12010-11-01 11:57:06 -0700334 // End the choice mode if any of the items in the list that are being removed are
335 // currently selected
336 ArrayList<Checkable> checkedList = getCheckedGrandchildren();
337 HashSet<ApplicationInfo> checkedAppInfos = new HashSet<ApplicationInfo>();
338 for (Checkable checked : checkedList) {
339 PagedViewIcon icon = (PagedViewIcon) checked;
340 checkedAppInfos.add((ApplicationInfo) icon.getTag());
341 }
342 for (ApplicationInfo info : list) {
343 if (checkedAppInfos.contains(info)) {
344 endChoiceMode();
345 break;
346 }
347 }
348
349 // Loop through all the apps and remove apps that have the same component
Winson Chung321e9ee2010-08-09 13:37:56 -0700350 final int length = list.size();
351 for (int i = 0; i < length; ++i) {
Winson Chung241c3b42010-08-25 16:53:03 -0700352 final ApplicationInfo info = list.get(i);
353 int removeIndex = findAppByComponent(mApps, info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700354 if (removeIndex > -1) {
355 mApps.remove(removeIndex);
Winson Chung241c3b42010-08-25 16:53:03 -0700356 mPageViewIconCache.removeOutline(info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700357 }
358 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700359 mFilteredApps = rebuildFilteredApps(mApps);
360 }
361 @Override
362 public void removeApps(ArrayList<ApplicationInfo> list) {
363 removeAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700364 invalidatePageData();
365 }
366
367 @Override
368 public void updateApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700369 removeAppsWithoutInvalidate(list);
370 addAppsWithoutInvalidate(list);
371 invalidatePageData();
Winson Chung321e9ee2010-08-09 13:37:56 -0700372 }
373
374 private int findAppByComponent(ArrayList<ApplicationInfo> list, ApplicationInfo item) {
375 ComponentName removeComponent = item.intent.getComponent();
376 final int length = list.size();
377 for (int i = 0; i < length; ++i) {
378 ApplicationInfo info = list.get(i);
379 if (info.intent.getComponent().equals(removeComponent)) {
380 return i;
381 }
382 }
383 return -1;
384 }
385
386 @Override
387 public void dumpState() {
388 ApplicationInfo.dumpApplicationInfoList(TAG, "mApps", mApps);
389 }
390
391 @Override
392 public void surrender() {
393 // do nothing?
394 }
395
396 @Override
397 public void syncPages() {
Winson Chung96785572010-10-14 13:37:13 -0700398 // ensure that we have the right number of pages (min of 1, since we have placeholders)
399 int numPages = Math.max(1,
400 (int) Math.ceil((float) mFilteredApps.size() / (mCellCountX * mCellCountY)));
Winson Chung321e9ee2010-08-09 13:37:56 -0700401 int curNumPages = getChildCount();
402 // remove any extra pages after the "last" page
403 int extraPageDiff = curNumPages - numPages;
404 for (int i = 0; i < extraPageDiff; ++i) {
405 removeViewAt(numPages);
406 }
407 // add any necessary pages
408 for (int i = curNumPages; i < numPages; ++i) {
409 PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
410 layout.setCellCount(mCellCountX, mCellCountY);
Winson Chung5ffd8ea2010-09-23 18:40:29 -0700411 layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
412 mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
Winson Chungdf4b83d2010-10-20 17:49:27 -0700413 layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
Winson Chung321e9ee2010-08-09 13:37:56 -0700414 addView(layout);
415 }
416
417 // bound the current page
Winson Chung86f77532010-08-24 11:08:22 -0700418 setCurrentPage(Math.max(0, Math.min(numPages - 1, getCurrentPage())));
Winson Chung321e9ee2010-08-09 13:37:56 -0700419 }
420
421 @Override
422 public void syncPageItems(int page) {
Winson Chung96785572010-10-14 13:37:13 -0700423 // Ensure that we have the right number of items on the pages
Winson Chung80baf5a2010-08-09 16:03:15 -0700424 final int cellsPerPage = mCellCountX * mCellCountY;
425 final int startIndex = page * cellsPerPage;
426 final int endIndex = Math.min(startIndex + cellsPerPage, mFilteredApps.size());
Winson Chung321e9ee2010-08-09 13:37:56 -0700427 PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page);
Winson Chung80baf5a2010-08-09 16:03:15 -0700428
Winson Chung96785572010-10-14 13:37:13 -0700429 if (!mFilteredApps.isEmpty()) {
430 int curNumPageItems = layout.getChildCount();
431 int numPageItems = endIndex - startIndex;
Winson Chung80baf5a2010-08-09 16:03:15 -0700432
Winson Chung96785572010-10-14 13:37:13 -0700433 // If we were previously an empty page, then restart anew
434 boolean wasEmptyPage = false;
435 if (curNumPageItems == 1) {
436 View icon = layout.getChildAt(0);
437 if (icon.getTag() == null) {
438 wasEmptyPage = true;
439 }
440 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700441
Winson Chung96785572010-10-14 13:37:13 -0700442 if (wasEmptyPage) {
443 // Remove all the previous items
444 curNumPageItems = 0;
445 layout.removeAllViews();
446 } else {
447 // Remove any extra items
448 int extraPageItemsDiff = curNumPageItems - numPageItems;
449 for (int i = 0; i < extraPageItemsDiff; ++i) {
450 layout.removeViewAt(numPageItems);
451 }
452 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700453
Winson Chung96785572010-10-14 13:37:13 -0700454 // Add any necessary items
455 for (int i = curNumPageItems; i < numPageItems; ++i) {
456 TextView text = (TextView) mInflater.inflate(
457 R.layout.all_apps_paged_view_application, layout, false);
458 text.setOnClickListener(this);
459 text.setOnLongClickListener(this);
Winson Chung321e9ee2010-08-09 13:37:56 -0700460
Winson Chung96785572010-10-14 13:37:13 -0700461 layout.addViewToCellLayout(text, -1, i,
462 new PagedViewCellLayout.LayoutParams(0, 0, 1, 1));
463 }
464
465 // Actually reapply to the existing text views
466 for (int i = startIndex; i < endIndex; ++i) {
467 final int index = i - startIndex;
468 final ApplicationInfo info = mFilteredApps.get(i);
469 PagedViewIcon icon = (PagedViewIcon) layout.getChildAt(index);
Winson Chungdf4b83d2010-10-20 17:49:27 -0700470 icon.applyFromApplicationInfo(info, mPageViewIconCache, true);
Winson Chung96785572010-10-14 13:37:13 -0700471
472 PagedViewCellLayout.LayoutParams params =
473 (PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
474 params.cellX = index % mCellCountX;
475 params.cellY = index / mCellCountX;
476 }
477
478 // Default to left-aligned icons
479 layout.enableCenteredContent(false);
480 } else {
481 // There are no items, so show the user a small message
482 TextView icon = (TextView) mInflater.inflate(
483 R.layout.all_apps_no_items_placeholder, layout, false);
484 switch (mAppFilter) {
Winson Chung96785572010-10-14 13:37:13 -0700485 case ApplicationInfo.DOWNLOADED_FLAG:
486 icon.setText(mContext.getString(R.string.all_apps_no_downloads));
487 break;
488 default: break;
489 }
490
491 // Center-align the message
492 layout.enableCenteredContent(true);
493 layout.removeAllViews();
494 layout.addViewToCellLayout(icon, -1, 0,
495 new PagedViewCellLayout.LayoutParams(0, 0, 2, 1));
Winson Chung321e9ee2010-08-09 13:37:56 -0700496 }
497 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700498
499 /*
500 * We don't actually use AllAppsPagedView as a drop target... it's only used to intercept a drop
501 * to the workspace.
502 */
503 @Override
504 public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
505 DragView dragView, Object dragInfo) {
506 return false;
507 }
508 @Override
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700509 public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset,
510 int yOffset, DragView dragView, Object dragInfo) {
511 return null;
512 }
513 @Override
514 public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
515 DragView dragView, Object dragInfo) {}
516 @Override
517 public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
518 DragView dragView, Object dragInfo) {}
519 @Override
520 public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
521 DragView dragView, Object dragInfo) {}
522 @Override
523 public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
524 DragView dragView, Object dragInfo) {}
Michael Jurka0280c3b2010-09-17 15:00:07 -0700525
526 public boolean isDropEnabled() {
527 return true;
528 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700529}