Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复 not implement interface 'androidx.lifecycle.LifecycleOwner 的问题 #869

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 42 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# PictureSelector 2.0
一款针对android平台下的图片选择器,支持从相册或拍照选择图片或视频、音频,支持动态权限获取、裁剪(单图or多图裁剪)、压缩、主题自定义配置等功能、适配android 6.0+系统的开源图片选择框架。<br>

<br>项目会一直维护(有bug修复完成,一般周末会更新(不好意思,最近比较忙有时间会解决~有问题先提issue)),有bug请描述清楚,并请Issues会第一时间修复,个人QQ [email protected] 希望用得着的朋友点个star。 <br>
Android开发交流 群一 619458861 (已满) <br>
Android开发交流 群二 679824206 (已满) <br>

 [我的博客地址](http://blog.csdn.net/luck_mw)

[![](https://jitpack.io/v/LuckSiege/PictureSelector.svg)](https://jitpack.io/#LuckSiege/PictureSelector)
[![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/LuckSiege)
[![CSDN](https://img.shields.io/twitter/url/http/blog.csdn.net/luck_mw.svg?style=social)](http://blog.csdn.net/luck_mw)
[![I](https://img.shields.io/github/issues/LuckSiege/PictureSelector.svg)](https://github.com/LuckSiege/PictureSelector/issues)
[![Star](https://img.shields.io/github/stars/LuckSiege/PictureSelector.svg)](https://github.com/LuckSiege/PictureSelector)
一款针对android平台下的图片选择器,支持从相册或拍照选择图片或视频、音频,支持动态权限获取、裁剪(单图or多图裁剪)、压缩、主题自定义配置等功能的开源图片选择框架。<br>

## 目录
-[功能特点](#功能特点)<br>
Expand All @@ -24,40 +12,35 @@
-[结果回调](#结果回调)<br>
-[更新日志](#更新日志)<br>
-[混淆配置](#混淆配置)<br>
-[兼容性测试](#兼容性测试)<br>
-[演示效果](#演示效果)<br>
-[打赏](#打赏)<br>

# 功能特点

* 1.适配android6.0+系统
* 2.解决部分机型裁剪闪退问题
* 3.解决图片过大oom闪退问题
* 4.动态获取系统权限,避免闪退
* 5.支持相片or视频的单选和多选
* 6.支持裁剪比例设置,如常用的 1:1、3:4、3:2、16:9 默认为图片大小
* 7.支持视频预览
* 8.支持gif图片
* 9.支持.webp格式图片
* 10.支持一些常用场景设置:如:是否裁剪、是否预览图片、是否显示相机等
* 11.新增自定义主题设置
* 12.新增图片勾选样式设置
* 13.新增图片裁剪宽高设置
* 14.新增图片压缩处理
* 15.新增录视频最大时间设置
* 16.新增视频清晰度设置
* 17.新增QQ选择风格,带数字效果
* 18.新增自定义 文字颜色 背景色让风格和项目更搭配
* 19.新增多图裁剪功能
* 20.新增LuBan多图压缩
* 21.新增单独拍照功能
* 22.新增压缩大小设置
* 23.新增Luban压缩档次设置
* 24.新增圆形头像裁剪
* 25.新增音频功能查询


重要的事情说三遍记得添加权限
* 兼容至Android 4.4
* 支持相片or视频的单选和多选
* 支持裁剪比例设置,如常用的 1:1、3:4、3:2、16:9 默认为图片大小
* 支持视频预览
* 支持gif图片
* 支持.webp格式图片
* 支持一些常用场景设置:如:是否裁剪、是否预览图片、是否显示相机等
* 新增自定义主题设置
* 新增图片勾选样式设置
* 新增图片裁剪宽高设置
* 新增图片压缩处理
* 新增录视频最大时间设置
* 新增视频清晰度设置
* 新增QQ选择风格,带数字效果
* 新增自定义 文字颜色 背景色让风格和项目更搭配
* 新增多图裁剪功能
* 新增LuBan多图压缩
* 新增单独拍照功能
* 新增压缩大小设置
* 新增Luban压缩档次设置
* 新增圆形头像裁剪
* 新增音频功能查询


添加权限

```
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Expand All @@ -69,48 +52,26 @@

## 集成方式

方式一 compile引入

```
dependencies {
   implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.2.3'
}

```

项目根目录build.gradle加入

```
allprojects {
repositories {
jcenter()
...
maven { url 'https://jitpack.io' }
}
}
```
添加依赖项

方式二 maven引入

step 1.
```
<repositories>
      <repository>
      <id>jitpack.io</id>
<url>https://jitpack.io</url>
      </repository>
</repositories>
```
step 2.
```

<dependency>
    <groupId>com.github.LuckSiege.PictureSelector</groupId>
     <artifactId>picture_library</artifactId>
     <version>v2.2.3</version>
</dependency>
dependencies {
   implementation 'com.github.labmem005.PictureSelector:picture_library:v2.3.1'
}

```


## 常见错误
```
重要:PictureSelector.create();调用此方法时,在activity中传activity.this,在fragment中请传fragment.this,
Expand Down Expand Up @@ -185,7 +146,7 @@ Glide.with(context).load(url).apply(options).into(imageView);
.isCamera()// 是否显示拍照按钮 true or false
.imageFormat(PictureMimeType.PNG)// 拍照保存图片格式后缀,默认jpeg
.isZoomAnim(true)// 图片列表点击 缩放效果 默认true
.sizeMultiplier(0.5f)// glide 加载图片大小 0~1之间 如设置 .glideOverride()无效
.sizeMultiplierOf(0.5f)// glide 加载图片大小 0~1之间 如设置 .glideOverride()无效
.setOutputCameraPath("/CustomPath")// 自定义拍照保存路径,可不填
.enableCrop()// 是否裁剪 true or false
.compress()// 是否压缩 true or false
Expand Down Expand Up @@ -337,11 +298,13 @@ PictureSelector.create(MainActivity.this).externalPictureVideo(video_path);

## 更新日志

# 当前版本:
[Lastest release & changes](https://github.com/labmem005/PictureSelector/releases)

# 历史版本:

* v2.2.3
* 1.修复沉浸式在部分机型标题栏遮挡情况

# 历史版本:
* v2.2.2
* 1.优化外部预览界面样式不同步问题
* 2.优化沉浸式方案,适配更多机型
Expand Down Expand Up @@ -409,12 +372,12 @@ PictureSelector.create(MainActivity.this).externalPictureVideo(video_path);
* 修复录音不显示时长问题

# 项目使用第三方库:
* glide:4.5.0
* rxjava:2.0.5
* rxandroid:2.0.1
* PhotoView:2.1.3
* glide
* rxjava
* rxandroid
* PhotoView
* luban
* 裁剪使用ucrop
* ucrop

## 混淆配置
```
Expand Down Expand Up @@ -463,14 +426,6 @@ PictureSelector.create(MainActivity.this).externalPictureVideo(video_path);
-keepresourcexmlelements manifest/application/meta-data@value=GlideModule

```
## 打赏
# ~如果您觉得好,对你有帮助,可以给我一点打赏当做鼓励,蚊子再小也是肉呀(*^__^*) 嘻嘻……
![image](https://github.com/LuckSiege/PictureSelector/blob/master/image/apply.png)

## 兼容性测试
******腾讯优测-深度测试-通过率达到100%******

![image](https://github.com/LuckSiege/PictureSelector/blob/master/image/test.png)

## 演示效果

Expand Down
14 changes: 10 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ android {
}

dependencies {
compile project(':picture_library')
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.17'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.github.bumptech.glide:glide:4.9.0'
//implementation project(':picture_library')
implementation 'com.github.labmem005:PictureSelector:v2.3.1'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
}
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
android:screenOrientation="portrait" />
<activity
android:name=".PhotoFragmentActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard|"
android:screenOrientation="portrait" />
<activity
android:name=".SimpleActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.luck.pictureselector;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/**
* author:luck
* project:PictureSelector
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/com/luck/pictureselector/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.IdRes;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
Expand All @@ -17,6 +13,11 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.IdRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;
Expand Down Expand Up @@ -172,7 +173,7 @@ public void onAddPicClick() {
.compress(cb_compress.isChecked())// 是否压缩
.synOrAsy(true)//同步true或异步false 压缩 默认同步
//.compressSavePath(getPath())//压缩图片保存地址
//.sizeMultiplier(0.5f)// glide 加载图片大小 0~1之间 如设置 .glideOverride()无效
//.sizeMultiplierOf(0.5f)// glide 加载图片大小 0~1之间 如设置 .glideOverride()无效
.glideOverride(160, 160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.withAspectRatio(aspect_ratio_x, aspect_ratio_y)// 裁剪比例 如16:9 3:2 3:4 1:1 可自定义
.hideBottomControls(cb_hide.isChecked() ? false : true)// 是否显示uCrop工具栏,默认不显示
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/com/luck/pictureselector/PhotoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -17,6 +12,12 @@
import android.widget.RadioGroup;
import android.widget.TextView;

import androidx.annotation.IdRes;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import android.Manifest;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.permissions.RxPermissions;
import com.luck.picture.lib.tools.PictureFileUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.luck.pictureselector;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class SimpleActivity extends AppCompatActivity implements View.OnClickListener {
private Button btn_activity, btn_fragment;

Expand Down
Loading