Java Code Examples for android.support.v4.app.ActivityOptionsCompat#makeThumbnailScaleUpAnimation()

The following examples show how to use android.support.v4.app.ActivityOptionsCompat#makeThumbnailScaleUpAnimation() . 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: OptionsCompatDemoActivity.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 这个方法可以用于4.x上,是将一个小块的Bitmpat进行拉伸的动画
 */
private void showThumbNailScaleAnim(ImageView view) {
    view.setDrawingCacheEnabled(true);
    Bitmap bitmap = view.getDrawingCache();
    if (mTestSwitch) {
        ActivityOptionsCompat optionsCompat
                = ActivityOptionsCompat.makeThumbnailScaleUpAnimation(
                view,
                bitmap,
                0, 0
        );
        ActivityCompat.startActivity(
                OptionsCompatDemoActivity.this,
                mIntent,
                optionsCompat.toBundle());
    } else {
        ActivityOptionsCompatICS optionsCompatICS
                = ActivityOptionsCompatICS.makeThumbnailScaleUpAnimation(
                view,
                bitmap,
                0, 0
        );
        ActivityCompatICS.startActivity(
                OptionsCompatDemoActivity.this,
                mIntent,
                optionsCompatICS.toBundle());
        // view.setDrawingCacheEnabled(false);
    }
}
 
Example 2
Source File: MainNormalActivity.java    From Mi-Band with GNU General Public License v2.0 5 votes vote down vote up
private void thumbNailScaleAnimation(View view) {
    view.setDrawingCacheEnabled(true);
    view.setPressed(false);
    view.refreshDrawableState();
    Bitmap bitmap = view.getDrawingCache();
    ActivityOptionsCompat opts = ActivityOptionsCompat.makeThumbnailScaleUpAnimation(
            view, bitmap, 0, 0);
    // Request the activity be started, using the custom animation options.
    startActivity(new Intent(MainNormalActivity.this, AppsPreferencesActivity.class),
            opts.toBundle());
    view.setDrawingCacheEnabled(false);
}
 
Example 3
Source File: MainServiceActivity.java    From Mi-Band with GNU General Public License v2.0 5 votes vote down vote up
private void thumbNailScaleAnimation(View view) {
    view.setDrawingCacheEnabled(true);
    view.setPressed(false);
    view.refreshDrawableState();
    Bitmap bitmap = view.getDrawingCache();
    ActivityOptionsCompat opts = ActivityOptionsCompat.makeThumbnailScaleUpAnimation(
            view, bitmap, 0, 0);
    // Request the activity be started, using the custom animation options.
    startActivity(new Intent(MainServiceActivity.this, AppsPreferencesActivity.class),
            opts.toBundle());
    view.setDrawingCacheEnabled(false);
}
 
Example 4
Source File: UserPhotosFragment.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
public void onItemClick(AdapterView<?> gridView, View view, int position,
		long id) {
	if (view.getId() == R.id.iv_camera_button) {
		takePhoto();
	} else {
		Bundle b = null;
		if (VERSION.SDK_INT >= 16) {
			ActivityOptionsCompat options = ActivityOptionsCompat
					.makeThumbnailScaleUpAnimation(view,
							Utils.drawViewOntoBitmap(view), 0, 0);
			b = options.toBundle();
		}

		Intent intent = new Intent(getActivity(), PhotoViewerActivity.class);

		// Need take Camera icon into account so minus 1
		intent.putExtra(PhotoViewerActivity.EXTRA_POSITION, position - 1);
		intent.putExtra(PhotoViewerActivity.EXTRA_MODE,
				PhotoViewerActivity.MODE_ALL_VALUE);

		MediaStoreBucket bucket = (MediaStoreBucket) mBucketSpinner
				.getSelectedItem();
		intent.putExtra(PhotoViewerActivity.EXTRA_BUCKET_ID, bucket.getId());

		ActivityCompat.startActivityForResult(getActivity(), intent,
				RESULT_PHOTOVIEW, b);
	}

}
 
Example 5
Source File: ActivityAnimate.java    From SmartGo with Apache License 2.0 4 votes vote down vote up
public static void animate(final @NonNull Box<ActivityOptionsCompat> box,
                           @NonNull View source, Bitmap thumbnail, int startX, int startY){
    final ActivityOptionsCompat compat = ActivityOptionsCompat.makeThumbnailScaleUpAnimation(
            source, thumbnail, startX, startY);
    box.set(compat);
}