Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set value #5

Open
balu-agna opened this issue Jul 3, 2018 · 1 comment
Open

set value #5

balu-agna opened this issue Jul 3, 2018 · 1 comment

Comments

@balu-agna
Copy link

balu-agna commented Jul 3, 2018

how to set the value for the ruler form the edit text.
I had already set selected value on initialize.
I am having edit text to enter the value on focus changed the value for the ruler is not set instead it is adding the value to the old value.

Android Version:Android 8.1

Device Information:

  • MANUFACTURER: Emulator
  • BRAND:Google Nexus 5

@ruzafa8
Copy link

ruzafa8 commented May 17, 2021

I've got the same problem, but with "+" and "-" buttons. It would be very useful if you revise this function...

public void selectValue(final int value) {
      mHorizontalScrollView.postDelayed(new Runnable() {
          @Override
          public void run() {
              int valuesToScroll;
              if (value < mRulerView.getMinValue()) {
                  valuesToScroll = 0;                                                    <<<<<<<
              } else if (value > mRulerView.getMaxValue()) {
                  valuesToScroll = mRulerView.getMaxValue() - mRulerView.getMinValue();        <<<<<<<<<<
              } else {
                  valuesToScroll = value - mRulerView.getMinValue();                       <<<<<<<<<<
              }

              mHorizontalScrollView.smoothScrollBy(
                      valuesToScroll * mRulerView.getIndicatorIntervalWidth(), 0);
          }
      }, 400);
  }

If I try to put a "+" button, now is just like:

rulerPicker.selectValue(MIN_VALUE + 1);

But there is no way to make the "-" button work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants