Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
a34622cb
Commit
a34622cb
authored
Feb 08, 2020
by
konghaorui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pictureselector 接入
parent
cd835900
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
320 additions
and
493 deletions
+320
-493
config.gradle
config.gradle
+2
-1
BrowsePicturesActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity.java
+2
-8
BrowsePicturesActivity2.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity2.java
+2
-11
GlideImageLoader.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/tool/GlideImageLoader.java
+0
-53
PublishQuestionAndTrendFragment.java
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
+11
-29
DynamicIn.kt
m-dynamic/src/main/java/com/yidianling/dynamic/router/DynamicIn.kt
+0
-6
PickImageAction.java
m-im/src/main/java/com/yidianling/uikit/business/session/actions/PickImageAction.java
+14
-14
WatchMessagePictureActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchMessagePictureActivity.java
+1
-2
im_nim_image_layout_multi_touch.xml
m-im/src/main/res_uikit/layout/im_nim_image_layout_multi_touch.xml
+1
-1
GlideImageLoader.java
m-user/src/main/java/com/yidianling/user/GlideImageLoader.java
+0
-52
FillInfoActivity.java
m-user/src/main/java/com/yidianling/user/ui/FillInfoActivity.java
+23
-57
build.gradle
ydl-platform/build.gradle
+1
-1
GlideEngine.java
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/GlideEngine.java
+232
-0
ImagePickerActivity.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/ImagePickerActivity.kt
+0
-72
ImagePickerFragment.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/ImagePickerFragment.kt
+0
-76
PickerCallback.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/PickerCallback.kt
+0
-17
YDLImagePicker.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/YDLImagePicker.kt
+31
-0
YdlImageLoader.java
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/YdlImageLoader.java
+0
-53
YdlImagePicker.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/YdlImagePicker.kt
+0
-19
YdlRepository.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/app/YdlRepository.kt
+0
-21
No files found.
config.gradle
View file @
a34622cb
ext
{
ext
{
kotlin_version
=
"1.3.21"
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
appName
:
"心理咨询壹点灵"
,
...
@@ -260,6 +260,7 @@ ext {
...
@@ -260,6 +260,7 @@ ext {
"exoplayer"
:
"com.google.android.exoplayer:exoplayer:2.9.0"
,
"exoplayer"
:
"com.google.android.exoplayer:exoplayer:2.9.0"
,
"free_reflection"
:
"me.weishu:free_reflection:2.0.0"
,
"free_reflection"
:
"me.weishu:free_reflection:2.0.0"
,
"imagepicker"
:
"com.ydl:imagepicker:1.0.8.2"
,
"imagepicker"
:
"com.ydl:imagepicker:1.0.8.2"
,
"pictureselector"
:
"com.ydl:pictureselector:1.2.0"
,
"protector"
:
"com.ydl:protector:1.0.1-SNAPSHOT@aar"
,
"protector"
:
"com.ydl:protector:1.0.1-SNAPSHOT@aar"
,
"ydl-hnet"
:
"com.ydl:h-net:0.0.8"
,
"ydl-hnet"
:
"com.ydl:h-net:0.0.8"
,
"ydl-user-router"
:
"com.ydl:router:1.0.0-SNAPSHOT@aar"
,
"ydl-user-router"
:
"com.ydl:router:1.0.0-SNAPSHOT@aar"
,
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity.java
View file @
a34622cb
...
@@ -20,6 +20,7 @@ import android.view.WindowManager;
...
@@ -20,6 +20,7 @@ import android.view.WindowManager;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseActivity
;
...
@@ -39,8 +40,6 @@ import java.util.List;
...
@@ -39,8 +40,6 @@ import java.util.List;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
import
io.reactivex.schedulers.Schedulers
;
import
uk.co.senab.photoview.PhotoView
;
import
uk.co.senab.photoview.PhotoViewAttacher
;
/**
/**
* 预览大图
* 预览大图
...
@@ -324,12 +323,7 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
...
@@ -324,12 +323,7 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
.
load
(
uri
)
.
load
(
uri
)
.
error
(
R
.
drawable
.
dynamic_default_img
)
.
error
(
R
.
drawable
.
dynamic_default_img
)
.
into
(
mDatas
.
get
(
position
));
.
into
(
mDatas
.
get
(
position
));
mDatas
.
get
(
position
).
setOnPhotoTapListener
(
new
PhotoViewAttacher
.
OnPhotoTapListener
()
{
mDatas
.
get
(
position
).
setOnPhotoTapListener
((
imageView
,
v
,
v1
)
->
finish
());
@Override
public
void
onPhotoTap
(
View
view
,
float
x
,
float
y
)
{
finish
();
}
});
((
ViewPager
)
container
).
addView
(
mDatas
.
get
(
position
),
0
);
((
ViewPager
)
container
).
addView
(
mDatas
.
get
(
position
),
0
);
// if (lodingDialog != null) {
// if (lodingDialog != null) {
// lodingDialog.dismiss();
// lodingDialog.dismiss();
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity2.java
View file @
a34622cb
...
@@ -17,6 +17,7 @@ import android.view.WindowManager;
...
@@ -17,6 +17,7 @@ import android.view.WindowManager;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.common.tools.ToastUtil
;
...
@@ -28,11 +29,6 @@ import com.yidianling.dynamic.common.tool.ImageDownLoadCallBack;
...
@@ -28,11 +29,6 @@ import com.yidianling.dynamic.common.tool.ImageDownLoadCallBack;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
uk.co.senab.photoview.PhotoView
;
import
uk.co.senab.photoview.PhotoViewAttacher
;
/**
/**
* 预览大图 2 集合范型为String
* 预览大图 2 集合范型为String
*/
*/
...
@@ -257,12 +253,7 @@ public class BrowsePicturesActivity2 extends BaseActivity implements ViewPager.O
...
@@ -257,12 +253,7 @@ public class BrowsePicturesActivity2 extends BaseActivity implements ViewPager.O
.
load
(
mImages
.
get
(
position
))
.
load
(
mImages
.
get
(
position
))
.
error
(
R
.
drawable
.
dynamic_default_img
)
.
error
(
R
.
drawable
.
dynamic_default_img
)
.
into
(
mDatas
.
get
(
position
));
.
into
(
mDatas
.
get
(
position
));
mDatas
.
get
(
position
).
setOnPhotoTapListener
(
new
PhotoViewAttacher
.
OnPhotoTapListener
()
{
mDatas
.
get
(
position
).
setOnPhotoTapListener
((
imageView
,
v
,
v1
)
->
finish
());
@Override
public
void
onPhotoTap
(
View
view
,
float
x
,
float
y
)
{
finish
();
}
});
((
ViewPager
)
container
).
addView
(
mDatas
.
get
(
position
),
0
);
((
ViewPager
)
container
).
addView
(
mDatas
.
get
(
position
),
0
);
// if (lodingDialog != null) {
// if (lodingDialog != null) {
// lodingDialog.dismiss();
// lodingDialog.dismiss();
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/common/tool/GlideImageLoader.java
deleted
100644 → 0
View file @
cd835900
package
com
.
yidianling
.
dynamic
.
common
.
tool
;
import
android.app.Activity
;
import
android.net.Uri
;
import
android.widget.ImageView
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.lzy.imagepicker.loader.ImageLoader
;
import
com.ydl.ydl_image.config.ISimpleImageOpConfig
;
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
;
import
com.ydl.ydl_image.manager.YDLImageCacheManager
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.yidianling.dynamic.R
;
/**
* Created by xiongyu on 2017/4/7.
*/
public
class
GlideImageLoader
implements
ImageLoader
{
@Override
public
void
displayImage
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
)
{
showImage
(
activity
,
path
,
imageView
,
width
,
height
);
}
@Override
public
void
displayImagePreview
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
)
{
showImage
(
activity
,
path
,
imageView
,
width
,
height
);
}
@Override
public
void
displayImage
(
Activity
activity
,
Uri
uri
,
ImageView
imageView
,
int
width
,
int
i1
)
{
GlideApp
.
with
(
activity
)
//配置上下文
.
load
(
uri
)
//设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.
error
(
com
.
ydl
.
ydlcommon
.
R
.
drawable
.
platform_default_img
)
//设置错误图片
.
placeholder
(
com
.
ydl
.
ydlcommon
.
R
.
drawable
.
platform_default_img
)
//设置占位图片
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
//缓存全尺寸
.
into
(
imageView
);
}
private
void
showImage
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
){
SimpleImageOpConfiger
sp
=
new
SimpleImageOpConfiger
();
sp
.
loadingPic
=
R
.
drawable
.
dynamic_default_img
;
sp
.
errorPic
=
R
.
drawable
.
dynamic_default_img
;
sp
.
scaleType
=
ISimpleImageOpConfig
.
CENTER_CROP
;
sp
.
isCacheOnDisk
=
false
;
YDLImageCacheManager
.
showImage
(
activity
,
path
,
imageView
,
width
,
height
,
sp
);
}
@Override
public
void
clearMemoryCache
()
{
}
}
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
View file @
a34622cb
...
@@ -32,14 +32,13 @@ import android.widget.LinearLayout;
...
@@ -32,14 +32,13 @@ import android.widget.LinearLayout;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.lzy.imagepicker.ImagePicker
;
import
com.luck.picture.lib.entity.LocalMedia
;
import
com.lzy.imagepicker.bean.ImageItem
;
import
com.luck.picture.lib.listener.OnResultCallbackListener
;
import
com.lzy.imagepicker.view.CropImageView
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.ydl.webview.H5Params
;
import
com.ydl.webview.H5Params
;
import
com.ydl.webview.NewH5Activity
;
import
com.ydl.webview.NewH5Activity
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.actions.imagepicker.
PickerCallback
;
import
com.ydl.ydlcommon.actions.imagepicker.
YDLImagePicker
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseApp
;
import
com.ydl.ydlcommon.base.BaseApp
;
import
com.ydl.ydlcommon.base.BaseFragment
;
import
com.ydl.ydlcommon.base.BaseFragment
;
...
@@ -60,7 +59,6 @@ import com.yidianling.dynamic.common.browsePictures.BrowsePicturesActivity;
...
@@ -60,7 +59,6 @@ import com.yidianling.dynamic.common.browsePictures.BrowsePicturesActivity;
import
com.yidianling.dynamic.common.emoji.EmoticonPickerView
;
import
com.yidianling.dynamic.common.emoji.EmoticonPickerView
;
import
com.yidianling.dynamic.common.emoji.IEmoticonSelectedListener
;
import
com.yidianling.dynamic.common.emoji.IEmoticonSelectedListener
;
import
com.yidianling.dynamic.common.net.DynamicApiUtils
;
import
com.yidianling.dynamic.common.net.DynamicApiUtils
;
import
com.yidianling.dynamic.common.tool.GlideImageLoader
;
import
com.yidianling.dynamic.common.tool.ImageCompress
;
import
com.yidianling.dynamic.common.tool.ImageCompress
;
import
com.yidianling.dynamic.model.Command
;
import
com.yidianling.dynamic.model.Command
;
import
com.yidianling.dynamic.model.PublishTrendResult
;
import
com.yidianling.dynamic.model.PublishTrendResult
;
...
@@ -69,8 +67,6 @@ import com.yidianling.dynamic.publishTrend.PublishTrendActivity;
...
@@ -69,8 +67,6 @@ import com.yidianling.dynamic.publishTrend.PublishTrendActivity;
import
com.yidianling.dynamic.publishTrend.SelecTopicActivity
;
import
com.yidianling.dynamic.publishTrend.SelecTopicActivity
;
import
com.yidianling.dynamic.router.DynamicIn
;
import
com.yidianling.dynamic.router.DynamicIn
;
import
org.jetbrains.annotations.NotNull
;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -197,17 +193,6 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
...
@@ -197,17 +193,6 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
@Override
@Override
public
void
initDataAndEventLazy
()
{
public
void
initDataAndEventLazy
()
{
rxPermissions
=
new
RxPermissions
(
getActivity
());
rxPermissions
=
new
RxPermissions
(
getActivity
());
ImagePicker
imagePicker
=
ImagePicker
.
getInstance
();
imagePicker
.
setImageLoader
(
new
GlideImageLoader
());
//设置图片加载器
imagePicker
.
setShowCamera
(
true
);
//显示拍照按钮
imagePicker
.
setCrop
(
true
);
//允许裁剪(单选才有效)
imagePicker
.
setSaveRectangle
(
true
);
//是否按矩形区域保存
imagePicker
.
setSelectLimit
(
9
);
//选中数量限制
imagePicker
.
setStyle
(
CropImageView
.
Style
.
RECTANGLE
);
//裁剪框的形状
imagePicker
.
setFocusWidth
(
800
);
//裁剪框的宽度。单位像素(圆形自动取宽高最小值)
imagePicker
.
setFocusHeight
(
800
);
//裁剪框的高度。单位像素(圆形自动取宽高最小值)
imagePicker
.
setOutPutX
(
1000
);
//保存文件的宽度。单位像素
imagePicker
.
setOutPutY
(
1000
);
//保存文件的高度。单位像素
imgFiles
=
new
ArrayList
<
File
>();
imgFiles
=
new
ArrayList
<
File
>();
initView
();
initView
();
uiHandler
=
new
Handler
();
uiHandler
=
new
Handler
();
...
@@ -770,25 +755,22 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
...
@@ -770,25 +755,22 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
}
private
static
final
int
PICK_IMAGE_COUNT
=
9
;
private
static
final
int
PORTRAIT_IMAGE_WIDTH
=
720
;
private
static
final
String
JPG
=
".jpg"
;
private
void
showSelector
()
{
private
void
showSelector
()
{
ImagePicker
.
getInstance
().
setEdit
(
true
);
int
selectedSize
=
publishTrendImgs
.
size
()!=
0
?
publishTrendImgs
.
size
()-
1
:
0
;
DynamicIn
.
INSTANCE
.
startPicker
((
BaseActivity
)
activity
,
false
,
new
PickerCallback
()
{
YDLImagePicker
.
INSTANCE
.
startPicker
((
BaseActivity
)
activity
,
9
-
selectedSize
,
new
OnResultCallbackListener
()
{
@Override
@Override
public
void
on
Success
(
@NotNull
ArrayList
<
ImageItem
>
images
)
{
public
void
on
Result
(
List
<
LocalMedia
>
list
)
{
if
(
images
.
isEmpty
())
{
if
(
list
.
isEmpty
())
{
return
;
return
;
}
}
for
(
int
i
=
0
;
i
<
images
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
AddImag
(
images
.
get
(
i
).
uri
.
toString
());
AddImag
(
list
.
get
(
i
).
getPath
());
}
}
}
}
@Override
@Override
public
void
on
Fai
l
()
{
public
void
on
Cance
l
()
{
}
}
});
});
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/router/DynamicIn.kt
View file @
a34622cb
...
@@ -6,8 +6,6 @@ import android.support.v4.app.DialogFragment
...
@@ -6,8 +6,6 @@ import android.support.v4.app.DialogFragment
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
com.ydl.confide.api.IConfideService
import
com.ydl.confide.api.IConfideService
import
com.ydl.course.api.ICourseService
import
com.ydl.course.api.ICourseService
import
com.ydl.ydlcommon.actions.imagepicker.PickerCallback
import
com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.yidianling.consultant.api.IConsultantService
import
com.yidianling.consultant.api.IConsultantService
...
@@ -168,10 +166,6 @@ object DynamicIn {
...
@@ -168,10 +166,6 @@ object DynamicIn {
getImService
().
showSelector
(
activity
,
requestCode
)
getImService
().
showSelector
(
activity
,
requestCode
)
}
}
fun
startPicker
(
activity
:
AppCompatActivity
,
openCamera
:
Boolean
,
callback
:
PickerCallback
)
{
YdlImagePicker
.
startPicker
(
activity
,
openCamera
,
callback
)
}
/**
/**
* 课程播放页
* 课程播放页
*/
*/
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/actions/PickImageAction.java
View file @
a34622cb
...
@@ -4,20 +4,16 @@ import android.Manifest;
...
@@ -4,20 +4,16 @@ import android.Manifest;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.util.Log
;
import
android.util.Log
;
import
com.lzy.imagepicker.bean.ImageItem
;
import
com.luck.picture.lib.entity.LocalMedia
;
import
com.luck.picture.lib.listener.OnResultCallbackListener
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.ydl.ydlcommon.actions.imagepicker.PickerCallback
;
import
com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker
;
import
com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.business.session.actions.BaseAction
;
import
com.yidianling.nimbase.business.session.actions.BaseAction
;
import
com.yidianling.nimbase.common.ToastHelper
;
import
org.jetbrains.annotations.NotNull
;
import
java.io.File
;
import
java.io.File
;
import
java.util.
Array
List
;
import
java.util.List
;
/**
/**
* Created by zhoujianghua on 2015/7/31.
* Created by zhoujianghua on 2015/7/31.
...
@@ -58,19 +54,23 @@ public abstract class PickImageAction extends BaseAction {
...
@@ -58,19 +54,23 @@ public abstract class PickImageAction extends BaseAction {
}
}
private
void
selectImage
(){
private
void
selectImage
(){
Y
dlImagePicker
.
INSTANCE
.
startPicker
((
AppCompatActivity
)
getActivity
(),
false
,
new
PickerCallback
()
{
Y
DLImagePicker
.
INSTANCE
.
startPicker
((
AppCompatActivity
)
getActivity
(),
9
,
new
OnResultCallbackListener
()
{
@Override
@Override
public
void
onSuccess
(
@NotNull
ArrayList
<
ImageItem
>
images
)
{
public
void
onResult
(
List
<
LocalMedia
>
list
)
{
for
(
int
i
=
0
;
i
<
images
.
size
();
i
++)
{
if
(
list
.
isEmpty
())
{
onPicked
(
FileUtils
.
INSTANCE
.
getFileByUri
(
getActivity
(),
images
.
get
(
i
).
uri
.
toString
()));
return
;
}
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
onPicked
(
FileUtils
.
INSTANCE
.
getFileByUri
(
getActivity
(),
list
.
get
(
i
).
getPath
()));
}
}
}
}
@Override
@Override
public
void
on
Fai
l
()
{
public
void
on
Cance
l
()
{
ToastHelper
.
showToast
(
getActivity
(),
R
.
string
.
im_picker_image_error
);
}
}
});
});
}
}
}
}
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchMessagePictureActivity.java
View file @
a34622cb
...
@@ -18,6 +18,7 @@ import android.view.ViewGroup;
...
@@ -18,6 +18,7 @@ import android.view.ViewGroup;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.netease.nimlib.sdk.AbortableFuture
;
import
com.netease.nimlib.sdk.AbortableFuture
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.Observer
;
import
com.netease.nimlib.sdk.Observer
;
...
@@ -48,8 +49,6 @@ import java.util.ArrayList;
...
@@ -48,8 +49,6 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
uk.co.senab.photoview.PhotoView
;
/**
/**
* 查看聊天消息原图
* 查看聊天消息原图
* Created by huangjun on 2015/3/6.
* Created by huangjun on 2015/3/6.
...
...
m-im/src/main/res_uikit/layout/im_nim_image_layout_multi_touch.xml
View file @
a34622cb
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
android:gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<
uk.co.sena
b.photoview.PhotoView
<
com.luck.picture.li
b.photoview.PhotoView
android:id=
"@+id/watch_image_view"
android:id=
"@+id/watch_image_view"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
/>
...
...
m-user/src/main/java/com/yidianling/user/GlideImageLoader.java
deleted
100644 → 0
View file @
cd835900
package
com
.
yidianling
.
user
;
import
android.app.Activity
;
import
android.net.Uri
;
import
android.widget.ImageView
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.lzy.imagepicker.loader.ImageLoader
;
import
com.ydl.ydl_image.config.ISimpleImageOpConfig
;
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
;
import
com.ydl.ydl_image.manager.YDLImageCacheManager
;
import
com.ydl.ydl_image.module.GlideApp
;
/**
* Created by xiongyu on 2017/4/7.
*/
public
class
GlideImageLoader
implements
ImageLoader
{
@Override
public
void
displayImage
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
)
{
showImage
(
activity
,
path
,
imageView
,
width
,
height
);
}
@Override
public
void
displayImagePreview
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
)
{
showImage
(
activity
,
path
,
imageView
,
width
,
height
);
}
@Override
public
void
displayImage
(
Activity
activity
,
Uri
uri
,
ImageView
imageView
,
int
i
,
int
i1
)
{
GlideApp
.
with
(
activity
)
//配置上下文
.
load
(
uri
)
//设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.
error
(
com
.
ydl
.
ydlcommon
.
R
.
drawable
.
platform_default_img
)
//设置错误图片
.
placeholder
(
com
.
ydl
.
ydlcommon
.
R
.
drawable
.
platform_default_img
)
//设置占位图片
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
//缓存全尺寸
.
into
(
imageView
);
}
private
void
showImage
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
){
SimpleImageOpConfiger
sp
=
new
SimpleImageOpConfiger
();
sp
.
loadingPic
=
R
.
drawable
.
platform_default_img
;
sp
.
errorPic
=
R
.
drawable
.
platform_default_img
;
sp
.
scaleType
=
ISimpleImageOpConfig
.
CENTER_CROP
;
sp
.
isCacheOnDisk
=
false
;
YDLImageCacheManager
.
showImage
(
activity
,
path
,
imageView
,
width
,
height
,
sp
);
}
@Override
public
void
clearMemoryCache
()
{
}
}
m-user/src/main/java/com/yidianling/user/ui/FillInfoActivity.java
View file @
a34622cb
package
com
.
yidianling
.
user
.
ui
;
package
com
.
yidianling
.
user
.
ui
;
import
android.Manifest
;
import
android.app.Dialog
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
...
@@ -15,13 +14,13 @@ import android.view.View;
...
@@ -15,13 +14,13 @@ import android.view.View;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.lzy.imagepicker.ImagePicker
;
import
com.luck.picture.lib.entity.LocalMedia
;
import
com.lzy.imagepicker.bean.ImageItem
;
import
com.luck.picture.lib.listener.OnResultCallbackListener
;
import
com.lzy.imagepicker.ui.ImageGridActivity
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.lzy.imagepicker.view.CropImageView
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.ydl.webview.RefreshWebEvent
;
import
com.ydl.webview.RefreshWebEvent
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
...
@@ -34,11 +33,8 @@ import com.ydl.ydlcommon.view.ListNoCancelDialog;
...
@@ -34,11 +33,8 @@ import com.ydl.ydlcommon.view.ListNoCancelDialog;
import
com.ydl.ydlcommon.view.RoundCornerButton
;
import
com.ydl.ydlcommon.view.RoundCornerButton
;
import
com.ydl.ydlcommon.view.TitleBar
;
import
com.ydl.ydlcommon.view.TitleBar
;
import
com.ydl.ydlcommon.view.dialog.CommonDialog
;
import
com.ydl.ydlcommon.view.dialog.CommonDialog
;
import
com.ydl.ydlcommon.view.dialog.ThreeLinesDialog
;
import
com.yidianling.common.tools.RxFileTool
;
import
com.yidianling.common.tools.RxFileTool
;
import
com.yidianling.common.tools.RxImageTool
;
import
com.yidianling.common.tools.RxImageTool
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.user.GlideImageLoader
;
import
com.yidianling.user.LoginHelper
;
import
com.yidianling.user.LoginHelper
;
import
com.yidianling.user.R
;
import
com.yidianling.user.R
;
import
com.yidianling.user.UserConstants
;
import
com.yidianling.user.UserConstants
;
...
@@ -133,18 +129,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
...
@@ -133,18 +129,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
void
init
()
{
void
init
()
{
rxPermissions
=
new
RxPermissions
(
this
);
rxPermissions
=
new
RxPermissions
(
this
);
head_dir
=
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
()
+
"/yidianling/img/head_img/"
;
head_dir
=
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
()
+
"/yidianling/img/head_img/"
;
ImagePicker
imagePicker
=
ImagePicker
.
getInstance
();
imagePicker
.
setImageLoader
(
new
GlideImageLoader
());
//设置图片加载器
imagePicker
.
setShowCamera
(
true
);
//显示拍照按钮
imagePicker
.
setCrop
(
true
);
//允许裁剪(单选才有效)
imagePicker
.
setMultiMode
(
false
);
imagePicker
.
setSaveRectangle
(
true
);
//是否按矩形区域保存
imagePicker
.
setSelectLimit
(
1
);
//选中数量限制
imagePicker
.
setStyle
(
CropImageView
.
Style
.
RECTANGLE
);
//裁剪框的形状
imagePicker
.
setFocusWidth
(
800
);
//裁剪框的宽度。单位像素(圆形自动取宽高最小值)
imagePicker
.
setFocusHeight
(
800
);
//裁剪框的高度。单位像素(圆形自动取宽高最小值)
imagePicker
.
setOutPutX
(
300
);
//保存文件的宽度。单位像素
imagePicker
.
setOutPutY
(
300
);
//保存文件的高度。单位像素
if
(!
TextUtils
.
isEmpty
(
icon
))
{
if
(!
TextUtils
.
isEmpty
(
icon
))
{
GlideApp
.
with
(
FillInfoActivity
.
this
)
GlideApp
.
with
(
FillInfoActivity
.
this
)
.
load
(
icon
)
.
load
(
icon
)
...
@@ -214,29 +198,23 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
...
@@ -214,29 +198,23 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
int
id
=
v
.
getId
();
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
sdv_head
)
{
if
(
id
==
R
.
id
.
sdv_head
)
{
rxPermissions
.
request
(
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
YDLImagePicker
.
INSTANCE
.
startPicker
(
FillInfoActivity
.
this
,
new
OnResultCallbackListener
()
{
.
subscribe
(
granted
->
{
@Override
if
(
granted
)
{
public
void
onResult
(
List
<
LocalMedia
>
list
)
{
ThreeLinesDialog
.
Builder
builder1
=
new
ThreeLinesDialog
.
Builder
(
FillInfoActivity
.
this
);
if
(
list
.
isEmpty
())
{
builder1
.
setTitle
(
"相机"
);
return
;
builder1
.
setMessage
(
"相册中选择"
);
}
builder1
.
setbottom
(
"取消"
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
builder1
.
setFirstButton
(
"相机"
,
(
dialog
,
which
)
->
{
uploadImage
(
list
.
get
(
0
).
getPath
(),
1002
);
head_path
=
head_dir
+
System
.
currentTimeMillis
()
+
"hand_carmer.jpg"
;
}
showCameraAction
(
REQUEST_CODE_FILL_CAMER_HEAD
,
head_path
);
dialog
.
dismiss
();
}
});
builder1
.
setSecondButton
(
"相册中选择"
,
(
dialog
,
which
)
->
{
@Override
Intent
intent
=
new
Intent
(
FillInfoActivity
.
this
,
ImageGridActivity
.
class
);
public
void
onCancel
()
{
startActivityForResult
(
intent
,
IMAGE_PICKER
);
dialog
.
dismiss
();
}
});
});
builder1
.
setThridButton
(
"取消"
,
(
dialog
,
which
)
->
dialog
.
dismiss
());
builder1
.
create
().
show
();
}
else
{
ToastHelper
.
Companion
.
show
(
"缺少使用相机和读取存储权限,无法获取图片"
);
}
});
}
else
if
(
id
==
R
.
id
.
tv_sex
)
{
}
else
if
(
id
==
R
.
id
.
tv_sex
)
{
List
<
String
>
name
=
new
ArrayList
<
String
>();
List
<
String
>
name
=
new
ArrayList
<
String
>();
name
.
add
(
"男"
);
name
.
add
(
"男"
);
...
@@ -436,19 +414,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
...
@@ -436,19 +414,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
}
}
break
;
break
;
}
}
}
else
if
(
resultCode
==
ImagePicker
.
RESULT_CODE_ITEMS
)
{
switch
(
requestCode
)
{
case
IMAGE_PICKER:
if
(
data
!=
null
)
{
ArrayList
<
ImageItem
>
images
=
(
ArrayList
<
ImageItem
>)
data
.
getSerializableExtra
(
ImagePicker
.
EXTRA_RESULT_ITEMS
);
uploadImage
(
images
.
get
(
0
).
path
,
1002
);
}
else
{
ToastUtil
.
toastShort
(
this
,
"没有数据"
);
}
break
;
}
}
}
}
}
...
@@ -498,7 +463,8 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
...
@@ -498,7 +463,8 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
*/
*/
void
uploadImage
(
final
String
path
,
final
int
requestCode
)
{
void
uploadImage
(
final
String
path
,
final
int
requestCode
)
{
UserHttp
userHttp
=
UserHttpImpl
.
Companion
.
getInstance
();
UserHttp
userHttp
=
UserHttpImpl
.
Companion
.
getInstance
();
userHttp
.
uploadHead
(
new
HeadParam
(
new
File
(
path
)))
File
outputFile
=
FileUtils
.
INSTANCE
.
getFileByUri
(
FillInfoActivity
.
this
,
path
);
userHttp
.
uploadHead
(
new
HeadParam
(
outputFile
))
.
compose
(
RxUtils
.
resultData
())
.
compose
(
RxUtils
.
resultData
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doOnSubscribe
(
disposable
->
{
.
doOnSubscribe
(
disposable
->
{
...
...
ydl-platform/build.gradle
View file @
a34622cb
...
@@ -81,7 +81,7 @@ dependencies {
...
@@ -81,7 +81,7 @@ dependencies {
exclude
group:
'com.squareup.okhttp3'
,
module:
'logging-interceptor'
exclude
group:
'com.squareup.okhttp3'
,
module:
'logging-interceptor'
}
}
api
(
rootProject
.
ext
.
dependencies
[
"
imagepicke
r"
])
{
api
(
rootProject
.
ext
.
dependencies
[
"
pictureselecto
r"
])
{
exclude
group:
'com.android.support'
,
module:
'recyclerview-v7'
exclude
group:
'com.android.support'
,
module:
'recyclerview-v7'
exclude
group:
'com.android.support'
,
module:
'appcompat-v7'
exclude
group:
'com.android.support'
,
module:
'appcompat-v7'
exclude
group:
'org.jetbrains.kotlin'
,
module:
'kotlin-stdlib'
exclude
group:
'org.jetbrains.kotlin'
,
module:
'kotlin-stdlib'
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/GlideEngine.java
0 → 100644
View file @
a34622cb
package
com
.
ydl
.
ydlcommon
.
actions
.
imagepicker
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.PointF
;
import
android.graphics.drawable.Drawable
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.support.v4.graphics.drawable.RoundedBitmapDrawable
;
import
android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory
;
import
android.view.View
;
import
android.widget.ImageView
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.bumptech.glide.request.target.BitmapImageViewTarget
;
import
com.bumptech.glide.request.target.ImageViewTarget
;
import
com.luck.picture.lib.engine.ImageEngine
;
import
com.luck.picture.lib.listener.ImageCompleteCallback
;
import
com.luck.picture.lib.tools.MediaUtils
;
import
com.luck.picture.lib.widget.longimage.ImageSource
;
import
com.luck.picture.lib.widget.longimage.ImageViewState
;
import
com.luck.picture.lib.widget.longimage.SubsamplingScaleImageView
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.R
;
/**
* @author:luck
* @date:2019-11-13 17:02
* @describe:Glide加载引擎
*/
public
class
GlideEngine
implements
ImageEngine
{
/**
* 加载图片
*
* @param context
* @param url
* @param imageView
*/
@Override
public
void
loadImage
(
@NonNull
Context
context
,
@NonNull
String
url
,
@NonNull
ImageView
imageView
)
{
GlideApp
.
with
(
context
)
.
load
(
url
)
.
into
(
imageView
);
}
/**
* 加载网络图片适配长图方案
* # 注意:此方法只有加载网络图片才会回调
*
* @param context
* @param url
* @param imageView
* @param longImageView
* @param callback 网络图片加载回调监听
*/
@Override
public
void
loadImage
(
@NonNull
Context
context
,
@NonNull
String
url
,
@NonNull
ImageView
imageView
,
SubsamplingScaleImageView
longImageView
,
ImageCompleteCallback
callback
)
{
GlideApp
.
with
(
context
)
.
asBitmap
()
.
load
(
url
)
.
into
(
new
ImageViewTarget
<
Bitmap
>(
imageView
)
{
@Override
public
void
onLoadStarted
(
@Nullable
Drawable
placeholder
)
{
super
.
onLoadStarted
(
placeholder
);
if
(
callback
!=
null
)
{
callback
.
onShowLoading
();
}
}
@Override
public
void
onLoadFailed
(
@Nullable
Drawable
errorDrawable
)
{
super
.
onLoadFailed
(
errorDrawable
);
if
(
callback
!=
null
)
{
callback
.
onHideLoading
();
}
}
@Override
protected
void
setResource
(
@Nullable
Bitmap
resource
)
{
if
(
callback
!=
null
)
{
callback
.
onHideLoading
();
}
if
(
resource
!=
null
)
{
boolean
eqLongImage
=
MediaUtils
.
isLongImg
(
resource
.
getWidth
(),
resource
.
getHeight
());
longImageView
.
setVisibility
(
eqLongImage
?
View
.
VISIBLE
:
View
.
GONE
);
imageView
.
setVisibility
(
eqLongImage
?
View
.
GONE
:
View
.
VISIBLE
);
if
(
eqLongImage
)
{
// 加载长图
longImageView
.
setQuickScaleEnabled
(
true
);
longImageView
.
setZoomEnabled
(
true
);
longImageView
.
setPanEnabled
(
true
);
longImageView
.
setDoubleTapZoomDuration
(
100
);
longImageView
.
setMinimumScaleType
(
SubsamplingScaleImageView
.
SCALE_TYPE_CENTER_CROP
);
longImageView
.
setDoubleTapZoomDpi
(
SubsamplingScaleImageView
.
ZOOM_FOCUS_CENTER
);
longImageView
.
setImage
(
ImageSource
.
bitmap
(
resource
),
new
ImageViewState
(
0
,
new
PointF
(
0
,
0
),
0
));
}
else
{
// 普通图片
imageView
.
setImageBitmap
(
resource
);
}
}
}
});
}
/**
* 加载网络图片适配长图方案
* # 注意:此方法只有加载网络图片才会回调
*
* @param context
* @param url
* @param imageView
* @param longImageView
* @ 已废弃
*/
@Override
public
void
loadImage
(
@NonNull
Context
context
,
@NonNull
String
url
,
@NonNull
ImageView
imageView
,
SubsamplingScaleImageView
longImageView
)
{
GlideApp
.
with
(
context
)
.
asBitmap
()
.
load
(
url
)
.
into
(
new
ImageViewTarget
<
Bitmap
>(
imageView
)
{
@Override
protected
void
setResource
(
@Nullable
Bitmap
resource
)
{
if
(
resource
!=
null
)
{
boolean
eqLongImage
=
MediaUtils
.
isLongImg
(
resource
.
getWidth
(),
resource
.
getHeight
());
longImageView
.
setVisibility
(
eqLongImage
?
View
.
VISIBLE
:
View
.
GONE
);
imageView
.
setVisibility
(
eqLongImage
?
View
.
GONE
:
View
.
VISIBLE
);
if
(
eqLongImage
)
{
// 加载长图
longImageView
.
setQuickScaleEnabled
(
true
);
longImageView
.
setZoomEnabled
(
true
);
longImageView
.
setPanEnabled
(
true
);
longImageView
.
setDoubleTapZoomDuration
(
100
);
longImageView
.
setMinimumScaleType
(
SubsamplingScaleImageView
.
SCALE_TYPE_CENTER_CROP
);
longImageView
.
setDoubleTapZoomDpi
(
SubsamplingScaleImageView
.
ZOOM_FOCUS_CENTER
);
longImageView
.
setImage
(
ImageSource
.
bitmap
(
resource
),
new
ImageViewState
(
0
,
new
PointF
(
0
,
0
),
0
));
}
else
{
// 普通图片
imageView
.
setImageBitmap
(
resource
);
}
}
}
});
}
/**
* 加载相册目录
*
* @param context 上下文
* @param url 图片路径
* @param imageView 承载图片ImageView
*/
@Override
public
void
loadFolderImage
(
@NonNull
Context
context
,
@NonNull
String
url
,
@NonNull
ImageView
imageView
)
{
GlideApp
.
with
(
context
)
.
asBitmap
()
.
load
(
url
)
.
override
(
180
,
180
)
.
centerCrop
()
.
sizeMultiplier
(
0.5f
)
.
apply
(
new
RequestOptions
().
placeholder
(
R
.
drawable
.
picture_image_placeholder
))
.
into
(
new
BitmapImageViewTarget
(
imageView
)
{
@Override
protected
void
setResource
(
Bitmap
resource
)
{
RoundedBitmapDrawable
circularBitmapDrawable
=
RoundedBitmapDrawableFactory
.
create
(
context
.
getResources
(),
resource
);
circularBitmapDrawable
.
setCornerRadius
(
8
);
imageView
.
setImageDrawable
(
circularBitmapDrawable
);
}
});
}
/**
* 加载gif
*
* @param context 上下文
* @param url 图片路径
* @param imageView 承载图片ImageView
*/
@Override
public
void
loadAsGifImage
(
@NonNull
Context
context
,
@NonNull
String
url
,
@NonNull
ImageView
imageView
)
{
GlideApp
.
with
(
context
)
.
asGif
()
.
load
(
url
)
.
into
(
imageView
);
}
/**
* 加载图片列表图片
*
* @param context 上下文
* @param url 图片路径
* @param imageView 承载图片ImageView
*/
@Override
public
void
loadGridImage
(
@NonNull
Context
context
,
@NonNull
String
url
,
@NonNull
ImageView
imageView
)
{
GlideApp
.
with
(
context
)
.
load
(
url
)
.
override
(
200
,
200
)
.
centerCrop
()
.
apply
(
new
RequestOptions
().
placeholder
(
R
.
drawable
.
picture_image_placeholder
))
.
into
(
imageView
);
}
private
GlideEngine
()
{
}
private
static
GlideEngine
instance
;
public
static
GlideEngine
createGlideEngine
()
{
if
(
null
==
instance
)
{
synchronized
(
GlideEngine
.
class
)
{
if
(
null
==
instance
)
{
instance
=
new
GlideEngine
();
}
}
}
return
instance
;
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/ImagePickerActivity.kt
deleted
100644 → 0
View file @
cd835900
package
com.ydl.ydlcommon.actions.imagepicker
import
android.app.Activity
import
android.content.Intent
import
com.lzy.imagepicker.ImagePicker
import
com.lzy.imagepicker.bean.ImageItem
import
com.lzy.imagepicker.ui.ImageGridActivity
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.utils.remind.ToastHelper
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
internal
class
ImagePickerActivity
:
BaseActivity
()
{
companion
object
{
private
const
val
REQUEST_CODE
=
0
X00
private
var
callback
:
PickerCallback
?
=
null
private
const
val
OPEN_CAMERA
=
"open_camera"
fun
start
(
activity
:
Activity
,
openCamera
:
Boolean
,
callback
:
PickerCallback
)
{
val
intent
=
Intent
(
activity
,
ImagePickerActivity
::
class
.
java
)
intent
.
putExtra
(
OPEN_CAMERA
,
openCamera
)
activity
.
startActivityForResult
(
intent
,
REQUEST_CODE
)
Companion
.
callback
=
callback
}
}
private
var
openCamera
=
false
// 是否是直接打开相机
override
fun
layoutResId
():
Int
{
return
0
}
override
fun
initDataAndEvent
()
{
openCamera
=
intent
.
getBooleanExtra
(
OPEN_CAMERA
,
false
)
val
intent
=
Intent
(
this
,
ImageGridActivity
::
class
.
java
)
intent
.
putExtra
(
ImageGridActivity
.
EXTRAS_TAKE_PICKERS
,
openCamera
)
startActivityForResult
(
intent
,
REQUEST_CODE
)
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
resultCode
==
ImagePicker
.
RESULT_CODE_ITEMS
)
{
if
(
data
!=
null
&&
requestCode
==
REQUEST_CODE
)
{
val
images
=
data
.
getSerializableExtra
(
ImagePicker
.
EXTRA_RESULT_ITEMS
)
as
ArrayList
<
ImageItem
>
callback
?.
onSuccess
(
images
)
}
else
{
callback
?.
onFail
()
ToastHelper
.
show
(
"没有数据"
)
}
finish
()
}
}
override
fun
onRestart
()
{
super
.
onRestart
()
finish
()
}
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/ImagePickerFragment.kt
deleted
100644 → 0
View file @
cd835900
package
com.ydl.ydlcommon.actions.imagepicker
import
android.content.Intent
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
com.lzy.imagepicker.ImagePicker
import
com.lzy.imagepicker.bean.ImageItem
import
com.lzy.imagepicker.ui.ImageGridActivity
import
com.ydl.ydlcommon.base.BaseFragment
import
com.ydl.ydlcommon.utils.remind.ToastHelper
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
internal
class
ImagePickerFragment
:
BaseFragment
()
{
companion
object
{
private
const
val
REQUEST_CODE
=
0
X00
private
const
val
OPEN_CAMERA
=
"open_camera"
private
const
val
PICKER
:
String
=
"picker"
fun
start
(
activity
:
AppCompatActivity
,
openCamera
:
Boolean
,
callback
:
PickerCallback
)
{
val
fragment
=
ImagePickerFragment
()
fragment
.
pickerCallback
=
callback
val
args
=
Bundle
()
args
.
putBoolean
(
OPEN_CAMERA
,
openCamera
)
fragment
.
arguments
=
args
activity
.
supportFragmentManager
.
beginTransaction
()
.
add
(
fragment
,
PICKER
)
.
commitAllowingStateLoss
()
}
}
private
var
pickerCallback
:
PickerCallback
?
=
null
private
var
openCamera
=
false
// 是否是直接打开相机
override
fun
layoutResId
():
Int
{
return
0
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
openCamera
=
arguments
.
getBoolean
(
OPEN_CAMERA
,
false
)
val
intent
=
Intent
(
activity
,
ImageGridActivity
::
class
.
java
)
startActivityForResult
(
intent
,
REQUEST_CODE
)
}
override
fun
initDataAndEvent
()
{
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
resultCode
==
ImagePicker
.
RESULT_CODE_ITEMS
)
{
if
(
data
!=
null
&&
requestCode
==
REQUEST_CODE
)
{
val
images
=
data
.
getSerializableExtra
(
ImagePicker
.
EXTRA_RESULT_ITEMS
)
as
ArrayList
<
ImageItem
>
pickerCallback
?.
onSuccess
(
images
)
}
else
{
pickerCallback
?.
onFail
()
ToastHelper
.
show
(
"没有数据"
)
}
}
}
override
fun
initDataAndEventLazy
()
{
}
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/PickerCallback.kt
deleted
100644 → 0
View file @
cd835900
package
com.ydl.ydlcommon.actions.imagepicker
import
com.lzy.imagepicker.bean.ImageItem
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
interface
PickerCallback
{
fun
onSuccess
(
images
:
ArrayList
<
ImageItem
>)
fun
onFail
()
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/YDLImagePicker.kt
0 → 100644
View file @
a34622cb
package
com.ydl.ydlcommon.actions.imagepicker
import
android.support.v7.app.AppCompatActivity
import
com.luck.picture.lib.PictureSelector
import
com.luck.picture.lib.config.PictureMimeType
import
com.luck.picture.lib.listener.OnResultCallbackListener
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
object
YDLImagePicker
{
fun
startPicker
(
activity
:
AppCompatActivity
,
callback
:
OnResultCallbackListener
)
{
startPicker
(
activity
,
1
,
callback
)
}
fun
startPicker
(
activity
:
AppCompatActivity
,
maxSelectNum
:
Int
,
callback
:
OnResultCallbackListener
)
{
PictureSelector
.
create
(
activity
)
.
openGallery
(
PictureMimeType
.
ofImage
())
.
maxSelectNum
(
maxSelectNum
)
.
isWeChatStyle
(
true
)
.
loadImageEngine
(
GlideEngine
.
createGlideEngine
())
.
forResult
(
callback
)
}
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/YdlImageLoader.java
deleted
100644 → 0
View file @
cd835900
package
com
.
ydl
.
ydlcommon
.
actions
.
imagepicker
;
import
android.app.Activity
;
import
android.net.Uri
;
import
android.widget.ImageView
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.lzy.imagepicker.loader.ImageLoader
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.R
;
import
java.io.File
;
/**
* Created by haorui on 2019/6/28.
* Des:
*/
public
class
YdlImageLoader
implements
ImageLoader
{
@Override
public
void
displayImage
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
)
{
showImage
(
activity
,
path
,
imageView
,
width
,
height
);
}
@Override
public
void
displayImagePreview
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
)
{
showImage
(
activity
,
path
,
imageView
,
width
,
height
);
}
@Override
public
void
displayImage
(
Activity
activity
,
Uri
uri
,
ImageView
imageView
,
int
i
,
int
i1
)
{
GlideApp
.
with
(
activity
)
//配置上下文
.
load
(
uri
)
//设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.
error
(
R
.
drawable
.
platform_default_img
)
//设置错误图片
.
placeholder
(
R
.
drawable
.
platform_default_img
)
//设置占位图片
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
//缓存全尺寸
.
into
(
imageView
);
}
private
void
showImage
(
Activity
activity
,
String
path
,
ImageView
imageView
,
int
width
,
int
height
){
GlideApp
.
with
(
activity
)
//配置上下文
.
load
(
Uri
.
fromFile
(
new
File
(
path
)))
//设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.
error
(
R
.
drawable
.
platform_default_img
)
//设置错误图片
.
placeholder
(
R
.
drawable
.
platform_default_img
)
//设置占位图片
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
//缓存全尺寸
.
into
(
imageView
);
}
@Override
public
void
clearMemoryCache
()
{
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/YdlImagePicker.kt
deleted
100644 → 0
View file @
cd835900
package
com.ydl.ydlcommon.actions.imagepicker
import
android.support.v7.app.AppCompatActivity
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
object
YdlImagePicker
{
fun
startPicker
(
activity
:
AppCompatActivity
,
openCamera
:
Boolean
,
callback
:
PickerCallback
)
{
ImagePickerFragment
.
start
(
activity
,
openCamera
,
callback
)
}
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/app/YdlRepository.kt
View file @
a34622cb
...
@@ -3,10 +3,7 @@ package com.ydl.ydlcommon.app
...
@@ -3,10 +3,7 @@ package com.ydl.ydlcommon.app
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.Application
import
android.app.Application
import
com.alibaba.android.arouter.launcher.ARouter
import
com.alibaba.android.arouter.launcher.ARouter
import
com.lzy.imagepicker.ImagePicker
import
com.lzy.imagepicker.view.CropImageView
import
com.ydl.devicesidlib.DeviceIDHelper
import
com.ydl.devicesidlib.DeviceIDHelper
import
com.ydl.ydlcommon.actions.imagepicker.YdlImageLoader
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.data.http.UpLoadLogUtils
import
com.ydl.ydlcommon.data.http.UpLoadLogUtils
import
com.ydl.ydlcommon.utils.AppProgressUtils
import
com.ydl.ydlcommon.utils.AppProgressUtils
...
@@ -38,7 +35,6 @@ object YdlRepository {
...
@@ -38,7 +35,6 @@ object YdlRepository {
//初始化工具类
//初始化工具类
RxTool
.
init
(
app
)
RxTool
.
init
(
app
)
BuryPointUtils
.
init
()
BuryPointUtils
.
init
()
initImagePicker
()
// if (LeakCanary.isInAnalyzerProcess(app)) {
// if (LeakCanary.isInAnalyzerProcess(app)) {
// // This process is dedicated to LeakCanary for heap analysis.
// // This process is dedicated to LeakCanary for heap analysis.
...
@@ -75,20 +71,4 @@ object YdlRepository {
...
@@ -75,20 +71,4 @@ object YdlRepository {
}
}
ARouter
.
init
(
app
)
ARouter
.
init
(
app
)
}
}
private
fun
initImagePicker
()
{
val
imagePicker
=
ImagePicker
.
getInstance
()
imagePicker
.
imageLoader
=
YdlImageLoader
()
//设置图片加载器
imagePicker
.
isEdit
=
true
//设置图片是否可编辑
imagePicker
.
isShowCamera
=
true
//显示拍照按钮
imagePicker
.
isCrop
=
true
//允许裁剪(单选才有效)
imagePicker
.
isSaveRectangle
=
true
//是否按矩形区域保存
imagePicker
.
selectLimit
=
9
//选中数量限制
imagePicker
.
style
=
CropImageView
.
Style
.
RECTANGLE
//裁剪框的形状
imagePicker
.
focusWidth
=
800
//裁剪框的宽度。单位像素(圆形自动取宽高最小值)
imagePicker
.
focusHeight
=
800
//裁剪框的高度。单位像素(圆形自动取宽高最小值)
imagePicker
.
outPutX
=
1000
//保存文件的宽度。单位像素
imagePicker
.
outPutY
=
1000
//保存文件的高度。单位像素
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment