Java 类android.support.v4.app.ActivityOptionsCompat 实例源码

项目:aos-Video    文件:VideoViewClickedListener.java   
public static void showVideoDetails(Activity activity, Video video, Presenter.ViewHolder itemViewHolder, boolean animate, boolean forceSelection, boolean shouldLoadBackdrop, long listId) {
    Intent intent = new Intent(activity, VideoDetailsActivity.class);
    intent.putExtra(VideoDetailsFragment.EXTRA_VIDEO, video);
    intent.putExtra(VideoDetailsFragment.EXTRA_LIST_ID, listId);
    intent.putExtra(VideoDetailsFragment.EXTRA_FORCE_VIDEO_SELECTION, forceSelection);
    intent.putExtra(VideoDetailsFragment.EXTRA_SHOULD_LOAD_BACKDROP,shouldLoadBackdrop);
    View sourceView = null;
    if (itemViewHolder.view instanceof ImageCardView) {
        sourceView = ((ImageCardView) itemViewHolder.view).getMainImageView();
    } else if (itemViewHolder instanceof ListPresenter.ListViewHolder){
        sourceView = ((ListPresenter.ListViewHolder)itemViewHolder).getImageView();
    }
    if(animate) {
        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                activity,
                sourceView,
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();

        activity.startActivity(intent,bundle);
    }
    else{
        activity.startActivity(intent);
    }
}
项目:GitHub    文件:CommonFragment.java   
@Override
public void gotoDetail() {
    Activity activity = (Activity) getContext();
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
            new Pair(imageView, DetailActivity.IMAGE_TRANSITION_NAME),
            new Pair(address1, DetailActivity.ADDRESS1_TRANSITION_NAME),
            new Pair(address2, DetailActivity.ADDRESS2_TRANSITION_NAME),
            new Pair(address3, DetailActivity.ADDRESS3_TRANSITION_NAME),
            new Pair(address4, DetailActivity.ADDRESS4_TRANSITION_NAME),
            new Pair(address5, DetailActivity.ADDRESS5_TRANSITION_NAME),
            new Pair(ratingBar, DetailActivity.RATINGBAR_TRANSITION_NAME),
            new Pair(head1, DetailActivity.HEAD1_TRANSITION_NAME),
            new Pair(head2, DetailActivity.HEAD2_TRANSITION_NAME),
            new Pair(head3, DetailActivity.HEAD3_TRANSITION_NAME),
            new Pair(head4, DetailActivity.HEAD4_TRANSITION_NAME)
    );
    Intent intent = new Intent(activity, DetailActivity.class);
    intent.putExtra(DetailActivity.EXTRA_IMAGE_URL, imageUrl);
    ActivityCompat.startActivity(activity, intent, options.toBundle());
}
项目:GSoC-Info-Android    文件:OrgAdapter.java   
public OrgHolder(View itemView) {
    super(itemView);
    orgImage = itemView.findViewById(R.id.org_image);
    orgCard = itemView.findViewById(R.id.card_view_org);
    orgName = itemView.findViewById(R.id.org_name);
    orgTagline = itemView.findViewById(R.id.org_tagline);

    orgCard.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(context, OrgDetailActivity.class);
            i.putExtra(ORG_TAG, getItem(getAdapterPosition()));
            i.putExtra("EXTRA_TRANSITION_NAME", ViewCompat.getTransitionName(orgImage));
            ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation((AppCompatActivity) context,
                    orgImage,
                    ViewCompat.getTransitionName(orgImage));
            i.putExtra("ORG_ID", getItem(getAdapterPosition()).getOrgID());
            context.startActivity(i, optionsCompat.toBundle());
        }
    });
}
项目:MBEStyle    文件:IconShowFragment.java   
@Override
public void onItemClick(View itemView, int position) {
    IconBean bean = mIcons.get(position);
    Intent intent = new Intent(getActivity(), IconViewActivity.class);
    intent.putExtra("icon_name", bean.name);
    intent.putExtra("resource_id", bean.id);

    if (mIsInstalledFragment) {
        // 已适配 Fragment,传入包名
        intent.putExtra("package_name", bean.iconPkgName);
    }

    ActivityOptionsCompat options = ActivityOptionsCompat
            .makeSceneTransitionAnimation(getActivity(), itemView, "dialog_icon");

    startActivity(intent, options.toBundle());
}
项目:shared-element-transitions    文件:SimpleActivityA.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_a);

    final ImageView imageView = (ImageView) findViewById(R.id.simple_activity_a_imageView);

    Button button = (Button) findViewById(R.id.simple_activity_a_btn);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(SimpleActivityA.this, SimpleActivityB.class);
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
                    SimpleActivityA.this,
                    imageView,
                    ViewCompat.getTransitionName(imageView));
            startActivity(intent, options.toBundle());
        }
    });

}
项目:AndroidGeneralUtils    文件:ActivityUtil.java   
/**
 * Safe Start activity for result with ActivityOptionsCompats
 *
 * @param a           current activity
 * @param i           intent to launch
 * @param requestCode requestCcde
 * @param options     ActivityOptionsCompat
 */
public static void startActivityForResult(Activity a,
                                          Intent i,
                                          int requestCode,
                                          ActivityOptionsCompat options) {
    if (a == null) {
        return;
    }
    if (options != null) {
        a.startActivityForResult(
                i,
                requestCode,
                options.toBundle()
        );
    } else {
        a.startActivityForResult(
                i,
                requestCode);
    }
}
项目:smart-lens    文件:InfoActivity.java   
public static void launch(@NonNull Activity activity,
                          @NonNull ArrayList<String> labels,
                          @Nullable View transitionView) {
    Intent launchIntent = new Intent(activity, InfoActivity.class);
    launchIntent.putStringArrayListExtra(ARA_RECOGNITION_LIST, labels);

    if (transitionView != null) {
        ActivityOptionsCompat options = ActivityOptionsCompat.
                makeSceneTransitionAnimation(activity,
                        transitionView,
                        activity.getString(R.string.info_activity_transition_name));
        activity.startActivity(launchIntent, options.toBundle());
        activity.overridePendingTransition(0, 0);
    } else {
        activity.startActivity(launchIntent);
    }
}
项目:AndroidGeneralUtils    文件:ActivityUtil.java   
/**
 * Get the transition animation between activity for view
 *
 * @param activity current activity
 * @param v        view on which animation is bound
 * @param name     custom name of animation
 * @return ActivityOptionsCompat constructed
 */
public static ActivityOptionsCompat getTransitionAnimationForProduct(Activity activity, View v, String name) {
    try {
        if (activity == null || v == null) {
            return null;
        }
        ViewCompat.setTransitionName(v, name);

        return ActivityOptionsCompat.
                makeSceneTransitionAnimation(activity,
                        Pair.create(v, ViewCompat.getTransitionName(v))
                );
    } catch (Throwable e) {
        e.printStackTrace();
        return null;
    }
}
项目:EasyReader    文件:ZhiHuHomeFragment.java   
private void startZhiHuDetailActivity(int id, View view) {
    Intent intent = new Intent();
    intent.setClass(getActivity(), ZhiHuDetailActivity.class);
    intent.putExtra("id", id);
    intent.putExtra("isNotTransition", true);
    /**
     * 用这个ActivityOptionsCompat比用ActivityOptions兼容性更好,前者是V4下的兼容到16后者到21.
     * ActivityOptionsCompat.makeSceneTransitionAnimation()的第三个参数则是跳转后图片显示的transitionName的值
     *     <android.support.design.widget.AppBarLayout
     android:transitionName="zhihu_detail_title"
     android:fitsSystemWindows="true">
     */
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
            view, getActivity().getResources().getString(R.string.zhihu_detail_title));
    getActivity().startActivity(intent, options.toBundle());
}
项目:CodeWatch    文件:SettingsFragment.java   
@Override
public boolean onPreferenceClick(Preference preference) {
    String key = preference.getKey();
    if (key.equals(prefAboutPageKey)) {

        ActivityOptionsCompat options =
                ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity());
        ((NavigationDrawerActivity) getActivity()).newAchievementUnlocked(1L << Constants.CURIOUS);
        startActivity(new Intent(getActivity(), AboutActivity.class), options.toBundle());
        return true;
    } else if (key.equals(prefLogoutButtonKey)) {
        //Clear login cache
        CacheUtils.clearLoginInfo(context);
        //Now launch on-board activity
        startActivity(new Intent(context, OnBoardActivity.class));
        //Now finish the activity
        ((NavigationDrawerActivity) context).finish();
        return true;
    }
    return false;
}
项目:Remindy    文件:ProgrammedRepeatingTaskViewHolder.java   
@Override
public void onClick(View view) {
    int id = view.getId();
    switch (id) {
        case R.id.item_task_programmed_repeating_container:
            Pair[] pairs = new Pair[1];
            pairs[0] = new Pair<View, String>(mCategoryIcon, mFragment.getResources().getString(R.string.transition_task_list_category));
            //pairs[1] = new Pair<View, String>(mTitle, mFragment.getResources().getString(R.string.transition_task_list_title));
            //pairs[2] = new Pair<View, String>(mDescription, mFragment.getResources().getString(R.string.transition_task_list_description));
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(mFragment.getActivity(), pairs);

            Intent openTaskDetailActivity = new Intent(mFragment.getActivity(), TaskDetailActivity.class);
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_ID_TO_DISPLAY, mCurrent.getId());
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_POSITION, mReminderPosition);
            //mFragment.getActivity().startActivityForResult(openTaskDetailActivity, TaskDetailActivity.TASK_DETAIL_REQUEST_CODE, options.toBundle());

            if (mClickListener != null) {
                mClickListener.onItemClicked(mReminderPosition, openTaskDetailActivity, options.toBundle());
            }

            break;
    }
}
项目:EasyReader    文件:TopNewsFragment.java   
private void startZhiHuDetailActivity(String id, String imgUrl, View view) {
    Intent intent = new Intent();
    intent.setClass(getActivity(), TopNewsActivity.class);
    intent.putExtra("id", id);
    intent.putExtra("url", imgUrl);
    /**
     * 用这个ActivityOptionsCompat比用ActivityOptions兼容性更好,前者是V4下的兼容到16后者到21.
     * ActivityOptionsCompat.makeSceneTransitionAnimation()的第三个参数则是跳转后图片显示的transitionName的值
     *     <android.support.design.widget.AppBarLayout
     android:transitionName="zhihu_detail_title"
     android:fitsSystemWindows="true">
     */
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
            view, getActivity().getResources().getString(R.string.zhihu_detail_title));
    getActivity().startActivity(intent, options.toBundle());
}
项目:AndroidOpen    文件:TransitionHelper.java   
public static ActivityOptionsCompat makeOptionsCompat(Activity fromActivity, Pair<View, String>... sharedElements) {
    ArrayList<Pair<View, String>> list = new ArrayList<>(Arrays.asList(sharedElements));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        list.add(Pair.create(fromActivity.findViewById(android.R.id.statusBarBackground), Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME));
        list.add(Pair.create(fromActivity.findViewById(android.R.id.navigationBarBackground), Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME));
    }

    //remove any views that are null
    for (ListIterator<Pair<View, String>> iter = list.listIterator(); iter.hasNext();) {
        Pair pair = iter.next();
        if (pair.first == null) iter.remove();
    }

    sharedElements = list.toArray(new Pair[list.size()]);
    return ActivityOptionsCompat.makeSceneTransitionAnimation(
            fromActivity,
            sharedElements
    );
}
项目:whatanime-android    文件:Navigator.java   
public static void goToMain(AppCompatActivity activity, View view) {
    ActivityOptionsCompat aoc;
    if (AndroidVersions.isLollipop() && view != null) {
        aoc = ActivityOptionsCompat.makeClipRevealAnimation(view,
                0,
                0,
                view.getWidth(),
                view.getHeight());
    } else {
        aoc = ActivityOptionsCompat.makeBasic();
    }
    Intent intent = new Intent(activity, MainActivity.class);
    ActivityCompat.startActivity(activity, intent, aoc.toBundle());
    ActivityCompat.finishAffinity(activity);
}
项目:MDRXL    文件:Router.java   
@SuppressWarnings("unchecked")
public void openGeraltWoman(final long id, final ClickInfo clickInfo) {
    SampleApplication.createWomanComponent(id);
    if (multiWindow) {
        final GeraltWomanFragment geraltWomanFragment = GeraltWomanFragment.create();
        activity.getSupportFragmentManager().beginTransaction()
                .replace(R.id.details, geraltWomanFragment, TAG_DETAILS_FRAGMENT)
                .commitNow();
    } else {
        final View view = clickInfo.getView();
        Bundle bundle = null;
        if (view != null) {
            bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                    activity, Pair.create(view.findViewWithTag("photo"), "photo")
            ).toBundle();
        }
        activity.startActivity(GeraltWomanActivity.intent(activity), bundle);
    }
}
项目:Remindy    文件:ProgrammedLocationBasedTaskViewHolder.java   
@Override
public void onClick(View view) {
    int id = view.getId();
    switch (id) {
        case R.id.item_task_programmed_location_based_container:
            Pair[] pairs = new Pair[1];
            pairs[0] = new Pair<View, String>(mCategoryIcon, mFragment.getResources().getString(R.string.transition_task_list_category));
            //pairs[1] = new Pair<View, String>(mTitle, mFragment.getResources().getString(R.string.transition_task_list_title));
            //pairs[2] = new Pair<View, String>(mDescription, mFragment.getResources().getString(R.string.transition_task_list_description));
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(mFragment.getActivity(), pairs);

            Intent openTaskDetailActivity = new Intent(mFragment.getActivity(), TaskDetailActivity.class);
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_ID_TO_DISPLAY, mCurrent.getId());
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_POSITION, mReminderPosition);
            //mFragment.getActivity().startActivityForResult(openTaskDetailActivity, TaskDetailActivity.TASK_DETAIL_REQUEST_CODE, options.toBundle());

            if (mClickListener != null) {
                mClickListener.onItemClicked(mReminderPosition, openTaskDetailActivity, options.toBundle());
            }

            break;
    }
}
项目:betterHotels    文件:BlogPostAdapter.java   
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
    final BlogPost blogPost = blogPosts.get(position);
    holder.tvPostTitle.setText(blogPost.getPostTitle());
    holder.tvDateOfPublication.setText(blogPost.getDateOfPublication());
    if (position != 0) {
        Picasso.with(context)
                .load(blogPost.getHeroImageResource())
                .into(holder.ivHeroImage);
    }
    holder.postLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Pair<View, String> p1 = Pair.create((View) holder.ivHeroImage, holder.ivHeroImage.getTransitionName());
            ActivityOptionsCompat options = ActivityOptionsCompat.
                    makeSceneTransitionAnimation(((Activity) context), p1);
            Bundle bundle = options.toBundle();
            Intent i = new Intent(context, BlogDetailActivity.class);
            i.putExtra("image", blogPost.getHeroImageResource());
            i.putExtra("text", blogPost.getPostTitle());
            context.startActivity(i, bundle);
        }
    });
}
项目:DailyStudy    文件:ViewerActivity.java   
public static void launch(AppCompatActivity activity, View transitionView, int resId) {
//        Intent intent = new Intent(activity, ViewerActivity.class);
//
//
//        ActivityOptionsCompat options = ActivityOptionsCompat
//                .makeSceneTransitionAnimation(activity, transitionView, "image");
//
//        ActivityCompat.startActivity(activity, intent, options.toBundle());


        Pair squareParticipant = new Pair<>(transitionView, ViewCompat.getTransitionName(transitionView));
        ActivityOptionsCompat transitionActivityOptions =
                ActivityOptionsCompat.makeSceneTransitionAnimation(
                        activity, squareParticipant);
        Intent intent = new Intent(
                activity, ViewerActivity.class);
        intent.putExtra("resId", resId);
        activity.startActivity(intent, transitionActivityOptions.toBundle());
    }
项目:ConnectU    文件:ProfesoresActivity.java   
@Override
public void onItemClick(int item, ProfesoresAdapter.ViewHolder view) {

    View imageView = view.profile;
    Intent intent = new Intent(ProfesoresActivity.this, ProfesoresViewActivity.class);
    Gson gson = new Gson();
    intent.putExtra("JDATA", gson.toJson(teachers.get(item)));
    overridePendingTransition(R.anim.fade_in,R.anim.fade_out);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Pair<View, String> pair1 = Pair.create(imageView, getString(R.string.activity_profesores_image_trans));
        ActivityOptionsCompat options = ActivityOptionsCompat.
                makeSceneTransitionAnimation(ProfesoresActivity.this, pair1);
        startActivity(intent, options.toBundle());
    }
    else {
        startActivity(intent);
    }

}
项目:Udacity_Sunshine    文件:MainActivity.java   
@Override
public void onItemSelected(Uri contentUri, ForecastAdapter.ForecastAdapterViewHolder vh) {
    if (mTwoPane) {
        // In two-pane mode, show the detail view in this activity by
        // adding or replacing the detail fragment using a
        // fragment transaction.
        Bundle args = new Bundle();
        args.putParcelable(DetailFragment.DETAIL_URI, contentUri);

        DetailFragment fragment = new DetailFragment();
        fragment.setArguments(args);

        getSupportFragmentManager().beginTransaction()
                .replace(R.id.weather_detail_container, fragment, DETAILFRAGMENT_TAG)
                .commit();
    } else {
        Intent intent = new Intent(this, DetailActivity.class)
                .setData(contentUri);

        ActivityOptionsCompat activityOptions =
                ActivityOptionsCompat.makeSceneTransitionAnimation(this,
                        new Pair<View, String>(vh.mIconView, getString(R.string.detail_icon_transition_name)));
        ActivityCompat.startActivity(this, intent, activityOptions.toBundle());
    }
}
项目:androidtv-sample    文件:SearchFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Video) {
        Video video = (Video) item;
        Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
        intent.putExtra(VideoDetailsActivity.VIDEO, video);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    } else {
        Toast.makeText(getActivity(), ((String) item), Toast.LENGTH_SHORT).show();
    }
}
项目:AndroidBlueprints    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    if (id == android.R.id.home) {
        //TODO: This is for sub activities, don't use for MainActivity
        //super.onBackPressed();
        //return true;
    } else if (id == R.id.action_settings) {
        Intent intent = new Intent(this, SettingsActivity.class);
        ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat.makeBasic();
        ActivityCompat.startActivity(this, intent, activityOptionsCompat.toBundle());
    }

    return super.onOptionsItemSelected(item);
}
项目:ClouldReader    文件:BookDetailActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, BooksBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, BookDetailActivity.class);
    intent.putExtra(EXTRA_PARAM, positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_book_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:ClouldReader    文件:SlideActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, SlideActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:ClouldReader    文件:OneMovieDetailActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, OneMovieDetailActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:MyDemo    文件:MovieDetailActivity.java   
public static void launchActivity(Activity context, View transitionView, String id, String title, String url){
    Intent intent = new Intent(context, MovieDetailActivity.class);
    intent.putExtra("movieId", id);
    intent.putExtra("movieTitle", title);
    intent.putExtra("movieUrl", url);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    transitionView, context.getResources().getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());

}
项目:ClouldReader    文件:SlideShadeViewActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, SlideShadeViewActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:ClouldReader    文件:MovieDetailActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, MovieDetailActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:GitHub    文件:SlideActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, SlideActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:chilly    文件:SearchFragment.java   
@Override
public void onLoadFinish(Map<String, String> images, Video video) {
    Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
    video.cardImageUrl = images.get("poster");
    intent.putExtra(VideoDetailsActivity.VIDEO, video);

    Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
            getActivity(),
            cardView.getMainImageView(),
            VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
    getActivity().startActivity(intent, bundle);
}
项目:GitHub    文件:SlideScrollViewActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, SlideScrollViewActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:GitHub    文件:SlideShadeViewActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, SlideShadeViewActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:GitHub    文件:MovieDetailActivity.java   
/**
 * @param context      activity
 * @param positionData bean
 * @param imageView    imageView
 */
public static void start(Activity context, SubjectsBean positionData, ImageView imageView) {
    Intent intent = new Intent(context, MovieDetailActivity.class);
    intent.putExtra("bean", positionData);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(context,
                    imageView, CommonUtils.getString(R.string.transition_movie_img));//与xml文件对应
    ActivityCompat.startActivity(context, intent, options.toBundle());
}
项目:GitHub    文件:StartActivity.java   
@Override
public void initData(Bundle savedInstanceState) {
    Router.newIntent(context)
            .to(EndActivity.class)
            .putString("arg_name", "xdroid")
            .launch();

    Router.newIntent(context)
            .to(EndActivity.class)
            .putString("arg_name", "xdroid")
            .requestCode(100)
            .launch();

    int exitAnim = 0, enterAnim = 0;
    Router.newIntent(context)
            .to(EndActivity.class)
            .putString("arg_name", "xdroid")
            .anim(enterAnim, exitAnim)
            .launch();

    Router.newIntent(context)
            .to(EndActivity.class)
            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            .launch();

    Router.newIntent(context)
            .to(EndActivity.class)
            .options(ActivityOptionsCompat.makeBasic())
            .launch();

}
项目:Android_ImagePicker    文件:PicImageActivity.java   
@OnClick({R.id.main_imgPicture, R.id.main_btnPicImage, R.id.main_btnCropImage})
public void onViewClicked(View view) {
    switch (view.getId()) {
        case R.id.main_imgPicture:
            if (selectedFilePath != null && selectedFilePath.length() > 0) {
                // Construct an Intent as normal
                Intent intent = new Intent(this, PicImageDetailActivity.class);
                intent.putExtra(PicImageDetailActivity.EXTRA_PARAM_ID, selectedFilePath);

                // BEGIN_INCLUDE(start_activity)
                /**
                 * Now create an {@link android.app.ActivityOptions} instance using the
                 * {@link ActivityOptionsCompat#makeSceneTransitionAnimation(Activity, Pair[])} factory
                 * method.
                 */
                ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(this,
                        // Now we provide a list of Pair items which contain the view we can transitioning
                        // from, and the name of the view it is transitioning to, in the launched activity
                        new Pair<View, String>(view.findViewById(R.id.main_imgPicture), PicImageDetailActivity.VIEW_NAME_HEADER_IMAGE));
                // Now we can start the Activity, providing the activity options as a bundle
                ActivityCompat.startActivity(this, intent, activityOptions.toBundle());
            }
            break;
        case R.id.main_btnPicImage:
            openImagePickerDialog(this);
            break;
        case R.id.main_btnCropImage:
            if (selectedFilePath != null && selectedFilePath.length() > 0) {
                try {
                    cropImage(selectedFilePath, getString(R.string.app_name), 1, 1, 200, 200);
                } catch (IOException e) {
                    Toast.makeText(mContext, e.getMessage().toString().trim(), Toast.LENGTH_LONG).show();
                    e.printStackTrace();
                }
            } else {
                Toast.makeText(mContext, "Please select image first.", Toast.LENGTH_LONG).show();
            }
            break;
    }
}
项目:GitHub    文件:MailsFragment.java   
@OnClick(R.id.createMail) public void onCreateMailClicked() {
  ActivityOptionsCompat options =
      ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), createMailButton,
          getString(R.string.shared_write_action));

  intentStarter.showWriteMail(getActivity(), null, options.toBundle());
}
项目:GitHub    文件:DetailsFragment.java   
@OnClick(R.id.replay) public void onReplayClicked() {

    ActivityOptionsCompat options =
        ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), replayView,
            getString(R.string.shared_write_action));

    intentStarter.showWriteMail(getActivity(), mail, options.toBundle());
  }
项目:LeMondeRssReader    文件:MainActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == GET_LATEST_RSS_FEED && resultCode == RssService.FETCH_SUCCESS) {
        ArrayList<RssItem> rssItems = data.getParcelableArrayListExtra(RssService.PARCELABLE_EXTRAS);
        RecyclerRssItemAdapter adapter = new RecyclerRssItemAdapter(rssItems);
        adapter.setOnItemClickListener(new RecyclerRssItemAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, @NonNull RssItem rssItem) {
                Intent intent = new Intent(MainActivity.this, ArticleActivity.class);
                Bundle extras = new Bundle();

                extras.putString(Constants.EXTRA_RSS_LINK, rssItem.getLink());
                extras.putString(Constants.EXTRA_RSS_IMAGE, rssItem.getEnclosure());

                AppCompatImageView rssImage = view.findViewById(R.id.rss_image);
                intent.putExtras(extras);

                String transitionName = "transition_open_article";
                if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
                    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(MainActivity.this,
                            rssImage,
                            transitionName);
                    ActivityCompat.startActivity(MainActivity.this, intent, options.toBundle());
                } else {
                    startActivity(intent);
                }
            }
        });
        mainActivityRecyclerView.setAdapter(adapter);
    } else if (requestCode == FROM_SETTINGS_ACTIVITY && resultCode == Constants.THEME_CHANGED) {
        recreate();
    }
    super.onActivityResult(requestCode, resultCode, data);
}
项目:OpenHub    文件:ProfileActivity.java   
public static void show(@NonNull Activity activity, @Nullable View userAvatarView,
                        @NonNull String loginId, @Nullable String userAvatar) {
    Intent intent = createIntent(activity, loginId, userAvatar);
    if (userAvatarView != null) {
        ActivityOptionsCompat optionsCompat = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity, userAvatarView, "userAvatar");
        activity.startActivity(intent, optionsCompat.toBundle());
    } else {
        activity.startActivity(intent);
    }

}
项目:AndroidModulePattern    文件:GirlsView.java   
private void initView() {
    inflate(getContext(), R.layout.view_girls_content, this);
    mNetworkErrorLayout = (ViewStub) findViewById(R.id.network_error_layout);
    mGirlsRecyclerView = (EasyRecyclerView) findViewById(R.id.girls_recycler_view);
    StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    mGirlsRecyclerView.setLayoutManager(staggeredGridLayoutManager);
    mAdapter = new GirlsAdapter(getContext());

    mGirlsRecyclerView.setAdapterWithProgress(mAdapter);
    mGirlsRecyclerView.setRefreshingColor(
            ContextCompat.getColor(getContext(), R.color.colorPrimary),
            ContextCompat.getColor(getContext(), android.R.color.holo_blue_light),
            ContextCompat.getColor(getContext(), android.R.color.holo_green_light)
    );
    mAdapter.setMore(R.layout.layout_load_more, this);
    mAdapter.setNoMore(R.layout.layout_load_no_more);
    mAdapter.setError(R.layout.layout_load_error);
    mAdapter.setOnMyItemClickListener(new GirlsAdapter.OnMyItemClickListener() {
        @Override
        public void onItemClick(int position, BaseViewHolder holder) {
            Intent intent = new Intent(Utils.getActivity(GirlsView.this), GirlActivity.class);
            intent.putParcelableArrayListExtra(Constants.INTENT_GIRLS, mData);
            intent.putExtra(Constants.INTENT_INDEX, position);
            ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(holder.itemView, holder.itemView.getWidth() / 2, holder.itemView.getHeight() / 2, 0, 0);
            Utils.getActivity(GirlsView.this).startActivity(intent, options.toBundle());
        }
    });

    mGirlsRecyclerView.setRefreshListener(this);

    mData = new ArrayList<>();
    mActive = true;
}