Java Code Examples for android.support.v4.app.ActivityOptionsCompat#makeScaleUpAnimation()
The following examples show how to use
android.support.v4.app.ActivityOptionsCompat#makeScaleUpAnimation() .
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: MNImageBrowser.java From MNImageBrowser with GNU General Public License v3.0 | 6 votes |
private void startBrowserAvtivity(Context context, View view, Intent intent) { if (imageBrowserConfig.getActivityOpenAnime() != R.anim.mn_browser_enter_anim) { context.startActivity(intent); ((Activity) context).overridePendingTransition(imageBrowserConfig.getActivityOpenAnime(), 0); } else { //android V4包的类,用于两个activity转场时的缩放效果实现 ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation(view, view.getWidth() / 2, view.getHeight() / 2, 0, 0); try { ActivityCompat.startActivity(context, intent, optionsCompat.toBundle()); } catch (IllegalArgumentException e) { e.printStackTrace(); context.startActivity(intent); ((Activity) context).overridePendingTransition(R.anim.mn_browser_enter_anim, 0); } } }
Example 2
Source File: NfcDeviceFragment.java From ESeal with Apache License 2.0 | 6 votes |
private void performTakePictureWithTransition(View v) { Activity activity = getActivity(); final int[] startLocation = new int[2]; v.getLocationOnScreen(startLocation); startLocation[0] += v.getWidth() / 2; if (v == null || ApiLevelHelper.isLowerThan(Build.VERSION_CODES.LOLLIPOP)) { TakePictueActivity.start(activity, startLocation); return; } if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) { // ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeBasic(); ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation(v, startLocation[0], startLocation[1], 0, 0); TakePictueActivity.start(activity, startLocation, optionsCompat); } }
Example 3
Source File: DeviceOperationActivity.java From ESeal with Apache License 2.0 | 6 votes |
private void performTakePictureWithTransition(View v) { Activity activity = DeviceOperationActivity.this; final int[] startLocation = new int[2]; v.getLocationOnScreen(startLocation); startLocation[0] += v.getWidth() / 2; if (v == null || ApiLevelHelper.isLowerThan(Build.VERSION_CODES.LOLLIPOP)) { TakePictueActivity.start(activity, startLocation); return; } if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) { // ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeBasic(); ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation(v, startLocation[0], startLocation[1], 0, 0); TakePictueActivity.start(activity, startLocation, optionsCompat); } }
Example 4
Source File: GankFragment.java From gank.io-unofficial-android-client with Apache License 2.0 | 6 votes |
public void launch(Gank.GankInfo gankInfo, AbsRecyclerViewAdapter.ClickableViewHolder holder) { //Activity跳转动画 界面共享元素的使用 Intent intent = BigImageActivity.launch(getActivity(), gankInfo.url, gankInfo.desc); ActivityOptionsCompat mActivityOptionsCompat; if (Build.VERSION.SDK_INT >= 21) { mActivityOptionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation( getActivity(), holder.getParentView().findViewById(R.id.item_image), ConstantUtil.TRANSIT_PIC); } else { mActivityOptionsCompat = ActivityOptionsCompat.makeScaleUpAnimation( holder.getParentView().findViewById(R.id.item_image), 0, 0, holder.getParentView().findViewById(R.id.item_image).getWidth(), holder.getParentView().findViewById(R.id.item_image).getHeight()); } startActivity(intent, mActivityOptionsCompat.toBundle()); }
Example 5
Source File: SearchGankActivity.java From gank.io-unofficial-android-client with Apache License 2.0 | 6 votes |
public void startFuliActivity(Gank.GankInfo gankInfo, AbsRecyclerViewAdapter.ClickableViewHolder holder) { //Activity跳转动画 界面共享元素的使用 Intent intent = BigImageActivity.launch(SearchGankActivity.this, gankInfo.url, gankInfo.desc); ActivityOptionsCompat mActivityOptionsCompat; if (Build.VERSION.SDK_INT >= 21) { mActivityOptionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation( SearchGankActivity.this, holder.getParentView().findViewById(R.id.item_image), ConstantUtil.TRANSIT_PIC); } else { mActivityOptionsCompat = ActivityOptionsCompat.makeScaleUpAnimation( holder.getParentView().findViewById(R.id.item_image), 0, 0, holder.getParentView().findViewById(R.id.item_image).getWidth(), holder.getParentView().findViewById(R.id.item_image).getHeight()); } startActivity(intent, mActivityOptionsCompat.toBundle()); }
Example 6
Source File: PhotoFragment.java From ZZShow with Apache License 2.0 | 6 votes |
@Override public void OnItemClickListener(View view, int position) { List<PhotoGirl> list = mAdapter.getList(); Intent intent = PhotoDetailActivity.getPhotoDetailIntent(getContext(),list.get(position).getUrl()); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ImageView animationIv = (ImageView) view.findViewById(R.id.photo_iv); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation( getActivity(), animationIv, Constants.TRANSITION_ANIMATION_NEWS_PHOTOS); startActivity(intent,options.toBundle()); }else{ ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation( view, view.getWidth() / 2, view.getHeight() / 2, 0, 0); ActivityCompat.startActivity(getActivity(),intent,optionsCompat.toBundle()); } }
Example 7
Source File: LoadAdapter.java From NBAPlus with Apache License 2.0 | 6 votes |
@Override public void onClick(View view) { Intent intent = new Intent(mContext, NewsDetileActivity.class); intent.putExtra(NewsDetileActivity.TITLE, newEntity.getTitle()); intent.putExtra(NewsDetileActivity.DETILE_DATE, new DateTime(Long.parseLong(newEntity.getPutdate())).toString("yyyyMMdd")); intent.putExtra(NewsDetileActivity.DETILE_ID, newEntity.getArticleId()); intent.putExtra(NewsDetileActivity.IMAGE_EXIST, newEntity.getImgUrlList().size() > 0); if (newEntity.getImgUrlList().size()>0) { intent.putExtra(NewsDetileActivity.IMAGE_URL, newEntity.getImgUrlList().get(0)); } ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(view, //The View that the new activity is animating from (int) view.getWidth() / 2, (int) view.getHeight() / 2, //拉伸开始的坐标 0, 0);//拉伸开始的区域大小,这里用(0,0)表示从无到全屏 ActivityCompat.startActivity((Activity) mContext, intent, options.toBundle()); }
Example 8
Source File: MainActivity.java From mr-mantou-android with GNU General Public License v3.0 | 6 votes |
@Override public void onImageClick(MainAdapter.ViewHolder holder) { final Image image = images.get(holder.getLayoutPosition()); final Intent intent = new Intent(this, ViewerActivity.class); intent.putExtra("index", holder.getAdapterPosition()); intent.putExtra("thumbnail", image.getUrl(holder.binding.image.getWidth())); final ActivityOptionsCompat options; if (Build.VERSION.SDK_INT >= 21) { options = ActivityOptionsCompat.makeSceneTransitionAnimation( this, holder.binding.image, String.format("%s.image", image.getObjectId())); } else { options = ActivityOptionsCompat.makeScaleUpAnimation( holder.itemView, 0, 0, holder.itemView.getWidth(), holder.itemView.getHeight()); } startActivity(intent, options.toBundle()); }
Example 9
Source File: ActivityAnimate.java From SmartGo with Apache License 2.0 | 5 votes |
public static void animate(final @NonNull Box<ActivityOptionsCompat> box, @NonNull View source, int startX, int startY, int startWidth, int startHeight){ final ActivityOptionsCompat compat = ActivityOptionsCompat.makeScaleUpAnimation( source, startX, startY, startWidth, startHeight); box.set(compat); }
Example 10
Source File: GirlFragment.java From GankGirl with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void onItemClick(View view, int position) { ActivityOptionsCompat options; if (Build.VERSION.SDK_INT >= 21) { options = ActivityOptionsCompat.makeSceneTransitionAnimation( getActivity(), view, mGirlAdapter.getItem(position)._id); } else { options = ActivityOptionsCompat.makeScaleUpAnimation( view, view.getWidth() / 2, view.getHeight() / 2,//拉伸开始的坐标 0, 0);//拉伸开始的区域大小,这里用(0,0)表示从无到全屏 } ActivityCompat.startActivity(getActivity(), ImagePagerActivity.newIntent(view.getContext(), position, mGirlAdapter.getData()), options.toBundle()); }
Example 11
Source File: NewsListFragment.java From ZZShow with Apache License 2.0 | 5 votes |
@Override public void OnItemClickListener(View view, int position) { List<NewsSummary> mNewsSummaryList = mAdapter.getList(); NewsSummary newsSummary = mNewsSummaryList.get(position); if(NewsListAdapter.TYPE_PHOTO_SET == mAdapter.getItemViewType(position)){ NewsPhotoDetail mNewsPhotoDetail = setNewsPhotoDetail(newsSummary); startActivity(NewsPhotoDetailActivity.getNewsDetailIntent(getActivity(),mNewsPhotoDetail)); KLog.d(TAG,"postId = " + newsSummary.getPostid() +"--- postSetId= "+ newsSummary.getPhotosetID()); }else{ Intent intent = NewsDetailActivity.getNewsDetailIntent(getActivity(),newsSummary.getPostid(),newsSummary.getImgsrc()); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ImageView animationIv = (ImageView) view.findViewById(R.id.news_picture_iv); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation( getActivity(), animationIv, Constants.TRANSITION_ANIMATION_NEWS_PHOTOS); startActivity(intent,options.toBundle()); }else{ ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation( view, view.getWidth() / 2, view.getHeight() / 2, 0, 0); ActivityCompat.startActivity(getActivity(),intent,optionsCompat.toBundle()); } } }
Example 12
Source File: OptionsCompatDemoActivity.java From AndroidStudyDemo with GNU General Public License v2.0 | 5 votes |
/** * 这个在4.x上有用,可以实现新的Activity从某个固定的坐标以某个大小扩大至全屏 */ private void showScaleUpAnim(View view) { if (mTestSwitch) { ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation( view, 0, 0, // 拉伸开始的坐标 view.getMeasuredWidth(), view.getMeasuredHeight() ); ActivityCompat.startActivity( OptionsCompatDemoActivity.this, mIntent, optionsCompat.toBundle()); } else { ActivityOptionsCompatICS optionsCompatICS = ActivityOptionsCompatICS.makeScaleUpAnimation( view, 0, 0, // 拉伸开始的坐标 view.getMeasuredWidth(), view.getMeasuredHeight() ); ActivityCompatICS.startActivity( OptionsCompatDemoActivity.this, mIntent, optionsCompatICS.toBundle()); } }
Example 13
Source File: ActivityOptionsCompatCompat.java From materialize with GNU General Public License v3.0 | 5 votes |
public static ActivityOptionsCompat makeClipRevealAnimation( View source, int startX, int startY, int width, int height) { if (Build.VERSION.SDK_INT >= 23) { return new ActivityOptionsImpl23(ActivityOptionsCompat23.makeClipRevealAnimation( source, startX, startY, width, height)); } return ActivityOptionsCompat.makeScaleUpAnimation(source, startX, startY, width, height); }
Example 14
Source File: Tools.java From Lucid-Browser with Apache License 2.0 | 5 votes |
public static ActivityOptionsCompat getActivityAnimation(View v, Activity activity){ ActivityOptionsCompat options = null; if (v==null && (activity instanceof MainActivity) && ((MainActivity)activity).contentFrame!=null) v = ((MainActivity)activity).contentFrame; if (v != null) { if (Build.VERSION.SDK_INT >= 23) options = ActivityOptionsCompat.makeClipRevealAnimation(v, 0, 0, v.getWidth(), v.getHeight()); else options = ActivityOptionsCompat.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight()); } return options; }