List of usage examples for android.transition Slide setDuration
public Transition setDuration(long duration)
From source file:org.huxizhijian.hhcomicviewer.ui.download.OfflineDownloadBaseActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) protected Visibility buildEnterTransition() { Slide enterTransition = new Slide(); enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium)); enterTransition.setSlideEdge(Gravity.RIGHT); //? return enterTransition; }
From source file:com.example.android.unsplash.DetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_detail); postponeEnterTransition();//ww w.jav a2 s . co 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: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 .ja va 2 s . c om*/ // 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: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);/*ww w. j a v a 2s.c o m*/ // 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:appteam.nith.hillffair.activities.HomeActivity.java
private void setupWindowAnimations() { // Re-enter transition is executed when returning to this activity if (Build.VERSION.SDK_INT >= 21) { Slide slideTransition = new Slide(); slideTransition.setSlideEdge(Gravity.LEFT); slideTransition.setDuration(800); getWindow().setReenterTransition(slideTransition); getWindow().setExitTransition(slideTransition); }// ww w . j ava 2s.c o m }
From source file:nu.yona.app.ui.YonaActivity.java
private void profileIcon() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Slide slideTransition = new Slide(Gravity.RIGHT); slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium)); ChangeBounds changeBoundsTransition = new ChangeBounds(); changeBoundsTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium)); mContent.setEnterTransition(slideTransition); mContent.setAllowEnterTransitionOverlap(true); mContent.setAllowReturnTransitionOverlap(true); mContent.setSharedElementEnterTransition(changeBoundsTransition); }/*from w ww. j a v a2 s . c om*/ }