Example usage for android.transition Slide addTarget

List of usage examples for android.transition Slide addTarget

Introduction

In this page you can find the example usage for android.transition Slide addTarget.

Prototype

public Transition addTarget(int targetId) 

Source Link

Document

Adds the id of a target view that this Transition is interested in animating.

Usage

From source file:com.jlt.unsplashd.DetailActivity.java

@Override
// begin onCreate
protected void onCreate(Bundle savedInstanceState) {

    // 0. super things
    // 1. use the detail layout
    // 2. bind things
    // 3. show the image
    // 3a. using the uri from the intent
    // 3b. using the place holder color
    // 3c. into the correct view
    // 4. set author text from intent
    // 5. when the back toolbar button is tapped
    // 5a. close activity after transition is done
    // 6. for lollipop devices
    // 6a. slide description from bottom

    // 0. super things

    super.onCreate(savedInstanceState);

    // 1. use the detail layout

    setContentView(R.layout.activity_detail);

    // 2. bind things

    ButterKnife.bind(this);

    // 3. show the image

    Picasso.with(this)

            // 3a. using the uri from the intent

            .load(getIntent().getData())

            // 3b. using the place holder color

            .placeholder(R.color.colorPlaceholder)

            // 3c. into the correct view

            .into(threeTwoImageView);/*from   w w  w .  jav a2s  .c  om*/

    // 4. set author text from intent

    authorTextView.setText(getString(R.string.author_name, getIntent().getStringArrayExtra(EXTRA_AUTHOR_NAME)));

    // 5. when the back toolbar button is tapped

    // begin toolbar.setNavigationOnClickListener
    toolbar.setNavigationOnClickListener(

            // begin new View.OnClickListener
            new View.OnClickListener() {

                @Override
                // begin onClick
                public void onClick(View view) {

                    // 5a. close activity after transition is done

                    finishAfterTransition();

                } // end onClick

            } // end new View.OnClickListener

    ); // end toolbar.setNavigationOnClickListener

    // 6. for lollipop devices

    // begin if lollipop and above
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        // 6a. slide description from bottom

        Slide slide = new Slide(Gravity.BOTTOM);

        slide.addTarget(R.id.ad_ll_description);

        slide.setInterpolator(new FastOutSlowInInterpolator());

        slide.setDuration(slideDuration);

        getWindow().setEnterTransition(slide);

    } // end if lollipop and above

}

From source file:spit.matrix2017.Activities.EventDetails.java

@Override
protected void onStart() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Slide slide = new Slide(Gravity.BOTTOM);

        if (isFirstLaunch) {
            fab.hide();//from w w w  .j a v a  2 s  . c om
            isFirstLaunch = false;
        }

        slide.addTarget(R.id.description_card);
        slide.addTarget(R.id.venue_time_card);
        slide.addTarget(R.id.registration_card);
        slide.addTarget(R.id.prizes_card);
        slide.addTarget(R.id.organizers_card);
        slide.setInterpolator(new LinearOutSlowInInterpolator());
        getWindow().setEnterTransition(slide);
        getWindow().setExitTransition(slide);
        getWindow().setReenterTransition(slide);

        setupEnterAnimation();
    }
    super.onStart();
}