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;
}
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;
}
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;
}
}
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);
}
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);
}
Aggregations