diff --git a/android/modules/ui/res/drawable/titanium_icon_drag.xml b/android/modules/ui/res/drawable/titanium_icon_drag.xml
index d9ca186c9f6..8acc84a1d5f 100644
--- a/android/modules/ui/res/drawable/titanium_icon_drag.xml
+++ b/android/modules/ui/res/drawable/titanium_icon_drag.xml
@@ -1,10 +1,10 @@
-
+ android:width="24dp"
+ android:height="34dp"
+ android:tint="#C3C3C3"
+ android:viewportWidth="24"
+ android:viewportHeight="34">
+
diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java
index 4891feb568b..e6c78e03e77 100644
--- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java
+++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java
@@ -27,11 +27,14 @@
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
import android.util.TypedValue;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.recyclerview.widget.RecyclerView;
+
import java.lang.ref.WeakReference;
import ti.modules.titanium.ui.UIModule;
@@ -157,6 +160,23 @@ public void bind(final ListItemProxy proxy, final boolean selected)
if (isEditing && canMove) {
this.rightImage.setImageDrawable(dragDrawable);
this.rightImage.setVisibility(View.VISIBLE);
+
+ RecyclerView.ViewHolder mViewHolder = this;
+
+ this.rightImage.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent)
+ {
+ if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) {
+ TiListView listView = listViewProxy.getListView();
+ listView.startDragging(mViewHolder);
+ }
+ return false;
+ }
+ });
+ } else {
+ this.rightImage.setOnTouchListener(null);
}
if (proxy != null) {
diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewProxy.java
index a75af390359..e3c8e727242 100644
--- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewProxy.java
+++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewProxy.java
@@ -312,7 +312,7 @@ public int getIndexOfSection(ListSectionProxy section)
*
* @return TiListView
*/
- private TiListView getListView()
+ public TiListView getListView()
{
final TiUIListView view = (TiUIListView) this.view;
diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java
index f76a478546c..f54780f32cf 100644
--- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java
+++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java
@@ -49,6 +49,7 @@ public class TiListView extends TiSwipeRefreshLayout implements OnSearchChangeLi
private final ListViewProxy proxy;
private final TiNestedRecyclerView recyclerView;
private final List selectedItems = new ArrayList<>();
+ private final ItemTouchHelper itemTouchHelper;
private boolean hasLaidOutChildren = false;
private SelectionTracker tracker = null;
@@ -176,7 +177,7 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy)
// Create ItemTouchHelper for swipe-to-delete and move gestures.
final ItemTouchHandler itemTouchHandler = new ItemTouchHandler(this.adapter, this.proxy, this.recyclerView);
- final ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemTouchHandler);
+ itemTouchHelper = new ItemTouchHelper(itemTouchHandler);
itemTouchHelper.attachToRecyclerView(this.recyclerView);
// Fire `postlayout` on layout changes.
@@ -606,6 +607,16 @@ public void setSeparator(int color, int height)
this.recyclerView.invalidate();
}
+ /**
+ * Starts dragging programatically.
+ *
+ * @param vHolder The dedicated view holder
+ */
+ public void startDragging(RecyclerView.ViewHolder vHolder)
+ {
+ itemTouchHelper.startDrag(vHolder);
+ }
+
/**
* Set row separator drawable.
*