Git Product home page Git Product logo

circleseekbar's Introduction

CircleSeekbar

Build Status API JitPack

an android circle seekbar library

quick start

1.Add root build.gradle

 repositories {
        // ...
        maven { url "https://jitpack.io" }
 }

2.Add build.gradle

dependencies {
	        compile 'com.github.feeeei:CircleSeekbar:v1.1.2'
	}

3.Added to the XML

    <io.feeeei.circleseekbar.CircleSeekBar
        android:id="@+id/seekbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:wheel_max_process="100"
        />

attrs

  <!-- process -->
  <attr name="wheel_max_process" format="integer" />
  <attr name="wheel_cur_process" format="integer" />
  
  <!-- reached style -->
  <attr name="wheel_reached_color" format="color" />
  <attr name="wheel_reached_width" format="dimension" />
  
  <!-- unReached style -->
  <attr name="wheel_unreached_color" format="color" />
  <attr name="wheel_unreached_width" format="dimension" />
  
  <!-- pointer style -->
  <attr name="wheel_pointer_color" format="color" />
  <attr name="wheel_pointer_radius" format="dimension" />
  
  <!--shadows style -->
  <attr name="wheel_has_pointer_shadow" format="boolean" />
  <attr name="wheel_has_wheel_shadow" format="boolean" />
  <attr name="wheel_pointer_shadow_radius" format="dimension" />
  <attr name="wheel_shadow_radius" format="dimension" />
  
  <!-- if you want to open the wheel shadow, open this can speed up the rendering speed -->
  <attr name="wheel_has_cache" format="boolean" />
  
  <!-- if you want to block touchListener,use like processBar,
   only allow the code to control the schedule, you can change this attribute to false -->
  <attr name="wheel_can_touch" format="boolean" />    
  
  <attr name="wheel_scroll_only_one_circle" format="boolean" />

License

PGSL

please give me star license

circleseekbar's People

Contributors

czhongm avatar feeeei avatar m6l1 avatar ppamorim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circleseekbar's Issues

decimal increments

Currently it seems like the seekbar only supports integer values. Would be nice to be able to have decimals.

can't change the color

I used

app:wheel_reached_color="@android:color/holo_purple"
app:wheel_unreached_color="@android:color/holo_red_dark"

in xml.
also tried mProgress.setUnreachedColor(getResources().getColor(R.color.mycolor));

but color is not changing what can i do to change the color?

onStopTrackingTouch listener method

Hi!

I would like to update a value when the user releases the seekbar but it doesnt seem like the onStopTrackingTouch is implemented in the CircleSeekBar.OnSeekBarChangeListener(). Or am I missing something?

使用1.0.4版本,锚点(起始圆点)mWheelCurX,mWheelCurY 起始坐标的问题

1、问题:
在使用过程中发现onMeasure() 一般初始化4次,但在某些手机上有概率初始化2次,这就导致只初始化2次的时候,此时拿到的getWidth() 是为0。这就直接导致mWheelCurX,mWheelCurY计算错误。会出现初始圆点不在正确位置上的问题。

2、解决思路:
a、refreshUnreachedWidth() 方法中计算mUnreachedRadius 时使用getMeasuredWidth()替换原先的getWidth(),因为当onMeasure() 中只初始化2次就规定布局时,getWidth拿到的是0。使用getMeasuredWidth可以确保拿到的mUnreachedRadius每次都是正确的值。
b、在onMeasure()中先refreshUnreachedWidth,再去刷新refreshPosition(),保证mUnreachedRadius 是在下面计算的时候是正确的值。
c、calcXLocationInWheel() 计算X 的坐标时,同样使用getMeasuredWidth()替换getWidth(),原因也是getWidth()为0,计算出来的X坐标永远是0。

3、针对上述问题,不知是否符合本开源项目修改。期待交流。

wheel_min_process

First of all, I believe by "process" you mean "progress"?

Secondly, it would be very useful if it would be possible to define the minimum value.

How to disable infinite scrolling

the problem is i dont want to scroll from min to max in reverse clockwize and also dont want to allow user to scroll from max to min clockwize i want to ignore this jump betwen max and min

Not Smooth Scrolling

When I use this library, the scrolling isn't smooth- I have to touch different points on the circle for the pointer to jump. My XML is below-


 <io.feeeei.circleseekbar.CircleSeekBar
                        android:id="@+id/seekbar"
                        android:layout_width="250dp"
                        android:visibility="gone"
                        android:layout_margin="20dp"
                        android:layout_height="250dp"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintTop_toTopOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:wheel_pointer_color="@color/colorAccent"
                        app:wheel_reached_color="@color/colorPrimary"
                        app:wheel_unreached_color="#93e1d9"
                        app:wheel_unreached_width="10dp"
                        app:wheel_pointer_radius="10dp"
                        android:padding="25dp"
                        app:wheel_has_cache="true"
                        app:wheel_reached_width="10dp"
                        app:wheel_max_process="9"
                        app:wheel_cur_process="0"
                        app:wheel_can_touch="true"
                        app:wheel_reached_has_corner_round="true" />

Can you teel me what's wrong, and how to fix it?

CircleSeekBar's wheel is on incorrect position when added in fragment

If I use circleseekbar in fragment(via onCreateView - inflate), due to incorrect measurewidth,measureheight, the white circle button (aka wheel) goes wrong position, and even if i changed progress by touch, it is just looping which is follwing a small circle.

incorrect

so, i fixed this problem tempory registering onGlobalLayout and force putting correct measure.

    outerBar = (CircleSeekBar) view.findViewById(R.id.outerSeek)
    ViewTreeObserver vto = outerBar.getViewTreeObserver()
    vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        private boolean updated = false;
        @Override
        public void onGlobalLayout() {
            if(!updated){
                // put updated boolean for only once draw
                updated = true;
                // getWidth said wrong number. so, should input number.
                int pxCircle = (int)UIUtils.convertDpToPixel(300,context);
                int measureInt = View.MeasureSpec.makeMeasureSpec(pxCircle, View.MeasureSpec.EXACTLY);
                //outerBar.setLayoutParams(params);
                outerBar.measure(measureInt, measureInt);
                // outerBar.refershPosition()
                // cause must correct at first view
                try {
                    // refersh? refresh is correct but :p
                    Method refresh = outerBar.getClass().getDeclaredMethod("refershPosition");
                    refresh.setAccessible(true);
                    refresh.invoke(outerBar);
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
                // redraw for correct position.
                outerBar.invalidate();
            }
        }

})

correct

i don't know why this bug happen, but i believe you can something edit 👍

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.