Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
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
bp
ShenghuoquanBusiness
Commits
8ebb2ab9
Commit
8ebb2ab9
authored
Jul 12, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 图片服务-选择图片最大数量逻辑
parent
939f43ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
ImageService.kt
.../src/main/java/com/yidian/common/services/ImageService.kt
+17
-5
No files found.
CommonLib/Common/src/main/java/com/yidian/common/services/ImageService.kt
View file @
8ebb2ab9
...
...
@@ -94,7 +94,7 @@ class ImageService : ZapService() {
val
resolveParams
=
params
as
JSONObject
when
(
action
)
{
ACTION_SELECT_PIC
->
{
selectPic
(
resolveParams
.
optInt
(
"maxCount"
))
selectPic
(
gson
.
fromJson
(
resolveParams
.
toString
(),
ActionSelectImageParamsBean
::
class
.
java
))
}
ACTION_TAKE_PIC
->
{
takePic
()
...
...
@@ -127,13 +127,13 @@ class ImageService : ZapService() {
/**
* 选择图片
* @param
maxCount 最多可选择的数量
* @param
params selectImage操作业务参数
*/
private
fun
selectPic
(
maxCount
:
Int
)
{
private
fun
selectPic
(
params
:
ActionSelectImageParamsBean
)
{
PictureSelector
.
create
(
curTopActivity
)
.
openGallery
(
PictureMimeType
.
ofImage
())
.
imageEngine
(
GlideEngine
.
createGlideEngine
())
.
maxSelectNum
(
maxCount
)
.
maxSelectNum
(
params
.
maxCount
-
params
.
selectedImages
.
size
)
.
isWeChatStyle
(
true
)
.
isCompress
(
true
)
.
compressQuality
(
10
)
...
...
@@ -145,7 +145,7 @@ class ImageService : ZapService() {
return
}
// 回传h5选择的图片的数据
val
selectedList
=
ArrayList
<
SelectedImageBean
>(
maxCount
)
val
selectedList
=
ArrayList
<
SelectedImageBean
>(
params
.
maxCount
-
params
.
selectedImages
.
size
)
result
.
forEach
{
val
uuid
=
UUID
.
randomUUID
().
toString
()
val
inputStream
=
FileInputStream
(
it
.
compressPath
)
...
...
@@ -298,4 +298,16 @@ class ImageService : ZapService() {
* 已上传的图片数据结构 回传H5结果使用
*/
data class
UploadImageBean
(
val
id
:
String
,
val
image_uploaded_key
:
String
)
/**
* selectImage操作传递的业务参数
*/
data class
ActionSelectImageParamsBean
(
val
maxCount
:
Int
,
val
selectedImages
:
List
<
SelectedImage
>
)
data class
SelectedImage
(
val
id
:
String
)
}
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