本文整理匯總了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());
}
示例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());
}
示例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);
}
}
示例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());
}
示例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;
}
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}