本文整理汇总了Java中android.support.transition.TransitionSet类的典型用法代码示例。如果您正苦于以下问题:Java TransitionSet类的具体用法?Java TransitionSet怎么用?Java TransitionSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransitionSet类属于android.support.transition包,在下文中一共展示了TransitionSet类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setOnStaggeredTransitionPreparedListener_setsField_whenPassed_nonNull_listener
import android.support.transition.TransitionSet; //导入依赖的package包/类
@Test
public void setOnStaggeredTransitionPreparedListener_setsField_whenPassed_nonNull_listener() {
//given
StaggeredAnimationGroup spiedGroup = prepareSpiedGroup();
StaggeredAnimationGroup.OnTransitionPreparedListener testListener =
new StaggeredAnimationGroup.OnTransitionPreparedListener() {
@Override
public TransitionSet onStaggeredTransitionPrepared(TransitionSet transition, boolean show, boolean inReversedOrder) {
return transition;
}
};
//when
spiedGroup.setOnTransitionPreparedListener(testListener);
//then
assertThat(spiedGroup.onPreparedListener).isEqualTo(testListener);
}
示例2: onResume
import android.support.transition.TransitionSet; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (mTextView == null)
return;
mTextView.postDelayed(new Runnable() {
@Override
public void run() {
if (mTextView != null) {
TransitionSet transition = (TransitionSet) new TransitionSet().addTransition(new Fade(Fade.OUT)).addTransition(new ChangeBounds()).addTransition(new Fade(Fade.IN)).setDuration(1000);
TransitionManager.beginDelayedTransition(logoContainer, transition);
mTextView.setVisibility(View.VISIBLE);
}
}
}, 1000);
}
示例3: hideWithFadeView
import android.support.transition.TransitionSet; //导入依赖的package包/类
public static void hideWithFadeView(boolean on, ViewGroup rootView, View view) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Fade fade = new Fade();
fade.setDuration(500);
ChangeBounds changeBounds = new ChangeBounds();
changeBounds.setDuration(500);
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(fade);
transitionSet.addTransition(changeBounds);
transitionSet.setOrdering(TransitionSet.ORDERING_TOGETHER);
TransitionManager.beginDelayedTransition(rootView, transitionSet);
}
view.setVisibility(on ? View.GONE : View.VISIBLE);
}
示例4: goneSlidingTabs
import android.support.transition.TransitionSet; //导入依赖的package包/类
private void goneSlidingTabs(boolean on) {
if (!isInvisible) {
Fade fade = new Fade();
fade.setDuration(500);
ChangeBounds changeBounds = new ChangeBounds();
changeBounds.setDuration(500);
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(fade);
transitionSet.addTransition(changeBounds);
transitionSet.setOrdering(TransitionSet.ORDERING_TOGETHER);
TransitionManager.beginDelayedTransition(getBinding().root, transitionSet);
getBinding().slidingTabs.setVisibility(on ? View.GONE : View.VISIBLE);
}
}
示例5: animateForViewGroupTransition
import android.support.transition.TransitionSet; //导入依赖的package包/类
public static void animateForViewGroupTransition(ViewGroup viewGroup) {
ChangeBounds changeBounds = new ChangeBounds();
Fade fadeOut = new Fade(Fade.OUT);
Fade fadeIn = new Fade(Fade.IN);
TransitionSet transition = new TransitionSet();
transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
transition.addTransition(fadeOut)
.addTransition(changeBounds)
.addTransition(fadeIn);
TransitionManager.beginDelayedTransition(viewGroup);
}
示例6: onStaggeredTransitionPrepared
import android.support.transition.TransitionSet; //导入依赖的package包/类
@NonNull
@Override
public TransitionSet onStaggeredTransitionPrepared(@NonNull TransitionSet transitionSet,
boolean isShowing,
boolean inReversedOrder) {
return transitionSet;
}
示例7: addTransitionToStaggeredTransition
import android.support.transition.TransitionSet; //导入依赖的package包/类
@VisibleForTesting
final void addTransitionToStaggeredTransition(Transition basePartialTransition,
TransitionSet staggeredTransition,
int viewId, int indexInTransition) {
Transition partialTransition =
applyStaggeredTransitionParams(basePartialTransition, viewId, indexInTransition);
staggeredTransition.addTransition(partialTransition);
}
示例8: onCreate
import android.support.transition.TransitionSet; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mStaggerCB = (CheckBox) findViewById(R.id.staggerCB);
mFirstButton = (Button) findViewById(R.id.firstButton);
mSecondButton = (Button) findViewById(R.id.secondButton);
mThirdButton = (Button) findViewById(R.id.thirdButton);
mFourthButton = (Button) findViewById(R.id.fourthButton);
mSceneRoot = (ViewGroup) findViewById(R.id.activity_main);
// Create custom transition that 'staggers' the animations by offsetting
// the individual start times
mStaggeredTransition = new TransitionSet();
Transition first = new ChangeBounds();
Transition second = new ChangeBounds();
Transition third = new ChangeBounds();
Transition fourth = new ChangeBounds();
first.addTarget(mFirstButton);
second.setStartDelay(50).addTarget(mSecondButton);
third.setStartDelay(100).addTarget(mThirdButton);
fourth.setStartDelay(150).addTarget(mFourthButton);
mStaggeredTransition.addTransition(first).addTransition(second).addTransition(third).
addTransition(fourth);
}
示例9: BottomNavigationMenuView
import android.support.transition.TransitionSet; //导入依赖的package包/类
public BottomNavigationMenuView(Context context, AttributeSet attrs) {
super(context, attrs);
final Resources res = getResources();
inactiveItemMaxWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_max_width);
inactiveItemMinWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_min_width);
activeItemMaxWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_max_width);
activeItemMinWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_min_width);
itemHeight = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_height);
itemTextColorDefault = createDefaultColorStateList(android.R.attr.textColorSecondary);
set = new AutoTransition();
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
set.setDuration(ACTIVE_ANIMATION_DURATION_MS);
set.setInterpolator(new FastOutSlowInInterpolator());
set.addTransition(new TextScale());
onClickListener =
new OnClickListener() {
@Override
public void onClick(View v) {
final BottomNavigationItemView itemView = (BottomNavigationItemView) v;
MenuItem item = itemView.getItemData();
if (!menu.performItemAction(item, presenter, 0)) {
item.setChecked(true);
}
}
};
tempChildWidths = new int[BottomNavigationMenu.MAX_ITEM_COUNT];
}
开发者ID:material-components,项目名称:material-components-android,代码行数:34,代码来源:BottomNavigationMenuView.java
示例10: BottomNavigationMenuView
import android.support.transition.TransitionSet; //导入依赖的package包/类
public BottomNavigationMenuView(Context context, AttributeSet attrs) {
super(context, attrs);
final Resources res = getResources();
mInactiveItemMaxWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_max_width);
mInactiveItemMinWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_min_width);
mActiveItemMaxWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_max_width);
mActiveItemMinWidth =
res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_min_width);
mItemHeight = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_height);
mSet = new AutoTransition();
mSet.setOrdering(TransitionSet.ORDERING_TOGETHER);
mSet.setDuration(ACTIVE_ANIMATION_DURATION_MS);
mSet.setInterpolator(new FastOutSlowInInterpolator());
mSet.addTransition(new TextScale());
mOnClickListener =
new OnClickListener() {
@Override
public void onClick(View v) {
final BottomNavigationItemView itemView = (BottomNavigationItemView) v;
MenuItem item = itemView.getItemData();
if (!mMenu.performItemAction(item, mPresenter, 0)) {
item.setChecked(true);
}
}
};
mTempChildWidths = new int[BottomNavigationMenu.MAX_ITEM_COUNT];
}
示例11: onCreate
import android.support.transition.TransitionSet; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transition);
radioGroup.setOnCheckedChangeListener(this);
// A Scene can be instantiated from a live view hierarchy.
mScene1 = new Scene(sceneRoot, sceneRoot.findViewById(R.id.container));
// You can also inflate a generate a Scene from a layout resource file.
mScene2 = Scene.getSceneForLayout(sceneRoot, R.layout.scene2, this);
// Another scene from a layout resource file.
mScene3 = Scene.getSceneForLayout(sceneRoot, R.layout.scene3, this);
// We create a custom TransitionManager for Scene 3, in which ChangeBounds and Fade
// take place at the same time.
/* Same as:
mTransitionManagerForScene3 = TransitionInflater.from(this)
.inflateTransitionManager(R.transition.scene3_transition_manager, sceneRoot);
+ in transition/scene3_transition_manager.xml
<transitionManager xmlns:android="http://schemas.android.com/apk/res/android">
<transition
android:toScene="@layout/scene3"
android:transition="@transition/changebounds_fadein_together"/>
</transitionManager>
+ in transition/changebounds_fadein_together.xml
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<changeBounds/>
<fade android:fadingMode="fade_in">
<targets>
<target android:targetId="@id/transition_title" />
</targets>
</fade>
</transitionSet>
*/
TransitionSet scene3Transitions = new TransitionSet();
scene3Transitions
.addTransition(new ChangeBounds())
.addTransition(new Fade(Fade.IN).addTarget(R.id.transition_title));
mTransitionManagerForScene3 = new TransitionManager();
mTransitionManagerForScene3.setTransition(mScene3, scene3Transitions);
}
示例12: onStaggeredTransitionReady
import android.support.transition.TransitionSet; //导入依赖的package包/类
@VisibleForTesting
final TransitionSet onStaggeredTransitionReady(TransitionSet transition, boolean isShowing, boolean inReversedOrder) {
return onPreparedListener.onStaggeredTransitionPrepared(transition, isShowing, inReversedOrder);
}