Skip to content

Commit

Permalink
refactor project
Browse files Browse the repository at this point in the history
  • Loading branch information
sucese committed Oct 22, 2017
1 parent 03057a3 commit d88f9ce
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

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

18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,21 @@ compile 'com.github.guoxiaoxing.phoenix:phoenix-compress-video:0.0.7'

```java
Phoenix.with()
.theme(PhoenixOption.THEME_DEFAULT )// 主题样式
.theme(PhoenixOption.THEME_DEFAULT )// 主题样式设置 具体参考 values/styles 用法:R.style.picture.white.style
.fileType(MimeType.ofAll())
.maxSelectNum(10)// 最大图片选择数量
.minSelectNum(0)// 最小选择数量
.maxPickNumber(10)// 最大图片选择数量
.minPickNumber(0)// 最小选择数量
.spanCount(4)// 每行显示个数
.pickMode(PhoenixConstant.MULTIPLE)// 多选 or 单选
.enablePreview(true)// 是否可预览图片
.enableCamera(true)// 是否显示拍照按钮
.zoomAnim(true)// 图片列表点击 缩放效果 默认true
.enableAnimation(true)// 图片列表点击 缩放效果 默认true
.enableCompress(true)// 是否压缩
.overrideHeight(160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.overrideWidth(160)
.enableGif(true)// 是否显示gif图片
.thumbnailHeight(160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.thumbnailWidth(160)
.enableClickSound(true)//ƒ 是否开启点击声音
.pickedMediaList(pickList)// 是否传入已选图片
.previewEggs(false)// 预览图片时 是否增强左右滑动图片体验(图片滑动一半即可看到上一张是否选中)
.compressMaxSize(10 * 1000)//压缩最大值kb compressGrade()为Luban.CUSTOM_GEAR有效
.compressMaxHeight(500)
.compressMaxWidth(300)
.videoSecond(0)//显示多少秒以内的视频or音频也可适用
.recordVideoSecond(2 * 60)//录制视频秒数 默认60s
.onPickerListener(new OnPickerListener() {
@Override
public void onPickSuccess(List<MediaEntity> pickList) {
Expand Down
16 changes: 8 additions & 8 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.2'

//图片/视频库
compile "com.github.guoxiaoxing.phoenix:phoenix-ui:$rootProject.ext.phoenixVerson"
compile "com.github.guoxiaoxing.phoenix:phoenix-compress-picture:$rootProject.ext.phoenixVerson"
compile "com.github.guoxiaoxing.phoenix:phoenix-compress-video:$rootProject.ext.phoenixVerson"

// //图片/视频库
// compile project(':phoenix-ui')
// compile project(':phoenix-compress-video')
// compile project(':phoenix-compress-picture')
// compile "com.github.guoxiaoxing.phoenix:phoenix-ui:$rootProject.ext.phoenixVerson"
// compile "com.github.guoxiaoxing.phoenix:phoenix-compress-picture:$rootProject.ext.phoenixVerson"
// compile "com.github.guoxiaoxing.phoenix:phoenix-compress-video:$rootProject.ext.phoenixVerson"

//图片/视频库
compile project(':phoenix-ui')
compile project(':phoenix-compress-video')
compile project(':phoenix-compress-picture')
}
16 changes: 5 additions & 11 deletions demo/src/main/java/com/guoxiaoxing/phoenix/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,19 @@ public void onAddPicClick() {
Phoenix.with()
.theme(PhoenixOption.THEME_DEFAULT )// 主题样式设置 具体参考 values/styles 用法:R.style.picture.white.style
.fileType(MimeType.ofAll())
.maxSelectNum(10)// 最大图片选择数量
.minSelectNum(0)// 最小选择数量
.maxPickNumber(10)// 最大图片选择数量
.minPickNumber(0)// 最小选择数量
.spanCount(4)// 每行显示个数
.pickMode(PhoenixConstant.MULTIPLE)// 多选 or 单选
.enablePreview(true)// 是否可预览图片
.enableCamera(true)// 是否显示拍照按钮
.zoomAnim(true)// 图片列表点击 缩放效果 默认true
.enableAnimation(true)// 图片列表点击 缩放效果 默认true
.enableCompress(true)// 是否压缩
.overrideHeight(160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.overrideWidth(160)
.enableGif(true)// 是否显示gif图片
.thumbnailHeight(160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.thumbnailWidth(160)
.enableClickSound(true)//ƒ 是否开启点击声音
.pickedMediaList(pickList)// 是否传入已选图片
.previewEggs(false)// 预览图片时 是否增强左右滑动图片体验(图片滑动一半即可看到上一张是否选中)
.compressMaxSize(10 * 1000)//压缩最大值kb compressGrade()为Luban.CUSTOM_GEAR有效
.compressMaxHeight(500)
.compressMaxWidth(300)
.videoSecond(0)//显示多少秒以内的视频or音频也可适用
.recordVideoSecond(2 * 60)//录制视频秒数 默认60s
.onPickerListener(new OnPickerListener() {
@Override
public void onPickSuccess(List<MediaEntity> pickList) {
Expand Down
4 changes: 2 additions & 2 deletions phoenix-compress-picture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')

compile "com.github.guoxiaoxing.phoenix:phoenix-core:$rootProject.ext.phoenixCoreVersion"
// compile project(':phoenix-core')
// compile "com.github.guoxiaoxing.phoenix:phoenix-core:$rootProject.ext.phoenixCoreVersion"
compile project(':phoenix-core')
}
4 changes: 2 additions & 2 deletions phoenix-compress-video/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.aspectj:aspectjrt:1.7.3'

compile "com.github.guoxiaoxing.phoenix:phoenix-core:$rootProject.ext.phoenixCoreVersion"
// compile project(':phoenix-core')
// compile "com.github.guoxiaoxing.phoenix:phoenix-core:$rootProject.ext.phoenixCoreVersion"
compile project(':phoenix-core')
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@ public class PhoenixOption {
//选择类型,单选、多选
private int pickMode = PhoenixConstant.MULTIPLE;
//最大选择张数,默认为0,表示不限制
private int maxSelectNum = 0;
private int maxPickNumber = 0;
//最小选择张数,默认为0,表示不限制
private int minSelectNum = 0;
private int minPickNumber = 0;
//显示多少秒以内的视频or音频也可适用
private int videoSecond;
//视频秒数录制 默认60s
private int recordVideoSecond;
//图片选择界面每行图片个数
private int spanCount = 4;
//选择列表图片宽度
private int overrideWidth = 160;
private int thumbnailWidth = 160;
//选择列表图片高度
private int overrideHeight = 160;
private int thumbnailHeight = 160;
//选择列表点击动画效果
private boolean zoomAnim = true;
private boolean enableAnimation = true;
//是否显示gif图片
private boolean enableGif;
//是否开启点击预览
private boolean enablePreview = true;
//是否开启数字显示模式
private boolean checkNumMode;
private boolean pickNumberMode;
//是否开启点击声音
private boolean enableClickSound = true;
//预览图片时,是否增强左右滑动图片体验
Expand Down Expand Up @@ -112,8 +112,8 @@ public boolean isEnablePreview() {
return enablePreview;
}

public boolean isCheckNumMode() {
return checkNumMode;
public boolean isPickNumberMode() {
return pickNumberMode;
}

public boolean isEnableClickSound() {
Expand Down Expand Up @@ -176,12 +176,12 @@ public int getPickMode() {
return pickMode;
}

public int getMaxSelectNum() {
return maxSelectNum;
public int getMaxPickNumber() {
return maxPickNumber;
}

public int getMinSelectNum() {
return minSelectNum;
public int getMinPickNumber() {
return minPickNumber;
}

public int getVideoSecond() {
Expand All @@ -196,16 +196,16 @@ public int getSpanCount() {
return spanCount;
}

public int getOverrideWidth() {
return overrideWidth;
public int getThumbnailWidth() {
return thumbnailWidth;
}

public int getOverrideHeight() {
return overrideHeight;
public int getThumbnailHeight() {
return thumbnailHeight;
}

public boolean isZoomAnim() {
return zoomAnim;
public boolean isEnableAnimation() {
return enableAnimation;
}

public PhoenixOption fileType(int val) {
Expand All @@ -228,13 +228,13 @@ public PhoenixOption pickMode(int val) {
return this;
}

public PhoenixOption maxSelectNum(int val) {
maxSelectNum = val;
public PhoenixOption maxPickNumber(int val) {
maxPickNumber = val;
return this;
}

public PhoenixOption minSelectNum(int val) {
minSelectNum = val;
public PhoenixOption minPickNumber(int val) {
minPickNumber = val;
return this;
}

Expand All @@ -253,18 +253,18 @@ public PhoenixOption spanCount(int val) {
return this;
}

public PhoenixOption overrideWidth(int val) {
overrideWidth = val;
public PhoenixOption thumbnailWidth(int val) {
thumbnailWidth = val;
return this;
}

public PhoenixOption overrideHeight(int val) {
overrideHeight = val;
public PhoenixOption thumbnailHeight(int val) {
thumbnailHeight = val;
return this;
}

public PhoenixOption zoomAnim(boolean val) {
zoomAnim = val;
public PhoenixOption enableAnimation(boolean val) {
enableAnimation = val;
return this;
}

Expand All @@ -278,8 +278,8 @@ public PhoenixOption enablePreview(boolean val) {
return this;
}

public PhoenixOption checkNumMode(boolean val) {
checkNumMode = val;
public PhoenixOption pickNumberMode(boolean val) {
pickNumberMode = val;
return this;
}

Expand Down
4 changes: 2 additions & 2 deletions phoenix-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ dependencies {
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
compile 'com.google.code.gson:gson:2.8.1'

compile "com.github.guoxiaoxing.phoenix:phoenix-core:$rootProject.ext.phoenixCoreVersion"
// compile project(':phoenix-core')
// compile "com.github.guoxiaoxing.phoenix:phoenix-core:$rootProject.ext.phoenixCoreVersion"
compile project(':phoenix-core')
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ class PickerAdapter(private val context: Context, private val config: PhoenixOpt
init {
this.selectMode = config.pickMode
this.enableCamera = config.isEnableCamera
this.maxSelectNum = config.maxSelectNum
this.maxSelectNum = config.maxPickNumber
this.enablePreview = config.isEnablePreview
this.is_checked_num = config.isCheckNumMode
this.overrideWidth = config.overrideWidth
this.overrideHeight = config.overrideHeight
this.is_checked_num = config.isPickNumberMode
this.overrideWidth = config.thumbnailWidth
this.overrideHeight = config.thumbnailHeight
this.enableVoice = config.isEnableClickSound
this.mimeType = config.fileType
this.zoomAnim = config.isZoomAnim
this.zoomAnim = config.isEnableAnimation
}

fun setAllMediaList(medias: MutableList<MediaEntity>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ open class BaseActivity : FragmentActivity() {
}
spanCount = option.spanCount
isGif = option.isEnableGif
maxSelectNum = option.maxSelectNum
minSelectNum = option.minSelectNum
maxSelectNum = option.maxPickNumber
minSelectNum = option.minPickNumber
enablePreview = option.isEnablePreview
checkNumMode = option.isCheckNumMode
checkNumMode = option.isPickNumberMode
openClickSound = option.isEnableClickSound
videoSecond = option.videoSecond
enableCompress = option.isEnableCompress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ open class BaseFragment : Fragment() {
}
spanCount = option.spanCount
isGif = option.isEnableGif
maxSelectNum = option.maxSelectNum
minSelectNum = option.minSelectNum
maxSelectNum = option.maxPickNumber
minSelectNum = option.minPickNumber
enablePreview = option.isEnablePreview
checkNumberMode = option.isCheckNumMode
checkNumberMode = option.isPickNumberMode
openClickSound = option.isEnableClickSound
videoSecond = option.videoSecond
enableCompress = option.isEnableCompress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.guoxiaoxing.phoenix.picker.ui.camera

import android.Manifest
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.guoxiaoxing.phoenix.R
import com.guoxiaoxing.phoenix.core.common.PhoenixConstant
Expand Down Expand Up @@ -32,7 +31,7 @@ class CameraActivity : BaseActivity() {

override fun onNext(aBoolean: Boolean?) {
if (aBoolean!!) {
maxCanTakePhotoNum = option.maxSelectNum
maxCanTakePhotoNum = option.maxPickNumber
//full screen
setTheme(R.style.style_full_screen)
setContentView(R.layout.activity_camera_library)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CameraFragment : BaseFragment(), SurfaceHolder.Callback, Camera.PictureCal
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
confirmDialog = ConfirmDialog(activity)
maxPictureNumber = option.maxSelectNum
maxPictureNumber = option.maxPickNumber
try {
handler = @SuppressLint("HandlerLeak")
object : Handler() {
Expand Down

0 comments on commit d88f9ce

Please sign in to comment.