Giter Club home page Giter Club logo

Comments (11)

grojasv avatar grojasv commented on June 12, 2024

From what I've seen this is not implemented. How would you show 3 colors in a progress?
IMHO only makes sense a color to fill the ring and an empty color.

from android-circular-progress.

ksandyasa avatar ksandyasa commented on June 12, 2024

circular_progress

I would like showing progress ring like the image above..

from android-circular-progress.

grojasv avatar grojasv commented on June 12, 2024

Aha, it seems some kind of gradient color. Let's wait for @kuassivi reply.

from android-circular-progress.

FranRiadigos avatar FranRiadigos commented on June 12, 2024

Hi, thanks @ksandyasa.
As @grojasv mentioned that feature is not yet implemented, but such interesting options are wellcome. Suggestion accepted 😃

from android-circular-progress.

FranRiadigos avatar FranRiadigos commented on June 12, 2024

Create an array of colors as a resource value.

<resources>
    <array name="gradient">
        <item>@color/white</item>
        <item>@color/black</item>
    </array>
</resources>

Then apply it with some few configs in the ProgressProfileView as follow:

<com.kuassivi.view.ProgressProfileView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                android:adjustViewBounds="true"
                tools:src="@drawable/ic_icon_user_default"
                app:progress="65"
                app:progressRingCorner="ROUND"
                app:progressRingSize="10dp"
                app:progressRingOutline="true"
                app:progressGradient="@array/gradient" <---
                app:backgroundRingColor="@android:color/darker_gray"
                app:joinGradient="true" <---
                app:gradientFactor="5.0"/>  <---

Gradient ring cannot be shown in Preview for now.

from android-circular-progress.

ksandyasa avatar ksandyasa commented on June 12, 2024

I wish the feature of gradient ring color can be implemented as soon as possible..
Your library is awesome and it will be more awesome if the gradient ring color can be implemented..
Will be waited for the update of gradient ring color in ProfileProgressView..

from android-circular-progress.

abhinavkorpal avatar abhinavkorpal commented on June 12, 2024

i want to ask how to set progress ring color from array of colors? I want to show progress ring color with 3 different type colors. How i do that?

from android-circular-progress.

viswakarmalovekush avatar viswakarmalovekush commented on June 12, 2024

@abhinavkorpal hi, as per you question, if want to set multiple color to progress ring than you need to set color array as integer as Gradient but is this lib, setProgressGredient is not working.
I solved this problem and i have added one method setProgressGredientColor(int []color_array) by this you can achieve your problem. i am committing some changes you can update and use it. enjoye.

from android-circular-progress.

viswakarmalovekush avatar viswakarmalovekush commented on June 12, 2024

@abhinavkorpal , Add this method in ProgressProfileView.java cass in Lib,

public void setProgressGredientColor(int[] mProgressGradient) {
mProgressRingPaint = new Paint();
mProgressRingPaint.setAntiAlias(true);
mProgressRingPaint.setStrokeCap(mProgressRingCorner);
mProgressRingPaint.setStyle(Paint.Style.STROKE);
mProgressRingPaint.setStrokeWidth(mProgressRingSize);
mProgressRingPaint.setColor(mProgressRingColor);

    if (mProgressGradient != null) {
        int[] colors = mProgressGradient;
        float[] positions;
        if (isJoinGradient()) {
            colors = new int[mProgressGradient.length + 1];
            positions = new float[colors.length];
            int i = 0;
            positions[i] = i;
            for (int color : mProgressGradient) {
                colors[i] = color;
                if (i == mProgressGradient.length - 1) {
                    positions[i] = (ANGLE_360 - mProgressRingSize * getGradientFactor())
                            / ANGLE_360;
                } else if (i > 0) {
                    positions[i] = ((float) i / (float) colors.length);
                }
                i++;
            }
            colors[i] = colors[0];
            positions[i] = 1;
        }

        SweepGradient gradient = new SweepGradient(mRingBounds.centerX(),
                mRingBounds.centerY(),
                colors, null);

        mProgressRingPaint.setShader(gradient);
        Matrix matrix = new Matrix();
        mProgressRingPaint.getShader().setLocalMatrix(matrix);
        matrix.postTranslate(-mRingBounds.centerX(), -mRingBounds.centerY());
        matrix.postRotate(-ANGLE_90);
        matrix.postTranslate(mRingBounds.centerX(), mRingBounds.centerY());
        mProgressRingPaint.getShader().setLocalMatrix(matrix);
        mProgressRingPaint.setColor(mProgressGradient[0]);
    }
}

use this method you can set gradient color to progressview.

from android-circular-progress.

abhinavkorpal avatar abhinavkorpal commented on June 12, 2024

@viswakarmalovekush amazing it's working. Thanks

from android-circular-progress.

viswakarmalovekush avatar viswakarmalovekush commented on June 12, 2024

Welcome dude 👍

from android-circular-progress.

Related Issues (3)

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.