android.transition.Explode Java Examples

The following examples show how to use android.transition.Explode. 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: PieActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
private void setupLayout() {
    Explode transition = new Explode();
    transition.setDuration(600);
    transition.setInterpolator(new OvershootInterpolator(1f));
    getWindow().setEnterTransition(transition);

    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
            getSupportFragmentManager(), FragmentPagerItems.with(this)
            .add("behavior", BehaviorSubFragment.class,  new Bundler().putBoolean(ORIENTATION_STATE_ARG, true).get())
            .add("progress", ProgressSubFragment.class)
            .add("background", BackgroundSubFragment.class, new Bundler().putBoolean(OFFSET_STATE_ARG, true).get())
            .add("text", TextSubFragment.class)
            .create());

    mViewPager.setAdapter(adapter);
    mViewPager.setOffscreenPageLimit(3);
    mTAbs.setViewPager(mViewPager);

    shadowColor = Color.WHITE;
    blur = distX = distY = 2f;
}
 
Example #2
Source File: RingActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
private void setupLayout() {
    Explode transition = new Explode();
    transition.setDuration(600);
    transition.setInterpolator(new OvershootInterpolator(1f));
    getWindow().setEnterTransition(transition);

    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
            getSupportFragmentManager(), FragmentPagerItems.with(this)
            .add("behavior", BehaviorSubFragment.class, new Bundler().putBoolean(ORIENTATION_STATE_ARG, true).get())
            .add("progress bar", ProgressSubFragment.class, new Bundler().putBoolean(BAR_STATE_ARG, true).get())
            .add("background bar", BackgroundBarSubFragment.class)
            .add("background", BackgroundSubFragment.class, new Bundler().putBoolean(ORIENTATION_STATE_ARG, false).get())
            .add("text", TextSubFragment.class)
            .create());

    mViewPager.setAdapter(adapter);
    mViewPager.setOffscreenPageLimit(4);
    mTAbs.setViewPager(mViewPager);

    shadowColor = Color.WHITE;
    blur = distX = distY = 2f;
}
 
Example #3
Source File: FillActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
private void setupLayout() {
    Explode transition = new Explode();
    transition.setDuration(600);
    transition.setInterpolator(new OvershootInterpolator(1f));
    getWindow().setEnterTransition(transition);

    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
            getSupportFragmentManager(), FragmentPagerItems.with(this)
            .add("behavior", BehaviorSubFragment.class, new Bundler().putBoolean(ORIENTATION_STATE_ARG, false).get())
            .add("progress", ProgressSubFragment.class)
            .add("background", BackgroundSubFragment.class, new Bundler().putBoolean(OFFSET_STATE_ARG, true).get())
            .add("text", TextSubFragment.class)
            .create());

    mViewPager.setAdapter(adapter);
    mViewPager.setOffscreenPageLimit(3);
    mTAbs.setViewPager(mViewPager);

    shadowColor = Color.WHITE;
    blur = distX = distY = 2f;
}
 
Example #4
Source File: MainActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mYellowSquare = findViewById(R.id.image_square);
    mGreenAndroid = findViewById(R.id.image_android);

    if (getIntent().hasExtra(ANIMATION)) {
        switch (getIntent().getStringExtra(ANIMATION)) {
            case EXPLODE_ANIMATION:
                Explode explode = new Explode();
                getWindow().setEnterTransition(explode);
                break;
            case FADE_TRANSITION:
                Fade fade = new Fade();
                getWindow().setEnterTransition(fade);
                break;
            default: break;
        }
    }

}
 
Example #5
Source File: MainActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 6 votes vote down vote up
public void animationsAndTransitions(View view) {
    switch (view.getId()) {
        case R.id.image_circle:
            Intent intent = new Intent(this, MainActivity.class);
            Explode explode = new Explode();
            explode.setDuration(400);
            getWindow().setExitTransition(explode);
            intent.putExtra(ANIMATION, EXPLODE_ANIMATION);
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this);
            startActivity(intent, options.toBundle());
            break;

        case R.id.image_line:
            Intent intent2 = new Intent(this, MainActivity.class);
            intent2.putExtra(ANIMATION, FADE_TRANSITION);
            Fade fade = new Fade();
            fade.setDuration(400);
            getWindow().setExitTransition(fade);
            startActivity(intent2,
                    ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
            break;

        case R.id.image_square:
            Animation rotateAnimation = AnimationUtils.loadAnimation(this, R.anim.anim_rotate);
            mYellowSquare.startAnimation(rotateAnimation);
            break;

        case R.id.image_android:
            Intent intent3 = new Intent(MainActivity.this, SecondActivity.class);
            ActivityOptions options2 = ActivityOptions.makeSceneTransitionAnimation(this,
                    Pair.create((View) mGreenAndroid, "swap_shared_transition_android_icon"),
                    Pair.create((View) mYellowSquare, "swap_shared_transition_square")
            );
            startActivity(intent3, options2.toBundle());
            break;

        default:
            break;
    }
}
 
Example #6
Source File: GalleryFragment.java    From animation-samples with Apache License 2.0 6 votes vote down vote up
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);
    }
 
Example #7
Source File: FragmentVideoActivity.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    // 设置一个exit transition
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
        getWindow().setEnterTransition(new Explode());
        getWindow().setExitTransition(new Explode());
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fragment);

    newFragment = new VideoFragment();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.frameLayout, newFragment);
    transaction.addToBackStack(null);
    transaction.commit();
}
 
Example #8
Source File: HomeActivity.java    From KotlinMVPRxJava2Dagger2GreenDaoRetrofitDemo with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //初始化
//        ImmersionBar.with(this)
//                .statusBarColor(R.color.colorPrimary)     //状态栏颜色,不写默认透明色
//                .statusBarColorTransform(R.color.colorPrimary)  //状态栏变色后的颜色
//                .init();
        getWindow().setEnterTransition(new Explode());
        setContentView(setLayoutId());
        unbinder = ButterKnife.bind(this);
//        initInject();
        initView();
        initData();
    }
 
Example #9
Source File: ExplodeAnimationActivity.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    getWindow().setEnterTransition( new Explode() );
    getWindow().setExitTransition( new Explode() );
    setContentView(R.layout.activity_explode_animation);
}
 
Example #10
Source File: MaterialAnimationActivity.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void setupWindowAnimations() {
    Explode explode = new Explode();
    explode.setDuration(2000);
    getWindow().setExitTransition(explode);

    Fade fade = new Fade();
    getWindow().setReenterTransition(fade);
}
 
Example #11
Source File: ViewActivity.java    From recurrence with GNU General Public License v3.0 5 votes vote down vote up
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);
    }
}
 
Example #12
Source File: MainActivity.java    From TutosAndroidFrance with MIT License 5 votes vote down vote up
private void setupWindowAnimations() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        Explode explode = new Explode();
        getWindow().setExitTransition(explode);

        Fade fade = new Fade();
        getWindow().setReenterTransition(fade);
    }
}
 
Example #13
Source File: AdaptiveColorsActivity.java    From PercentageChartView with Apache License 2.0 5 votes vote down vote up
private void setupLayoutAnimation() {
    Explode transition = new Explode();
    transition.setDuration(600);
    transition.setInterpolator(new OvershootInterpolator(1f));
    getWindow().setEnterTransition(transition);

    displayedMode = MODE_PIE;

    mConstraintSet = new ConstraintSet();
    mConstraintSet.clone(mConstraintLayout);

    fade = new Fade();
    fade.setDuration(400);
}
 
Example #14
Source File: GradientColorsActivity.java    From PercentageChartView with Apache License 2.0 5 votes vote down vote up
private void setupLayoutAnimation() {
    Explode transition = new Explode();
    transition.setDuration(600);
    transition.setInterpolator(new OvershootInterpolator(1f));
    getWindow().setEnterTransition(transition);

    displayedMode = MODE_PIE;

    mConstraintSet = new ConstraintSet();
    mConstraintSet.clone(mConstraintLayout);

    fade = new Fade();
    fade.setDuration(400);
}
 
Example #15
Source File: TextFormatterActivity.java    From PercentageChartView with Apache License 2.0 5 votes vote down vote up
private void setupLayout() {
        Explode transition = new Explode();
        transition.setDuration(600);
        transition.setInterpolator(new OvershootInterpolator(1f));
        getWindow().setEnterTransition(transition);

        mPieChart.setTextFormatter(progress -> {
            int voters = (int) (progress * maxVoters / 100);
            if(voters > 1000) {
                voters /= 1000;
                return voters + " k voters";
            }
            return voters + " Voters";
        });

        mFillChart.setTextFormatter(progress -> {
            int cals = (int) (progress * maxCalories / 100);
            return cals + " cal";
        });

        SpannableStringBuilder b =  new SpannableStringBuilder();
        mRingChart.setTextFormatter(progress -> {
            int days = (int) (progress * maxDays / 100);
//            b.clear();
//            String text =;
//            b.append(text);
//            int start = String.valueOf(days).length();
//            int end = b.length();
//            b.setSpan(new RelativeSizeSpan(0.4f), 0, start, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
//            mText.setText(b);
            return  days + " days";
        });
    }
 
Example #16
Source File: TransitionAnimationByExplodeActivity.java    From Study_Android_Demo with Apache License 2.0 4 votes vote down vote up
private Transition buildEnterTransitionByCode() {
    Explode enterTransition = new Explode();
    enterTransition.setDuration(500);
    return enterTransition;
}
 
Example #17
Source File: SettingActivity.java    From smartcoins-wallet with MIT License 4 votes vote down vote up
void designMethod() {
    if (android.os.Build.VERSION.SDK_INT > 21)
        getWindow().setExitTransition(new Explode());
}
 
Example #18
Source File: TransitionAnimationByExplodeActivity.java    From Android-Animation-Set with Apache License 2.0 4 votes vote down vote up
private Transition buildEnterTransitionByCode() {
    Explode enterTransition = new Explode();
    enterTransition.setDuration(500);
    return enterTransition;
}
 
Example #19
Source File: TransitionUtils.java    From Material-Movies with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static Transition makeEnterTransition () {

    Explode explodeTransition = new Explode();
    return explodeTransition;
}
 
Example #20
Source File: DetailActivity1.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
private void setupWindowAnimations() {
    Explode explode = new Explode();
    explode.setDuration(2000);
    getWindow().setEnterTransition(explode);
}