androidx.core.app.ActivityOptionsCompat Java Examples

The following examples show how to use androidx.core.app.ActivityOptionsCompat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserInfoActivity.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
    int i = v.getId();
    if (i == R.id.btn_user_info_chat) {
        ChatActivity.start(this, ConstantUtil.TYPE_PERSON, uid);

    } else if (i == R.id.btn_user_info_add_friend) {
        sendAddFriendMsg();

    } else if (i == R.id.btn_user_info_add_black) {//                                添加对方为黑名单
        if (!isBlack) {
            showAddBlackDialog();
        } else {
            showCancelBlackDialog();
        }
    } else if (i == R.id.riv_user_info_avatar) {
        UserDetailActivity.start(this,userEntity.getUid(), ActivityOptionsCompat.makeSceneTransitionAnimation(this, Pair.create(avatar, "avatar")
                , Pair.create(name, "name")
                , Pair.create(sex, "sex")
        ,Pair.create(signature,"signature")));
    }
}
 
Example #2
Source File: ActivityRecreationHelper.java    From LocaleChanger with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method to recreate the Activity. This method should be called after a Locale change.
 * @param activity the Activity that will be recreated
 * @param animate a flag indicating if the recreation will be animated or not
 */
public static void recreate(Activity activity, boolean animate) {
    Intent restartIntent = new Intent(activity, activity.getClass());

    Bundle extras = activity.getIntent().getExtras();
    if (extras != null) {
        restartIntent.putExtras(extras);
    }

    if (animate) {
        ActivityCompat.startActivity(
                activity,
                restartIntent,
                ActivityOptionsCompat
                        .makeCustomAnimation(activity, android.R.anim.fade_in, android.R.anim.fade_out)
                        .toBundle()
        );
    } else {
        activity.startActivity(restartIntent);
        activity.overridePendingTransition(0, 0);
    }

    activity.finish();

}
 
Example #3
Source File: ActivityUtils.java    From DevUtils with Apache License 2.0 6 votes vote down vote up
/**
 * 设置跳转动画
 * @param activity       {@link Activity}
 * @param sharedElements 转场动画 View
 * @return {@link Bundle}
 */
public static Bundle getOptionsBundle(final Activity activity, final View[] sharedElements) {
    if (activity == null) return null;
    try {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            int len = sharedElements.length;
            @SuppressWarnings("unchecked")
            Pair<View, String>[] pairs = new Pair[len];
            for (int i = 0; i < len; i++) {
                pairs[i] = Pair.create(sharedElements[i], sharedElements[i].getTransitionName());
            }
            return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs).toBundle();
        }
        return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, null, null).toBundle();
    } catch (Exception e) {
        LogPrintUtils.eTag(TAG, e, "getOptionsBundle");
    }
    return null;
}
 
Example #4
Source File: VerticalGridFragment.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #5
Source File: SearchUsersActivity.java    From Hify with MIT License 6 votes vote down vote up
public static void startActivity(Activity activity, Context context, View view) {
    Intent intent = new Intent(context, SearchUsersActivity.class);

    if (Build.VERSION.SDK_INT >= 21) {
        String transitionName = "search";
        ActivityOptionsCompat options =
                ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
                        view,   // Starting view
                        transitionName    // The String
                );
        ActivityCompat.startActivity(context, intent, options.toBundle());

    } else {
        context.startActivity(intent);
    }

}
 
Example #6
Source File: PlaybackFragment.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #7
Source File: StreamsAdapter.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("NewApi")
@Override
void handleElementOnClick(View view) {
    int itemPosition = getRecyclerView().getChildAdapterPosition(view);

    if (itemPosition < 0 || getElements().size() <= itemPosition) {
        return;
    }

    boolean deviceHasLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
    StreamInfo item = getElements().get(itemPosition);
    Intent intent = LiveStreamActivity.createLiveStreamIntent(item, deviceHasLollipop, getContext());

    if (deviceHasLollipop) {
        View sharedView = view.findViewById(R.id.image_stream_preview);
        sharedView.setTransitionName(getContext().getString(R.string.stream_preview_transition));
        final ActivityOptionsCompat options = ActivityOptionsCompat.
                makeSceneTransitionAnimation(activity, sharedView, getContext().getString(R.string.stream_preview_transition));
        activity.startActivity(intent, options.toBundle());
    } else {
        getContext().startActivity(intent);
        activity.overridePendingTransition(R.anim.slide_in_bottom_anim, R.anim.fade_out_semi_anim);
    }
}
 
Example #8
Source File: SharedElementsComponentSpec.java    From litho with Apache License 2.0 6 votes vote down vote up
@OnEvent(ClickEvent.class)
static void onClickEvent(
    ComponentContext c, @FromEvent View view, @Param int color, @State boolean landLitho) {
  Activity activity = (Activity) c.getAndroidContext();
  Intent intent = new Intent(c.getAndroidContext(), DetailActivity.class);
  intent.putExtra(INTENT_COLOR_KEY, color);
  intent.putExtra(INTENT_LAND_LITHO, landLitho);
  ActivityOptionsCompat options =
      ActivityOptionsCompat.makeSceneTransitionAnimation(
          activity,
          new Pair<View, String>(view, SQUARE_TRANSITION_NAME),
          new Pair<View, String>(
              activity.getWindow().getDecorView().findViewWithTag(TITLE_TRANSITION_NAME),
              TITLE_TRANSITION_NAME));
  activity.startActivity(intent, options.toBundle());
}
 
Example #9
Source File: VerticalGridFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #10
Source File: SearchFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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();
    }
}
 
Example #11
Source File: VideoDetailsFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #12
Source File: DetailViewExampleWithVideoBackgroundFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
private void startWizardActivityForPayment() {
    Intent intent = new Intent(getActivity(),
            WizardExampleActivity.class);

    // Prepare extras which contains the Movie and will be passed to the Activity
    // which is started through the Intent.
    Bundle extras = new Bundle();
    String json = Utils.inputStreamToString(
            getResources().openRawResource(R.raw.wizard_example));
    Movie movie = new Gson().fromJson(json, Movie.class);
    extras.putSerializable("movie", movie);
    intent.putExtras(extras);


    Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity())
            .toBundle();
    startActivityForResult(intent,
            DetailViewExampleWithVideoBackgroundActivity.BUY_MOVIE_REQUEST, bundle);
}
 
Example #13
Source File: BrowseAdapter.java    From android-notification-log with MIT License 6 votes vote down vote up
@NonNull
@Override
public BrowseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
	View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_browse, parent, false);
	BrowseViewHolder vh = new BrowseViewHolder(view);
	vh.item.setOnClickListener(v -> {
		String id = (String) v.getTag();
		if(id != null) {
			Intent intent = new Intent(context, DetailsActivity.class);
			intent.putExtra(DetailsActivity.EXTRA_ID, id);
			if(Build.VERSION.SDK_INT >= 21) {
				Pair<View, String> p1 = Pair.create(vh.icon, "icon");
				@SuppressWarnings("unchecked") ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(context, p1);
				context.startActivityForResult(intent, 1, options.toBundle());
			} else {
				context.startActivityForResult(intent, 1);
			}
		}
	});
	return vh;
}
 
Example #14
Source File: PlaybackFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #15
Source File: VideoBrowserFragment.java    From CastVideos-android with Apache License 2.0 6 votes vote down vote up
@Override
public void itemClicked(View view, MediaInfo item, int position) {
    if (view instanceof ImageButton) {
        Utils.showQueuePopup(getActivity(), view, item);
    } else {
        String transitionName = getString(R.string.transition_image);
        VideoListAdapter.ViewHolder viewHolder =
                (VideoListAdapter.ViewHolder) mRecyclerView.findViewHolderForPosition(position);
        Pair<View, String> imagePair = Pair
                .create((View) viewHolder.getImageView(), transitionName);
        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(getActivity(), imagePair);

        Intent intent = new Intent(getActivity(), LocalPlayerActivity.class);
        intent.putExtra("media", item);
        intent.putExtra("shouldStart", false);
        ActivityCompat.startActivity(getActivity(), intent, options.toBundle());
    }
}
 
Example #16
Source File: IntentHelper.java    From GeometricWeather with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void startSearchActivityForResult(Activity activity, View bar, int requestCode) {
    Intent intent = new Intent(activity, SearchActivity.class);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        activity.startActivityForResult(intent, requestCode);
        activity.overridePendingTransition(R.anim.activity_search_in, 0);
    } else {
        ActivityCompat.startActivityForResult(
                activity,
                intent,
                requestCode,
                ActivityOptionsCompat.makeSceneTransitionAnimation(
                        activity,
                        Pair.create(bar, activity.getString(R.string.transition_activity_search_bar))
                ).toBundle()
        );
    }
}
 
Example #17
Source File: SearchApplication.java    From Mysplash with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void startSearchActivity(Activity a, View background, @Nullable String query) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        Bundle b = new Bundle();
        Recolor.addExtraProperties(background, b);
        RoundCornerTransition.addExtraProperties(background, b);

        ARouter.getInstance()
                .build(SearchActivity.SEARCH_ACTIVITY)
                .withString(SearchActivity.KEY_SEARCH_ACTIVITY_QUERY, query)
                .withBoolean(SearchActivity.KEY_EXECUTE_TRANSITION, true)
                .withBundle(a.getString(R.string.transition_search_background), b)
                .withOptionsCompat(
                        ActivityOptionsCompat.makeSceneTransitionAnimation(
                                a,
                                Pair.create(background, a.getString(R.string.transition_search_background))
                        )
                ).navigation(a);
    } else {
        startSearchActivity(a, query);
    }
}
 
Example #18
Source File: LatestFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onItemClick(View view, final int position) {
    //Toast.makeText(getActivity(),"item click detected", Toast.LENGTH_SHORT).show();
    if(position < 0 || position >= listNovelItemInfo.size()) {
        // ArrayIndexOutOfBoundsException
        Toast.makeText(getActivity(), "ArrayIndexOutOfBoundsException: " + position + " in size " + listNovelItemInfo.size(), Toast.LENGTH_SHORT).show();
        return;
    }

    // go to detail activity
    Intent intent = new Intent(getActivity(), NovelInfoActivity.class);
    intent.putExtra("aid", listNovelItemInfo.get(position).aid);
    intent.putExtra("from", "latest");
    intent.putExtra("title", listNovelItemInfo.get(position).title);
    if(Build.VERSION.SDK_INT < 21) {
        startActivity(intent);
    }
    else {
        ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
                Pair.create(view.findViewById(R.id.novel_cover), "novel_cover"),
                Pair.create(view.findViewById(R.id.novel_title), "novel_title"));
        ActivityCompat.startActivity(getActivity(), intent, options.toBundle());
    }
}
 
Example #19
Source File: LaunchActivity.java    From Ruisi with Apache License 2.0 5 votes vote down vote up
private void enterHome() {
    if (isForeGround) {
        ActivityOptionsCompat compat = ActivityOptionsCompat.makeCustomAnimation(this,
                R.anim.fade_in, R.anim.fade_out);
        ActivityCompat.startActivity(this,
                new Intent(this, HomeActivity.class), compat.toBundle());
        new Handler().postDelayed(this::finish, 305);
    }
}
 
Example #20
Source File: UserDetailActivity.java    From Ruisi with Apache License 2.0 5 votes vote down vote up
public static void openWithAnimation(Activity activity, String username, ImageView imgAvatar, String avatarUrl) {
    Intent intent = new Intent(activity, UserDetailActivity.class);
    intent.putExtra("loginName", username);
    intent.putExtra("avatarUrl", UrlUtils.getAvaterurlm(avatarUrl));
    needAnimate = true;
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, imgAvatar, NAME_IMG_AVATAR);
    ActivityCompat.startActivity(activity, intent, options.toBundle());
}
 
Example #21
Source File: JumpUtils.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 跳转列表带广告
 *
 * @param activity
 */
public static void goToADListVideoPlayer(Activity activity) {
    //Intent intent = new Intent(activity, ListADVideoActivity.class);
    Intent intent = new Intent(activity, ListADVideoActivity2.class);
    ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity);
    ActivityCompat.startActivity(activity, intent, activityOptions.toBundle());
}
 
Example #22
Source File: LollipopTransitionAnimation.java    From Alligator with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Bundle getActivityOptionsBundle(@NonNull Activity activity) {
	if (mSharedElements == null) {
		return ActivityOptionsCompat.makeSceneTransitionAnimation(activity).toBundle();
	} else {
		Pair<View, String>[] sharedElements = mSharedElements.toArray(new Pair[mSharedElements.size()]);
		return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle();
	}
}
 
Example #23
Source File: SeamlessPlayFragment.java    From DKVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void initView() {
    super.initView();

    //提前添加到VideoViewManager,供详情使用
    getVideoViewManager().add(mVideoView, Tag.SEAMLESS);

    mAdapter.setOnItemClickListener(position -> {
        mSkipToDetail = true;
        Intent intent = new Intent(getActivity(), DetailActivity.class);
        Bundle bundle = new Bundle();
        VideoBean videoBean = mVideos.get(position);
        if (mCurPos == position) {
            //需要无缝播放
            bundle.putBoolean(IntentKeys.SEAMLESS_PLAY, true);
            bundle.putString(IntentKeys.TITLE, videoBean.getTitle());
        } else {
            //无需无缝播放,把相应数据传到详情页
            mVideoView.release();
            //需要把控制器还原
            mController.setPlayState(VideoView.STATE_IDLE);
            bundle.putBoolean(IntentKeys.SEAMLESS_PLAY, false);
            bundle.putString(IntentKeys.URL, videoBean.getUrl());
            bundle.putString(IntentKeys.TITLE, videoBean.getTitle());
            mCurPos = position;
        }
        intent.putExtras(bundle);
        View sharedView = mLinearLayoutManager.findViewByPosition(position).findViewById(R.id.player_container);
        //使用共享元素动画
        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(getActivity(), sharedView, DetailActivity.VIEW_NAME_PLAYER_CONTAINER);
        ActivityCompat.startActivity(getActivity(), intent, options.toBundle());
    });
}
 
Example #24
Source File: CustomTabsIntent.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the exit animations.
 *
 * @param context Application context.
 * @param enterResId Resource ID of the "enter" animation for the application.
 * @param exitResId Resource ID of the "exit" animation for the browser.
 */
public Builder setExitAnimations(
        @NonNull Context context, @AnimRes int enterResId, @AnimRes int exitResId) {
    Bundle bundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResId, exitResId).toBundle();
    mIntent.putExtra(EXTRA_EXIT_ANIMATION_BUNDLE, bundle);
    return this;
}
 
Example #25
Source File: TransitionActivityMain.java    From android-test with Apache License 2.0 5 votes vote down vote up
/**
 * Called when an item in the {@link android.widget.GridView} is clicked. Here will launch the
 * {@link TransitionDetailActivity}, using the Scene Transition animation functionality.
 */
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    TransitionActivityItem item =
        (TransitionActivityItem) adapterView.getItemAtPosition(position);

    // Construct an Intent as normal
    Intent intent = new Intent(this, TransitionDetailActivity.class);
    intent.putExtra(TransitionDetailActivity.EXTRA_PARAM_ID, item.getId());

    /**
     * Now create an {@link android.app.ActivityOptions} instance using the
     * {@link ActivityOptionsCompat#makeSceneTransitionAnmation(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.imageview_item),
            TransitionDetailActivity.VIEW_NAME_HEADER_IMAGE),
        new Pair<View, String>(view.findViewById(R.id.textview_name),
            TransitionDetailActivity.VIEW_NAME_HEADER_TITLE));

    // Now we can start the Activity, providing the activity options as a bundle
    ActivityCompat.startActivity(this, intent, activityOptions.toBundle());
}
 
Example #26
Source File: PhotoActivity.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
public static void start(Activity activity, String url, View view) {
    Intent intent = new Intent(activity, PhotoActivity.class);
    intent.putExtra(ActivityConstant.URL, url);
    ActivityOptionsCompat options = ActivityOptionsCompat.
            makeSceneTransitionAnimation(activity, view, activity.getString(R.string.transition_photo));
    activity.startActivity(intent, options.toBundle());
}
 
Example #27
Source File: ContactDetailActivity.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
public static void start(Activity activity, Bitmap bitmap, Contact contact, Pair<View, String>... pairs) {
    Intent intent = new Intent(activity, ContactDetailActivity.class);
    ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation
            (activity, pairs);
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.PNG, 100, bytes);
    intent.putExtra(BITMAP, bytes.toByteArray());
    intent.putExtra(CONTACT, contact);
    activity.startActivity(intent, optionsCompat.toBundle());
}
 
Example #28
Source File: NotePreviewActivity.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
public static void start(Activity activity, int position, ArrayList<String> data, Pair<View, String>... pairs) {
    ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation
            (activity, pairs);
    Intent intent = new Intent(activity, NotePreviewActivity.class);
    intent.putExtra(ActivityConstant.POSITION, position);
    intent.putExtra(ActivityConstant.DATA, data);
    activity.startActivityForResult(intent, REQUEST_CODE, optionsCompat.toBundle());
}
 
Example #29
Source File: MainActivity.java    From AppsMonitor with MIT License 5 votes vote down vote up
@SuppressLint("RestrictedApi")
void setOnClickListener(final AppItem item) {
    itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(MainActivity.this, DetailActivity.class);
            intent.putExtra(DetailActivity.EXTRA_PACKAGE_NAME, item.mPackageName);
            intent.putExtra(DetailActivity.EXTRA_DAY, mDay);
            ActivityOptionsCompat options = ActivityOptionsCompat.
                    makeSceneTransitionAnimation(MainActivity.this, mIcon, "profile");
            startActivityForResult(intent, 1, options.toBundle());
        }
    });
}
 
Example #30
Source File: ActorDetailInfoActivity.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
public static void start(Activity activity, String data, ActivityOptionsCompat activityOptionsCompat) {
    Intent intent = new Intent(activity, ActorDetailInfoActivity.class);
    intent.putExtra(VideoUtil.DATA, data);
    if (activityOptionsCompat != null) {
        activity.startActivity(intent, activityOptionsCompat.toBundle());
    } else {
        activity.startActivity(intent);
    }
}