Search in sources :

Example 1 with TransitionManager

use of android.transition.TransitionManager in project platform_frameworks_base by android.

the class CrossFadeDemo method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.crossfade);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade_1, this);
    Crossfade crossfade = new Crossfade();
    crossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_CROSSFADE);
    crossfade.setResizeBehavior(Crossfade.RESIZE_BEHAVIOR_NONE);
    crossfade.addTarget(R.id.textview).addTarget(R.id.textview1).addTarget(R.id.textview2);
    mTransitionManager = new TransitionManager();
    TransitionSet moveCrossFade = new TransitionSet();
    moveCrossFade.addTransition(crossfade).addTransition(new ChangeBounds());
    mTransitionManager.setTransition(mScene1, moveCrossFade);
    mTransitionManager.setTransition(mScene2, moveCrossFade);
    mCurrentScene = 1;
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Crossfade(android.transition.Crossfade) View(android.view.View)

Example 2 with TransitionManager

use of android.transition.TransitionManager in project platform_frameworks_base by android.

the class LoginActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    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 = new TransitionManager();
    // Custom transitions in/out of NewUser screen - slide in the 2nd password UI
    TransitionSet slider = new TransitionSet();
    slider.addTransition(new Slide().addTarget(R.id.retype).addTarget(R.id.retypeEdit));
    slider.addTransition(new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit));
    slider.addTransition(new Fade());
    mTransitionManager.setTransition(mLoginScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mPasswordScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mLoginScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mPasswordScene, slider);
    // Custom transitions with recoloring password field
    Transition colorizer = new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit);
    mTransitionManager.setTransition(mLoginScene, mPasswordScene, colorizer);
    mTransitionManager.setTransition(mPasswordScene, mLoginScene, colorizer);
    mCurrentScene = mLoginScene;
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) Slide(android.transition.Slide) Transition(android.transition.Transition) TextView(android.widget.TextView) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 3 with TransitionManager

use of android.transition.TransitionManager in project platform_frameworks_base by android.

the class Demo2 method sendMessage.

public void sendMessage(View view) {
    if (mFirstTime) {
        mFirstTime = false;
        //        mResultsScreen = new Scene(this, mSceneRoot, R.layout.results_screen);
        try {
            mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
            mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
        } catch (Exception e) {
            System.out.println("Problem loading scene resource: " + e);
        }
        TransitionSet transition = new TransitionSet();
        transition.addTransition(new Fade().addTarget(R.id.resultsText).addTarget(R.id.resultsList)).addTransition(new ChangeBounds().addTarget(R.id.searchContainer)).addTransition(new Recolor().addTarget(R.id.container));
        mTransitionManager = new TransitionManager();
        mTransitionManager.setTransition(mSearchScreen, transition);
        mTransitionManager.setTransition(mResultsScreen, transition);
    }
    if (mCurrentScene == mResultsScreen) {
        mTransitionManager.transitionTo(mSearchScreen);
        mCurrentScene = mSearchScreen;
    } else {
        mTransitionManager.transitionTo(mResultsScreen);
        mCurrentScene = mResultsScreen;
    }
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 4 with TransitionManager

use of android.transition.TransitionManager in project platform_frameworks_base by android.

the class Demo3 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_screen);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
    mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this);
    TransitionSet transition = new TransitionSet();
    transition.addTransition(new Fade()).addTransition(new ChangeBounds()).addTransition(new Recolor());
    mTransitionManager = new TransitionManager();
    mTransitionManager.setTransition(mSearchScreen, transition);
    mTransitionManager.setTransition(mResultsScreen, transition);
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 5 with TransitionManager

use of android.transition.TransitionManager in project platform_frameworks_base by android.

the class Demo4 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_screen);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
    mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this);
    TransitionSet transitionToResults = new TransitionSet();
    Fade fade = new Fade();
    fade.addTarget(R.id.resultsText).addTarget(R.id.resultsList);
    fade.setStartDelay(300);
    fade.setDuration(1000);
    transitionToResults.addTransition(fade).addTransition(new ChangeBounds().addTarget(R.id.searchContainer)).addTransition(new Recolor().addTarget(R.id.container));
    TransitionSet transitionToSearch = new TransitionSet();
    transitionToSearch.addTransition(fade).addTransition(new ChangeBounds().addTarget(R.id.searchContainer)).addTransition(new Recolor().addTarget(R.id.container));
    mTransitionManager = new TransitionManager();
    mTransitionManager.setTransition(mSearchScreen, transitionToSearch);
    mTransitionManager.setTransition(mResultsScreen, transitionToResults);
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Aggregations

TransitionManager (android.transition.TransitionManager)37 TransitionSet (android.transition.TransitionSet)32 View (android.view.View)29 ChangeBounds (android.transition.ChangeBounds)28 Fade (android.transition.Fade)28 Recolor (android.transition.Recolor)24 TextView (android.widget.TextView)9 TransitionInflater (android.transition.TransitionInflater)5 ImageView (android.widget.ImageView)5 MenuView (com.android.internal.view.menu.MenuView)5 DecorContentParent (com.android.internal.widget.DecorContentParent)5 Crossfade (android.transition.Crossfade)4 Slide (android.transition.Slide)4 Transition (android.transition.Transition)4