Code Monkey home page Code Monkey logo

dragselectrecyclerview's People

Contributors

mflisar 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

dragselectrecyclerview's Issues

Scroller seems no used

Since Scroller used to calculate current position which relate to the peogress of scrolling. But in this lib we calculate the speed ourselves. Scroller just be used as a flag to indicate whether is scrolling.

So I think we can simply use a boolean var to take the place of the Scroller. I have already done this and every thing woks well.

I am still not sure if you use it for any other reason.

Updating selection states

This can be improved. Sometimes, when redrawing views while scrolling fast, they are creating some not very beautiful "shadow"...

Ideas:

  • simply batching the updates of the selection change events and execute them via a handler every 100ms or so?
  • make a queue of items to update, iterate over it via a handler every 100ms or so if it is not empty?

Not sure if this is causing the problems though, but as the corresponding function is called on every MotionEvent.ACTION_MOVE it may help...

How to know when the dragging is finished?

Currently I am using

mDragSelectionProcessor = new DragSelectionProcessor(new DragSelectionProcessor.ISelectionHandler() {
           @Override
           public HashSet<Integer> getSelection() {
               return mAdapter.getSelection();
           }

           @Override
           public boolean isSelected(int index) {
               return mAdapter.getSelection().contains(index);
           }

           @Override
           public void updateSelection(int start, int end, boolean isSelected, boolean calledFromOnStart) {
               mAdapter.selectRange(start, end, isSelected);
           }
       }).withMode(mMode);

I also tried

mDragSelectionProcessor  = new DragSelectTouchListener.OnAdvancedDragSelectListener()
        {
            @Override
            public void onSelectChange(int start, int end, boolean isSelected) {
                // update your selection
                // range is inclusive start/end positions
                mAdapter.selectRange(start, end, isSelected);
            }

            @Override
            public void onSelectionStarted(int start) {
                // drag selection was started at index start
                Log.e("michaelflisar",start+" Start");
            }

            @Override
            public void onSelectionFinished(int end) {
                Log.e("michaelflisar",end+" End");
                // drag selection was finished at index start
            }
        };

but on using OnAdvancedDragSelectListener() the first cell is not selecting in the sample app you provided

Can not deselect immediately after a long press

Hi, thanks for the much useful library!

Here's how to recreate a bug I spotted. (See the Current behavior gif below.)

  1. Start the demo app.
  2. Long press any tile (for example tile 0 hereafter) to switch to dragselect mode.
    Important: do not perform any drag gesture, just long press tile 0 till it becomes red.
  3. Without touching anything else click on tile 0 again.
    This click should deselect tile 0 (make it white again) but right now it does not happen.
  4. If tile 0 is clicked on again (two times including step 3) now it is deselected.

Desired behavior should be being able to deselect at the step 3 right?
I think bug is in the following line:

break; needs to be changed to return false;
Right now the function onInterceptTouchEvent will return true in the case MotionEvent.ACTION_DOWN: and the user does not receive an onClick event for the ViewHolder of tile 0 .

Current behavior:

Desired behavior:

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.