GithubHelp home page GithubHelp logo

Comments (2)

MahmoudAlyuDeen avatar MahmoudAlyuDeen commented on July 27, 2024 3

Been struggling with that exact same issue for a couple hours, finally I decided to get hacky and took matters into my own hands.. literally..

public class RangeBar extends com.appyvet.rangebar.RangeBar {
    public RangeBar(Context context) {
        super(context);
    }

    public RangeBar(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RangeBar(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            EventBus.getDefault().post(new PriceRangeUpdated());
            return super.onTouchEvent(event);
        }
        return super.onTouchEvent(event);
    }

    public class PriceRangeUpdated {
    }
}

As you can see, I extended his RangeBar and overridden the onTouchEventMethod, in it I notify my activity that a the user's finger is leaving the RangeBar, then in the activity, I can easily retrieve the values like this:

@Subscribe(threadMode = ThreadMode.MAIN)
    public void onPriceRangeUpdated(RangeBar.PriceRangeUpdated updateEvent) {
        String leftPin = priceRangeBar.getLeftPinValue();
        String rightPin = priceRangeBar.getRightPinValue();
        Log.d("@@@@", "onPriceRangeUpdated: leftPin: " + leftPin);
        Log.d("@@@@", "onPriceRangeUpdated: rightPin: " + rightPin);
    }

from material-range-bar.

campaignium avatar campaignium commented on July 27, 2024

I would ask highly that this be added - very basic but important functionality to know when the seek has stopped and what is the final value (ie to save it or send to server, etc)

from material-range-bar.

Related Issues (20)

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.