I have an implementation of Drag-Sort ListView (DSLV) and LazyList together in my project, I load the LazyList and Drag-Sort ListView demos from github, then integrate and modify as per my requirement.
I use DSLV to drag and sort ListView and LazyList elements to display the image from the URL, I just implement the "Basic use of the playground" from DSLV to drag and sort,
I have an implementation in TestBedDSLV.java, but the problem is that when I search for content from a list, but I canβt update the list, I tried the notifyDataSetChanged method, but it doesnβt work, as a rule, we create a new adapter and pass it to listview like lv.setAdapter (adapter), but here they just install the ListAdapter, so we can't do lv.setAdapter (adapter)
TestBedDSLV.java
package com.mobeta.android.demodslv; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuInflater; import android.widget.Button; import android.widget.EditText; import com.mobeta.android.dslv.DragSortController; import com.mobeta.android.dslv.DragSortListView; public class TestBedDSLV extends FragmentActivity { private int mNumHeaders = 0; private int mNumFooters = 0; private int mDragStartMode = DragSortController.ON_DOWN; private boolean mRemoveEnabled = false; private int mRemoveMode = DragSortController.FLING_RIGHT_REMOVE; private boolean mSortEnabled = true; private boolean mDragEnabled = true; private String mTag = "dslvTag"; Button search; EditText search_customer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_bed_main); search = (Button) findViewById(R.id.btn_search); search_customer = (EditText) findViewById(R.id.search_product); search_customer.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {
DSLVFragmentClicks.java
package com.mobeta.android.demodslv; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.os.Bundle; import android.widget.Toast; public class DSLVFragmentClicks extends DSLVFragment { public static DSLVFragmentClicks newInstance(int headers, int footers) { DSLVFragmentClicks f = new DSLVFragmentClicks(); Bundle args = new Bundle(); args.putInt("headers", headers); args.putInt("footers", footers); f.setArguments(args); return f; } AdapterView.OnItemLongClickListener mLongClickListener = new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String message = String.format("Long-clicked item %d", arg2); Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show(); return true; } }; @Override public void onActivityCreated(Bundle savedState) { super.onActivityCreated(savedState); ListView lv = getListView(); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String message = String.format("Clicked item %d", arg2); Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show(); } }); lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String message = String.format("Long-clicked item %d", arg2); Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show(); return true; } }); } }
DSLVFragment.java
package com.mobeta.android.demodslv; import java.util.ArrayList; import java.util.Arrays; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import com.mobeta.android.dslv.DragSortController; import com.mobeta.android.dslv.DragSortListView; public class DSLVFragment extends ListFragment { ArrayAdapter<String> adapter; private String[] array; public static ArrayList<String> list; private DragSortListView.DropListener onDrop = new DragSortListView.DropListener() { @Override public void drop(int from, int to) { if (from != to) { String item = adapter.getItem(from); adapter.remove(item); adapter.insert(item, to); } } }; private DragSortListView.RemoveListener onRemove = new DragSortListView.RemoveListener() { @Override public void remove(int which) { adapter.remove(adapter.getItem(which)); } }; protected int getLayout() { return R.layout.dslv_fragment_main; } protected int getItemLayout() { return R.layout.list_item_handle_right; } private DragSortListView mDslv; private DragSortController mController; public int dragStartMode = DragSortController.ON_DOWN; public boolean removeEnabled = false; public int removeMode = DragSortController.FLING_RIGHT_REMOVE; public boolean sortEnabled = true; public boolean dragEnabled = true; public static DSLVFragment newInstance(int headers, int footers) { DSLVFragment f = new DSLVFragment(); Bundle args = new Bundle(); args.putInt("headers", headers); args.putInt("footers", footers); f.setArguments(args); return f; } public DragSortController getController() { return mController; } public void setListAdapter() { array = getResources().getStringArray(R.array.jazz_artist_names); list = new ArrayList<String>(Arrays.asList(array)); adapter = new ArrayAdapter<String>(getActivity(), getItemLayout(), R.id.text, list); setListAdapter(adapter); } public DragSortController buildController(DragSortListView dslv) { DragSortController controller = new DragSortController(dslv); controller.setDragHandleId(R.id.drag_handle); controller.setClickRemoveId(R.id.click_remove); controller.setRemoveEnabled(removeEnabled); controller.setSortEnabled(sortEnabled); controller.setDragInitMode(dragStartMode); controller.setRemoveMode(removeMode); return controller; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDslv = (DragSortListView) inflater.inflate(getLayout(), container, false); mController = buildController(mDslv); mDslv.setFloatViewManager(mController); mDslv.setOnTouchListener(mController); mDslv.setDragEnabled(dragEnabled); return mDslv; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mDslv = (DragSortListView) getListView(); mDslv.setDropListener(onDrop); mDslv.setRemoveListener(onRemove); Bundle args = getArguments(); int headers = 0; int footers = 0; if (args != null) { headers = args.getInt("headers", 0); footers = args.getInt("footers", 0); } setListAdapter(); } }
test_bed_main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/search_lay" android:layout_width="fill_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true" android:orientation="horizontal" > <EditText android:id="@+id/search_product" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="2dp" android:layout_marginLeft="5dp" android:layout_marginTop="2dp" android:layout_weight="1" android:background="@drawable/search_back" android:hint="Enter Firstname" android:imeOptions="actionSearch" android:inputType="text" android:paddingBottom="2dp" android:paddingLeft="5dp" android:paddingTop="2dp" android:visibility="visible" /> <Button android:id="@+id/btn_search" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_weight="2.5" android:text="CANCEL" android:textColor="#155280" android:textSize="14sp" android:textStyle="bold" android:visibility="visible" /> </LinearLayout> <FrameLayout android:id="@+id/test_bed" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>

and another require class can be loaded from the github link above .....