当前位置: 首页>>代码示例>>Java>>正文


Java TransitionSet.setDuration方法代码示例

本文整理汇总了Java中android.transition.TransitionSet.setDuration方法的典型用法代码示例。如果您正苦于以下问题:Java TransitionSet.setDuration方法的具体用法?Java TransitionSet.setDuration怎么用?Java TransitionSet.setDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.transition.TransitionSet的用法示例。


在下文中一共展示了TransitionSet.setDuration方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:lewismcgeary,项目名称:AndroidGameofLife,代码行数:20,代码来源:MainActivity.java

示例2: 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;
        }
    }
}
 
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:26,代码来源:ScenesSample.java

示例3: 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();
}
 
开发者ID:Bynder,项目名称:FragmentTransitionExample,代码行数:35,代码来源:MainActivity.java

示例4: makeTransition

import android.transition.TransitionSet; //导入方法依赖的package包/类
/**
 * activity scene transition animation
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Transition makeTransition() {
    TransitionSet transition = new TransitionSet();
    transition.addTransition(new Explode());
    transition.addTransition(new Fade());
    transition.setDuration(400);
    return transition;
}
 
开发者ID:yansha87,项目名称:douban-movie,代码行数:12,代码来源:SubjectActivity.java

示例5: onPeerSelected

import android.transition.TransitionSet; //导入方法依赖的package包/类
@Override
public void onPeerSelected(View identiconView, View usernameView, String peerAddress) {
    Peer peer = mChatManager.getRemotePeer(peerAddress);
    if (peer == null) {
        Timber.w("Could not lookup peer. Cannot show profile");
        return;
    }
    setTitle(peer.getAlias());
    MessageFragment messageFragment = new MessageFragment();
    messageFragment.setDbManager(mChatManager.getDbManager());
    messageFragment.setPeer(mChatManager.getRemotePeer(peerAddress));


    final TransitionSet slideTransition = new TransitionSet();
    slideTransition.addTransition(new Slide());
    slideTransition.setInterpolator(new AccelerateDecelerateInterpolator());
    slideTransition.setDuration(300);
    messageFragment.setEnterTransition(slideTransition);
    messageFragment.setReturnTransition(slideTransition);
    messageFragment.setAllowEnterTransitionOverlap(false);
    messageFragment.setAllowReturnTransitionOverlap(false);

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.container, messageFragment)
            .addToBackStack("profile")
            .commit();

}
 
开发者ID:wl1244hotmai,项目名称:BLE-Mesh,代码行数:29,代码来源:MainActivity.java

示例6: getSlideExplosionTransition

import android.transition.TransitionSet; //导入方法依赖的package包/类
/**
 * explode animation moving view to specific sides using 'Slide Transition'
 *
 * @return returns transition (null if API level 14 is less than LOLLIPOP)
 */
public static Transition getSlideExplosionTransition(int duration,
                                                     View topViewContainer,
                                                     View bottomViewContainer,
                                                     View leftViewContainer,
                                                     View rightViewContainer)
{
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
    {
        TransitionSet set = new TransitionSet();
        Slide slideTop = new Slide(android.view.Gravity.TOP);
        slideTop.addTarget(topViewContainer);
        set.addTransition(slideTop);
        Slide slideBottom = new Slide(android.view.Gravity.BOTTOM);
        slideBottom.addTarget(bottomViewContainer);
        set.addTransition(slideBottom);
        Slide slideLeft = new Slide(android.view.Gravity.LEFT);
        slideLeft.addTarget(leftViewContainer);
        set.addTransition(slideLeft);
        Slide slideRight = new Slide(android.view.Gravity.RIGHT);
        slideRight.addTarget(rightViewContainer);
        set.addTransition(slideRight);
        set.setDuration(duration);
        return set;
    }

    return null;
}
 
开发者ID:carrot,项目名称:android-animation-arsenal,代码行数:33,代码来源:AnimationArsenal.java

示例7: getAudioTransition

import android.transition.TransitionSet; //导入方法依赖的package包/类
@Override public Object getAudioTransition() {
    final ChangeText tc = new ChangeText();
    tc.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN);
    final TransitionSet inner = new TransitionSet();
    inner.addTransition(tc).addTransition(new ChangeBounds());
    final TransitionSet tg = new TransitionSet();
    tg.addTransition(new Fade(Fade.OUT)).addTransition(inner).
            addTransition(new Fade(Fade.IN));
    tg.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    tg.setDuration(TRANSITION_DURATION);
    return tg;
}
 
开发者ID:Tombarr,项目名称:Noyze,代码行数:13,代码来源:TransitionKitKat.java

示例8: setTransition

import android.transition.TransitionSet; //导入方法依赖的package包/类
private void setTransition() {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    return;
  }

  final TransitionSet transition = new TransitionSet();

  ChangeBounds transition1 = new ChangeBounds();
  transition.addTransition(transition1);
  ChangeTransform transition2 = new ChangeTransform();
  transition.addTransition(transition2);
  ChangeClipBounds transition3 = new ChangeClipBounds();
  transition.addTransition(transition3);
  ChangeImageTransform transition4 = new ChangeImageTransform();
  transition.addTransition(transition4);

  transition.setDuration(SHARED_ELEMENT_TRANSITION_DURATION);

  FastOutSlowInInterpolator interpolator = new FastOutSlowInInterpolator();
  transition1.setInterpolator(interpolator);
  transition2.setInterpolator(interpolator);
  transition3.setInterpolator(interpolator);
  transition4.setInterpolator(interpolator);

  final GravityArcMotion pathMotion = new GravityArcMotion();
  transition.setPathMotion(pathMotion);

  getWindow().setSharedElementEnterTransition(transition);
  getWindow().setSharedElementReturnTransition(transition);
  getWindow().setSharedElementsUseOverlay(false);

  Slide slide = new Slide(Gravity.TOP);
  slide.setInterpolator(new LinearOutSlowInInterpolator());
  slide.addTarget(appBar);
  slide.setDuration(225);
  slide.setStartDelay(100);
  getWindow().setEnterTransition(slide);
  Slide slideOut = (Slide) slide.clone();
  slideOut.setInterpolator(new FastOutLinearInInterpolator());
  slideOut.setStartDelay(0);
  getWindow().setReturnTransition(slideOut);
}
 
开发者ID:afollestad,项目名称:polar-dashboard,代码行数:43,代码来源:ViewerActivity.java

示例9: onMessageSelected

import android.transition.TransitionSet; //导入方法依赖的package包/类
@Override
    public void onMessageSelected(View identictionView, View usernameView, int messageId, int peerId) {
        // Create new fragment to add (Fragment B)
        Peer peer = mClient.getDataStore().getPeerById(peerId);
        if (peer == null) {
            Log.w(TAG, "Could not lookup peer. Cannot show profile");
            return;
        }

        setTitle(peer.getAlias());

//        identictionView.setTransitionName(getString(R.string.identicon_transition_name));
//        usernameView.setTransitionName(getString(R.string.username_transition_name));

        Fragment profileFragment = ProfileFragment.createForPeer(mClient.getDataStore(), peer);

//        final TransitionSet sharedElementTransition = new TransitionSet();
//        sharedElementTransition.addTransition(new ChangeBounds());
//        sharedElementTransition.addTransition(new ChangeTransform());
//        sharedElementTransition.setInterpolator(new AccelerateDecelerateInterpolator());
//        sharedElementTransition.setDuration(200);

        final TransitionSet slideTransition = new TransitionSet();
        slideTransition.addTransition(new Slide());
        slideTransition.setInterpolator(new AccelerateDecelerateInterpolator());
        slideTransition.setDuration(300);

        profileFragment.setEnterTransition(slideTransition);
        profileFragment.setReturnTransition(slideTransition);
//        profileFragment.setSharedElementEnterTransition(sharedElementTransition);
        profileFragment.setAllowEnterTransitionOverlap(false);
        profileFragment.setAllowReturnTransitionOverlap(false);

        // Message fragment performs an exit when Profile is added, and an enter when profile is popped
//        getFragmentManager().findFragmentByTag("messaging").setReenterTransition(slideTransition);
//        getFragmentManager().findFragmentByTag("messaging").setExitTransition(slideTransition);
//        getFragmentManager().findFragmentByTag("messaging").setSharedElementEnterTransition(sharedElementTransition);

        getSupportFragmentManager().beginTransaction()
                .replace(R.id.container, profileFragment)
                .addToBackStack("profile")
//                .addSharedElement(identictionView, getString(R.string.identicon_transition_name))
//                .addSharedElement(usernameView, getString(R.string.username_transition_name))
                .commit();

        Bitmap bitmap = Notification.loadBitmapFromView(identictionView, 100, 100);
        Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {
            public void onGenerated(Palette p) {
                mPalette = p;
                tintSystemBars(getResources().getColor(R.color.primary), getResources().getColor(R.color.primaryDark),
                        p.getVibrantColor(R.color.primary), p.getDarkVibrantColor(R.color.primaryDark));

            }
        });

        // Hack animate the drawer icon
        ValueAnimator drawerAnimator = ValueAnimator.ofFloat(0, 1f);
        drawerAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                mDrawerToggle.onDrawerSlide(null, (Float) animation.getAnimatedValue());
            }
        });
        drawerAnimator.start();
    }
 
开发者ID:OnlyInAmerica,项目名称:BLEMeshChat,代码行数:66,代码来源:MainActivity.java


注:本文中的android.transition.TransitionSet.setDuration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。