@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(DetailActivityFragment.DETAIL_URI, contentUri); DetailActivityFragment fragment = new DetailActivityFragment(); 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()); } }
public void openRecipeDetail(View view, int position) { try { // Image imageItem = adapter.GetItemAt(position); Intent intent = new Intent(this, RecipeActivity.class); intent.putExtra( Constants.exRecipeTitle, String.valueOf(BrewSharedPrefs.getCurrentContentTitle())); intent.putExtra( Constants.exContentItemPk, String.valueOf(BrewSharedPrefs.getNextContentItemId())); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); ActivityCompat.startActivity(this, intent, options.toBundle()); } else { this.startActivity(intent); this.overridePendingTransition(R.anim.slide_in_from_right, R.anim.slide_out_to_left); } } catch (Exception e) { if (BuildConfig.DEBUG) { Log.e(Constants.LOG, e.getMessage()); } } }
public static void playEpisodeFromFile(Activity parentActivity, File file) { Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "audio/*"); if (parentActivity != null) startActivity(parentActivity, intent, Bundle.EMPTY); Log.i("Podcast|playfile", "No context or activity."); }
private void handleBackPress() { if (getIntent().getBooleanExtra(MANAGE_UP_NAVIGATION, false)) { if (!IN_CATID.equals("0")) { Intent intent = new Intent(this, AudioCatListActivity.class); intent.putExtra(AMAppMasterActivity.MANAGE_UP_NAVIGATION, true); intent.putExtra(AudioCatListActivity.CAT_ID, "0"); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this); ActivityCompat.startActivity(this, intent, options.toBundle()); } else { Intent intent = new Intent(this, HomeListActivity.class); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this); ActivityCompat.startActivity(this, intent, options.toBundle()); } } supportFinishAfterTransition(); }
public void playNewestEpisode(Activity parentActivity) { File file = getNewestEpisode(); Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "audio/*"); if (context != null) context.startActivity(intent); else if (parentActivity != null) startActivity(parentActivity, intent, Bundle.EMPTY); Log.i("Podcast|playNewest", "No context or activity."); }
@OnClick(R.id.btn_assign) public void startAssignActivity(PaperButton paperButton) { Activity activity = (Activity) paperButton.getContext(); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( activity, cardView, WorkOrderCardActivity.SHARED_VIEW); Intent intent = new Intent(paperButton.getContext(), AssignActivity.class); intent.putExtra("workOrderProcessInfo", workOrderProcessInfoList.get(getAdapterPosition())); intent.putExtra("refreshEventTag", refreshEventTag); ActivityCompat.startActivity(activity, intent, options.toBundle()); }
@Override public void onListItemClick(ListView l, View view, int position, long id) { Intent intent = new Intent(getActivity(), EpisodesActivity.class); intent.putExtra(EpisodesActivity.InitBundle.SEASON_TVDBID, (int) id); ActivityCompat.startActivity( getActivity(), intent, ActivityOptionsCompat.makeScaleUpAnimation(view, 0, 0, view.getWidth(), view.getHeight()) .toBundle()); }
public static void openWithTransitionAnimation( Activity activity, String loginName, ImageView imgAvatar, String avatarUrl) { Intent intent = new Intent(activity, UserDetailActivity.class); intent.putExtra("loginName", loginName); intent.putExtra("avatarUrl", avatarUrl); // 控件动画效果启动另一个activity ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, imgAvatar, NAME_IMG_AVATAR); ActivityCompat.startActivity(activity, intent, options.toBundle()); }
public void Jump() { Intent intent = new Intent(activity, DeviceActivity.class); intent.putExtra("Device", mDataset.get(getAdapterPosition())); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( activity, Pair.create(itemView.findViewById(R.id.device_icon), "device_icon"), Pair.create(itemView.findViewById(R.id.device_name), "device_name")); ActivityCompat.startActivity(activity, intent, options.toBundle()); }
@Override public void onClick(View v) { ChapterItemBinding bind = DataBindingUtil.getBinding(v); ChapterEntity chapter = bind.getChapter(); Toast.makeText(getActivity(), chapter.getTitle(), Toast.LENGTH_SHORT).show(); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( getActivity(), v, getString(R.string.chapter_transition)); Intent intent = new Intent(getContext(), ChapterContentActivity.class); intent.putExtra("chapterId", chapter.getId()); ActivityCompat.startActivity(getActivity(), intent, options.toBundle()); }
public static void start(Activity activity, String url, View transitionView) { Intent intent = new Intent(activity, PictureActivity.class); intent.putExtra(PictureActivity.EXTRA_IMAGE_URL, url); // Image Transition. ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation( activity, transitionView, PictureActivity.TRANSIT_PIC); try { ActivityCompat.startActivity(activity, intent, optionsCompat.toBundle()); } catch (IllegalArgumentException e) { e.printStackTrace(); activity.startActivity(intent); } }
@Override public void onItemClick(View view, int position) { Book book = mAdapter.getBook(position); Intent intent = new Intent(getActivity(), BookDetailActivity.class); intent.putExtra("book", book); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( getActivity(), view.findViewById(R.id.ivBook), getString(R.string.transition_book_img)); ActivityCompat.startActivity(getActivity(), intent, options.toBundle()); }
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { String item = (String) adapterView.getItemAtPosition(position); Intent intent = new Intent(this, DetailActivity.class); intent.putExtra(DetailActivity.EXTRA_PARAM_ID, position); ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation( this, new Pair<View, String>( view.findViewById(R.id.imageview_item), DetailActivity.VIEW_NAME_HEADER_IMAGE)); ActivityCompat.startActivity(this, intent, activityOptions.toBundle()); }
public static void launch(Activity context, Project project, View... sharedViews) { final Bundle options; if (LUtils.hasL()) { options = getSharedElementsBundle(context, sharedViews); } else { options = new Bundle(); } Intent intent = new Intent(context, ProjectDetailsActivity.class); Parcelable wrapped = Parcels.wrap(project); intent.putExtra(EXTRA_PROJECT, wrapped); // Preload big photo Picasso.with(context).load(project.getBigPhotoUrl()); ActivityCompat.startActivity(context, intent, options); }
private void showQrCodeDialog() { Intent qrCodeIntent = new Intent(getActivity(), QrCodeViewActivity.class); // create the transition animation - the images in the layouts // of both activities are defined with android:transitionName="qr_code" Bundle opts = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getActivity(), mQrCodeLayout, "qr_code"); opts = options.toBundle(); } qrCodeIntent.setData(mDataUri); ActivityCompat.startActivity(getActivity(), qrCodeIntent, opts); }
@SuppressWarnings("unchecked") @Override public void onItemClick(View view, int position) { Intent intent = new Intent(GridViewActivity.this, TransitionActivity.class); intent.putExtra("image_id", position); // ctivityOptionsCompat.makeSceneTransitionAnimation(CardRevealActivity.this, imageView, // "Image").toBundle(); ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation( GridViewActivity.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.image), TransitionActivity.VIEW_NAME_HEADER_IMAGE)); ActivityCompat.startActivity(GridViewActivity.this, intent, activityOptions.toBundle()); }
@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. switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; case R.id.action_settings: Intent intent = new Intent(this, SettingsActivity.class); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this); ActivityCompat.startActivity(this, intent, options.toBundle()); return true; } return super.onOptionsItemSelected(item); }
public static void showReaderPhotoViewer( Activity activity, String imageUrl, boolean isPrivate, View source, int startX, int startY) { if (TextUtils.isEmpty(imageUrl)) { return; } Intent intent = new Intent(activity, ReaderPhotoViewerActivity.class); intent.putExtra(ReaderPhotoViewerActivity.ARG_IMAGE_URL, imageUrl); intent.putExtra(ReaderPhotoViewerActivity.ARG_IS_PRIVATE, isPrivate); // use built-in scale animation on jb+, fall back to our own animation on pre-jb if (source != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(source, startX, startY, 0, 0); ActivityCompat.startActivity(activity, intent, options.toBundle()); } else { activity.startActivity(intent); activity.overridePendingTransition(R.anim.reader_photo_in, 0); } }
public static void startThis( Context context, View imageView, @DrawableRes int imageResId, View textView, CharSequence text) { Intent intent = new Intent(context, SharedElementsActivity.class); intent.putExtra(IMAGE_RES_ID, imageResId); intent.putExtra(TEXT, text); // core ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation( (Activity) context, Pair.create(imageView, TRANSIT_IMAGE), Pair.create(textView, TRANSIT_TEXT)); try { ActivityCompat.startActivity((Activity) context, intent, optionsCompat.toBundle()); } catch (IllegalArgumentException e) { e.printStackTrace(); context.startActivity(intent); } }
public static void launch(Activity activity) { ActivityOptionsCompat options = ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.head_in, R.anim.head_out); Intent intent = new Intent(activity, VideoPlayActivity.class); ActivityCompat.startActivity(activity, intent, options.toBundle()); }
public static void startActivity(Activity activity, ToolType toolType, Bundle activityOptions) { final Intent intent = new Intent(activity, ToolListActivity.class); intent.putExtra(EXTRA_TOOL_TYPE, toolType); ActivityCompat.startActivity(activity, intent, activityOptions); }
/** * Show single instance of {@link MyLocationListActivity} * * @param cxt {@link Context}. */ public static void showInstance(Activity cxt) { Intent intent = new Intent(cxt, MyLocationListActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); ActivityCompat.startActivity(cxt, intent, null); }