本文整理汇总了Java中android.transition.TransitionSet.addTransition方法的典型用法代码示例。如果您正苦于以下问题:Java TransitionSet.addTransition方法的具体用法?Java TransitionSet.addTransition怎么用?Java TransitionSet.addTransition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.transition.TransitionSet
的用法示例。
在下文中一共展示了TransitionSet.addTransition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initTransitions
import android.transition.TransitionSet; //导入方法依赖的package包/类
@TargetApi(21) private void initTransitions() {
Window window = getActivity().getWindow();
window.setEnterTransition(
new ExplodeFadeEnterTransition(senderNameView, senderMailView, separatorLine));
window.setExitTransition(new ExcludedExplodeTransition());
window.setReenterTransition(new ExcludedExplodeTransition());
window.setReturnTransition(new ExcludedExplodeTransition());
TransitionSet textSizeSet = new TransitionSet();
textSizeSet.addTransition(
TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.move));
TextSizeTransition textSizeTransition = new TextSizeTransition();
textSizeTransition.addTarget(R.id.subject);
textSizeTransition.addTarget(getString(R.string.shared_mail_subject));
textSizeSet.addTransition(textSizeTransition);
textSizeSet.setOrdering(TransitionSet.ORDERING_TOGETHER);
window.setSharedElementEnterTransition(textSizeSet);
getActivity().setEnterSharedElementCallback(
new TextSizeEnterSharedElementCallback(getActivity()));
}
示例2: onClick
import android.transition.TransitionSet; //导入方法依赖的package包/类
@OnClick(R.id.square2)
public void onClick() {
FragmentSharedElementTransitionTarget targetFragment = new FragmentSharedElementTransitionTarget();
// FIXME: 08/02/2017 the shared element transitions to the next fragment below other views while it should be on top as in Activity transitions
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new ChangeBounds());
transitionSet.setPathMotion(new ArcMotion());
targetFragment.setSharedElementEnterTransition(transitionSet);
targetFragment.setSharedElementReturnTransition(transitionSet);
targetFragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_bottom));
targetFragment.setExitTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_top_and_fade));
setExitTransition(new Explode());
setReenterTransition(new Explode());
setAllowReturnTransitionOverlap(false);
}
getActivity().getSupportFragmentManager()
.beginTransaction()
.addSharedElement(square2, getString(R.string.custom_element_transition_name))
.replace(R.id.fragmentContainer, targetFragment)
.addToBackStack(null)
.commit();
}
示例3: constructTransitions
import android.transition.TransitionSet; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private TransitionSet constructTransitions() {
int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider};
Transition slideTransition = new Slide(Gravity.BOTTOM);
Transition fadeTransition = new Fade();
for (int slideTarget : slideTargets) {
slideTransition.addTarget(slideTarget);
fadeTransition.excludeTarget(slideTarget, true);
}
TransitionSet set = new TransitionSet();
set.addTransition(slideTransition);
set.addTransition(fadeTransition);
return set;
}
示例4: onCreate
import android.transition.TransitionSet; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_detail);
postponeEnterTransition();
TransitionSet transitions = new TransitionSet();
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.interpolator.linear_out_slow_in));
slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
transitions.addTransition(slide);
transitions.addTransition(new Fade());
getWindow().setEnterTransition(transitions);
Intent intent = getIntent();
sharedElementCallback = new DetailSharedElementEnterCallback(intent);
setEnterSharedElementCallback(sharedElementCallback);
initialItem = intent.getIntExtra(IntentUtil.SELECTED_ITEM_POSITION, 0);
setUpViewPager(intent.<Photo>getParcelableArrayListExtra(IntentUtil.PHOTO));
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(navigationOnClickListener);
super.onCreate(savedInstanceState);
}
示例5: startTransition
import android.transition.TransitionSet; //导入方法依赖的package包/类
private void startTransition(){
lifeGridFragment = LifeGridFragment.newInstance();
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if(Build.VERSION.SDK_INT >= 21) {
TransitionSet gridTransition = new TransitionSet();
gridTransition.setDuration(600);
gridTransition.addTransition(new ChangeBounds());
gridTransition.addTransition((new ChangeTransform()));
lifeGridFragment.setSharedElementEnterTransition(gridTransition);
}
fragmentTransaction.addSharedElement(findViewById(R.id.intro_card_view), getString(R.string.card_view_transition_name));
fragmentTransaction.replace(R.id.container, lifeGridFragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
appBarLayout.setExpanded(false, true);
}
示例6: GalleryFragment
import android.transition.TransitionSet; //导入方法依赖的package包/类
public GalleryFragment() {
final Fade fade = new Fade();
fade.addTarget(R.id.appbar);
Explode explode = new Explode();
explode.excludeTarget(R.id.appbar, true);
Elevation elevation = new Elevation();
elevation.addTarget(R.id.gallery_card);
elevation.setStartDelay(250); // arbitrarily chosen delay
TransitionSet exit = new TransitionSet();
exit.addTransition(fade);
exit.addTransition(explode);
exit.addTransition(elevation);
setExitTransition(exit);
}
示例7: createTransition
import android.transition.TransitionSet; //导入方法依赖的package包/类
private Transition createTransition() {
TransitionSet set = new TransitionSet();
set.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
Transition tFab = new Scale();
tFab.setDuration(150);
tFab.addTarget(fab);
Transition tTitle = new Fold();
tTitle.setDuration(150);
tTitle.addTarget(titlePanel);
Transition tTrack = new Fold();
tTrack.setDuration(150);
tTrack.addTarget(trackPanel);
set.addTransition(tTrack);
set.addTransition(tTitle);
set.addTransition(tFab);
return set;
}
示例8: onCheckedChanged
import android.transition.TransitionSet; //导入方法依赖的package包/类
@Override public void onCheckedChanged(final RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.select_scene_1: {
// You can start an automatic transition with TransitionManager.go().
TransitionManager.go(mScene1);
break;
}
case R.id.select_scene_2: {
TransitionSet set = new TransitionSet();
Slide slide = new Slide(Gravity.LEFT);
slide.addTarget(R.id.transition_title);
set.addTransition(slide);
set.addTransition(new ChangeBounds());
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
set.setDuration(350);
TransitionManager.go(mScene2, set);
break;
}
case R.id.select_scene_3: {
// You can also start a transition with a custom TransitionManager.
mTransitionManagerForScene3.transitionTo(mScene3);
break;
}
}
}
示例9: mergeTransitions
import android.transition.TransitionSet; //导入方法依赖的package包/类
public static Transition mergeTransitions(Transition... transitions) {
int count = 0;
int nonNullIndex = -1;
for (int i = 0; i < transitions.length; i++) {
if (transitions[i] != null) {
count++;
nonNullIndex = i;
}
}
if (count == 0) {
return null;
}
if (count == 1) {
return transitions[nonNullIndex];
}
TransitionSet transitionSet = new TransitionSet();
for (int i = 0; i < transitions.length; i++) {
if (transitions[i] != null) {
transitionSet.addTransition(transitions[i]);
}
}
return transitionSet;
}
示例10: makeSharedElementEnterTransition
import android.transition.TransitionSet; //导入方法依赖的package包/类
public static Transition makeSharedElementEnterTransition(List<String> textTransitionNames) {
TransitionSet set = new TransitionSet();
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
Transition recolor = new Recolor();
Transition changeBounds = new ChangeBounds();
Transition textSize = new TextSizeTransition();
for (String textTName : textTransitionNames) {
changeBounds.addTarget(textTName);
textSize.addTarget(textTName);
recolor.addTarget(textTName);
}
set.addTransition(recolor);
set.addTransition(changeBounds);
set.addTransition(textSize);
///set.setDuration(3000);
return set;
}
示例11: onTextClick
import android.transition.TransitionSet; //导入方法依赖的package包/类
@OnClick({ R.id.text1 })
public void onTextClick() {
// Create a TransitionSet that will animated ChangeBounds and Fade
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new ChangeBounds());
transitionSet.addTransition(new Fade());
TransitionManager.beginDelayedTransition(mLayout, transitionSet);
// Remove text1 from the Layout
mLayout.removeView(mText1);
// Increase the height of Text1 and set a top margin
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mText1.getLayoutParams();
params.height *= 2;
params.topMargin = 100;
mText1.setLayoutParams(params);
// Add text1 back to the layout
// TransitionManager will automagically apply animations
mLayout.addView(mText1, 1);
}
示例12: createTransitionSet
import android.transition.TransitionSet; //导入方法依赖的package包/类
public static TransitionSet createTransitionSet(
ScalingUtils.ScaleType fromScale,
ScalingUtils.ScaleType toScale) {
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new ChangeBounds());
transitionSet.addTransition(new DraweeTransition(fromScale, toScale));
return transitionSet;
}
示例13: setupTransitions
import android.transition.TransitionSet; //导入方法依赖的package包/类
public void setupTransitions() {
// Add shared element transition animation if on Lollipop or later
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Enter transitions
TransitionSet setEnter = new TransitionSet();
Transition slideDown = new Explode();
slideDown.addTarget(headerView);
slideDown.excludeTarget(scrollView, true);
slideDown.setDuration(500);
setEnter.addTransition(slideDown);
Transition fadeOut = new Slide(Gravity.BOTTOM);
fadeOut.addTarget(scrollView);
fadeOut.setDuration(500);
setEnter.addTransition(fadeOut);
// Exit transitions
TransitionSet setExit = new TransitionSet();
Transition slideDown2 = new Explode();
slideDown2.addTarget(headerView);
slideDown2.setDuration(570);
setExit.addTransition(slideDown2);
Transition fadeOut2 = new Slide(Gravity.BOTTOM);
fadeOut2.addTarget(scrollView);
fadeOut2.setDuration(280);
setExit.addTransition(fadeOut2);
getWindow().setEnterTransition(setEnter);
getWindow().setReturnTransition(setExit);
}
}
示例14: performTransition
import android.transition.TransitionSet; //导入方法依赖的package包/类
private void performTransition()
{
if (isDestroyed())
{
return;
}
Fragment previousFragment = mFragmentManager.findFragmentById(R.id.fragment_container);
Fragment nextFragment = Fragment2.newInstance();
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
// 1. Exit for Previous Fragment
Fade exitFade = new Fade();
exitFade.setDuration(FADE_DEFAULT_TIME);
previousFragment.setExitTransition(exitFade);
// 2. Shared Elements Transition
TransitionSet enterTransitionSet = new TransitionSet();
enterTransitionSet.addTransition(TransitionInflater.from(this).inflateTransition(android.R.transition.move));
enterTransitionSet.setDuration(MOVE_DEFAULT_TIME);
enterTransitionSet.setStartDelay(FADE_DEFAULT_TIME);
nextFragment.setSharedElementEnterTransition(enterTransitionSet);
// 3. Enter Transition for New Fragment
Fade enterFade = new Fade();
enterFade.setStartDelay(MOVE_DEFAULT_TIME + FADE_DEFAULT_TIME);
enterFade.setDuration(FADE_DEFAULT_TIME);
nextFragment.setEnterTransition(enterFade);
View logo = ButterKnife.findById(this, R.id.fragment1_logo);
fragmentTransaction.addSharedElement(logo, logo.getTransitionName());
fragmentTransaction.replace(R.id.fragment_container, nextFragment);
fragmentTransaction.commitAllowingStateLoss();
}
示例15: getDefaultTransition
import android.transition.TransitionSet; //导入方法依赖的package包/类
@TargetApi(TARGET_API) private Transition getDefaultTransition() {
TransitionSet set = new TransitionSet();
set.addTransition(new ChangeBounds());
set.addTransition(new Fade());
set.addTransition(new ChangeImageTransform());
set.setInterpolator(new FastOutSlowInInterpolator());
return set;
}