CircleControlView
Ready for usage CircleControlView based on gesture detection
Features
- get value based on min, max values and rotation angle
- get count of full circles (2*PI)
- get rotation direction (clockwise/counter clockwise)
Usage
- Import
circlecontrolview
module to your project
-
Add following line to your
settings.gradle
fileinclude ':YOUR_APP_PROJECT_NAME', ':circlecontrolview'
-
Add following line to your
build.gradle
filedependencies { ... compile project(':circlecontrolview') }
-
Initialize
CircleControlView
from codefinal CircleControlView circleControlView = (CircleControlView) findViewById(R.id.radio_cv_fm); circleControlView.setOnValueChangedCallback(onValueChangedCallback); final Drawable pressedBackground = ContextCompat.getDrawable(this, R.drawable.bg_btn_radio_pressed); circleControlView.setPressedBackground(pressedBackground); final Properties properties = CircleControlView.newPropertiesBuilder() .minValue(700) .value(1000) .maxValue(1200) .numberOfCircles(2) .build(); circleControlView.setProperties(properties); ... private CircleControlView.OnValueChangedCallback onValueChangedCallback = new CircleControlView.OnValueChangedCallback() { @Override public void onValueChanged(int value) { ... Process your value here } };
-
Initialize
CircleControlView
from XML<com.themindstudios.circlecontrolview.widget.CircleControlView android:id="@+id/circleview" android:layout_width="200dp" android:layout_height="200dp" android:background="@drawable/PUT_YOUR_BG_RESOURCE_ID_HERE" circle:minValue="0" circle:currentValue="333" circle:maxValue="360"/>
final CircleControlView circleView = (CircleControlView) findViewById(R.id.circleview); circleView.setOnValueChangedCallback(onValueChangedCallback); ... private CircleControlView.OnValueChangedCallback onValueChangedCallback = new CircleControlView.OnValueChangedCallback() { @Override public void onValueChanged(int value) { ... Process your value here } };
Examples
You can find examples in APP module
License
CorcleControlView is available under the MIT license. See the LICENSE file for more info.