use of android.transition.TransitionSet in project platform_frameworks_base by android.
the class SurfaceAndTextureViews method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.surface_texture_views);
final ViewGroup container = (ViewGroup) findViewById(R.id.container);
Button toggleButton = (Button) findViewById(R.id.toggleButton);
mView = new SimpleView(this);
mView.setId(0);
mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
container.addView(mView);
mSurfaceView = new SimpleSurfaceView(this);
mSurfaceView.setId(1);
mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
container.addView(mSurfaceView);
mTextureView = new SimpleTextureView(this);
mTextureView.setId(2);
mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
container.addView(mTextureView);
final TransitionSet transition = new TransitionSet();
transition.addTransition(new ChangeBounds()).addTransition(new Crossfade().addTarget(0).addTarget(1).addTarget(2));
toggleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Scene newScene = new Scene(container);
newScene.setEnterAction(new Runnable() {
@Override
public void run() {
if (mView.getWidth() <= SMALL_SIZE) {
mView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
mView.mColor = SimpleView.LARGE_COLOR;
mSurfaceView.mColor = SimpleSurfaceView.LARGE_COLOR;
mTextureView.mColor = SimpleTextureView.LARGE_COLOR;
} else {
mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
mView.mColor = SimpleView.SMALL_COLOR;
mSurfaceView.mColor = SimpleSurfaceView.SMALL_COLOR;
mTextureView.mColor = SimpleTextureView.SMALL_COLOR;
}
}
});
TransitionManager.go(newScene, transition);
}
});
}
use of android.transition.TransitionSet in project platform_frameworks_base by android.
the class HierarchicalMove method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hierarchical_move);
View container = (View) findViewById(R.id.container);
mSceneRoot = (ViewGroup) container.getParent();
buttons[0] = (Button) findViewById(R.id.button0);
buttons[1] = (Button) findViewById(R.id.button1);
buttons[2] = (Button) findViewById(R.id.button2);
buttons[3] = (Button) findViewById(R.id.button3);
buttons[4] = (Button) findViewById(R.id.button4);
buttons[5] = (Button) findViewById(R.id.button5);
// Move button0, then buttons 1/2 together, then buttons 3/4/5 sequentially:
// group (seq)
// Move 0
// group (seq)
// group (together)
// Move 1
// Move 2
// group (sequentially)
// Move 3
// Move 4/5
TransitionSet rootTransition = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
// button0
Transition move0 = new ChangeBounds();
move0.addTarget(buttons[0]);
// buttons 1/2/3/4/5
TransitionSet group12345 = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
// buttons 1/2
TransitionSet group12 = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER);
ChangeBounds changeBounds1 = new ChangeBounds();
changeBounds1.addTarget(buttons[1]);
ChangeBounds changeBounds2 = new ChangeBounds();
changeBounds2.addTarget(buttons[2]);
group12.addTransition(changeBounds1).addTransition(changeBounds2);
TransitionSet group345 = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
ChangeBounds changeBounds3 = new ChangeBounds();
changeBounds3.addTarget(buttons[3]);
ChangeBounds changeBounds45 = new ChangeBounds();
changeBounds45.addTarget(buttons[4]).addTarget(buttons[5]);
group345.addTransition(changeBounds3).addTransition(changeBounds45);
group12345.addTransition(move0).addTransition(group12).addTransition(group345);
rootTransition.addTransition(group12345);
rootTransition.setDuration(1000);
mTransition = rootTransition;
}
use of android.transition.TransitionSet 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.TransitionSet 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.TransitionSet 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);
}
Aggregations