public static void startAction(Context mContext, View view,String postId, String imgUrl) {
Intent intent =
new Intent(mContext, NewsDetailActivity.
class);
intent.putExtra(AppConstant.
NEWS_POST_ID, postId);
intent.putExtra(AppConstant.
NEWS_IMG_RES, imgUrl);
if (Build.VERSION.
SDK_INT >= Build.VERSION_CODES.
LOLLIPOP) {
ActivityOptions options = ActivityOptions
.
makeSceneTransitionAnimation((Activity) mContext,view, AppConstant.
TRANSITION_ANIMATION_NEWS_PHOTOS);
mContext.startActivity(intent, options.toBundle());
}
else {
//让新的Activity从一个小的范围扩大到全屏
ActivityOptionsCompat options = ActivityOptionsCompat
.
makeScaleUpAnimation(view, view.getWidth() /
2, view.getHeight() /
2,
0,
0);
ActivityCompat.
startActivity((Activity) mContext, intent, options.toBundle());
}
}
转载请注明原文地址: https://ju.6miu.com/read-13165.html