Skip to content

tayaza/DWRulerView

 
 

Repository files navigation

Android Arsenal

DWRulerView

Youtube

Demo

  • Ruler Number Picker & Ruler Seekbar

Image


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]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.1%
  • Prolog 2.9%