Added BaseDropTargetBar, which SearchDropTargetBar extends.

This is to allow for a future AppInfoDropTargetBar.

Change-Id: I5e66129919226eaef1ba1ddb0c0c99d0a6dc48df
This commit is contained in:
Tony Wickham
2015-09-11 08:40:20 -07:00
parent e33c09f1be
commit b54c4a3d86
3 changed files with 169 additions and 106 deletions

View File

@@ -49,11 +49,11 @@ import com.android.launcher3.util.Thunk;
public abstract class ButtonDropTarget extends TextView
implements DropTarget, DragController.DragListener, OnClickListener {
private static int DRAG_VIEW_DROP_DURATION = 285;
private static final int DRAG_VIEW_DROP_DURATION = 285;
protected Launcher mLauncher;
private int mBottomDragPadding;
protected SearchDropTargetBar mSearchDropTargetBar;
protected BaseDropTargetBar mDropTargetBar;
/** Whether this drop target is active for the current drag */
protected boolean mActive;
@@ -106,8 +106,8 @@ public abstract class ButtonDropTarget extends TextView
mLauncher = launcher;
}
public void setSearchDropTargetBar(SearchDropTargetBar searchDropTargetBar) {
mSearchDropTargetBar = searchDropTargetBar;
public void setDropTargetBar(BaseDropTargetBar dropTargetBar) {
mDropTargetBar = dropTargetBar;
}
@Override
@@ -230,13 +230,13 @@ public abstract class ButtonDropTarget extends TextView
final Rect to = getIconRect(d.dragView.getMeasuredWidth(), d.dragView.getMeasuredHeight(),
width, height);
final float scale = (float) to.width() / from.width();
mSearchDropTargetBar.deferOnDragEnd();
mDropTargetBar.deferOnDragEnd();
Runnable onAnimationEndRunnable = new Runnable() {
@Override
public void run() {
completeDrop(d);
mSearchDropTargetBar.onDragEnd();
mDropTargetBar.onDragEnd();
mLauncher.exitSpringLoadedDragModeDelayed(true, 0, null);
}
};