当前位置: 首页>>代码示例>>Java>>正文


Java ActivityOptionsCompat.makeSceneTransitionAnimation方法代码示例

本文整理汇总了Java中android.support.v4.app.ActivityOptionsCompat.makeSceneTransitionAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityOptionsCompat.makeSceneTransitionAnimation方法的具体用法?Java ActivityOptionsCompat.makeSceneTransitionAnimation怎么用?Java ActivityOptionsCompat.makeSceneTransitionAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.ActivityOptionsCompat的用法示例。


在下文中一共展示了ActivityOptionsCompat.makeSceneTransitionAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClick

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
public void onClick(View view) {
        Intent intent = new Intent(this, SharedElementSecondActivity.class);

//        startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this, firstSharedView, "sharedView").toBundle());

        /* 要实现这种共享元素的过渡,那么就需要在两个布局对应的 view 中指定相同的 android:transitionName=""
        * 有多个 View 需要过渡就需要用到 Pair 来将 view 和 transitionName 对应起来
        * */
        Pair first = new Pair<>(mFirstSharedView, ViewCompat.getTransitionName(mFirstSharedView));
        Pair second = new Pair<>(mSecondSharedView, ViewCompat.getTransitionName(mSecondSharedView));

        ActivityOptionsCompat transitionActivityOptions =
                ActivityOptionsCompat.makeSceneTransitionAnimation(
                        this, first, second);

        ActivityCompat.startActivity(this,
                intent, transitionActivityOptions.toBundle());
    }
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:19,代码来源:SharedElementActivity.java

示例2: startZhiHuDetailActivity

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
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());
}
 
开发者ID:paterWang,项目名称:EasyReader,代码行数:17,代码来源:TopNewsFragment.java

示例3: onLayoutItemClick

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@OnClick(R.id.layoutQuestion_item)
public void onLayoutItemClick()
{
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP)
    {
        Intent intent = new Intent(context, DetailsActivity.class);
        ActivityOptionsCompat options = ActivityOptionsCompat.
                makeSceneTransitionAnimation((Activity)context, (View)layoutQuestion, "questionTransition");
        ((Activity)context).startActivity(intent, options.toBundle());

    }
    else {
        Intent ii = new Intent(context, DetailsActivity.class);
        context.startActivity(ii);
    }


}
 
开发者ID:wajahatkarim3,项目名称:Quizca-UI-Concept,代码行数:20,代码来源:QuestionsRecyclerAdapter.java

示例4: gotoDetail

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:CommonFragment.java

示例5: onClick

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@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;
    }
}
 
开发者ID:abicelis,项目名称:Remindy,代码行数:24,代码来源:ProgrammedLocationBasedTaskViewHolder.java

示例6: onItemClick

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@Override
public void onItemClick(int position, BaseItem data, View view) {
    //跳转到其他界面
    NewsBean topNews = (NewsBean) data.getData();
    Bundle bundle = new Bundle();
    Intent intent = new Intent(TecNewsFragment.this.getActivity(), TopNewsInfoActivity.class);
    bundle.putString(Constants.BUNDLE_KEY_TITLE, topNews.getTitle());
    bundle.putString(Constants.BUNDLE_KEY_ID, topNews.getDocid());
    bundle.putString(Constants.BUNDLE_KEY_IMG_URL, topNews.getImgsrc());
    intent.putExtras(bundle);
    String transitionName = getString(R.string.top_news_img);
    Pair pairImg = new Pair<>(view.findViewById(R.id.news_image), transitionName);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pairImg);
    startActivity(intent, transitionActivityOptions.toBundle());
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:16,代码来源:TecNewsFragment.java

示例7: start

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
/**
 * @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());
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:14,代码来源:OneMovieDetailActivity.java

示例8: onItemClick

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@Override
public void onItemClick(int position, BaseItem data, View view) {
    //跳转到其他界面
    NewsBean topNews = (NewsBean) data.getData();
    Bundle bundle = new Bundle();
    Intent intent = new Intent(SportNewsFragment.this.getActivity(), TopNewsInfoActivity.class);
    bundle.putString(Constants.BUNDLE_KEY_TITLE, topNews.getTitle());
    bundle.putString(Constants.BUNDLE_KEY_ID, topNews.getDocid());
    bundle.putString(Constants.BUNDLE_KEY_IMG_URL, topNews.getImgsrc());
    intent.putExtras(bundle);
    String transitionName = getString(R.string.top_news_img);
    Pair pairImg = new Pair<>(view.findViewById(R.id.news_image), transitionName);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pairImg);
    startActivity(intent, transitionActivityOptions.toBundle());
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:16,代码来源:SportNewsFragment.java

示例9: start

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
/**
 * @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());
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:14,代码来源:MovieDetailActivity.java

示例10: onItemClick

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@Override
public void onItemClick(int position, BaseItem data, View view) {
    //跳转到其他界面
    NewsBean topNews = (NewsBean) data.getData();
    Bundle bundle = new Bundle();
    Intent intent = new Intent(HeadLineFragment.this.getActivity(), TopNewsInfoActivity.class);
    bundle.putString(Constants.BUNDLE_KEY_TITLE, topNews.getTitle());
    bundle.putString(Constants.BUNDLE_KEY_ID, topNews.getDocid());
    bundle.putString(Constants.BUNDLE_KEY_IMG_URL, topNews.getImgsrc());
    intent.putExtras(bundle);
    String transitionName = getString(R.string.top_news_img);
    Pair pairImg = new Pair<>(view.findViewById(R.id.news_image), transitionName);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pairImg);
    startActivity(intent, transitionActivityOptions.toBundle());
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:16,代码来源:HeadLineFragment.java

示例11: onItemSelected

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@Override
public void onItemSelected(String userId) {
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity());
    Intent intent = new Intent(context, ProfileActivity.class);
    intent.putExtra(Intent.EXTRA_TEXT, userId);
    startActivity(intent, options.toBundle());
}
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:9,代码来源:LeaderboardFragment.java

示例12: start

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
/**
 * @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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:SlideShadeViewActivity.java

示例13: startWithTransition

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
public static void startWithTransition(Activity activity, Intent intent, View sourceView) {
    ViewCompat.setTransitionName(sourceView, TRANSITION_NAME);

    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
            activity, sourceView, TRANSITION_NAME);
    activity.startActivity(intent, options.toBundle());
}
 
开发者ID:rsippl,项目名称:AndroidProgramming3e,代码行数:8,代码来源:ImageActivity.java

示例14: onMailClicked

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@Override public void onMailClicked(MailsAdapterHolders.MailViewHolder vh, Mail mail) {

    ActivityOptionsCompat options =
        ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
            Pair.create((View) vh.senderPic, getString(R.string.shared_mail_sender_pic)),
            Pair.create((View) vh.subject, getString(R.string.shared_mail_subject)),
            Pair.create((View) vh.date, getString(R.string.shared_mail_date)),
            Pair.create((View) vh.star, getString(R.string.shared_mail_star)),
            Pair.create(getActivity().findViewById(R.id.toolbar),
                getString(R.string.shared_mail_toolbar)));

    intentStarter.showMailDetails(getActivity(), mail, options.toBundle());
  }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:BaseMailsFragment.java

示例15: launch

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
private void launch(AppCompatActivity activity, View transitionView, int resId) {


        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);
        startActivity(intent, transitionActivityOptions.toBundle());
    }
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:13,代码来源:ShareTractionActivity.java


注:本文中的android.support.v4.app.ActivityOptionsCompat.makeSceneTransitionAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。