public class

ProgressIndicatorColors

extends java.lang.Object

 java.lang.Object

↳androidx.wear.tiles.material.ProgressIndicatorColors

Gradle dependencies

compile group: 'androidx.wear.tiles', name: 'tiles-material', version: '1.1.0-alpha07'

  • groupId: androidx.wear.tiles
  • artifactId: tiles-material
  • version: 1.1.0-alpha07

Artifact androidx.wear.tiles:tiles-material:1.1.0-alpha07 it located at Google repository (https://maven.google.com/)

Overview

Represents the indicator and track colors used in a progress indicator Tiles component.

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 a progress indicator Tiles component.

public ColorBuilders.ColorPropgetTrackColor()

The background track color to be used for a progress indicator Tiles component.

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 a progress indicator Tiles component.
trackColor: The background track color to be used for a progress indicator Tiles component.

public ProgressIndicatorColors(int indicatorColor, int trackColor)

Constructor for ProgressIndicatorColors object.

Parameters:

indicatorColor: The indicator color to be used for a progress indicator Tiles component. Should be in ARGB format.
trackColor: The background track color to be used for a progress indicator Tiles component. 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 a progress indicator Tiles component.

public ColorBuilders.ColorProp getTrackColor()

The background track color to be used for a progress indicator Tiles component.

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.tiles.material;

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

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

/**
 * Represents the indicator and track colors used in a progress indicator Tiles component.
 *
 * <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 a progress indicator Tiles
     *     component.
     * @param trackColor The background track color to be used for a progress indicator Tiles
     *     component.
     */
    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 a progress indicator Tiles
     *     component. Should be in ARGB format.
     * @param trackColor The background track color to be used for a progress indicator Tiles
     *     component. 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 a progress indicator Tiles component. */
    @NonNull
    public ColorProp getIndicatorColor() {
        return mIndicatorColor;
    }

    /** The background track color to be used for a progress indicator Tiles component. */
    @NonNull
    public ColorProp getTrackColor() {
        return mTrackColor;
    }
}