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); } }
@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()); }
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()); } }); }
@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()); }
@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()); } }); }
/** * 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); } }
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); } }
/** * 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; } }
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()); }
@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; }
@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; } }
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()); }
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 ); }
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); }
@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); } }
@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; } }
@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); } }); }
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()); }
@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); } }
@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()); } }
@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(); } }
@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); }
/** * @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()); }
/** * @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()); }
/** * @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()); }
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()); }
/** * @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()); }
/** * @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()); }
@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); }
/** * @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()); }
@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(); }
@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; } }
@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()); }
@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()); }
@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); }
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); } }
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; }