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

updating progress and arc colors programmatically #78

Open
danwguy opened this issue Feb 28, 2020 · 1 comment
Open

updating progress and arc colors programmatically #78

danwguy opened this issue Feb 28, 2020 · 1 comment

Comments

@danwguy
Copy link

danwguy commented Feb 28, 2020

I am not sure if this is possible, but I am in a scenario where we want to be able to change the arc color and background color based on certain actions. What I have noticed so far is when calling progress.setProgressColor(int) or progress.setArcColor(int) it uses tinting to change the color.
I have it setup in my xml with a progress color of orange and leaving the arc color as default...

<com.triggertrap.seekarc.SeekArc
        android:id="@+id/seek"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_gravity="center"
        android:layout_marginStart="32dp"
        android:layout_marginEnd="32dp"
        android:layout_marginTop="8dp"
        android:paddingStart="30dp"
        android:paddingEnd="30dp"
        app:arcWidth="30dp"
        app:layout_constraintBottom_toTopOf="@id/bottomguideline"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/topguideline"
        app:layout_constraintVertical_bias="0.5"
        app:progress="30"
        seekarc:progressColor="@color/stepup_orange"
        seekarc:arcColor="@android:color/darker_gray"
        app:progressWidth="30dp"
        app:roundEdges="true"
        app:sweepAngle="360"
        seekarc:enabled="false"
        seekarc:max="100"
        seekarc:rotation="0"
        seekarc:startAngle="0"
        seekarc:touchInside="false"/>

Now when I call progress.setProgressColor(int) I am using a red color #D81B60 however the progress color is coming out purple/gray/blue-ish. It isn't actually coming out that red color. I'm not sure if it's possible since I think the only way to update color dynamically on rendered graphics is using tinting, but I was hoping there was a way, or someone knows how to do this, or maybe you can build it in. Please let me know, this is actually a very important part of this project. Thank you

@BhargavBhanshali
Copy link

BhargavBhanshali commented Mar 12, 2021

use progress.setProgressColor (ContextCompat.getColor (context,R.color.YOUR COLOR));

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