use of android.support.v4.app.ActivityOptionsCompat in project WordPress-Android by wordpress-mobile.
the class PhotoChooserFragment method showPreview.
/*
* shows full-screen preview of the passed media
*/
private void showPreview(View sourceView, Uri mediaUri) {
boolean isVideo = getAdapter().isVideoUri(mediaUri);
Intent intent = new Intent(getActivity(), PhotoChooserPreviewActivity.class);
intent.putExtra(PhotoChooserPreviewActivity.ARG_MEDIA_URI, mediaUri.toString());
intent.putExtra(PhotoChooserPreviewActivity.ARG_IS_VIDEO, isVideo);
int startWidth = sourceView.getWidth();
int startHeight = sourceView.getHeight();
int startX = startWidth / 2;
int startY = startHeight / 2;
ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(sourceView, startX, startY, startWidth, startHeight);
ActivityCompat.startActivity(getActivity(), intent, options.toBundle());
}
use of android.support.v4.app.ActivityOptionsCompat in project WordPress-Android by wordpress-mobile.
the class ReaderActivityLauncher method showReaderPhotoViewer.
public static void showReaderPhotoViewer(Context context, String imageUrl, String content, View sourceView, EnumSet<PhotoViewerOption> imageOptions, int startX, int startY) {
if (context == null || TextUtils.isEmpty(imageUrl)) {
return;
}
boolean isPrivate = imageOptions != null && imageOptions.contains(PhotoViewerOption.IS_PRIVATE_IMAGE);
boolean isGallery = imageOptions != null && imageOptions.contains(PhotoViewerOption.IS_GALLERY_IMAGE);
Intent intent = new Intent(context, ReaderPhotoViewerActivity.class);
intent.putExtra(ReaderConstants.ARG_IMAGE_URL, imageUrl);
intent.putExtra(ReaderConstants.ARG_IS_PRIVATE, isPrivate);
intent.putExtra(ReaderConstants.ARG_IS_GALLERY, isGallery);
if (!TextUtils.isEmpty(content)) {
intent.putExtra(ReaderConstants.ARG_CONTENT, content);
}
if (context instanceof Activity && sourceView != null) {
Activity activity = (Activity) context;
ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(sourceView, startX, startY, 0, 0);
ActivityCompat.startActivity(activity, intent, options.toBundle());
} else {
context.startActivity(intent);
}
}
use of android.support.v4.app.ActivityOptionsCompat in project WordPress-Android by wordpress-mobile.
the class ActivityLauncher method showSitePickerForResult.
public static void showSitePickerForResult(Activity activity, SiteModel site) {
Intent intent = new Intent(activity, SitePickerActivity.class);
intent.putExtra(SitePickerActivity.KEY_LOCAL_ID, site.getId());
ActivityOptionsCompat options = ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.activity_slide_in_from_left, R.anim.do_nothing);
ActivityCompat.startActivityForResult(activity, intent, RequestCodes.SITE_PICKER, options.toBundle());
}
use of android.support.v4.app.ActivityOptionsCompat in project LookLook by xinghongfei.
the class TopNewsAdapter method startTopnewsActivity.
private void startTopnewsActivity(NewsBean newsBeanItem, RecyclerView.ViewHolder holder) {
Intent intent = new Intent(mContext, TopNewsDescribeActivity.class);
intent.putExtra("docid", newsBeanItem.getDocid());
intent.putExtra("title", newsBeanItem.getTitle());
intent.putExtra("image", newsBeanItem.getImgsrc());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final android.support.v4.util.Pair<View, String>[] pairs = Help.createSafeTransitionParticipants((Activity) mContext, false, new android.support.v4.util.Pair<>(((TopNewsViewHolder) holder).imageView, mContext.getString(R.string.transition_topnew)), new android.support.v4.util.Pair<>(((TopNewsViewHolder) holder).linearLayout, mContext.getString(R.string.transition_topnew_linear)));
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) mContext, pairs);
mContext.startActivity(intent, options.toBundle());
} else {
mContext.startActivity(intent);
}
}
use of android.support.v4.app.ActivityOptionsCompat in project LookLook by xinghongfei.
the class MeiziAdapter method startDescribeActivity.
private void startDescribeActivity(Meizi meizi, RecyclerView.ViewHolder holder) {
Intent intent = new Intent(mContext, MeiziPhotoDescribeActivity.class);
intent.putExtra("image", meizi.getUrl());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final android.support.v4.util.Pair<View, String>[] pairs = Help.createSafeTransitionParticipants((Activity) mContext, false, new android.support.v4.util.Pair<>(((MeiziViewHolder) holder).imageView, mContext.getString(R.string.meizi)));
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) mContext, pairs);
mContext.startActivity(intent, options.toBundle());
} else {
mContext.startActivity(intent);
}
}
Aggregations