mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Some drag and drop code refactor:
1) Adding DragOptions to easily extend drap functionality 2) Changing onDragStarted signature to send more information 3) Updating states for dropTargetButton based on drag event directly 4) Removing folder item based on onDragStarted and not startDrag Change-Id: I65b684e092ddc081d086bfe2c8c1973ed170eaeb
This commit is contained in:
@@ -43,6 +43,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
@@ -199,8 +200,8 @@ public abstract class ButtonDropTarget extends TextView
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragStart(DragSource source, ItemInfo info, int dragAction) {
|
||||
mActive = supportsDrop(source, info);
|
||||
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
|
||||
mActive = supportsDrop(dragObject.dragSource, dragObject.dragInfo);
|
||||
mDrawable.setColorFilter(null);
|
||||
if (mCurrentColorAnim != null) {
|
||||
mCurrentColorAnim.cancel();
|
||||
@@ -209,6 +210,9 @@ public abstract class ButtonDropTarget extends TextView
|
||||
setTextColor(mOriginalTextColor);
|
||||
(mHideParentOnDisable ? ((ViewGroup) getParent()) : this)
|
||||
.setVisibility(mActive ? View.VISIBLE : View.GONE);
|
||||
|
||||
mAccessibleDrag = options.isAccessibleDrag;
|
||||
setOnClickListener(mAccessibleDrag ? this : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,6 +231,7 @@ public abstract class ButtonDropTarget extends TextView
|
||||
@Override
|
||||
public void onDragEnd() {
|
||||
mActive = false;
|
||||
setOnClickListener(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,11 +313,6 @@ public abstract class ButtonDropTarget extends TextView
|
||||
return to;
|
||||
}
|
||||
|
||||
public void enableAccessibleDrag(boolean enable) {
|
||||
mAccessibleDrag = enable;
|
||||
setOnClickListener(enable ? this : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mLauncher.getAccessibilityDelegate().handleAccessibleDrop(this, null, null);
|
||||
|
||||
Reference in New Issue
Block a user