List of usage examples for android.app ActivityOptions makeThumbnailScaleUpAnimation
public static ActivityOptions makeThumbnailScaleUpAnimation(View source, Bitmap thumbnail, int startX, int startY)
From source file:com.bitants.wally.fragments.LatestFragment.java
private void setupAdapter() { imagesAdapter.setOnGetViewListener(new RecyclerImagesAdapter.OnGetViewListener() { @Override/*ww w . jav a 2 s . co m*/ public void onBindView(int position) { getMoreImagesIfNeeded(position, imagesAdapter.getItemCount()); } }); imagesAdapter.setOnItemClickListener(new RecyclerImagesAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Image image = (Image) imagesAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(image.imagePageURL()), view.getContext(), ImageDetailsActivity.class); ImageView thumbnailImageView = (ImageView) view.findViewById(R.id.thumb_image_view); Bitmap thumb = null; intent.putExtra(ImageDetailsActivity.INTENT_EXTRA_IMAGE, image); if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof GlideBitmapDrawable) { GlideBitmapDrawable glideBitmapDrawable = (GlideBitmapDrawable) thumbnailImageView .getDrawable(); thumb = glideBitmapDrawable.getBitmap(); } else if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof TransitionDrawable) { GlideBitmapDrawable squaringDrawable = (GlideBitmapDrawable) ((TransitionDrawable) thumbnailImageView .getDrawable()).getDrawable(1); thumb = squaringDrawable.getBitmap(); } WallyApplication.setBitmapThumb(thumb); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String transitionNameImage = getString(R.string.transition_image_details); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(getActivity(), android.support.v4.util.Pair .create(view.findViewById(R.id.thumb_image_view), transitionNameImage)); ActivityCompat.startActivityForResult(getActivity(), intent, ImageDetailsActivity.REQUEST_EXTRA_TAG, options.toBundle()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.buildDrawingCache(true); Bitmap drawingCache = view.getDrawingCache(true); Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0) .toBundle(); getActivity().startActivityForResult(intent, REQUEST_CODE, bundle); } else { startActivityForResult(intent, REQUEST_CODE); } } }); }
From source file:com.bitants.wally.fragments.ToplistFragment.java
private void setupAdapter() { imagesAdapter.setOnGetViewListener(new RecyclerImagesAdapter.OnGetViewListener() { @Override//w w w .jav a 2 s . c o m public void onBindView(int position) { getMoreImagesIfNeeded(position, imagesAdapter.getItemCount()); } }); imagesAdapter.setOnItemClickListener(new RecyclerImagesAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Image image = (Image) imagesAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(image.imagePageURL()), view.getContext(), ImageDetailsActivity.class); ImageView thumbnailImageView = (ImageView) view.findViewById(R.id.thumb_image_view); Bitmap thumb = null; intent.putExtra(ImageDetailsActivity.INTENT_EXTRA_IMAGE, image); if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof GlideBitmapDrawable) { GlideBitmapDrawable glideBitmapDrawable = (GlideBitmapDrawable) thumbnailImageView .getDrawable(); thumb = glideBitmapDrawable.getBitmap(); } else if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof TransitionDrawable) { GlideBitmapDrawable squaringDrawable = (GlideBitmapDrawable) ((TransitionDrawable) thumbnailImageView .getDrawable()).getDrawable(1); thumb = squaringDrawable.getBitmap(); } WallyApplication.setBitmapThumb(thumb); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String transitionNameImage = getString(R.string.transition_image_details); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( getActivity(), Pair.create(view.findViewById(R.id.thumb_image_view), transitionNameImage)); ActivityCompat.startActivityForResult(getActivity(), intent, ImageDetailsActivity.REQUEST_EXTRA_TAG, options.toBundle()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.buildDrawingCache(true); Bitmap drawingCache = view.getDrawingCache(true); Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0) .toBundle(); getActivity().startActivityForResult(intent, REQUEST_CODE, bundle); } else { startActivityForResult(intent, REQUEST_CODE); } } }); }
From source file:com.musenkishi.wally.fragments.LatestFragment.java
private void setupAdapter() { imagesAdapter.setOnGetViewListener(new RecyclerImagesAdapter.OnGetViewListener() { @Override/*w w w. j a va 2 s. c om*/ public void onBindView(int position) { getMoreImagesIfNeeded(position, imagesAdapter.getItemCount()); } }); imagesAdapter.setOnItemClickListener(new RecyclerImagesAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Image image = (Image) imagesAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(image.imagePageURL()), view.getContext(), ImageDetailsActivity.class); ImageView thumbnailImageView = (ImageView) view.findViewById(R.id.thumb_image_view); Bitmap thumb = null; intent.putExtra(ImageDetailsActivity.INTENT_EXTRA_IMAGE, image); if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof GlideBitmapDrawable) { GlideBitmapDrawable glideBitmapDrawable = (GlideBitmapDrawable) thumbnailImageView .getDrawable(); thumb = glideBitmapDrawable.getBitmap(); } else if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof TransitionDrawable) { GlideBitmapDrawable squaringDrawable = (GlideBitmapDrawable) ((TransitionDrawable) thumbnailImageView .getDrawable()).getDrawable(1); thumb = squaringDrawable.getBitmap(); } WallyApplication.setBitmapThumb(thumb); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.buildDrawingCache(true); Bitmap drawingCache = view.getDrawingCache(true); Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0) .toBundle(); getActivity().startActivityForResult(intent, REQUEST_CODE, bundle); } else { startActivityForResult(intent, REQUEST_CODE); } } }); }
From source file:com.bitants.wally.fragments.RandomImagesFragment.java
private void setupAdapter() { imagesAdapter.setOnGetViewListener(new RecyclerImagesAdapter.OnGetViewListener() { @Override/* w w w.j a va2 s . c o m*/ public void onBindView(int position) { int defaultNumberOfItemsPerPage = NetworkDataProvider.THUMBS_PER_PAGE; boolean shouldLoadMore = position >= imagesAdapter.getItemCount() - (defaultNumberOfItemsPerPage / 2); if (shouldLoadMore && !isLoading && imagesAdapter.getItemCount() > 0) { getImages(++currentPage, null); } } }); imagesAdapter.setOnItemClickListener(new RecyclerImagesAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Image image = (Image) imagesAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(image.imagePageURL()), view.getContext(), ImageDetailsActivity.class); ImageView thumbnailImageView = (ImageView) view.findViewById(R.id.thumb_image_view); Bitmap thumb = null; intent.putExtra(ImageDetailsActivity.INTENT_EXTRA_IMAGE, image); if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof GlideBitmapDrawable) { GlideBitmapDrawable glideBitmapDrawable = (GlideBitmapDrawable) thumbnailImageView .getDrawable(); thumb = glideBitmapDrawable.getBitmap(); } else if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof TransitionDrawable) { GlideBitmapDrawable squaringDrawable = (GlideBitmapDrawable) ((TransitionDrawable) thumbnailImageView .getDrawable()).getDrawable(1); thumb = squaringDrawable.getBitmap(); } WallyApplication.setBitmapThumb(thumb); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String transitionNameImage = getString(R.string.transition_image_details); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(getActivity(), android.support.v4.util.Pair .create(view.findViewById(R.id.thumb_image_view), transitionNameImage)); ActivityCompat.startActivityForResult(getActivity(), intent, ImageDetailsActivity.REQUEST_EXTRA_TAG, options.toBundle()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.buildDrawingCache(true); Bitmap drawingCache = view.getDrawingCache(true); Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0) .toBundle(); getActivity().startActivityForResult(intent, REQUEST_CODE, bundle); } else { startActivityForResult(intent, REQUEST_CODE); } } }); }
From source file:com.musenkishi.wally.fragments.RandomImagesFragment.java
private void setupAdapter() { imagesAdapter.setOnGetViewListener(new RecyclerImagesAdapter.OnGetViewListener() { @Override//from w ww. j a va2s . co m public void onBindView(int position) { int defaultNumberOfItemsPerPage = NetworkDataProvider.THUMBS_PER_PAGE; boolean shouldLoadMore = position >= imagesAdapter.getItemCount() - (defaultNumberOfItemsPerPage / 2); if (shouldLoadMore && !isLoading && imagesAdapter.getItemCount() > 0) { getImages(++currentPage, null); } } }); imagesAdapter.setOnItemClickListener(new RecyclerImagesAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Image image = (Image) imagesAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(image.imagePageURL()), view.getContext(), ImageDetailsActivity.class); ImageView thumbnailImageView = (ImageView) view.findViewById(R.id.thumb_image_view); Bitmap thumb = null; intent.putExtra(ImageDetailsActivity.INTENT_EXTRA_IMAGE, image); if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof GlideBitmapDrawable) { GlideBitmapDrawable glideBitmapDrawable = (GlideBitmapDrawable) thumbnailImageView .getDrawable(); thumb = glideBitmapDrawable.getBitmap(); } else if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof TransitionDrawable) { GlideBitmapDrawable squaringDrawable = (GlideBitmapDrawable) ((TransitionDrawable) thumbnailImageView .getDrawable()).getDrawable(1); thumb = squaringDrawable.getBitmap(); } WallyApplication.setBitmapThumb(thumb); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.buildDrawingCache(true); Bitmap drawingCache = view.getDrawingCache(true); Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0) .toBundle(); getActivity().startActivityForResult(intent, REQUEST_CODE, bundle); } else { startActivityForResult(intent, REQUEST_CODE); } } }); }
From source file:com.musenkishi.wally.fragments.SearchFragment.java
private void setupAdapter() { imagesAdapter.setOnGetViewListener(new RecyclerImagesAdapter.OnGetViewListener() { @Override//from w w w . j av a 2 s . c o m public void onBindView(int position) { if (gridView.getAdapter() != null) { getMoreImagesIfNeeded(position, imagesAdapter.getItemCount()); } } }); imagesAdapter.setOnItemClickListener(new RecyclerImagesAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Image image = (Image) imagesAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(image.imagePageURL()), view.getContext(), ImageDetailsActivity.class); ImageView thumbnailImageView = (ImageView) view.findViewById(R.id.thumb_image_view); Bitmap thumb = null; intent.putExtra(ImageDetailsActivity.INTENT_EXTRA_IMAGE, image); if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof GlideBitmapDrawable) { GlideBitmapDrawable glideBitmapDrawable = (GlideBitmapDrawable) thumbnailImageView .getDrawable(); thumb = glideBitmapDrawable.getBitmap(); } else if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof TransitionDrawable) { GlideBitmapDrawable squaringDrawable = (GlideBitmapDrawable) ((TransitionDrawable) thumbnailImageView .getDrawable()).getDrawable(1); thumb = squaringDrawable.getBitmap(); } WallyApplication.setBitmapThumb(thumb); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.buildDrawingCache(true); Bitmap drawingCache = view.getDrawingCache(true); Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0) .toBundle(); getActivity().startActivityForResult(intent, REQUEST_CODE, bundle); } else { startActivityForResult(intent, REQUEST_CODE); } } }); }
From source file:com.bitants.wally.fragments.SearchFragment.java
private void setupAdapter() { imagesAdapter.setOnGetViewListener(new RecyclerImagesAdapter.OnGetViewListener() { @Override/*from w w w .j ava 2 s. c om*/ public void onBindView(int position) { if (gridView.getAdapter() != null) { getMoreImagesIfNeeded(position, imagesAdapter.getItemCount()); } } }); imagesAdapter.setOnItemClickListener(new RecyclerImagesAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Image image = (Image) imagesAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(image.imagePageURL()), view.getContext(), ImageDetailsActivity.class); ImageView thumbnailImageView = (ImageView) view.findViewById(R.id.thumb_image_view); Bitmap thumb = null; intent.putExtra(ImageDetailsActivity.INTENT_EXTRA_IMAGE, image); if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof GlideBitmapDrawable) { GlideBitmapDrawable glideBitmapDrawable = (GlideBitmapDrawable) thumbnailImageView .getDrawable(); thumb = glideBitmapDrawable.getBitmap(); } else if (thumbnailImageView != null && thumbnailImageView.getDrawable() != null && thumbnailImageView.getDrawable() instanceof TransitionDrawable) { GlideBitmapDrawable squaringDrawable = (GlideBitmapDrawable) ((TransitionDrawable) thumbnailImageView .getDrawable()).getDrawable(1); thumb = squaringDrawable.getBitmap(); } WallyApplication.setBitmapThumb(thumb); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String transitionNameImage = getString(R.string.transition_image_details); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(getActivity(), android.support.v4.util.Pair .create(view.findViewById(R.id.thumb_image_view), transitionNameImage)); ActivityCompat.startActivityForResult(getActivity(), intent, ImageDetailsActivity.REQUEST_EXTRA_TAG, options.toBundle()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.buildDrawingCache(true); Bitmap drawingCache = view.getDrawingCache(true); Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0) .toBundle(); getActivity().startActivityForResult(intent, REQUEST_CODE, bundle); } else { startActivityForResult(intent, REQUEST_CODE); } } }); }