Search in sources :

Example 1 with TransitionInflater

use of android.transition.TransitionInflater in project android_frameworks_base by ResurrectionRemix.

the class LoginActivityFromResources method sendMessage.

public void sendMessage(View view) {
    if (mTransitionManager == null) {
        TransitionInflater inflater = TransitionInflater.from(this);
        mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
        mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
        mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
        mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
        mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
        mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
        mTransitionManager = inflater.inflateTransitionManager(R.transition.login_transition_mgr, mSceneRoot);
        mCurrentScene = mLoginScene;
    }
    TextView textView = (TextView) view;
    CharSequence text = textView.getText();
    if (text.equals("Cancel")) {
        applyScene(mLoginScene);
    } else if (text.equals("Submit")) {
        if (mCurrentScene == mLoginScene) {
            applyScene(mPasswordScene);
        } else if (mCurrentScene == mPasswordScene) {
            applyScene(Math.random() < .5 ? mSuccessScene : mIncorrectPasswordScene);
        } else if (mCurrentScene == mNewUserScene) {
            applyScene(Math.random() < .5 ? mSuccessScene : mUsernameTakenScene);
        }
    } else if (text.equals("New User?")) {
        applyScene(mNewUserScene);
    } else if (text.equals("Okay")) {
        if (mCurrentScene == mIncorrectPasswordScene) {
            applyScene(mPasswordScene);
        } else {
            // username taken scene
            applyScene(mNewUserScene);
        }
    } else if (text.equals("Reset")) {
        applyScene(mLoginScene);
    }
}
Also used : TextView(android.widget.TextView) TransitionInflater(android.transition.TransitionInflater)

Example 2 with TransitionInflater

use of android.transition.TransitionInflater in project android_frameworks_base by ResurrectionRemix.

the class Fragment method loadTransition.

private static Transition loadTransition(Context context, TypedArray typedArray, Transition currentValue, Transition defaultValue, int id) {
    if (currentValue != defaultValue) {
        return currentValue;
    }
    int transitionId = typedArray.getResourceId(id, 0);
    Transition transition = defaultValue;
    if (transitionId != 0 && transitionId != com.android.internal.R.transition.no_transition) {
        TransitionInflater inflater = TransitionInflater.from(context);
        transition = inflater.inflateTransition(transitionId);
        if (transition instanceof TransitionSet && ((TransitionSet) transition).getTransitionCount() == 0) {
            transition = null;
        }
    }
    return transition;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) TransitionInflater(android.transition.TransitionInflater)

Example 3 with TransitionInflater

use of android.transition.TransitionInflater in project android_frameworks_base by DirtyUnicorns.

the class LoginActivityFromResources method sendMessage.

public void sendMessage(View view) {
    if (mTransitionManager == null) {
        TransitionInflater inflater = TransitionInflater.from(this);
        mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
        mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
        mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
        mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
        mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
        mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
        mTransitionManager = inflater.inflateTransitionManager(R.transition.login_transition_mgr, mSceneRoot);
        mCurrentScene = mLoginScene;
    }
    TextView textView = (TextView) view;
    CharSequence text = textView.getText();
    if (text.equals("Cancel")) {
        applyScene(mLoginScene);
    } else if (text.equals("Submit")) {
        if (mCurrentScene == mLoginScene) {
            applyScene(mPasswordScene);
        } else if (mCurrentScene == mPasswordScene) {
            applyScene(Math.random() < .5 ? mSuccessScene : mIncorrectPasswordScene);
        } else if (mCurrentScene == mNewUserScene) {
            applyScene(Math.random() < .5 ? mSuccessScene : mUsernameTakenScene);
        }
    } else if (text.equals("New User?")) {
        applyScene(mNewUserScene);
    } else if (text.equals("Okay")) {
        if (mCurrentScene == mIncorrectPasswordScene) {
            applyScene(mPasswordScene);
        } else {
            // username taken scene
            applyScene(mNewUserScene);
        }
    } else if (text.equals("Reset")) {
        applyScene(mLoginScene);
    }
}
Also used : TextView(android.widget.TextView) TransitionInflater(android.transition.TransitionInflater)

Example 4 with TransitionInflater

use of android.transition.TransitionInflater in project android_frameworks_base by DirtyUnicorns.

the class ResourceLoadingTest method sendMessage.

public void sendMessage(View view) {
    if (mTransitionManager == null) {
        try {
            TransitionInflater inflater = TransitionInflater.from(this);
            mTransitionManager = inflater.inflateTransitionManager(R.transition.my_transition_mgr, mSceneRoot);
            Scene loadedScene = new Scene(mSceneRoot);
            System.out.println("loadedScene = " + loadedScene);
            Transition loadedTransition = inflater.inflateTransition(R.transition.my_transition);
            System.out.println("loadedTransition = " + loadedTransition);
        } catch (Exception e) {
            System.out.println("Problem loading scene resource: " + e);
        }
    }
    if (mCurrentScene == RESULTS_SCREEN) {
        Scene scene = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
        mTransitionManager.transitionTo(scene);
        mCurrentScene = SEARCH_SCREEN;
    } else {
        Scene scene = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this);
        mTransitionManager.transitionTo(scene);
        mCurrentScene = RESULTS_SCREEN;
    }
}
Also used : Transition(android.transition.Transition) TransitionInflater(android.transition.TransitionInflater) Scene(android.transition.Scene)

Example 5 with TransitionInflater

use of android.transition.TransitionInflater in project android_frameworks_base by AOSPA.

the class PopupWindow method getTransition.

private Transition getTransition(int resId) {
    if (resId != 0 && resId != R.transition.no_transition) {
        final TransitionInflater inflater = TransitionInflater.from(mContext);
        final Transition transition = inflater.inflateTransition(resId);
        if (transition != null) {
            final boolean isEmpty = transition instanceof TransitionSet && ((TransitionSet) transition).getTransitionCount() == 0;
            if (!isEmpty) {
                return transition;
            }
        }
    }
    return null;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) TransitionInflater(android.transition.TransitionInflater)

Aggregations

TransitionInflater (android.transition.TransitionInflater)29 Transition (android.transition.Transition)19 TransitionSet (android.transition.TransitionSet)15 TextView (android.widget.TextView)9 ImageView (android.widget.ImageView)6 TransitionManager (android.transition.TransitionManager)5 View (android.view.View)5 MenuView (com.android.internal.view.menu.MenuView)5 DecorContentParent (com.android.internal.widget.DecorContentParent)5 Scene (android.transition.Scene)4 Context (android.content.Context)1 Resources (android.content.res.Resources)1 Bitmap (android.graphics.Bitmap)1 Drawable (android.graphics.drawable.Drawable)1 Nullable (androidx.annotation.Nullable)1 Toolbar (androidx.appcompat.widget.Toolbar)1 DataSource (com.bumptech.glide.load.DataSource)1 GlideException (com.bumptech.glide.load.engine.GlideException)1 RequestListener (com.bumptech.glide.request.RequestListener)1 CustomTarget (com.bumptech.glide.request.target.CustomTarget)1