DWRulerView

Additional

Language
Java
Version
1.1.0 (Jan 6, 2017)
Created
Sep 5, 2016
Updated
Jul 26, 2017
Owner
DWFOX (dwfox)
Contributor
DWFOX (dwfox)
1
Activity
Badge
Generate
Download
Source code
APK file

Show card

DWRulerView

Demo

  • Ruler Number Picker & Ruler Seekbar


Usage

  • Ruler Number Picker
ScrollingValuePicker myScrollingValuePicker;
myScrollingValuePicker = (ScrollingValuePicker) findViewById(R.id.myScrollingValuePicker);
myScrollingValuePicker.setViewMultipleSize(LINE_RULER_MULTIPLE_SIZE);
myScrollingValuePicker.setMaxValue(MIN_VALUE, MAX_VALUE);
myScrollingValuePicker.setValueTypeMultiple(5);
myScrollingValuePicker.getScrollView().setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            myScrollingValuePicker.getScrollView().startScrollerTask();
        }
        return false;
    }
});
  • Ruler Seekbar
DWRulerSeekbar dwRulerSeekbar;
dwRulerSeekbar = (DWRulerSeekbar) findViewById(R.id.dwRulerSeekbar);
dwRulerSeekbar
        .setMinMaxValue((int) MIN_VALUE, (int) MAX_VALUE)
        //Get the value with the OnDWSeekbarListener
        .setDWRulerSeekbarListener(new DWRulerSeekbar.OnDWSeekBarListener() {
            @Override
            public void onStopSeekbarValue(int value) {
                seekbarText.setText("DWSeekBar Value : " + value);
            }
        });

Get Value

  • Ruler Number Picker
myScrollingValuePicker.setOnScrollChangedListener(new ObservableHorizontalScrollView.OnScrollChangedListener() {

        @Override
        public void onScrollChanged(ObservableHorizontalScrollView view, int l, int t) {}

        @Override
        public void onScrollStopped(int l, int t) {
            text.setText("Value STOP : " + DWUtils.getValueAndScrollItemToCenter(myScrollingValuePicker.getScrollView() // set TextView
                            , l
                            , t
                            , MAX_VALUE
                            , MIN_VALUE
                            , myScrollingValuePicker.getViewMultipleSize()));
        }
    });

Gradle

allprojects {
  repositories {
   ...
   maven { url "https://jitpack.io" }
  }
}
dependencies {
   compile 'com.github.dwfox:DWRulerView:1.1.0'
}

More Usage

More Usage Here [ link]