Java Code Examples for android.transition.ChangeBounds#setDuration()

The following examples show how to use android.transition.ChangeBounds#setDuration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From auid2 with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mSceneRoot = (ViewGroup) findViewById(R.id.scene_root);

    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene1, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, this);

    mTransition = new ChangeBounds();
    mTransition.setDuration(DateUtils.SECOND_IN_MILLIS);
    mTransition.setInterpolator(new AccelerateDecelerateInterpolator());
    TransitionManager.go(mScene1);
    mCurrentScene = mScene1;

    findViewById(R.id.button).setOnClickListener(this);
}
 
Example 2
Source File: MainActivity.java    From journaldev with MIT License 5 votes vote down vote up
private void showAnimation() {
    show = true;

    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(this, R.layout.activity_main_animation);

    ChangeBounds transition = new ChangeBounds();
    transition.setInterpolator(new AnticipateInterpolator(1.0f));
    transition.setDuration(1200);

    TransitionManager.beginDelayedTransition(cc1, transition);
    constraintSet.applyTo(cc1);
}
 
Example 3
Source File: MainActivity.java    From journaldev with MIT License 5 votes vote down vote up
private void revertAnimation() {
    show = false;

    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(this, R.layout.activity_main);

    ChangeBounds transition = new ChangeBounds();
    transition.setInterpolator(new AnticipateInterpolator(1.0f));
    transition.setDuration(1200);

    TransitionManager.beginDelayedTransition(cc1, transition);
    constraintSet.applyTo(cc1);

}
 
Example 4
Source File: CacheControlActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void updateStorageUsageRow() {
    View view = layoutManager.findViewByPosition(storageUsageRow);
    if (view instanceof StroageUsageView) {
        StroageUsageView stroageUsageView = ((StroageUsageView) view);
        long currentTime =  System.currentTimeMillis();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && currentTime - fragmentCreateTime > 250) {
            TransitionSet transition = new TransitionSet();
            ChangeBounds changeBounds = new ChangeBounds();
            changeBounds.setDuration(250);
            changeBounds.excludeTarget(stroageUsageView.legendLayout,true);
            Fade in = new Fade(Fade.IN);
            in.setDuration(290);
            transition
                    .addTransition(new Fade(Fade.OUT).setDuration(250))
                    .addTransition(changeBounds)
                    .addTransition(in);
            transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
            transition.setInterpolator(CubicBezierInterpolator.EASE_OUT);
            TransitionManager.beginDelayedTransition(listView, transition);
        }
        stroageUsageView.setStorageUsage(calculating, databaseSize, totalSize, totalDeviceFreeSize, totalDeviceSize);
        RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(storageUsageRow);
        if (holder != null) {
            stroageUsageView.setEnabled(listAdapter.isEnabled(holder));
        }
    } else {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example 5
Source File: CacheControlActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void updateStorageUsageRow() {
    View view = layoutManager.findViewByPosition(storageUsageRow);
    if (view instanceof StroageUsageView) {
        StroageUsageView stroageUsageView = ((StroageUsageView) view);
        long currentTime =  System.currentTimeMillis();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && currentTime - fragmentCreateTime > 250) {
            TransitionSet transition = new TransitionSet();
            ChangeBounds changeBounds = new ChangeBounds();
            changeBounds.setDuration(250);
            changeBounds.excludeTarget(stroageUsageView.legendLayout,true);
            Fade in = new Fade(Fade.IN);
            in.setDuration(290);
            transition
                    .addTransition(new Fade(Fade.OUT).setDuration(250))
                    .addTransition(changeBounds)
                    .addTransition(in);
            transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
            transition.setInterpolator(CubicBezierInterpolator.EASE_OUT);
            TransitionManager.beginDelayedTransition(listView, transition);
        }
        stroageUsageView.setStorageUsage(calculating, databaseSize, totalSize, totalDeviceFreeSize, totalDeviceSize);
        RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(storageUsageRow);
        if (holder != null) {
            stroageUsageView.setEnabled(listAdapter.isEnabled(holder));
        }
    } else {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example 6
Source File: AlbumDetailActivity.java    From android-animations-transitions with MIT License 4 votes vote down vote up
private void setupTransitions() {
//        Slide slide = new Slide(Gravity.BOTTOM);
//        slide.excludeTarget(android.R.id.statusBarBackground, true);
//        getWindow().setEnterTransition(slide);
//        getWindow().setSharedElementsUseOverlay(false);

        mTransitionManager = new TransitionManager();
        ViewGroup transitionRoot = detailContainer;

        // Expanded scene
        mExpandedScene = Scene.getSceneForLayout(transitionRoot,
                R.layout.activity_album_detail_expanded, this);

        mExpandedScene.setEnterAction(new Runnable() {
            @Override
            public void run() {
                ButterKnife.bind(AlbumDetailActivity.this);
                populate();
                mCurrentScene = mExpandedScene;
            }
        });

        TransitionSet expandTransitionSet = new TransitionSet();
        expandTransitionSet.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
        ChangeBounds changeBounds = new ChangeBounds();
        changeBounds.setDuration(200);
        expandTransitionSet.addTransition(changeBounds);

        Fade fadeLyrics = new Fade();
        fadeLyrics.addTarget(R.id.lyrics);
        fadeLyrics.setDuration(150);
        expandTransitionSet.addTransition(fadeLyrics);

        // Collapsed scene
        mCollapsedScene = Scene.getSceneForLayout(transitionRoot,
                R.layout.activity_album_detail, this);

        mCollapsedScene.setEnterAction(new Runnable() {
            @Override
            public void run() {
                ButterKnife.bind(AlbumDetailActivity.this);
                populate();
                mCurrentScene = mCollapsedScene;
            }
        });

        TransitionSet collapseTransitionSet = new TransitionSet();
        collapseTransitionSet.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);

        Fade fadeOutLyrics = new Fade();
        fadeOutLyrics.addTarget(R.id.lyrics);
        fadeOutLyrics.setDuration(150);
        collapseTransitionSet.addTransition(fadeOutLyrics);

        ChangeBounds resetBounds = new ChangeBounds();
        resetBounds.setDuration(200);
        collapseTransitionSet.addTransition(resetBounds);

        mTransitionManager.setTransition(mExpandedScene, mCollapsedScene, collapseTransitionSet);
        mTransitionManager.setTransition(mCollapsedScene, mExpandedScene, expandTransitionSet);
        mCollapsedScene.enter();

//        postponeEnterTransition();
    }