Skip to content

Commit

Permalink
Support Chinese and English documents
Browse files Browse the repository at this point in the history
Support Chinese and English documents
  • Loading branch information
liqi committed Oct 13, 2017
1 parent dc2cc00 commit 5212c14
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 49 deletions.
132 changes: 85 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,91 @@
# PhotoFrame是什么?
PhotoFrame是对图库调用和相机调用进行封装的框架,<br>并对用户操作的图片进行指定质量压缩。<br>兼容到android7.0系统
#### PhotographUtils图片压缩机制
当图片第一次被选择时,将进行质量压缩并存进压缩文件夹中.<br>
如果此图片存在压缩文件夹中,那么不进行压缩,将直接从压缩文件中取出
[中文版文档](https://github.com/LiqiNew/PhotoFrame/blob/master/README_CHINESE.md) <br><br>
[![](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,<br>
And the user to operate the image specified quality compression.<br>
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. <br>
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** <br>
allprojects {<br>
  repositories { <br>
  //依赖仓库 <br>
   maven { url 'https://jitpack.io' }<br>
  }<br>
}<br>
**2:依赖PhotoFrame框架**<br>
**1:In the project root directory build.gradle** <br>

```gradle
allprojects {
  repositories {
  //Rely on the warehouse
   maven { url 'https://jitpack.io' }
  }
}
```

**2:Depends on the PhotoFrame framework**<br>

```gradle
compile 'com.github.liqinew:photoframe:v.1.0.0'
## 如何通过PhotoFrame去使用?
**1:通过链式配置对象构建图库和照相机操作对象暴露接口(OnDisposeOuterListener)**<br>
//获取配置对象<br>
PhotographStaticUtils.getPhotographBuilder(this)<br><br>
//设置图片压缩路径<br>
.setCompressPath(COMPRESSPATH)<br><br>
//设置照片暂时存路径<br>
.setImagePath(IMAGEPATH)<br><br>
//设置是否删除没有压缩的拍照照片(默认是拍一张删一张)<br>
.setDelePGImage(false)<br><br>
//设置处理好的图片路径接口<br>
.setOnPhotographGetDataListener(new OnPhotographGetDataListener\<File>())<br><br>
//设置图片压缩大小(默认是1M)<br>
.setImageSize(IMAGESIZE)<br><br>
//构建图库和照相机处理操作对象暴露接口(OnDisposeOuterListener)<br>
.builder();<br><br>
**2:通过OnDisposeOuterListener暴露接口去进行操作**<br>
(!注:此方法一定要放到Activity中onActivityResult(int requestCode, int resultCode, Intent data)回调方法里面)<br>
//处理activity界面中图片系统回调操作<br>
OnDisposeOuterListener.onActivityResult(requestCode(请求编码), Intent);<br><br>
//打开照相机<br>
OnDisposeOuterListener.startCamera();<br><br>
//打开相册<br>
OnDisposeOuterListener.startPhoto();<br><br>
(!注:为了防止内存泄漏,请在Activity生命周期onDestroy()调用)<br>
//清理数据<br>
OnDisposeOuterListener.clear()<br><br>

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)**<br>
```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<File>())

//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**<br>
```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.<br><br>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<br>
联系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.
92 changes: 92 additions & 0 deletions README_CHINESE.md
Original file line number Diff line number Diff line change
@@ -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是对图库调用和相机调用进行封装的框架,<br>并对用户操作的图片进行指定质量压缩。<br>兼容到android7.0系统
#### PhotographUtils图片压缩机制
当图片第一次被选择时,将进行质量压缩并存进压缩文件夹中.<br>
如果此图片存在压缩文件夹中,那么不进行压缩,将直接从压缩文件中取出

使用方法
-----
#### Gradle
**1:在项目根目录build.gradley** <br>

```gradle
allprojects {
  repositories {
  //依赖仓库
   maven { url 'https://jitpack.io' }
  }
}
```

**2:依赖PhotoFrame框架**<br>

```gradle
compile 'com.github.liqinew:photoframe:v.1.0.0'
```

## 如何通过PhotoFrame去使用?
**1:通过链式配置对象构建图库和照相机操作对象暴露接口(OnDisposeOuterListener)**<br>
```java
//获取配置对象
PhotographStaticUtils.getPhotographBuilder(this)

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

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

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

//设置处理好的图片路径接口
.setOnPhotographGetDataListener(new OnPhotographGetDataListener<File>())

//设置图片压缩大小,默认是1M。
.setImageSize(IMAGE_SIZE)

//构建图库和照相机处理操作对象暴露接口(OnDisposeOuterListener)
.builder();
```
**2:通过OnDisposeOuterListener暴露接口去进行操作**<br>
```java
//处理activity界面中图片系统回调操作
//注:此方法一定要放到Activity中onActivityResult(...)回调方法里面。
OnDisposeOuterListener.onActivityResult(requestCode(请求编码), Intent);

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

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

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

6.0系统以上需要自己动态添加权限
-----
##### 如果觉得不错,请star给我动力.

### 如有疑问请联系我
技术QQ群:46523908<br>
联系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.
4 changes: 2 additions & 2 deletions demo/src/main/java/com/liqi/photographutils/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ protected void closeDialog() {
@Override
protected void onDestroy() {
super.onDestroy();
//防止内存泄漏,请求在界面kill掉调用
//防止内存泄漏,请在界面kill掉调用
mOnDisposeOuterListener.clear();
}
}

0 comments on commit 5212c14

Please sign in to comment.