use of android.transition.TransitionSet in project android_frameworks_base by ResurrectionRemix.
the class SequenceTestSimple method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fading_test_simple);
View container = (View) findViewById(R.id.container);
mSceneRoot = (ViewGroup) container.getParent();
mRemovingButton = (Button) findViewById(R.id.removingButton);
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_simple, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_simple2, this);
TransitionSet fader = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
fader.addTransition(new Fade().addTarget(R.id.removingButton));
fader.addTransition(new ChangeBounds().addTarget(R.id.sceneSwitchButton));
sequencedFade = fader;
sequencedFadeReverse = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
sequencedFadeReverse.addTransition(new ChangeBounds().addTarget(R.id.sceneSwitchButton));
sequencedFadeReverse.addTransition(new Fade().addTarget(R.id.removingButton));
mCurrentScene = mScene1;
}
use of android.transition.TransitionSet in project android_frameworks_base by ResurrectionRemix.
the class ActivityTransitionCoordinator method noLayoutSuppressionForVisibilityTransitions.
/**
* Blocks suppressLayout from Visibility transitions. It is ok to suppress the layout,
* but we don't want to force the layout when suppressLayout becomes false. This leads
* to visual glitches.
*/
private static void noLayoutSuppressionForVisibilityTransitions(Transition transition) {
if (transition instanceof Visibility) {
final Visibility visibility = (Visibility) transition;
visibility.setSuppressLayout(false);
} else if (transition instanceof TransitionSet) {
final TransitionSet set = (TransitionSet) transition;
final int count = set.getTransitionCount();
for (int i = 0; i < count; i++) {
noLayoutSuppressionForVisibilityTransitions(set.getTransitionAt(i));
}
}
}
use of android.transition.TransitionSet in project android_frameworks_base by ResurrectionRemix.
the class ActivityTransitionCoordinator method setTargets.
protected Transition setTargets(Transition transition, boolean add) {
if (transition == null || (add && (mTransitioningViews == null || mTransitioningViews.isEmpty()))) {
return null;
}
// Add the targets to a set containing transition so that transition
// remains unaffected. We don't want to modify the targets of transition itself.
TransitionSet set = new TransitionSet();
if (mTransitioningViews != null) {
for (int i = mTransitioningViews.size() - 1; i >= 0; i--) {
View view = mTransitioningViews.get(i);
if (add) {
set.addTarget(view);
} else {
set.excludeTarget(view, true);
}
}
}
// By adding the transition after addTarget, we prevent addTarget from
// affecting transition.
set.addTransition(transition);
if (!add && mTransitioningViews != null && !mTransitioningViews.isEmpty()) {
// Allow children of excluded transitioning views, but not the views themselves
set = new TransitionSet().addTransition(set);
}
return set;
}
use of android.transition.TransitionSet 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;
}
use of android.transition.TransitionSet in project android_frameworks_base by DirtyUnicorns.
the class SequenceTestSimple method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fading_test_simple);
View container = (View) findViewById(R.id.container);
mSceneRoot = (ViewGroup) container.getParent();
mRemovingButton = (Button) findViewById(R.id.removingButton);
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_simple, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_simple2, this);
TransitionSet fader = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
fader.addTransition(new Fade().addTarget(R.id.removingButton));
fader.addTransition(new ChangeBounds().addTarget(R.id.sceneSwitchButton));
sequencedFade = fader;
sequencedFadeReverse = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
sequencedFadeReverse.addTransition(new ChangeBounds().addTarget(R.id.sceneSwitchButton));
sequencedFadeReverse.addTransition(new Fade().addTarget(R.id.removingButton));
mCurrentScene = mScene1;
}
Aggregations