public class

TransitionValues

extends java.lang.Object

 java.lang.Object

↳androidx.transition.TransitionValues

Gradle dependencies

compile group: 'androidx.transition', name: 'transition', version: '1.4.1'

  • groupId: androidx.transition
  • artifactId: transition
  • version: 1.4.1

Artifact androidx.transition:transition:1.4.1 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.transition:transition com.android.support:transition

Androidx class mapping:

androidx.transition.TransitionValues android.support.transition.TransitionValues

Overview

Data structure which holds cached values for the transition. The view field is the target which all of the values pertain to. The values field is a map which holds information for fields according to names selected by the transitions. These names should be unique to avoid clobbering values stored by other transitions, such as the convention project:transition_name:property_name. For example, the platform might store a property "alpha" in a transition "Fader" as "android:fader:alpha".

These values are cached during the Transition.captureStartValues(TransitionValues) capture} phases of a scene change, once when the start values are captured and again when the end values are captured. These start/end values are then passed into the transitions via the for Transition method.

Summary

Fields
public final java.util.Map<java.lang.String, java.lang.Object>values

The set of values tracked by transitions for this scene

public Viewview

The View with these values

Constructors
publicTransitionValues()

publicTransitionValues(View view)

Methods
public booleanequals(java.lang.Object other)

public inthashCode()

public java.lang.StringtoString()

from java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait

Fields

public final java.util.Map<java.lang.String, java.lang.Object> values

The set of values tracked by transitions for this scene

public View view

The View with these values

Constructors

public TransitionValues()

Deprecated: Use TransitionValues.TransitionValues(View) instead

public TransitionValues(View view)

Methods

public boolean equals(java.lang.Object other)

public int hashCode()

public java.lang.String toString()

Source

/*
 * Copyright (C) 2016 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.transition;

import android.view.View;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * Data structure which holds cached values for the transition.
 * The view field is the target which all of the values pertain to.
 * The values field is a map which holds information for fields
 * according to names selected by the transitions. These names should
 * be unique to avoid clobbering values stored by other transitions,
 * such as the convention project:transition_name:property_name. For
 * example, the platform might store a property "alpha" in a transition
 * "Fader" as "android:fader:alpha".
 *
 * <p>These values are cached during the
 * {@link androidx.transition.Transition#captureStartValues(TransitionValues)}
 * capture} phases of a scene change, once when the start values are captured
 * and again when the end values are captured. These start/end values are then
 * passed into the transitions via the
 * for {@link androidx.transition.Transition#createAnimator(android.view.ViewGroup,
 * TransitionValues, TransitionValues)} method.</p>
 */
public class TransitionValues {

    /** @deprecated Use {@link #TransitionValues(View)} instead */
    @Deprecated
    public TransitionValues() {
    }

    public TransitionValues(@NonNull View view) {
        this.view = view;
    }

    /**
     * The set of values tracked by transitions for this scene
     */
    public final Map<String, Object> values = new HashMap<>();

    /**
     * The View with these values
     */
    // TODO Make it NonNull and final after removing the deprecated constructor.
    public View view;

    /**
     * The Transitions that targeted this view.
     */
    final ArrayList<Transition> mTargetedTransitions = new ArrayList<>();

    @Override
    public boolean equals(Object other) {
        if (other instanceof TransitionValues) {
            if (view == ((TransitionValues) other).view) {
                if (values.equals(((TransitionValues) other).values)) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        return 31 * view.hashCode() + values.hashCode();
    }

    @Override
    public String toString() {
        String returnValue = "TransitionValues@" + Integer.toHexString(hashCode()) + ":\n";
        returnValue += "    view = " + view + "\n";
        returnValue += "    values:";
        for (String s : values.keySet()) {
            returnValue += "    " + s + ": " + values.get(s) + "\n";
        }
        return returnValue;
    }

}