diff --git a/README.md b/README.md index ca8e16b..c809a79 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,91 @@ -# PhotoFrame是什么? -PhotoFrame是对图库调用和相机调用进行封装的框架,
并对用户操作的图片进行指定质量压缩。
兼容到android7.0系统 -#### PhotographUtils图片压缩机制 -当图片第一次被选择时,将进行质量压缩并存进压缩文件夹中.
-如果此图片存在压缩文件夹中,那么不进行压缩,将直接从压缩文件中取出 +[中文版文档](https://github.com/LiqiNew/PhotoFrame/blob/master/README_CHINESE.md)

+[![](https://jitpack.io/v/liqinew/photoframe.svg)](https://jitpack.io/#liqinew/photoframe) +[![](https://img.shields.io/badge/%E4%BD%9C%E8%80%85-%E6%9D%8E%E5%A5%87-orange.svg)](https://github.com/LiqiNew) +# What is the PhotoFrame framework? +PhotoFrame is a framework for calling libraries and calling camera packages,
+And the user to operate the image specified quality compression.
+Compatible with android7.0 system. +#### PhotographUtils picture compression mechanism. +When the picture is selected for the first time, it will be mass compressed and stored in the compressed folder.
+If this picture is in a compressed folder, it will not be compressed and taken directly from the compressed file. -使用方法 +Instructions ----- #### Gradle -**1:在项目根目录build.gradley**
-allprojects {
-  repositories {
-   //依赖仓库
-   maven { url 'https://jitpack.io' }
-  }
-}
-**2:依赖PhotoFrame框架**
+**1:In the project root directory build.gradle**
+ +```gradle +allprojects { +  repositories { +   //Rely on the warehouse +   maven { url 'https://jitpack.io' } +  } +} +``` + +**2:Depends on the PhotoFrame framework**
+ +```gradle compile 'com.github.liqinew:photoframe:v.1.0.0' -## 如何通过PhotoFrame去使用? -**1:通过链式配置对象构建图库和照相机操作对象暴露接口(OnDisposeOuterListener)**
-//获取配置对象
-PhotographStaticUtils.getPhotographBuilder(this)

-//设置图片压缩路径
-.setCompressPath(COMPRESSPATH)

-//设置照片暂时存路径
-.setImagePath(IMAGEPATH)

-//设置是否删除没有压缩的拍照照片(默认是拍一张删一张)
-.setDelePGImage(false)

-//设置处理好的图片路径接口
-.setOnPhotographGetDataListener(new OnPhotographGetDataListener\())

-//设置图片压缩大小(默认是1M)
-.setImageSize(IMAGESIZE)

-//构建图库和照相机处理操作对象暴露接口(OnDisposeOuterListener)
-.builder();

-**2:通过OnDisposeOuterListener暴露接口去进行操作**
-(!注:此方法一定要放到Activity中onActivityResult(int requestCode, int resultCode, Intent data)回调方法里面)
-//处理activity界面中图片系统回调操作
-OnDisposeOuterListener.onActivityResult(requestCode(请求编码), Intent);

-//打开照相机
-OnDisposeOuterListener.startCamera();

-//打开相册
-OnDisposeOuterListener.startPhoto();

-(!注:为了防止内存泄漏,请在Activity生命周期onDestroy()调用)
-//清理数据
-OnDisposeOuterListener.clear()

- -6.0系统以上需要自己动态添加权限 +``` + +## How do I use it with PhotoFrame? +**1:Building a library and a camera operation object through a chain configuration object Exposure interface (OnDisposeOuterListener)**
+```java +//Get the configuration object +PhotographStaticUtils.getPhotographBuilder(this) + +//Set the image compression path +.setCompressPath(COMPRESS_PATH) + +//Set the photo temporary save path +.setImagePath(IMAGE_PATH) + +//Set whether to delete a photo without compression.if true yes,else false. default true. +.setDelePGImage(false) + +//Set the interface to get the processed image path +.setOnPhotographGetDataListener(new OnPhotographGetDataListener()) + +//Set the image compression size, the default is 1M. +.setImageSize(IMAGE_SIZE) + +//Building the Gallery and Camera Handling the Object Exposure Interface (OnDisposeOuterListener) +.builder(); +``` +**2:Through the "OnDisposeOuterListener" interface to operate**
+```java +//Processing the interface in the picture system callback operation +//Note: This method must be placed in the Activity "onActivityResult (...)" callback method inside. +OnDisposeOuterListener.onActivityResult(requestCode,Intent); + +//Turn on the camera +OnDisposeOuterListener.startCamera(); + +//Open the album +OnDisposeOuterListener.startPhoto(); + +//Clean up the data +//Note: To prevent memory leaks, call "onDestroy()" in the Activity lifecycle. +OnDisposeOuterListener.clear() +``` + +6.0 system above need to add their own dynamic permissions ----- -##### 如果觉得不错,请star给我动力. +##### If you feel good, please star give me motivation.

thank you very much. + +# License + + Copyright 2017 Liqi + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 -### 如有疑问请联系我 -技术QQ群:46523908
-联系QQ:543945827 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README_CHINESE.md b/README_CHINESE.md new file mode 100644 index 0000000..86d5776 --- /dev/null +++ b/README_CHINESE.md @@ -0,0 +1,92 @@ +[![](https://jitpack.io/v/liqinew/photoframe.svg)](https://jitpack.io/#liqinew/photoframe) +[![](https://img.shields.io/badge/%E4%BD%9C%E8%80%85-%E6%9D%8E%E5%A5%87-orange.svg)](https://github.com/LiqiNew) +# PhotoFrame是什么? +PhotoFrame是对图库调用和相机调用进行封装的框架,
并对用户操作的图片进行指定质量压缩。
兼容到android7.0系统 +#### PhotographUtils图片压缩机制 +当图片第一次被选择时,将进行质量压缩并存进压缩文件夹中.
+如果此图片存在压缩文件夹中,那么不进行压缩,将直接从压缩文件中取出 + +使用方法 +----- +#### Gradle +**1:在项目根目录build.gradley**
+ +```gradle +allprojects { +  repositories { +   //依赖仓库 +   maven { url 'https://jitpack.io' } +  } +} +``` + +**2:依赖PhotoFrame框架**
+ +```gradle +compile 'com.github.liqinew:photoframe:v.1.0.0' +``` + +## 如何通过PhotoFrame去使用? +**1:通过链式配置对象构建图库和照相机操作对象暴露接口(OnDisposeOuterListener)**
+```java +//获取配置对象 +PhotographStaticUtils.getPhotographBuilder(this) + +//设置图片压缩路径 +.setCompressPath(COMPRESS_PATH) + +//设置照片暂时存路径 +.setImagePath(IMAGE_PATH) + +//设置是否删除没有压缩的拍照照片,默认是拍一张删一张。 +.setDelePGImage(false) + +//设置处理好的图片路径接口 +.setOnPhotographGetDataListener(new OnPhotographGetDataListener()) + +//设置图片压缩大小,默认是1M。 +.setImageSize(IMAGE_SIZE) + +//构建图库和照相机处理操作对象暴露接口(OnDisposeOuterListener) +.builder(); +``` +**2:通过OnDisposeOuterListener暴露接口去进行操作**
+```java +//处理activity界面中图片系统回调操作 +//注:此方法一定要放到Activity中onActivityResult(...)回调方法里面。 +OnDisposeOuterListener.onActivityResult(requestCode(请求编码), Intent); + +//打开照相机 +OnDisposeOuterListener.startCamera(); + +//打开相册 +OnDisposeOuterListener.startPhoto(); + +//清理数据 +//注:为了防止内存泄漏,请在Activity生命周期onDestroy()调用。 +OnDisposeOuterListener.clear() +``` + +6.0系统以上需要自己动态添加权限 +----- +##### 如果觉得不错,请star给我动力. + +### 如有疑问请联系我 +技术QQ群:46523908
+联系QQ:543945827 + +# License + + Copyright 2017 Liqi + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/demo/src/main/java/com/liqi/photographutils/MainActivity.java b/demo/src/main/java/com/liqi/photographutils/MainActivity.java index 8921b6f..ea95d1d 100644 --- a/demo/src/main/java/com/liqi/photographutils/MainActivity.java +++ b/demo/src/main/java/com/liqi/photographutils/MainActivity.java @@ -82,7 +82,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis break; } } else { - Toast.makeText(this, "改功能需要相机和读写文件权限", Toast.LENGTH_SHORT).show(); + Toast.makeText(this, "该功能需要相机和读写文件权限", Toast.LENGTH_SHORT).show(); } break; } @@ -159,7 +159,7 @@ protected void closeDialog() { @Override protected void onDestroy() { super.onDestroy(); - //防止内存泄漏,请求在界面kill掉调用 + //防止内存泄漏,请在界面kill掉调用 mOnDisposeOuterListener.clear(); } }