Example usage for android.transition Slide setInterpolator

List of usage examples for android.transition Slide setInterpolator

Introduction

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

Prototype

public Transition setInterpolator(TimeInterpolator interpolator) 

Source Link

Document

Sets the interpolator of this transition.

Usage

From source file:com.example.android.unsplash.DetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_detail);

    postponeEnterTransition();// w  w  w  . j a v a 2 s  .  c o  m

    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);
    try {
        initialItem = Integer.parseInt(intent.getData().getLastPathSegment());
    } catch (NumberFormatException e) {
        initialItem = 0;
    }
    PhotoService.getInstance().getPhotosAsync(new PhotoService.PhotoCallback() {
        @Override
        public void success(ArrayList<Photo> photos) {
            setUpViewPager(photos);
            findViewById(android.R.id.empty).setVisibility(View.GONE);
        }

        @Override
        public void error() {
            finishAfterTransition();
        }
    });

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(navigationOnClickListener);

    super.onCreate(savedInstanceState);
}

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 ww  w .  ja  v  a 2s.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:io.github.marktony.espresso.mvp.packages.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set the navigation bar color
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
        getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }/*  w w  w  .  j av a 2  s .c  o  m*/

    // Begin the slide animation.
    Slide slide = new Slide();
    slide.setDuration(500);
    slide.setInterpolator(new AccelerateDecelerateInterpolator());
    getWindow().setExitTransition(slide);

    Explode explode = new Explode();
    explode.setDuration(500);
    explode.setInterpolator(new AccelerateDecelerateInterpolator());
    getWindow().setEnterTransition(explode);

    initViews();

    // Init the fragments.
    if (savedInstanceState != null) {
        packagesFragment = (PackagesFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "PackagesFragment");
        companiesFragment = (CompaniesFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "CompaniesFragment");
        selectedNavItem = savedInstanceState.getInt(KEY_NAV_ITEM);
    } else {
        packagesFragment = (PackagesFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
        if (packagesFragment == null) {
            packagesFragment = PackagesFragment.newInstance();
        }

        companiesFragment = (CompaniesFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
        if (companiesFragment == null) {
            companiesFragment = CompaniesFragment.newInstance();
        }
    }

    // Add the fragments.
    if (!packagesFragment.isAdded()) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.content_main, packagesFragment, "PackagesFragment").commit();
    }

    if (!companiesFragment.isAdded()) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.content_main, companiesFragment, "CompaniesFragment").commit();
    }

    // Make sure the data in repository is the latest.
    // Also to void the repo only contains a package
    // when user has already gone to detail page
    // by check a notification or widget.
    PackagesRepository.destroyInstance();
    // Init the presenters.
    packagesPresenter = new PackagesPresenter(packagesFragment, PackagesRepository
            .getInstance(PackagesRemoteDataSource.getInstance(), PackagesLocalDataSource.getInstance()));

    new CompaniesPresenter(companiesFragment,
            CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()));

    // Get data from Bundle.
    if (savedInstanceState != null) {
        PackageFilterType currentFiltering = (PackageFilterType) savedInstanceState
                .getSerializable(CURRENT_FILTERING_KEY);
        packagesPresenter.setFiltering(currentFiltering);
    }

    // Show the default fragment.
    if (selectedNavItem == 0) {
        showPackagesFragment();
    } else if (selectedNavItem == 1) {
        showCompaniesFragment();
    }

    PushUtil.startReminderService(this);

}

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  ava2s . 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();
}