{"id":13644088,"url":"https://github.com/hss01248/PicCrop","last_synced_at":"2025-04-21T06:33:00.665Z","repository":{"id":119093617,"uuid":"69001326","full_name":"hss01248/PicCrop","owner":"hss01248","description":"图片裁剪的工具类，基于uCrop封装，使用十分便捷","archived":false,"fork":false,"pushed_at":"2017-03-08T03:26:21.000Z","size":847,"stargazers_count":98,"open_issues_count":3,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-09T16:43:47.377Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hss01248.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-09-23T07:36:42.000Z","updated_at":"2023-12-24T19:58:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"dda804ec-7523-4f41-a14d-9537f7ad7fb6","html_url":"https://github.com/hss01248/PicCrop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hss01248%2FPicCrop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hss01248%2FPicCrop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hss01248%2FPicCrop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hss01248%2FPicCrop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hss01248","download_url":"https://codeload.github.com/hss01248/PicCrop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250008292,"owners_count":21359960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:01:57.393Z","updated_at":"2025-04-21T06:32:56.058Z","avatar_url":"https://github.com/hss01248.png","language":"Java","funding_links":[],"categories":["图片"],"sub_categories":[],"readme":"## 注: 图片选择/拍照-\u003e裁剪-\u003e压缩 整个流程的操作已经串起到下面的库中\n[PhotoOut](https://github.com/hss01248/PhotoOut)\n\n\n# PicCrop\n对ucrop的封装工具类,让其使用更加快捷.\n\n在ucrop 2.2.0(compile 'com.yalantis:ucrop:2.2.0')基础上封装,\n\n\n如果以后ucrop以后升级,那么本工具类只需要改CropConfig里字段就可以.无需更改api.\n\n甚至,切换其他图片裁剪框架,也是改方法内部实现即可,不用更换各处已调用的api.\n\n\n\n## 说明\n\n此项目从[https://github.com/glassLake/CropUtils](https://github.com/glassLake/CropUtils)迁移而来,已更新ucrop 依赖和api命名,原项目不再更新.\n\n\n\n# uCrop主项目地址:\n\n[https://github.com/Yalantis/uCrop ](https://github.com/Yalantis/uCrop)\n\n\n\n# 效果图(标题栏和状态栏颜色均可自定义)\n\n## 通用裁剪界面\n\n\n\n ![normalCrop](normalCrop.jpg)\n\n\n\n## 头像裁剪框\n\n ![avatarcrop](avatarcrop.jpg)\n\n# 封装的api\n\n``` java\n\npublic static void cropFromGallery(Activity context)\npublic static void cropFromCamera(Activity context)\n\n  \n //从图库中选头像\npublic static void cropAvatarFromGallery(Activity context)\npublic static void cropAvatarFromCamera(Activity context)\n\n  \n//需要自定义设置时使用\npublic static void cropFromGallery(Activity context,CropConfig config,int type)\npublic static void cropFromCamera(Activity context,CropConfig config,int type)\n  \n\npublic static void onActivityResult( int requestCode, int resultCode, Intent data,Activity context, CropHandler cropHandler)\n\n  \n//回调接口\npublic interface CropHandler {\n        void handleCropResult(Uri uri,int tag);\n        void handleCropError(Intent data);\n    }\n```\n\n\n\n# 使用\n\n## 拷贝本工具类并添加gradle:\n\n`compile 'com.yalantis:ucrop:2.2.0'`\n\n若主项目有更新,请自行更新.\n\n\n\n## 代码里\n\n点击选择图片或拍照的地方调用cropFromxxx,\n\n裁剪头像用cropAvatarFromxxx\n\n\n\n在activity的onActivityResult里调用\n\n`handleResult(this,cropHandler,requestCode,resultCode,data);`\n\n注意无需预先对intent做为空的判断.\n\n\n\ntag字段用于同一个页面多个地方接收裁剪图片的区分,如无需要,不必设置.\n\n\n\n# 混淆\n\n  -dontwarn com.yalantis.ucrop**\n  \n  -keep class com.yalantis.ucrop** { *; }\n  \n  -keep interface com.yalantis.ucrop** { *; }\n\n\n# 相关\n\n[本工具类介绍blog地址](http://blog.csdn.net/hss01248/article/details/52124075)\n\n[图片加载框架Fresco的封装工具类FrescoUtils](https://github.com/glassLake/FrescoUtlis)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhss01248%2FPicCrop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhss01248%2FPicCrop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhss01248%2FPicCrop/lists"}