GithubHelp home page GithubHelp logo

dragsortrecycler's People

Contributors

emileb avatar itadventurer avatar snooplsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dragsortrecycler's Issues

Drag and Drop with long click and Contextual Action Bar

Is it possible with this library? I'll explain:

I have a list with some items that you can click on it (radio buttons) (so onItemClickListener and all that stuff will not work). When I long click any element inside my list row, I launch a Contextual Action Bar (when item selected).

My idea is to launch a drag action too (like startDraging(position). Something like:

    holder.radioButton.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {

            if (!isCAB()) { //No Contextual Action Bar
               getListView().setItemChecked(position, true); //Launch ActionMode
               getListView().startDrag(position); //HERE (launch drag too)
            }else {
                selectCABitem(checkedItems, position);
            }
            return true;
        }
    });

What I would do then is have a drag listener, if we drag an item to another position (even if we don't drop it yet), the contextual action bar will disappear, on the other hand, if we drop the element in the same position, then the CAB stays and you can continue selecting items. This is the default behaviour of Google Keep for example.

I think what is really needed is the ability to say "startDrag(position)" and having that listener... I was not really lucky for now with that libraries out there.

Looking at this library, the only way for launching a drag action is to give a id handler (like imageview)?

Thanks for your time!

Drag Handler bitmap?

Could you please recommend on the web a nice drag handler bitmap to put on the left of the item?

minSdkVersion=15

Is there any reason you set the minSdkVersion to 15? I think you can lower it at least to 11.

Arno

Support to drag on long press

At the moment, you are only allowed to drag items with a handler. A common and useful design pattern is also to be able to drag and drop items on long press on the item. Could it be possible to add this feature to your lib ? Thanks.

Check visibility of the viewhandle

If the viewhandle is not visible, dragging should not happen. Also it would be nice if there could be a limit to where one could drag to. Working on that now though.

if (handleView == null)
{
Log.e(TAG, "The view ID " + viewHandleId + " was not found in the RecycleView item");
return false;
}

if(handleView.getVisibility()!=View.VISIBLE) {
return false;
}

OnItemMovedListener provide wrong "to" position when dragged to bottom of screen from top

I have encountered this issue while playing testing it in a demo project. The details are as below:

My UI Layout:

  1. Recycler view of layout_height "match_parent".
  2. Individual item view height is approx. 180 dp (basically only 3 items fits on screen in portrait)
  3. Drag handle view to center right (size 60x40)
  4. There are 5 items in Recycler view

Steps that I used to reproduce:

  1. Drag item at position 0 to bottom of screen (inside recycler view, most probably 'to' position will be 2) and make sure it doesn't scroll and then lift the finger.
  2. OnItemMovedListener reports 5 as the "to" position where it should be 2. So after calling notifyDataSetChanged(), the dragged item goes to last position in Recycler view.
  3. If I let the recycler to scroll while dragging and release the view in center of the screen, reported "to" position is correct.
  4. If I drag an item from bottom towards top of the screen, reported position is also correct.

BTW thanks for your time in making this.

Click listener

The DragSortRecylcer is intercepting all touch events. I have a click listener defined for the itemView that will never be invoked (which seems to be the recommended way to handle click events for RecyclerView). That will probably require some changes to your code in order to distinguish between a click event and a drag event. Any idea on how to handle this?

Using DragSort recycler with SwipeRefreshLayout

Hello,

I have implemented your DragSort Recycler in my RecyclerView. I am also trying to implement the SwipeRefreshLayout on the recyclerview..

The problem I am facing is when I long press and drag the view in downward motion, the SwipeRefreshLayout's setOnRefreshListener gets called preventing me from sorting the view items. I am able to move items in the upward motion.

Any suggestions on this would be very helpful

Upload the lib to Maven

Thank you for this very nice looking library!

Why not upload the library to maven, so we can use with gradle.

Faded item stuck at drop point after draggning

On random occasions items are "stuck" where you drop them as what seems like an image of the item in the "faded" situation it is (with alpha) when it's dragged.
If you scroll after the drop when it happens the RecyclerView and DragSort keeps working as intended but the "image" of the item that was dropped is kept on the same place on the screen.

Did anyone else experience this behavior or have any idea why it happens?

setHasStableIds(true) method ?

Your lib works fine unless I call adapter,setHasStableIds(true), in which case my list completely screws up (duplicated items, missing items etc...).
So this is fine for me, I don't call it.
But I am curious about why you call it in you demo activity testdragsortrecycler ?
Is it important. Do I miss something if i don't call it? How to fix the problem if I have to call it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.