Search in sources :

Example 56 with ActivityOptionsCompat

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());
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 57 with ActivityOptionsCompat

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);
    }
}
Also used : WPWebViewActivity(org.wordpress.android.ui.WPWebViewActivity) Activity(android.app.Activity) Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 58 with ActivityOptionsCompat

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());
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 59 with ActivityOptionsCompat

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);
    }
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 60 with ActivityOptionsCompat

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);
    }
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Aggregations

ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)94 Intent (android.content.Intent)74 View (android.view.View)32 Pair (android.support.v4.util.Pair)18 RecyclerView (android.support.v7.widget.RecyclerView)15 Activity (android.app.Activity)14 ImageView (android.widget.ImageView)14 TextView (android.widget.TextView)13 OnClick (butterknife.OnClick)7 ActivityOptions (android.app.ActivityOptions)4 Context (android.content.Context)4 Bundle (android.os.Bundle)4 Handler (android.os.Handler)4 BindView (butterknife.BindView)4 CardView (android.support.v7.widget.CardView)3 Explode (android.transition.Explode)3 AdapterView (android.widget.AdapterView)3 LinearLayout (android.widget.LinearLayout)3 Uri (android.net.Uri)2 LayoutInflater (android.view.LayoutInflater)2