Java Code Examples for android.view.View#setTagInternal()

The following examples show how to use android.view.View#setTagInternal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActivityOptions.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * This method should be called when the {@link #startSharedElementAnimation(Window, Pair[])}
 * animation must be stopped and the Views reset. This can happen if there was an error
 * from startActivity or a springboard activity and the animation should stop and reset.
 *
 * @hide
 */
public static void stopSharedElementAnimation(Window window) {
    final View decorView = window.getDecorView();
    if (decorView == null) {
        return;
    }
    final ExitTransitionCoordinator exit = (ExitTransitionCoordinator)
            decorView.getTag(com.android.internal.R.id.cross_task_transition);
    if (exit != null) {
        exit.cancelPendingTransitions();
        decorView.setTagInternal(com.android.internal.R.id.cross_task_transition, null);
        TransitionManager.endTransitions((ViewGroup) decorView);
        exit.resetViews();
        exit.clearState();
        decorView.setVisibility(View.VISIBLE);
    }
}
 
Example 2
Source File: ActivityOptions.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public HideWindowListener(Window window, ExitTransitionCoordinator exit) {
    mWindow = window;
    mExit = exit;
    mSharedElements = new ArrayList<>(exit.mSharedElements);
    Transition transition = mWindow.getExitTransition();
    if (transition != null) {
        transition.addListener(this);
        mWaitingForTransition = true;
    } else {
        mWaitingForTransition = false;
    }
    View decorView = mWindow.getDecorView();
    if (decorView != null) {
        if (decorView.getTag(com.android.internal.R.id.cross_task_transition) != null) {
            throw new IllegalStateException(
                    "Cannot start a transition while one is running");
        }
        decorView.setTagInternal(com.android.internal.R.id.cross_task_transition, exit);
    }
}
 
Example 3
Source File: ActivityOptions.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void hideWhenDone() {
    if (mSharedElementHidden && (!mWaitingForTransition || mTransitionEnded)) {
        mExit.resetViews();
        int numSharedElements = mSharedElements.size();
        for (int i = 0; i < numSharedElements; i++) {
            View view = mSharedElements.get(i);
            view.requestLayout();
        }
        View decorView = mWindow.getDecorView();
        if (decorView != null) {
            decorView.setTagInternal(
                    com.android.internal.R.id.cross_task_transition, null);
            decorView.setVisibility(View.GONE);
        }
    }
}
 
Example 4
Source File: RemoteViews.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
    final View target = root.findViewById(viewId);
    if (target == null) return;

    target.setTagInternal(R.id.remote_input_tag, remoteInputs);
}
 
Example 5
Source File: Scene.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Set the scene that the given view is in. The current scene is set only
 * on the root view of a scene, not for every view in that hierarchy. This
 * information is used by Scene to determine whether there is a previous
 * scene which should be exited before the new scene is entered.
 *
 * @param view The view on which the current scene is being set
 */
static void setCurrentScene(View view, Scene scene) {
    view.setTagInternal(com.android.internal.R.id.current_scene, scene);
}