public class

ProgressIndicatorColors

extends java.lang.Object

 java.lang.Object

↳androidx.wear.protolayout.material.ProgressIndicatorColors

Gradle dependencies

compile group: 'androidx.wear.protolayout', name: 'protolayout-material', version: '1.2.0'

  • groupId: androidx.wear.protolayout
  • artifactId: protolayout-material
  • version: 1.2.0

Artifact androidx.wear.protolayout:protolayout-material:1.2.0 it located at Google repository (https://maven.google.com/)

Overview

Represents the indicator and track colors used in CircularProgressIndicator.

See ProgressIndicatorDefaults.DEFAULT_COLORS for the default colors used in a CircularProgressIndicator.

Summary

Constructors
publicProgressIndicatorColors(ColorBuilders.ColorProp indicatorColor, ColorBuilders.ColorProp trackColor)

Constructor for ProgressIndicatorColors object.

publicProgressIndicatorColors(int indicatorColor, int trackColor)

Constructor for ProgressIndicatorColors object.

Methods
public ColorBuilders.ColorPropgetIndicatorColor()

The indicator color to be used for CircularProgressIndicator.

public ColorBuilders.ColorPropgetTrackColor()

The background track color to be used for CircularProgressIndicator.

public static ProgressIndicatorColorsprogressIndicatorColors(Colors colors)

Returns a ProgressIndicatorColors object, using the current Primary color for indicator color and the current Surface color for the track color from the given Colors.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public ProgressIndicatorColors(ColorBuilders.ColorProp indicatorColor, ColorBuilders.ColorProp trackColor)

Constructor for ProgressIndicatorColors object.

Parameters:

indicatorColor: The indicator color to be used for CircularProgressIndicator.
trackColor: The background track color to be used for CircularProgressIndicator.

public ProgressIndicatorColors(int indicatorColor, int trackColor)

Constructor for ProgressIndicatorColors object.

Parameters:

indicatorColor: The indicator color to be used for CircularProgressIndicator. Should be in ARGB format.
trackColor: The background track color to be used for CircularProgressIndicator. Should be in ARGB format.

Methods

public static ProgressIndicatorColors progressIndicatorColors(Colors colors)

Returns a ProgressIndicatorColors object, using the current Primary color for indicator color and the current Surface color for the track color from the given Colors.

public ColorBuilders.ColorProp getIndicatorColor()

The indicator color to be used for CircularProgressIndicator.

public ColorBuilders.ColorProp getTrackColor()

The background track color to be used for CircularProgressIndicator.

Source

/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.wear.protolayout.material;

import static androidx.wear.protolayout.ColorBuilders.argb;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.wear.protolayout.ColorBuilders.ColorProp;

/**
 * Represents the indicator and track colors used in {@link CircularProgressIndicator}.
 *
 * <p>See {@link ProgressIndicatorDefaults#DEFAULT_COLORS} for the default colors used in a {@link
 * CircularProgressIndicator}.
 */
public class ProgressIndicatorColors {
    @NonNull private final ColorProp mIndicatorColor;
    @NonNull private final ColorProp mTrackColor;

    /**
     * Constructor for {@link ProgressIndicatorColors} object.
     *
     * @param indicatorColor The indicator color to be used for {@link CircularProgressIndicator}.
     * @param trackColor The background track color to be used for {@link
     *     CircularProgressIndicator}.
     */
    public ProgressIndicatorColors(
            @NonNull ColorProp indicatorColor, @NonNull ColorProp trackColor) {
        this.mIndicatorColor = indicatorColor;
        this.mTrackColor = trackColor;
    }

    /**
     * Constructor for {@link ProgressIndicatorColors} object.
     *
     * @param indicatorColor The indicator color to be used for {@link CircularProgressIndicator}.
     *     Should be in ARGB format.
     * @param trackColor The background track color to be used for {@link
     *     CircularProgressIndicator}. Should be in ARGB format.
     */
    public ProgressIndicatorColors(@ColorInt int indicatorColor, @ColorInt int trackColor) {
        this.mIndicatorColor = argb(indicatorColor);
        this.mTrackColor = argb(trackColor);
    }

    /**
     * Returns a {@link ProgressIndicatorColors} object, using the current Primary color for
     * indicator color and the current Surface color for the track color from the given {@link
     * Colors}.
     */
    @NonNull
    public static ProgressIndicatorColors progressIndicatorColors(@NonNull Colors colors) {
        return new ProgressIndicatorColors(colors.getPrimary(), colors.getSurface());
    }

    /** The indicator color to be used for {@link CircularProgressIndicator}. */
    @NonNull
    public ColorProp getIndicatorColor() {
        return mIndicatorColor;
    }

    /** The background track color to be used for {@link CircularProgressIndicator}. */
    @NonNull
    public ColorProp getTrackColor() {
        return mTrackColor;
    }
}