Compare commits
3
Commits
4973236469
...
dev_lvmeng
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc6d2f2c5 | ||
|
|
3dea103e27 | ||
|
|
5a4f136dba |
@@ -1,5 +1,6 @@
|
||||
package com.zmkg.coaloperation
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -10,7 +11,7 @@ import com.zmkg.coaloperation.bottomtab.HomeBottomTabLayout
|
||||
import com.zmkg.coaloperation.databinding.ActivityMainBinding
|
||||
import com.zmkg.coaloperation.ui.home.fragment.HomeFragment
|
||||
import com.zmkg.coaloperation.ui.record.fragment.RecordFragment
|
||||
import com.zmkg.coaloperation.ui.report.fragment.ReportFragment
|
||||
import com.zmkg.coaloperation.ui.report.fragment.Report2Fragment
|
||||
import com.zmkg.coaloperation.ui.user.fragment.UserFragment
|
||||
|
||||
class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layout.activity_main),
|
||||
@@ -56,7 +57,7 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
||||
}
|
||||
|
||||
TAG_REPORT -> {
|
||||
return ReportFragment()
|
||||
return Report2Fragment()
|
||||
}
|
||||
|
||||
// TAG_MESSAGE -> {
|
||||
@@ -77,4 +78,5 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.databinding.ListItemCommonImageBinding
|
||||
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.load
|
||||
|
||||
class CommonImageAdapter(var list: MutableList<CommonImageBean>, var imageSize: Int = 70.dp):
|
||||
BaseQuickAdapter<CommonImageBean, CommonImageAdapter.VH>(
|
||||
R.layout.list_item_common_image, list
|
||||
){
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemCommonImageBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: CommonImageBean
|
||||
) {
|
||||
holder.binding.ivImage.let {
|
||||
it.updateLayoutParams {
|
||||
width = imageSize
|
||||
height = imageSize
|
||||
}
|
||||
if (item.isAddFlag) {
|
||||
it.load(R.drawable.ic_add_image)
|
||||
} else {
|
||||
it.loadRoundedImage(item.imagePath, 3F)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemCommonImageBinding): BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.GeoPointImage
|
||||
import com.zmkg.coaloperation.databinding.ListItemPointImageBinding
|
||||
import com.zmkg.coaloperation.utils.load
|
||||
|
||||
class GeoPointImageAdapter(list: MutableList<GeoPointImage>):
|
||||
BaseQuickAdapter<GeoPointImage, GeoPointImageAdapter.VH>(
|
||||
R.layout.list_item_point_image, list
|
||||
){
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemPointImageBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: GeoPointImage
|
||||
) {
|
||||
holder.binding.ivPointImage.let {
|
||||
if (item.isAddFlag) {
|
||||
it.load(R.drawable.ic_add_image)
|
||||
} else {
|
||||
it.load(item.imagePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemPointImageBinding): BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
+28
-27
@@ -1,7 +1,6 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
@@ -9,14 +8,13 @@ import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
import com.zmkg.coaloperation.bean.BaseItem
|
||||
import com.zmkg.coaloperation.bean.GeoPointImage
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemPointBaseHorizontalBinding
|
||||
import com.zmkg.coaloperation.databinding.ListItemPointBaseVerticalBinding
|
||||
import com.zmkg.coaloperation.ui.geologging.AddGeologicalPointFragment
|
||||
import com.zmkg.coaloperation.utils.GalleryUtils
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||
@@ -60,18 +58,16 @@ class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
||||
if (item.images == null) {
|
||||
item.images = mutableListOf()
|
||||
}
|
||||
val images = item.images!!
|
||||
rvImageList.let { rv ->
|
||||
rv.layoutManager = GridLayoutManager(rv.context, 4, GridLayoutManager.VERTICAL, false)
|
||||
rv.adapter = GeoPointImageAdapter(item.images!!).also {
|
||||
rv.adapter = CommonImageAdapter(images).also {
|
||||
it.setOnItemClickListener { adapter, view, position ->
|
||||
if (it.data[position].isAddFlag.not()) {
|
||||
return@setOnItemClickListener
|
||||
}
|
||||
(context as BaseActivity).let { activity ->
|
||||
StorageUtils.requestPermission(activity) {
|
||||
GalleryUtils.openGallery(context as Activity, AddGeologicalPointFragment.IMAGE_REQUEST_CODE)
|
||||
}
|
||||
} }
|
||||
openGallery(context as BaseActivity, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,18 +80,8 @@ class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
||||
|
||||
private fun loadBaseInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||
val llBaseTop = holder.itemView.findViewById<LinearLayout>(R.id.llBaseTop)
|
||||
val topList = mutableListOf(
|
||||
BaseItem(name = "点号", value = ""),
|
||||
BaseItem(name = "点距", value = ""),
|
||||
BaseItem(name = "累距", value = ""),
|
||||
)
|
||||
val bottomList = mutableListOf(
|
||||
BaseItem(name = "巷高", value = ""),
|
||||
BaseItem(name = "顶板", value = ""),
|
||||
BaseItem(name = "底板", value = ""),
|
||||
BaseItem(name = "巷顶煤厚", value = ""),
|
||||
)
|
||||
topList.forEach {
|
||||
llBaseTop.removeAllViews()
|
||||
item.baseTopList?.forEach {
|
||||
val itemBinding = ListItemPointBaseHorizontalBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
llBaseTop,
|
||||
@@ -107,9 +93,10 @@ class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
||||
}
|
||||
llBaseTop.addView(itemBinding.root)
|
||||
}
|
||||
val llBaseBottom = holder.itemView.findViewById<LinearLayout>(R.id.llBaseBottom)
|
||||
|
||||
bottomList.forEachIndexed { index, it ->
|
||||
val llBaseBottom = holder.itemView.findViewById<LinearLayout>(R.id.llBaseBottom)
|
||||
llBaseBottom.removeAllViews()
|
||||
item.baseBottomList?.forEachIndexed { index, it ->
|
||||
val itemBinding = ListItemPointBaseVerticalBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
llBaseBottom,
|
||||
@@ -119,15 +106,29 @@ class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
||||
tvItemName.text = it.name
|
||||
etInputValue.setText(it.value)
|
||||
dividerVertical.run {
|
||||
if (index == bottomList.size - 1) gone() else visible()
|
||||
if (index == item.baseBottomList!!.size - 1) gone() else visible()
|
||||
}
|
||||
}
|
||||
itemBinding.root.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
width = 0
|
||||
height = LinearLayout.LayoutParams.MATCH_PARENT
|
||||
weight = if (index == bottomList.size - 1) 1.24F else 1.0F
|
||||
weight = if (index == item.baseBottomList!!.size - 1) 1.24F else 1.0F
|
||||
}
|
||||
llBaseBottom.addView(itemBinding.root)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun openGallery(activity: BaseActivity, adapter: CommonImageAdapter) {
|
||||
StorageUtils.requestPermission(activity) {
|
||||
GalleryUtils.openGallery(activity) { data ->
|
||||
val paths = Matisse.obtainPathResult(data) // 获取文件路径列表
|
||||
paths?.forEach { path ->
|
||||
val size = adapter.list.size
|
||||
adapter.list.add(size - 1, CommonImageBean(imagePath = path))
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.ReportItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemReportBinding
|
||||
import com.zmkg.coaloperation.utils.GalleryUtils
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class ReportAdapter(list: MutableList<ReportItem>) :
|
||||
BaseQuickAdapter<ReportItem, ReportAdapter.VH>(R.layout.list_item_report, list) {
|
||||
|
||||
inner class VH(var binding: ListItemReportBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemReportBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(holder: VH, item: ReportItem) {
|
||||
val binding = holder.binding
|
||||
val position = holder.layoutPosition
|
||||
binding.tvItemName.run {
|
||||
text = item.name
|
||||
gravity = Gravity.CENTER_VERTICAL
|
||||
updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
gravity = if (item.viewType == 4) Gravity.CENTER_VERTICAL else Gravity.TOP
|
||||
}
|
||||
}
|
||||
binding.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
}
|
||||
when (item.viewType) {
|
||||
1 -> {
|
||||
binding.tvItemValue.gone()
|
||||
binding.rvReportImage.gone()
|
||||
binding.etInputValue.let { et ->
|
||||
et.visible()
|
||||
et.setText(item.value)
|
||||
et.hint = item.inputHint
|
||||
et.isSingleLine = item.isSingleLine
|
||||
if (item.isSingleLine) {
|
||||
et.gravity = Gravity.CENTER_VERTICAL
|
||||
et.setLines(1)
|
||||
et.updateLayoutParams<LinearLayout.LayoutParams> { height = 50.dp }
|
||||
} else {
|
||||
et.gravity = Gravity.TOP
|
||||
et.setLines(item.inputShowLines)
|
||||
et.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
height = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
topMargin = 15.dp
|
||||
bottomMargin = 15.dp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2 -> {
|
||||
binding.rvReportImage.gone()
|
||||
binding.etInputValue.gone()
|
||||
binding.tvItemValue.let { tv ->
|
||||
tv.visible()
|
||||
tv.text = item.value
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(
|
||||
0,
|
||||
0,
|
||||
R.drawable.ic_arrow_down_gray,
|
||||
0
|
||||
)
|
||||
tv.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
width = LinearLayout.LayoutParams.MATCH_PARENT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3 -> {
|
||||
binding.rvReportImage.gone()
|
||||
binding.etInputValue.gone()
|
||||
binding.tvItemValue.let { tv ->
|
||||
tv.visible()
|
||||
tv.text = item.value
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_select_time, 0)
|
||||
tv.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
width = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4 -> {
|
||||
binding.tvItemValue.gone()
|
||||
binding.etInputValue.gone()
|
||||
if (item.images == null) {
|
||||
item.images = mutableListOf()
|
||||
}
|
||||
binding.rvReportImage.let { rv ->
|
||||
rv.visible()
|
||||
rv.layoutManager = GridLayoutManager(rv.context, 2)
|
||||
rv.adapter = CommonImageAdapter(item.images!!, 80.dp).also {
|
||||
it.setOnItemClickListener { adapter, view, position ->
|
||||
if (it.data[position].isAddFlag.not()) {
|
||||
return@setOnItemClickListener
|
||||
}
|
||||
openGallery(context as BaseActivity, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun openGallery(activity: BaseActivity, adapter: CommonImageAdapter) {
|
||||
StorageUtils.requestPermission(activity) {
|
||||
GalleryUtils.openGallery(activity) { data ->
|
||||
val paths = Matisse.obtainPathResult(data) // 获取文件路径列表
|
||||
paths?.forEach { path ->
|
||||
val size = adapter.list.size
|
||||
adapter.list.add(size - 1, CommonImageBean(imagePath = path))
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,8 +63,10 @@ data class GeoPointMultiItem(
|
||||
var pointName: String = "",
|
||||
var pointDistance: String = "",
|
||||
var totalDistance: String = "",
|
||||
var images: MutableList<GeoPointImage>?=null
|
||||
): MultiItemEntity {
|
||||
var baseTopList: MutableList<BaseItem>? = null,
|
||||
var baseBottomList: MutableList<BaseItem>? = null,
|
||||
var images: MutableList<CommonImageBean>? = null
|
||||
) : MultiItemEntity {
|
||||
companion object {
|
||||
const val TYPE_BASE_INFO = 1
|
||||
const val TYPE_LOGGING_INFO = 2
|
||||
@@ -73,7 +75,19 @@ data class GeoPointMultiItem(
|
||||
}
|
||||
}
|
||||
|
||||
data class GeoPointImage(
|
||||
data class CommonImageBean(
|
||||
var imagePath: String = "",
|
||||
var isAddFlag:Boolean = false
|
||||
var isAddFlag: Boolean = false
|
||||
)
|
||||
|
||||
data class ReportItem(
|
||||
var name: String = "",
|
||||
var value: String = "",
|
||||
var id: String = "",
|
||||
//1-输入框,2-文本选择弹窗,3-时间选择弹窗,4-上传图片
|
||||
var viewType: Int = 0,
|
||||
var inputHint: String = "",
|
||||
var inputShowLines: Int = 0,
|
||||
var isSingleLine: Boolean = true,
|
||||
var images: MutableList<CommonImageBean>? = null
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zmkg.coaloperation.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import androidx.annotation.StyleRes
|
||||
import com.zmkg.coaloperation.R
|
||||
|
||||
open class BaseDialog(context: Context, @StyleRes dialogTheme: Int) :
|
||||
Dialog(context, dialogTheme) {
|
||||
constructor(context: Context) : this(context, R.style.DialogTheme)
|
||||
|
||||
override fun show() {
|
||||
super.show()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.zmkg.coaloperation.dialog
|
||||
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.allen.library.shape.ShapeButton
|
||||
import com.zmkg.coaloperation.databinding.DialogCommonBinding
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
|
||||
class CustomCenterDialog(
|
||||
var activity: FragmentActivity,
|
||||
var defaultWidth: Int = 300.dp
|
||||
) : BaseDialog(activity) {
|
||||
|
||||
private lateinit var binding: DialogCommonBinding
|
||||
|
||||
var dialogCancelable = false
|
||||
var dialogCanceledOnTouchOutside = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = DialogCommonBinding.inflate(LayoutInflater.from(activity))
|
||||
setContentView(binding.root)
|
||||
|
||||
setCancelable(dialogCancelable)
|
||||
setCanceledOnTouchOutside(dialogCanceledOnTouchOutside)
|
||||
window?.apply {
|
||||
setLayout(defaultWidth, WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
setBackgroundDrawable(ColorDrawable())
|
||||
setGravity(Gravity.CENTER)
|
||||
}
|
||||
binding.btnCancel.setOnClickListener { onLeftClick?.invoke(this) }
|
||||
binding.btnConfirm.setOnClickListener { onRightClick?.invoke(this) }
|
||||
}
|
||||
|
||||
private var dialogTitle: String = ""
|
||||
fun setDialogTitle(title: String) {
|
||||
this.dialogTitle = title
|
||||
}
|
||||
|
||||
private var dialogContent: String = ""
|
||||
fun setDialogContent(content: String) {
|
||||
this.dialogContent = content
|
||||
}
|
||||
|
||||
private var spannableBuilder: SpannableStringBuilder? = null
|
||||
fun setDialogContent(spannableBuilder: SpannableStringBuilder) {
|
||||
this.spannableBuilder = spannableBuilder
|
||||
}
|
||||
|
||||
private var dialogLeftBtnText = ""
|
||||
private var onLeftClick: ((CustomCenterDialog) -> Unit)? = null
|
||||
fun setCancelButton(
|
||||
text: String,
|
||||
onClick: (CustomCenterDialog) -> Unit
|
||||
) {
|
||||
this.dialogLeftBtnText = text
|
||||
this.onLeftClick = onClick
|
||||
}
|
||||
|
||||
private var dialogRightBtnText = ""
|
||||
private var onRightClick: ((CustomCenterDialog) -> Unit)? = null
|
||||
fun setConfirmButton(
|
||||
text: String,
|
||||
onClick: (CustomCenterDialog) -> Unit
|
||||
) {
|
||||
this.dialogRightBtnText = text
|
||||
this.onRightClick = onClick
|
||||
}
|
||||
|
||||
private var showSingleButton = false
|
||||
fun setShowSingleButton(show: Boolean) {
|
||||
this.showSingleButton = show
|
||||
}
|
||||
|
||||
|
||||
var bgLayoutSetting: ((View) -> Unit)? = null
|
||||
var titleSetting: ((TextView) -> Unit)? = null
|
||||
var contentSetting: ((TextView) -> Unit)? = null
|
||||
var leftBtnSetting: ((ShapeButton) -> Unit)? = null
|
||||
var rightBtnSetting: ((ShapeButton) -> Unit)? = null
|
||||
|
||||
override fun show() {
|
||||
super.show()
|
||||
|
||||
binding.tvDialogTitle.apply {
|
||||
text = dialogTitle
|
||||
}
|
||||
binding.tvDialogContent.apply {
|
||||
text = dialogContent
|
||||
}
|
||||
|
||||
bgLayoutSetting?.invoke(binding.root)
|
||||
titleSetting?.invoke(binding.tvDialogTitle)
|
||||
contentSetting?.invoke(binding.tvDialogContent)
|
||||
leftBtnSetting?.invoke(binding.btnCancel)
|
||||
rightBtnSetting?.invoke(binding.btnConfirm)
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ fun ImageView.loadCircle(@DrawableRes resourceId: Int) {
|
||||
* @param imageView View
|
||||
* @param placeholder 占位图
|
||||
*/
|
||||
fun ImageView.loadRoundedImage(
|
||||
fun ImageView.loadRoundedImage2(
|
||||
url: String?,
|
||||
roundingRadius: Float,
|
||||
@DrawableRes defaultResId: Int = 0,
|
||||
@@ -239,6 +239,32 @@ fun ImageView.loadRoundedImage(
|
||||
.into(this)
|
||||
}
|
||||
|
||||
fun ImageView.loadRoundedImage(
|
||||
any: Any,
|
||||
roundingRadius: Float,
|
||||
@DrawableRes defaultResId: Int = 0,
|
||||
isCenterCrop:Boolean = true
|
||||
) {
|
||||
//设置图片圆角角度
|
||||
val roundedCorners = RoundedCorners(dp2px(roundingRadius))
|
||||
val multiTransformation: MultiTransformation<Bitmap> = MultiTransformation(
|
||||
if (isCenterCrop) CenterCrop() else FitCenter(), roundedCorners
|
||||
)
|
||||
val options = RequestOptions
|
||||
.bitmapTransform(multiTransformation)
|
||||
if (defaultResId == 0) {
|
||||
options.placeholder(R.drawable.ic_default)
|
||||
.error(R.drawable.ic_default)
|
||||
} else {
|
||||
options.placeholder(defaultResId)
|
||||
.error(defaultResId)
|
||||
}
|
||||
Glide.with(context)
|
||||
.load(any)
|
||||
.apply(options)
|
||||
.into(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载图片到ImageView
|
||||
* @param imageUrl 图片地址
|
||||
|
||||
+21
-41
@@ -42,13 +42,6 @@ class AddGeologicalPointActivity :
|
||||
// mBinding.toolbarLay.rightText = "新增工作面"
|
||||
|
||||
initFragments()
|
||||
//switchFragment(0)
|
||||
|
||||
supportFragmentManager.commit {
|
||||
setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
show(fragments[0])
|
||||
setReorderingAllowed(true)
|
||||
}
|
||||
initMagicIndicator()
|
||||
showFragment(0)
|
||||
}
|
||||
@@ -63,30 +56,21 @@ class AddGeologicalPointActivity :
|
||||
}
|
||||
|
||||
|
||||
private val fragments = mutableListOf<Fragment>()
|
||||
private val fragments = mutableListOf<AddGeologicalPointFragment>()
|
||||
private fun initFragments() {
|
||||
titles.forEach { _ ->
|
||||
fragments.add(AddGeologicalPointFragment())
|
||||
}
|
||||
// supportFragmentManager.commit {
|
||||
//// add(R.id.fragment_container, fragments[0], "volume").hide(fragments[0])
|
||||
titles.forEachIndexed { index, string ->
|
||||
val fragment = AddGeologicalPointFragment()
|
||||
fragments.add(fragment)
|
||||
supportFragmentManager.commit {
|
||||
add(R.id.frgContainerView, fragment, "frg_${index}").hide(fragment)
|
||||
// replace(R.id.frgContainerView, fragments[0], "point01")
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private fun switchFragment(position: Int) {
|
||||
// supportFragmentManager.commit {
|
||||
// setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
// fragments.forEachIndexed { index, fragment ->
|
||||
// if (index == position) show(fragment) else hide(fragment)
|
||||
// }
|
||||
// setReorderingAllowed(true)
|
||||
// }
|
||||
// }
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
fragments[0].onActivityResult(requestCode, resultCode, data)
|
||||
fragments[showFrgIndex].onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
|
||||
private val titles = listOf("1#", "2#", "3#", "4#", "5#", "6#")
|
||||
@@ -96,12 +80,6 @@ class AddGeologicalPointActivity :
|
||||
override fun getCount() = titles.size
|
||||
override fun getTitleView(context: Context?, index: Int): IPagerTitleView {
|
||||
return ColorTransitionPagerTitleView(context).apply {
|
||||
// setPadding(
|
||||
// if (index == 0) 20.dp else 10.dp,
|
||||
// 10.dp,
|
||||
// if (index == titles.size - 1) 20.dp else 10.dp,
|
||||
// 10.dp
|
||||
// )
|
||||
// setPadding(10.dp, 5.dp,10.dp, 5.dp)
|
||||
width = 65.dp
|
||||
text = titles[index]
|
||||
@@ -114,13 +92,6 @@ class AddGeologicalPointActivity :
|
||||
strokeColor = "#0C0D0E".toColorInt(),
|
||||
strokeWidth = 8.dp
|
||||
)
|
||||
// showToast(parent.javaClass.simpleName)
|
||||
// updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
// topMargin = 10.dp
|
||||
// bottomMargin = 10.dp
|
||||
// leftMargin = if (index == 0) 20.dp else 10.dp
|
||||
// rightMargin = if (index == titles.size - 1) 20.dp else 10.dp
|
||||
// }
|
||||
setOnClickListener { showFragment(index) }
|
||||
}
|
||||
}
|
||||
@@ -147,11 +118,20 @@ class AddGeologicalPointActivity :
|
||||
|
||||
private lateinit var fragmentContainerHelper:FragmentContainerHelper
|
||||
|
||||
private var showFrgIndex = 0
|
||||
private fun showFragment(position: Int) {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.frgContainerView, fragments[position])
|
||||
.commit()
|
||||
showFrgIndex = position
|
||||
// supportFragmentManager.beginTransaction()
|
||||
// .replace(R.id.frgContainerView, fragments[position])
|
||||
// .commit()
|
||||
fragmentContainerHelper.handlePageSelected(position)
|
||||
supportFragmentManager.commit {
|
||||
setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
fragments.forEachIndexed { index, fragment ->
|
||||
if (index == position) show(fragment) else hide(fragment)
|
||||
}
|
||||
setReorderingAllowed(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+23
-24
@@ -1,16 +1,14 @@
|
||||
package com.zmkg.coaloperation.ui.geologging
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.GeoPointMultiAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.GeoPointImage
|
||||
import com.zmkg.coaloperation.bean.BaseItem
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
||||
import com.zmkg.coaloperation.databinding.FragmentAddGeologicalPointBinding
|
||||
|
||||
@@ -27,10 +25,28 @@ class AddGeologicalPointFragment :
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
val imageList = mutableListOf<GeoPointImage>()
|
||||
imageList.add(GeoPointImage(isAddFlag = true))
|
||||
geoPointList.clear()
|
||||
val topList = mutableListOf(
|
||||
BaseItem(name = "点号", value = ""),
|
||||
BaseItem(name = "点距", value = ""),
|
||||
BaseItem(name = "累距", value = ""),
|
||||
)
|
||||
val bottomList = mutableListOf(
|
||||
BaseItem(name = "巷高", value = ""),
|
||||
BaseItem(name = "顶板", value = ""),
|
||||
BaseItem(name = "底板", value = ""),
|
||||
BaseItem(name = "巷顶煤厚", value = ""),
|
||||
)
|
||||
val imageList = mutableListOf<CommonImageBean>()
|
||||
imageList.add(CommonImageBean(isAddFlag = true))
|
||||
geoPointList.run {
|
||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_BASE_INFO))
|
||||
add(
|
||||
GeoPointMultiItem(
|
||||
itemType = GeoPointMultiItem.TYPE_BASE_INFO,
|
||||
baseTopList = topList,
|
||||
baseBottomList = bottomList
|
||||
)
|
||||
)
|
||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_LOGGING_INFO))
|
||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_CALCULATE_INFO))
|
||||
add(
|
||||
@@ -54,21 +70,4 @@ class AddGeologicalPointFragment :
|
||||
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == IMAGE_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
||||
val uris = Matisse.obtainResult(data) // 获取选中URI列表
|
||||
val paths = Matisse.obtainPathResult(data) // 获取文件路径列表
|
||||
|
||||
geoPointList[3].let {
|
||||
paths?.forEach { path ->
|
||||
val size = it.images!!.size
|
||||
it.images!!.add(size - 1, GeoPointImage(imagePath = path))
|
||||
}
|
||||
}
|
||||
geoPointAdapter.notifyItemChanged(3)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+123
-123
@@ -1,123 +1,123 @@
|
||||
package com.zmkg.coaloperation.ui.report.adapter
|
||||
|
||||
import android.view.View
|
||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||
import com.zmkg.coaloperation.bean.ImageBean
|
||||
import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
import java.io.File
|
||||
|
||||
class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||
R.layout.item_recycle_image
|
||||
), LoadMoreModule {
|
||||
private var isEditModel = false
|
||||
private var editImageShow = false
|
||||
override fun bindViewClickListener(
|
||||
viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
viewType: Int
|
||||
) {
|
||||
addChildClickViewIds(R.id.btn_delete)
|
||||
super.bindViewClickListener(viewHolder, viewType)
|
||||
}
|
||||
override fun convert(
|
||||
holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
item: ImageBean
|
||||
) {
|
||||
val mBinding = holder.dataBinding
|
||||
mBinding?.let {
|
||||
if(item.isAddButton){
|
||||
mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||
mBinding.btnDelete.visibility = View.GONE
|
||||
}else{
|
||||
if(item.isFilePath){
|
||||
mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||
}else{
|
||||
mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||
}
|
||||
if(isEditModel){
|
||||
mBinding.btnDelete.visibility = View.VISIBLE
|
||||
}else{
|
||||
mBinding.btnDelete.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun isEditModel(isEdit: Boolean){
|
||||
isEditModel = isEdit
|
||||
notifyDataSetChanged()
|
||||
if(isEditModel && !editImageShow){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setList(list: Collection<ImageBean>?) {
|
||||
super.setList(list)
|
||||
if(isEditModel){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||
super.setNewInstance(list)
|
||||
if(isEditModel){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addData(newData: Collection<ImageBean>) {
|
||||
if(isEditModel){
|
||||
if(editImageShow){
|
||||
var lastPosition = data.size - 1
|
||||
if(lastPosition < 0){
|
||||
lastPosition = 0
|
||||
}
|
||||
addData(lastPosition, newData)
|
||||
}else{
|
||||
showAddButton(true)
|
||||
}
|
||||
if(data.size > maxNum){
|
||||
showAddButton(false)
|
||||
}
|
||||
}else{
|
||||
super.addData(newData)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAt(position: Int) {
|
||||
super.removeAt(position)
|
||||
if(isEditModel && !editImageShow){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
fun getImageList(): MutableList<ImageBean>{
|
||||
var list = mutableListOf<ImageBean>()
|
||||
data.forEach { imageBean ->
|
||||
if(!imageBean.isAddButton){
|
||||
list.add(imageBean)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
fun getImageSize(): Int {
|
||||
if(isEditModel && editImageShow){
|
||||
return getDefItemCount() - 1
|
||||
}
|
||||
return getDefItemCount()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示添加图片按钮
|
||||
* @param isShow true为显示 false为隐藏
|
||||
*/
|
||||
private fun showAddButton(isShow: Boolean){
|
||||
editImageShow = if(isShow){
|
||||
addData(ImageBean(isAddButton = true))
|
||||
true
|
||||
}else{
|
||||
removeAt(data.size-1)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.zmkg.coaloperation.ui.report.adapter
|
||||
//
|
||||
//import android.view.View
|
||||
//import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
//import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||
//import com.zmkg.coaloperation.R
|
||||
//import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||
//import com.zmkg.coaloperation.bean.ImageBean
|
||||
//import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||
//import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
//import java.io.File
|
||||
//
|
||||
//class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||
// R.layout.item_recycle_image
|
||||
//), LoadMoreModule {
|
||||
// private var isEditModel = false
|
||||
// private var editImageShow = false
|
||||
// override fun bindViewClickListener(
|
||||
// viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
// viewType: Int
|
||||
// ) {
|
||||
// addChildClickViewIds(R.id.btn_delete)
|
||||
// super.bindViewClickListener(viewHolder, viewType)
|
||||
// }
|
||||
// override fun convert(
|
||||
// holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
// item: ImageBean
|
||||
// ) {
|
||||
// val mBinding = holder.dataBinding
|
||||
// mBinding?.let {
|
||||
// if(item.isAddButton){
|
||||
// mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||
// mBinding.btnDelete.visibility = View.GONE
|
||||
// }else{
|
||||
// if(item.isFilePath){
|
||||
// mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||
// }else{
|
||||
// mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||
// }
|
||||
// if(isEditModel){
|
||||
// mBinding.btnDelete.visibility = View.VISIBLE
|
||||
// }else{
|
||||
// mBinding.btnDelete.visibility = View.GONE
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fun isEditModel(isEdit: Boolean){
|
||||
// isEditModel = isEdit
|
||||
// notifyDataSetChanged()
|
||||
// if(isEditModel && !editImageShow){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun setList(list: Collection<ImageBean>?) {
|
||||
// super.setList(list)
|
||||
// if(isEditModel){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
// override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||
// super.setNewInstance(list)
|
||||
// if(isEditModel){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun addData(newData: Collection<ImageBean>) {
|
||||
// if(isEditModel){
|
||||
// if(editImageShow){
|
||||
// var lastPosition = data.size - 1
|
||||
// if(lastPosition < 0){
|
||||
// lastPosition = 0
|
||||
// }
|
||||
// addData(lastPosition, newData)
|
||||
// }else{
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// if(data.size > maxNum){
|
||||
// showAddButton(false)
|
||||
// }
|
||||
// }else{
|
||||
// super.addData(newData)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun removeAt(position: Int) {
|
||||
// super.removeAt(position)
|
||||
// if(isEditModel && !editImageShow){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
// fun getImageList(): MutableList<ImageBean>{
|
||||
// var list = mutableListOf<ImageBean>()
|
||||
// data.forEach { imageBean ->
|
||||
// if(!imageBean.isAddButton){
|
||||
// list.add(imageBean)
|
||||
// }
|
||||
// }
|
||||
// return list
|
||||
// }
|
||||
// fun getImageSize(): Int {
|
||||
// if(isEditModel && editImageShow){
|
||||
// return getDefItemCount() - 1
|
||||
// }
|
||||
// return getDefItemCount()
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 显示添加图片按钮
|
||||
// * @param isShow true为显示 false为隐藏
|
||||
// */
|
||||
// private fun showAddButton(isShow: Boolean){
|
||||
// editImageShow = if(isShow){
|
||||
// addData(ImageBean(isAddButton = true))
|
||||
// true
|
||||
// }else{
|
||||
// removeAt(data.size-1)
|
||||
// false
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.zmkg.coaloperation.ui.report.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.ReportAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.ReportItem
|
||||
import com.zmkg.coaloperation.databinding.FragmentReport2Binding
|
||||
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
|
||||
class Report2Fragment :
|
||||
BaseVMBFragment<ReportViewModel, FragmentReport2Binding>(R.layout.fragment_report2) {
|
||||
|
||||
lateinit var pageStatus: PageStatus
|
||||
|
||||
enum class PageStatus(val status: Int) {
|
||||
ADD(1),
|
||||
EDIT(2),
|
||||
SEE(3),
|
||||
NO_EDIT(4)
|
||||
}
|
||||
|
||||
private val reportItemList = mutableListOf(
|
||||
ReportItem(viewType = 2, name = "上报类型"),
|
||||
ReportItem(viewType = 2, name = "上报区域"),
|
||||
ReportItem(viewType = 1, name = "上报地点", isSingleLine = true, inputHint = "请输入"),
|
||||
ReportItem(viewType = 1, name = "上报描述", isSingleLine = true, inputHint = "请输入"),
|
||||
ReportItem(viewType = 3, name = "上报时间"),
|
||||
ReportItem(viewType = 2, name = "处理状态"),
|
||||
ReportItem(viewType = 2, name = "上报人"),
|
||||
ReportItem(viewType = 2, name = "处理人"),
|
||||
ReportItem(viewType = 1, name = "处理策略", isSingleLine = false, inputShowLines = 4, inputHint = "请输入"),
|
||||
ReportItem(viewType = 1, name = "处理结果", isSingleLine = false, inputShowLines = 4, inputHint = "请输入"),
|
||||
ReportItem(viewType = 3, name = "处理时间"),
|
||||
ReportItem(viewType = 4, name = "上传图片", images = mutableListOf(
|
||||
CommonImageBean(isAddFlag = true)
|
||||
)),
|
||||
ReportItem(viewType = 1, name = "备注", isSingleLine = false, inputShowLines = 6 ,inputHint = "请输入备注信息,120字以内"),
|
||||
)
|
||||
private val reportAdapter by lazy {
|
||||
ReportAdapter(reportItemList)
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "新增临时上报"
|
||||
mBinding.toolbarLay.rightText = "查看记录"
|
||||
mBinding.toolbarLay.titleIvBack.gone()
|
||||
mBinding.toolbarLay.titleTvName.updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||
leftMargin = 20.dp
|
||||
}
|
||||
mBinding.rvReport.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context)
|
||||
it.adapter = reportAdapter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
}
|
||||
|
||||
}
|
||||
+204
-200
@@ -1,200 +1,204 @@
|
||||
package com.zmkg.coaloperation.ui.report.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
import com.luck.picture.lib.basic.PictureSelector
|
||||
import com.luck.picture.lib.config.SelectMimeType
|
||||
import com.luck.picture.lib.config.SelectModeConfig
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||
import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.bean.ImageBean
|
||||
import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||
import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class ReportFragment :
|
||||
BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||
OnItemClickListener, OnItemChildClickListener {
|
||||
|
||||
private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||
lateinit var pageStatus: PageStatus
|
||||
|
||||
companion object {
|
||||
const val maxImageNum = 5
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
|
||||
mBinding.apply {
|
||||
val gridLayoutManager = GridLayoutManager(context, 3)
|
||||
layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||
imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||
imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||
mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||
ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||
}
|
||||
|
||||
setPageModel(PageStatus.ADD)
|
||||
|
||||
}
|
||||
|
||||
enum class PageStatus(val status: Int) {
|
||||
ADD(1),
|
||||
EDIT(2),
|
||||
SEE(3),
|
||||
NO_EDIT(4)
|
||||
}
|
||||
|
||||
private fun setPageModel(status: PageStatus) {
|
||||
this.pageStatus = status
|
||||
mBinding?.apply {
|
||||
when (status) {
|
||||
PageStatus.ADD -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(false)
|
||||
}
|
||||
}
|
||||
|
||||
PageStatus.EDIT -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PageStatus.SEE -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(true)
|
||||
}
|
||||
}
|
||||
|
||||
PageStatus.NO_EDIT -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.noEdit.collectLatest { noEdit ->
|
||||
mBinding.apply {
|
||||
imageAdapter.isEditModel(!noEdit)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||
imageBean?.let { it ->
|
||||
if (it.isAddButton) {
|
||||
initPictureSelectorModel()
|
||||
.forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||
override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||
result?.let { list ->
|
||||
var resultList = localMediaToImageList(list)
|
||||
imageAdapter.addData(resultList)
|
||||
setImageNum(imageAdapter.getImageSize())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancel() {}
|
||||
})
|
||||
} else {
|
||||
// startFullScreenImageActivity(
|
||||
// it.isFilePath,
|
||||
// it.imageUrl
|
||||
// )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setImageNum(size: Int) {
|
||||
mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||
R.string.image_list_num,
|
||||
size,
|
||||
maxImageNum
|
||||
)
|
||||
}
|
||||
|
||||
private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||
return PictureSelector.create(this)
|
||||
.openGallery(SelectMimeType.TYPE_IMAGE)
|
||||
.setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||
.setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||
.setCompressEngine(ImageFileCompressEngine())
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setSandboxFileEngine { context, srcPath, mineType, call ->
|
||||
if (call != null) {
|
||||
var sandboxPath =
|
||||
SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
||||
call.onCallback(srcPath, sandboxPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
adapter.removeAt(position)
|
||||
}
|
||||
|
||||
fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||
var imageList = mutableListOf<ImageBean>()
|
||||
var imageBean: ImageBean
|
||||
result.forEach {
|
||||
it?.let {
|
||||
imageBean = ImageBean(getImagePath(it), true)
|
||||
imageList.add(imageBean)
|
||||
}
|
||||
}
|
||||
return imageList
|
||||
}
|
||||
|
||||
private fun getImagePath(localMedia: LocalMedia): String {
|
||||
if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||
return localMedia.cutPath
|
||||
}
|
||||
if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||
return localMedia.compressPath
|
||||
}
|
||||
if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||
return localMedia.sandboxPath
|
||||
}
|
||||
return localMedia.path
|
||||
}
|
||||
}
|
||||
//package com.zmkg.coaloperation.ui.report.fragment
|
||||
//
|
||||
//import android.os.Bundle
|
||||
//import android.view.View
|
||||
//import androidx.core.view.ViewCompat
|
||||
//import androidx.lifecycle.Lifecycle
|
||||
//import androidx.lifecycle.lifecycleScope
|
||||
//import androidx.lifecycle.repeatOnLifecycle
|
||||
//import androidx.recyclerview.widget.GridLayoutManager
|
||||
//import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
//import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
//import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
//import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
//import com.luck.picture.lib.basic.PictureSelector
|
||||
//import com.luck.picture.lib.config.SelectMimeType
|
||||
//import com.luck.picture.lib.config.SelectModeConfig
|
||||
//import com.luck.picture.lib.entity.LocalMedia
|
||||
//import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
//import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||
//import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||
//import com.zmkg.coaloperation.R
|
||||
//import com.zmkg.coaloperation.base.BaseActivity
|
||||
//import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
//import com.zmkg.coaloperation.bean.ImageBean
|
||||
//import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||
//import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||
//import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
//import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||
//import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||
//import kotlinx.coroutines.flow.collectLatest
|
||||
//import kotlinx.coroutines.launch
|
||||
//
|
||||
//class ReportFragment :
|
||||
// BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||
// OnItemClickListener, OnItemChildClickListener {
|
||||
//
|
||||
// private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||
// lateinit var pageStatus: PageStatus
|
||||
//
|
||||
// companion object {
|
||||
// const val maxImageNum = 5
|
||||
// }
|
||||
//
|
||||
// override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
//
|
||||
// mBinding.apply {
|
||||
// val gridLayoutManager = GridLayoutManager(context, 3)
|
||||
// layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||
// imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||
// imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||
// mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||
// ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||
// }
|
||||
//
|
||||
// setPageModel(PageStatus.ADD)
|
||||
//
|
||||
// }
|
||||
//
|
||||
// enum class PageStatus(val status: Int) {
|
||||
// ADD(1),
|
||||
// EDIT(2),
|
||||
// SEE(3),
|
||||
// NO_EDIT(4)
|
||||
// }
|
||||
//
|
||||
// private fun setPageModel(status: PageStatus) {
|
||||
// this.pageStatus = status
|
||||
// mBinding?.apply {
|
||||
// when (status) {
|
||||
// PageStatus.ADD -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(false)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PageStatus.EDIT -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(false)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// PageStatus.SEE -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PageStatus.NO_EDIT -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(true)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun bindEvent() {
|
||||
// }
|
||||
//
|
||||
// override fun onClick(v: View?) {
|
||||
// }
|
||||
//
|
||||
// override fun transparentStatusBar(): Boolean {
|
||||
// return true
|
||||
// }
|
||||
//
|
||||
// override fun createObserve() {
|
||||
// super.createObserve()
|
||||
// lifecycleScope.launch {
|
||||
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
// mViewModel.noEdit.collectLatest { noEdit ->
|
||||
// mBinding.apply {
|
||||
// imageAdapter.isEditModel(!noEdit)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
// val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||
// imageBean?.let { it ->
|
||||
// if (it.isAddButton) {
|
||||
// StorageUtils.requestPermission(context as BaseActivity) {
|
||||
// initPictureSelectorModel()
|
||||
// .forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||
// override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||
// result?.let { list ->
|
||||
// var resultList = localMediaToImageList(list)
|
||||
// imageAdapter.addData(resultList)
|
||||
// setImageNum(imageAdapter.getImageSize())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onCancel() {}
|
||||
// })
|
||||
// }
|
||||
// } else {
|
||||
//// startFullScreenImageActivity(
|
||||
//// it.isFilePath,
|
||||
//// it.imageUrl
|
||||
//// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun setImageNum(size: Int) {
|
||||
// mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||
// R.string.image_list_num,
|
||||
// size,
|
||||
// maxImageNum
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||
// return PictureSelector.create(this)
|
||||
// .openGallery(SelectMimeType.TYPE_IMAGE)
|
||||
// .setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||
// .setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||
// .setCompressEngine(ImageFileCompressEngine())
|
||||
// .setImageEngine(GlideEngine.createGlideEngine())
|
||||
// .setSandboxFileEngine { context, srcPath, mineType, call ->
|
||||
// if (call != null) {
|
||||
// var sandboxPath =
|
||||
// SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
||||
// call.onCallback(srcPath, sandboxPath)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
// adapter.removeAt(position)
|
||||
// }
|
||||
//
|
||||
// fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||
// var imageList = mutableListOf<ImageBean>()
|
||||
// var imageBean: ImageBean
|
||||
// result.forEach {
|
||||
// it?.let {
|
||||
// imageBean = ImageBean(getImagePath(it), true)
|
||||
// imageList.add(imageBean)
|
||||
// }
|
||||
// }
|
||||
// return imageList
|
||||
// }
|
||||
//
|
||||
// private fun getImagePath(localMedia: LocalMedia): String {
|
||||
// if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||
// return localMedia.cutPath
|
||||
// }
|
||||
// if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||
// return localMedia.compressPath
|
||||
// }
|
||||
// if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||
// return localMedia.sandboxPath
|
||||
// }
|
||||
// return localMedia.path
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
package com.zmkg.coaloperation.utils
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zhihu.matisse.MimeType
|
||||
import com.zhihu.matisse.R
|
||||
import com.zhihu.matisse.engine.impl.GlideEngine
|
||||
import com.zhihu.matisse.internal.entity.CaptureStrategy
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
|
||||
object GalleryUtils {
|
||||
|
||||
fun openGallery(activity: Activity, requestCode:Int) {
|
||||
fun openGallery(activity: BaseActivity, action:(Intent)-> Unit) {
|
||||
Matisse.from(activity)
|
||||
.choose(MimeType.ofImage(),false) // 只选图片
|
||||
.choose(MimeType.ofImage(), false) // 只选图片
|
||||
.capture(true)
|
||||
.captureStrategy(CaptureStrategy(true, "${activity.packageName}.fileprovider", "coalImage"))
|
||||
.captureStrategy(
|
||||
CaptureStrategy(
|
||||
true,
|
||||
"${activity.packageName}.fileprovider",
|
||||
"coalImage"
|
||||
)
|
||||
)
|
||||
.countable(true) // 显示选中数量
|
||||
.maxSelectable(9) // 最多选9张
|
||||
.gridExpectedSize(120.dp)
|
||||
@@ -22,7 +29,13 @@ object GalleryUtils {
|
||||
.thumbnailScale(0.8f)
|
||||
.theme(R.style.Matisse_Dracula)
|
||||
.imageEngine(GlideEngine()) // 必须设置引擎
|
||||
.forResult(requestCode)
|
||||
.forResultLaunch { intent ->
|
||||
activity.launchActivityResult(intent) { result ->
|
||||
result.data?.let {
|
||||
action(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+12
-12
@@ -11,21 +11,21 @@ object StorageUtils {
|
||||
|
||||
fun requestPermission(activity: BaseActivity, callback: () -> Unit) {
|
||||
activity.requestSinglePermissionResult(Manifest.permission.CAMERA) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
if (Environment.isExternalStorageManager()) {
|
||||
callback()
|
||||
} else {
|
||||
val intent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
|
||||
// activity.startActivityForResult(intent, MANAGE_REQUEST_CODE)
|
||||
activity.launchActivityResult(intent) {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// if (Environment.isExternalStorageManager()) {
|
||||
// callback()
|
||||
// } else {
|
||||
// val intent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
|
||||
//// activity.startActivityForResult(intent, MANAGE_REQUEST_CODE)
|
||||
// activity.launchActivityResult(intent) {
|
||||
// callback()
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
activity.requestSinglePermissionResult(Manifest.permission.WRITE_EXTERNAL_STORAGE) {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 699 B |
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<com.allen.library.shape.ShapeLinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:shapeCornersRadius="30dp"
|
||||
app:shapeSolidColor="#17181C"
|
||||
app:shapeStrokeColor="#282C38"
|
||||
app:shapeStrokeWidth="1dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDialogTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="50dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
tools:text="保存" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDialogContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textColor="#6A6F87"
|
||||
android:textSize="14sp"
|
||||
tools:text="是否确认保存输入的消息" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<com.allen.library.shape.ShapeButton
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp"
|
||||
app:shapeCornersRadius="22dp"
|
||||
tools:text="取消"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
app:shapeSolidColor="#353846" />
|
||||
|
||||
<com.allen.library.shape.ShapeButton
|
||||
android:id="@+id/btnConfirm"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp"
|
||||
tools:text="确定"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
app:shapeCornersRadius="22dp"
|
||||
app:shapeSolidColor="#21A69A" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
</layout>
|
||||
@@ -28,14 +28,13 @@
|
||||
android:layout_marginBottom="70dp">
|
||||
|
||||
|
||||
<com.allen.library.shape.ShapeLinearLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="vertical"
|
||||
app:shapeCornersRadius="6dp"
|
||||
app:shapeSolidColor="@color/theme_color">
|
||||
android:background="@drawable/bg_stroke_gray">
|
||||
|
||||
<com.zmkg.coaloperation.view.CustomTextSelectView
|
||||
android:id="@+id/type"
|
||||
@@ -153,7 +152,7 @@
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_lay"
|
||||
layout="@layout/lay_title_right_bar"
|
||||
app:goneBack="@{true}"
|
||||
app:title="@{@string/title_report}"
|
||||
app:transparentBg="@{true}" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvReport"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
tools:listitem="@layout/list_item_report"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:itemCount="10"
|
||||
android:background="@drawable/bg_stroke_gray"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.allen.library.shape.ShapeButton
|
||||
android:id="@+id/btnConfirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginHorizontal="45dp"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="center"
|
||||
android:text="确认"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:shapeCornersRadius="20dp"
|
||||
app:shapeSolidColor="@color/text_green" />
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
+2
-1
@@ -5,10 +5,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:id="@+id/ivPointImage"
|
||||
android:id="@+id/ivImage"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_add_image"/>
|
||||
@@ -29,7 +29,7 @@
|
||||
app:spanCount="4"
|
||||
android:paddingVertical="5dp"
|
||||
android:orientation="vertical"
|
||||
tools:listitem="@layout/list_item_point_image"
|
||||
tools:listitem="@layout/list_item_common_image"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:background="@color/black_bg">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvItemName"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="20dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="#6A6F87"
|
||||
android:textSize="16sp"
|
||||
tools:text="功能名称" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etInputValue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="请输入"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="#757B8C"
|
||||
android:textCursorDrawable="@drawable/cursor_white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvItemValue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="请选择"
|
||||
android:drawablePadding="20dp"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="#757B8C"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"
|
||||
app:drawableEndCompat="@drawable/ic_arrow_down_gray" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvReportImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="3"
|
||||
tools:itemCount="6"
|
||||
tools:listitem="@layout/list_item_common_image" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
app:dividerColor="#282C38" />
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -38,5 +38,9 @@
|
||||
<!-- 遮罩层 -->
|
||||
<item name="android:backgroundDimAmount">0.5</item>
|
||||
</style>
|
||||
|
||||
<!-- <style name="Theme_dialog" parent="@android:style/Theme.Dialog">-->
|
||||
<!-- <item name="android:windowBackground">@android:color/transparent</item>-->
|
||||
<!-- <item name="android:windowNoTitle">true</item>-->
|
||||
<!-- <item name="android:windowIsFloating">true</item>-->
|
||||
<!-- </style>-->
|
||||
</resources>
|
||||
@@ -38,6 +38,7 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
|
||||
@@ -368,4 +369,15 @@ public final class SelectionCreator {
|
||||
mSelectionSpec.showPreview = showPreview;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void forResultLaunch(Consumer<Intent> consumer) {
|
||||
Activity activity = mMatisse.getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(activity, MatisseActivity.class);
|
||||
if (consumer!=null) {
|
||||
consumer.accept(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user