Skip to content

Commit

Permalink
部分功能优化
Browse files Browse the repository at this point in the history
  • Loading branch information
dida-logistics committed Aug 20, 2018
1 parent 1fccb1a commit f628468
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object PickPhotoHelper {
activity.getString(R.string.pick_chose_camera),
activity.getString(R.string.pick_chose_album)
)
PickChoseActivity.show(activity, choiceList) { key ->
PickChoseActivity.show(activity, choiceList) shown@{ key ->
val action: Int = when (key) {
choiceList[0] -> {
PickControl.ACTION_CAMERA
Expand All @@ -28,7 +28,7 @@ object PickPhotoHelper {
}
else -> -1
}
if (action < 0) return@show
if (action < 0) return@shown
PickControl.obtain(true)
.action(action)
.limit(limit)
Expand Down
10 changes: 7 additions & 3 deletions picker/src/main/java/pizzk/media/picker/widget/PhotoGroupView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.view.ViewGroup
import pizzk.media.picker.R
import pizzk.media.picker.adapter.CommonListAdapter
import pizzk.media.picker.adapter.PhotoGroupAdapter
import pizzk.media.picker.arch.CropParams
import pizzk.media.picker.arch.PickControl
import pizzk.media.picker.entity.PhotoItem
import pizzk.media.picker.utils.PickUtils
Expand Down Expand Up @@ -56,7 +57,7 @@ class PhotoGroupView : RecyclerView {
//选择图片
val selects: List<String> = if (pAdapter.isAppend) pAdapter.selectPaths() else emptyList()
PickChoseActivity.show(special.activity, choiceList) { key ->
showPickPhoto(special.activity, key, selects, special.limit, pAdapter, index)
showPickPhoto(special.activity, key, selects, special.limit, pAdapter, index,special.crop)
}
} else {
//预览
Expand All @@ -83,7 +84,8 @@ class PhotoGroupView : RecyclerView {
//跳转至选择图片
private fun showPickPhoto(activity: Activity, key: String,
selects: List<String>, limit: Int,
adapter: PhotoGroupAdapter, index: Int) {
adapter: PhotoGroupAdapter, index: Int,
crop: CropParams?) {
val action: Int = when (key) {
choiceList[0] -> {
PickControl.ACTION_CAMERA
Expand All @@ -97,6 +99,7 @@ class PhotoGroupView : RecyclerView {
PickControl.obtain(true).action(action)
.selects(selects)
.limit(limit)
.crop(crop)
.callback { code, list ->
if (code == PickControl.ACTION_CAMERA) {
val allOf: MutableList<String> = ArrayList(adapter.selectCount() + 1)
Expand All @@ -119,6 +122,7 @@ class PhotoGroupView : RecyclerView {
var lp: ViewGroup.LayoutParams,
var limit: Int = 1,
var column: Int = 4,
var fixed: MutableList<PhotoItem>? = null
var fixed: MutableList<PhotoItem>? = null,
var crop: CropParams? = null
)
}

0 comments on commit f628468

Please sign in to comment.