public final class

ComplicationSlotMetadataWireFormat

extends java.lang.Object

implements VersionedParcelable

 java.lang.Object

↳androidx.wear.watchface.data.ComplicationSlotMetadataWireFormat

Gradle dependencies

compile group: 'androidx.wear', name: 'wear-watchface-data', version: '1.0.0-alpha22'

  • groupId: androidx.wear
  • artifactId: wear-watchface-data
  • version: 1.0.0-alpha22

Artifact androidx.wear:wear-watchface-data:1.0.0-alpha22 it located at Google repository (https://maven.google.com/)

Summary

Fields
public static final <any>CREATOR

Constructors
publicComplicationSlotMetadataWireFormat(int id, int[] complicationBoundsType[], RectF complicationBounds[], int boundsType, int[] supportedTypes[], java.util.List<ComponentName> defaultDataSourcesToTry, int fallbackSystemDataSource, int defaultDataSourceType, boolean isInitiallyEnabled, boolean fixedComplicationDataSource, Bundle complicationConfigExtras)

publicComplicationSlotMetadataWireFormat(int id, int[] complicationBoundsType[], RectF complicationBounds[], int boundsType, int[] supportedTypes[], java.util.List<ComponentName> defaultDataSourcesToTry, int fallbackSystemDataSource, int defaultDataSourceType, int primaryDataSourceDefaultType, int secondaryDataSourceDefaultType, boolean isInitiallyEnabled, boolean fixedComplicationDataSource, Bundle complicationConfigExtras)

publicComplicationSlotMetadataWireFormat(int id, int[] complicationBoundsType[], RectF complicationBounds[], int boundsType, int[] supportedTypes[], java.util.List<ComponentName> defaultDataSourcesToTry, int fallbackSystemDataSource, int defaultDataSourceType, int primaryDataSourceDefaultType, int secondaryDataSourceDefaultType, boolean isInitiallyEnabled, boolean fixedComplicationDataSource, Bundle complicationConfigExtras, BoundingArcWireFormat boundingArc)

Methods
public intdescribeContents()

public BoundingArcWireFormatgetBoundingArc()

public intgetBoundsType()

public RectFgetComplicationBounds()

public int[]getComplicationBoundsType()

public BundlegetComplicationConfigExtras()

public java.util.List<ComponentName>getDefaultDataSourcesToTry()

Along with ComplicationSlotMetadataWireFormat.getFallbackSystemDataSource() this is the wire format for DefaultComplicationDataSourcePolicy.

public intgetDefaultDataSourceType()

public intgetFallbackSystemDataSource()

Along with ComplicationSlotMetadataWireFormat.getDefaultDataSourcesToTry() this is the wire format for DefaultComplicationDataSourcePolicy.

public intgetId()

public intgetPrimaryDataSourceDefaultType()

public intgetSecondaryDataSourceDefaultType()

public int[]getSupportedTypes()

public booleanisFixedComplicationDataSource()

public booleanisInitiallyEnabled()

public voidwriteToParcel(Parcel parcel, int flags)

Serializes this ComplicationDetails to the specified .

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

Fields

public static final <any> CREATOR

Constructors

public ComplicationSlotMetadataWireFormat(int id, int[] complicationBoundsType[], RectF complicationBounds[], int boundsType, int[] supportedTypes[], java.util.List<ComponentName> defaultDataSourcesToTry, int fallbackSystemDataSource, int defaultDataSourceType, int primaryDataSourceDefaultType, int secondaryDataSourceDefaultType, boolean isInitiallyEnabled, boolean fixedComplicationDataSource, Bundle complicationConfigExtras, BoundingArcWireFormat boundingArc)

public ComplicationSlotMetadataWireFormat(int id, int[] complicationBoundsType[], RectF complicationBounds[], int boundsType, int[] supportedTypes[], java.util.List<ComponentName> defaultDataSourcesToTry, int fallbackSystemDataSource, int defaultDataSourceType, int primaryDataSourceDefaultType, int secondaryDataSourceDefaultType, boolean isInitiallyEnabled, boolean fixedComplicationDataSource, Bundle complicationConfigExtras)

public ComplicationSlotMetadataWireFormat(int id, int[] complicationBoundsType[], RectF complicationBounds[], int boundsType, int[] supportedTypes[], java.util.List<ComponentName> defaultDataSourcesToTry, int fallbackSystemDataSource, int defaultDataSourceType, boolean isInitiallyEnabled, boolean fixedComplicationDataSource, Bundle complicationConfigExtras)

Deprecated: Use the other constructor with primaryDataSourceDefaultType & secondaryDataSourceDefaultType instead.

Methods

public int getId()

public int[] getComplicationBoundsType()

public RectF getComplicationBounds()

public int getBoundsType()

public int[] getSupportedTypes()

public java.util.List<ComponentName> getDefaultDataSourcesToTry()

Along with ComplicationSlotMetadataWireFormat.getFallbackSystemDataSource() this is the wire format for DefaultComplicationDataSourcePolicy.

public int getFallbackSystemDataSource()

Along with ComplicationSlotMetadataWireFormat.getDefaultDataSourcesToTry() this is the wire format for DefaultComplicationDataSourcePolicy.

public int getDefaultDataSourceType()

Returns:

The for ComplicationSlotMetadataWireFormat.getFallbackSystemDataSource().

public int getPrimaryDataSourceDefaultType()

Returns:

The for the first entry from ComplicationSlotMetadataWireFormat.getDefaultDataSourcesToTry().

public int getSecondaryDataSourceDefaultType()

Returns:

The for the second entry from ComplicationSlotMetadataWireFormat.getDefaultDataSourcesToTry().

public boolean isInitiallyEnabled()

public boolean isFixedComplicationDataSource()

public Bundle getComplicationConfigExtras()

public BoundingArcWireFormat getBoundingArc()

public void writeToParcel(Parcel parcel, int flags)

Serializes this ComplicationDetails to the specified .

public int describeContents()

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.watchface.data;

import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.wearable.complications.ComplicationData;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.versionedparcelable.ParcelField;
import androidx.versionedparcelable.ParcelUtils;
import androidx.versionedparcelable.VersionedParcelable;
import androidx.versionedparcelable.VersionedParcelize;
import androidx.wear.watchface.complications.data.ComplicationExperimental;

import java.util.List;

/** @hide */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
@VersionedParcelize
@SuppressLint("BanParcelableUsage") // TODO(b/169214666): Remove Parcelable
public final class ComplicationSlotMetadataWireFormat implements VersionedParcelable, Parcelable {

    @ParcelField(1)
    int mId;

    @ParcelField(2)
    @NonNull
    int[] mComplicationBoundsType = new int[0];

    @ParcelField(3)
    @NonNull
    RectF[] mComplicationBounds = new RectF[0];

    @ParcelField(4)
    int mBoundsType;

    @ParcelField(5)
    @NonNull
    @ComplicationData.ComplicationType
    int[] mSupportedTypes = new int[0];

    @ParcelField(6)
    @Nullable
    List<ComponentName> mDefaultDataSourcesToTry;

    @ParcelField(7)
    int mFallbackSystemDataSource;

    @ParcelField(8)
    @ComplicationData.ComplicationType
    int mDefaultType;

    @ParcelField(9)
    boolean mIsInitiallyEnabled;

    @ParcelField(10)
    boolean mFixedComplicationDataSource;

    @ParcelField(11)
    @NonNull
    Bundle mComplicationConfigExtras;

    // Not supported in library v1.0.
    @ParcelField(12)
    @ComplicationData.ComplicationType
    int mPrimaryDataSourceDefaultType = ComplicationData.TYPE_NOT_CONFIGURED;

    // Not supported in library v1.0.
    @ParcelField(13)
    @ComplicationData.ComplicationType
    int mSecondaryDataSourceDefaultType = ComplicationData.TYPE_NOT_CONFIGURED;

    // Only valid for edge complications. Not supported in library v1.0.
    @ParcelField(14)
    @Nullable
    BoundingArcWireFormat mBoundingArc;

    /** Used by VersionedParcelable. */
    ComplicationSlotMetadataWireFormat() {
    }

    @ComplicationExperimental
    public ComplicationSlotMetadataWireFormat(
            int id,
            @NonNull int[] complicationBoundsType,
            @NonNull RectF[] complicationBounds,
            int boundsType,
            @NonNull @ComplicationData.ComplicationType int[] supportedTypes,
            @Nullable List<ComponentName> defaultDataSourcesToTry,
            int fallbackSystemDataSource,
            @ComplicationData.ComplicationType int defaultDataSourceType,
            @ComplicationData.ComplicationType int primaryDataSourceDefaultType,
            @ComplicationData.ComplicationType int secondaryDataSourceDefaultType,
            boolean isInitiallyEnabled,
            boolean fixedComplicationDataSource,
            @NonNull Bundle complicationConfigExtras,
            @Nullable BoundingArcWireFormat boundingArc) {
        mId = id;
        mComplicationBoundsType = complicationBoundsType;
        mComplicationBounds = complicationBounds;
        mBoundsType = boundsType;
        mSupportedTypes = supportedTypes;
        mDefaultDataSourcesToTry = defaultDataSourcesToTry;
        mPrimaryDataSourceDefaultType = primaryDataSourceDefaultType;
        mSecondaryDataSourceDefaultType = secondaryDataSourceDefaultType;
        mFallbackSystemDataSource = fallbackSystemDataSource;
        mDefaultType = defaultDataSourceType;
        mIsInitiallyEnabled = isInitiallyEnabled;
        mFixedComplicationDataSource = fixedComplicationDataSource;
        mComplicationConfigExtras = complicationConfigExtras;
        mBoundingArc = boundingArc;
    }

    // TODO(b/230364881): Deprecate when BoundingArc is no longer experimental.
    public ComplicationSlotMetadataWireFormat(
            int id,
            @NonNull int[] complicationBoundsType,
            @NonNull RectF[] complicationBounds,
            int boundsType,
            @NonNull @ComplicationData.ComplicationType int[] supportedTypes,
            @Nullable List<ComponentName> defaultDataSourcesToTry,
            int fallbackSystemDataSource,
            @ComplicationData.ComplicationType int defaultDataSourceType,
            @ComplicationData.ComplicationType int primaryDataSourceDefaultType,
            @ComplicationData.ComplicationType int secondaryDataSourceDefaultType,
            boolean isInitiallyEnabled,
            boolean fixedComplicationDataSource,
            @NonNull Bundle complicationConfigExtras) {
        mId = id;
        mComplicationBoundsType = complicationBoundsType;
        mComplicationBounds = complicationBounds;
        mBoundsType = boundsType;
        mSupportedTypes = supportedTypes;
        mDefaultDataSourcesToTry = defaultDataSourcesToTry;
        mPrimaryDataSourceDefaultType = primaryDataSourceDefaultType;
        mSecondaryDataSourceDefaultType = secondaryDataSourceDefaultType;
        mFallbackSystemDataSource = fallbackSystemDataSource;
        mDefaultType = defaultDataSourceType;
        mIsInitiallyEnabled = isInitiallyEnabled;
        mFixedComplicationDataSource = fixedComplicationDataSource;
        mComplicationConfigExtras = complicationConfigExtras;
    }

    /**
     * @deprecated Use the other constructor with primaryDataSourceDefaultType &
     * secondaryDataSourceDefaultType instead.
     */
    @Deprecated
    public ComplicationSlotMetadataWireFormat(
            int id,
            @NonNull int[] complicationBoundsType,
            @NonNull RectF[] complicationBounds,
            int boundsType,
            @NonNull @ComplicationData.ComplicationType int[] supportedTypes,
            @Nullable List<ComponentName> defaultDataSourcesToTry,
            int fallbackSystemDataSource,
            @ComplicationData.ComplicationType int defaultDataSourceType,
            boolean isInitiallyEnabled,
            boolean fixedComplicationDataSource,
            @NonNull Bundle complicationConfigExtras) {
        mId = id;
        mComplicationBoundsType = complicationBoundsType;
        mComplicationBounds = complicationBounds;
        mBoundsType = boundsType;
        mSupportedTypes = supportedTypes;
        mDefaultDataSourcesToTry = defaultDataSourcesToTry;
        mFallbackSystemDataSource = fallbackSystemDataSource;
        mDefaultType = defaultDataSourceType;
        mIsInitiallyEnabled = isInitiallyEnabled;
        mFixedComplicationDataSource = fixedComplicationDataSource;
        mComplicationConfigExtras = complicationConfigExtras;
    }

    public int getId() {
        return mId;
    }

    @NonNull
    public int[] getComplicationBoundsType() {
        return mComplicationBoundsType;
    }

    @NonNull
    public RectF[] getComplicationBounds() {
        return mComplicationBounds;
    }

    public int getBoundsType() {
        return mBoundsType;
    }

    @NonNull
    @ComplicationData.ComplicationType
    public int[] getSupportedTypes() {
        return mSupportedTypes;
    }

    /**
     * Along with {@link #getFallbackSystemDataSource} this is the wire format for
     * DefaultComplicationDataSourcePolicy.
     */
    @Nullable
    public List<ComponentName> getDefaultDataSourcesToTry() {
        return mDefaultDataSourcesToTry;
    }

    /**
     * Along with {@link #getDefaultDataSourcesToTry} this is the wire format for
     * DefaultComplicationDataSourcePolicy.
     */
    public int getFallbackSystemDataSource() {
        return mFallbackSystemDataSource;
    }

    /**
     * @return The {@link ComplicationData.ComplicationType} for
     * {@link #getFallbackSystemDataSource}.
     */
    @ComplicationData.ComplicationType
    public int getDefaultDataSourceType() {
        return mDefaultType;
    }

    /**
     * @return The {@link ComplicationData.ComplicationType} for the first entry from
     * {@link #getDefaultDataSourcesToTry}.
     */
    @ComplicationData.ComplicationType
    public int getPrimaryDataSourceDefaultType() {
        // Not supported in library v1.0. TYPE_NOT_CONFIGURED is not a valid API choice indicating
        // and old client.
        return (mPrimaryDataSourceDefaultType == ComplicationData.TYPE_NOT_CONFIGURED)
                ? mDefaultType : mPrimaryDataSourceDefaultType;
    }

    /**
     * @return The {@link ComplicationData.ComplicationType} for the second entry from
     * {@link #getDefaultDataSourcesToTry}.
     */
    @ComplicationData.ComplicationType
    public int getSecondaryDataSourceDefaultType() {
        // Not supported in library v1.0. TYPE_NOT_CONFIGURED is not a valid API choice indicating
        // and old client.
        return (mSecondaryDataSourceDefaultType == ComplicationData.TYPE_NOT_CONFIGURED)
                ? mDefaultType : mSecondaryDataSourceDefaultType;
    }

    public boolean isInitiallyEnabled() {
        return mIsInitiallyEnabled;
    }

    public boolean isFixedComplicationDataSource() {
        return mFixedComplicationDataSource;
    }

    @NonNull
    public Bundle getComplicationConfigExtras() {
        return mComplicationConfigExtras;
    }

    @Nullable
    @ComplicationExperimental
    public BoundingArcWireFormat getBoundingArc() {
        return mBoundingArc;
    }

    /** Serializes this ComplicationDetails to the specified {@link Parcel}. */
    @Override
    public void writeToParcel(@NonNull Parcel parcel, int flags) {
        parcel.writeParcelable(ParcelUtils.toParcelable(this), flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Parcelable.Creator<ComplicationSlotMetadataWireFormat> CREATOR =
            new Parcelable.Creator<ComplicationSlotMetadataWireFormat>() {
                @SuppressWarnings("deprecation")
                @Override
                public ComplicationSlotMetadataWireFormat createFromParcel(Parcel source) {
                    return ParcelUtils.fromParcelable(
                            source.readParcelable(getClass().getClassLoader()));
                }

                @Override
                public ComplicationSlotMetadataWireFormat[] newArray(int size) {
                    return new ComplicationSlotMetadataWireFormat[size];
                }
            };
}