Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b53f20ed authored by Xiaowen Lei's avatar Xiaowen Lei
Browse files

Add setters for solid/faded progress segment heights.

Also updated `NotificationProgressBar.getNotificationProgressDrawable`
to public, so that clients of the class can get the drawable and call
these setters.

Flag: android.app.api_rich_ongoing
Bug: 422269932
Test: N/A. Just adding utility functions. Compiles.
Change-Id: I9cd889145fde35f82f21869526c441c102d59b88
parent eaa48a7f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -226,7 +226,9 @@ public final class NotificationProgressBar extends ProgressBar implements
    }

    @NonNull
    private NotificationProgressDrawable getNotificationProgressDrawable() {
    public NotificationProgressDrawable getNotificationProgressDrawable() {
        if (mNotificationProgressDrawable != null) return mNotificationProgressDrawable;

        final Drawable d = getProgressDrawable();
        if (d == null) {
            throw new IllegalStateException("getProgressDrawable() returns null");
+28 −0
Original line number Diff line number Diff line
@@ -90,6 +90,34 @@ public final class NotificationProgressDrawable extends Drawable {
        return mState.mPointRadius;
    }

    /**
     * <p>Set the segment height for the drawable.</p>
     * <p>Note: changing this property will affect all instances of a drawable loaded from a
     * resource. It is recommended to invoke {@link #mutate()} before changing this property.</p>
     *
     * @param height The height of the segments
     * @see #mutate()
     */
    public void setSegmentHeight(float height) {
        mState.mSegmentHeight = height;

        invalidateSelf();
    }

    /**
     * <p>Set the faded segment height for the drawable.</p>
     * <p>Note: changing this property will affect all instances of a drawable loaded from a
     * resource. It is recommended to invoke {@link #mutate()} before changing this property.</p>
     *
     * @param height The height of the faded segments
     * @see #mutate()
     */
    public void setFadedSegmentHeight(float height) {
        mState.mFadedSegmentHeight = height;

        invalidateSelf();
    }

    /**
     * Set the segments and points that constitute the drawable.
     */