mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-15 18:28:47 +00:00
Adding drag and drop functionality
This commit is contained in:
parent
578d360319
commit
1fd617c55f
@ -2,9 +2,11 @@ package com.example.listify.adapter;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.ClipData;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.view.DragEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -172,6 +174,17 @@ public class ShoppingListsSwipeableAdapter extends BaseAdapter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
holder.frontView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
ClipData data = ClipData.newPlainText(" ", " ");
|
||||||
|
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);
|
||||||
|
v.startDragAndDrop(data, shadowBuilder, v, 0);
|
||||||
|
// v.setVisibility(View.INVISIBLE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package com.example.listify.ui.home;
|
package com.example.listify.ui.home;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.DragEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
@ -92,6 +94,30 @@ public class HomeFragment extends Fragment implements CreateListDialogFragment.O
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// refreshLists.setOnDragListener(new View.OnDragListener() {
|
||||||
|
// @Override
|
||||||
|
// public boolean onDrag(View v, DragEvent event) {
|
||||||
|
// int action = event.getAction();
|
||||||
|
// System.out.println("drag event");
|
||||||
|
// switch (action) {
|
||||||
|
// case DragEvent.ACTION_DRAG_STARTED:
|
||||||
|
// System.out.println("start");
|
||||||
|
// break;
|
||||||
|
// case DragEvent.ACTION_DRAG_ENTERED:
|
||||||
|
// break;
|
||||||
|
// case DragEvent.ACTION_DRAG_EXITED:
|
||||||
|
// break;
|
||||||
|
// case DragEvent.ACTION_DROP:
|
||||||
|
// System.out.println("dropped on me");
|
||||||
|
// break;
|
||||||
|
// case DragEvent.ACTION_DRAG_ENDED:
|
||||||
|
// System.out.println("dropped");
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user