|
|
package com.br_technology.securitytrain_master.ui.view.mine.activity
|
|
|
|
|
|
import android.view.View
|
|
|
import android.widget.TextView
|
|
|
import com.bigkoo.pickerview.builder.OptionsPickerBuilder
|
|
|
import com.bigkoo.pickerview.view.OptionsPickerView
|
|
|
import com.br_technology.securitytrain_master.R
|
|
|
import com.br_technology.securitytrain_master.databinding.ActivityComplaintsAndSuggestionsBinding
|
|
|
import com.br_technology.securitytrain_master.ui.view.mine.bean.FeedBackTypeBean
|
|
|
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ComplaintsAndSuggestionsViewModel
|
|
|
import com.br_technology.securitytrain_master.view.DialogFeedType
|
|
|
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
|
|
|
|
|
|
|
...
|
...
|
@@ -30,7 +28,7 @@ class ComplaintsAndSuggestionsActivity : |
|
|
private var is_hide: String = "0"
|
|
|
|
|
|
override fun initDataObserver() {
|
|
|
mViewModel.mCommonBean.observe(this,{
|
|
|
mViewModel.mCommonBean.observe(this, {
|
|
|
startActivity(ComplaintsAndSuggestionsSuccessActivity::class.java)
|
|
|
finish()
|
|
|
})
|
...
|
...
|
@@ -114,47 +112,25 @@ class ComplaintsAndSuggestionsActivity : |
|
|
}
|
|
|
//投诉类型
|
|
|
llType.setOnClickListener {
|
|
|
initCustomOptionPicker()
|
|
|
// initCustomOptionPicker()
|
|
|
dialogShow()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private fun initCustomOptionPicker() { //条件选择器初始化,自定义布局
|
|
|
/**
|
|
|
* @description
|
|
|
*
|
|
|
* 注意事项:
|
|
|
* 自定义布局中,id为 optionspicker 或者 timepicker 的布局以及其子控件必须要有,否则会报空指针。
|
|
|
* 具体可参考demo 里面的两个自定义layout布局。
|
|
|
*/
|
|
|
cardItem = mutableListOf()
|
|
|
cardItem?.add(FeedBackTypeBean("功能异常"))
|
|
|
cardItem?.add(FeedBackTypeBean("体验问题"))
|
|
|
cardItem?.add(FeedBackTypeBean("功能建议"))
|
|
|
cardItem?.add(FeedBackTypeBean("服务投诉"))
|
|
|
cardItem?.add(FeedBackTypeBean("其他问题"))
|
|
|
private var dialogFeedType: DialogFeedType? = null
|
|
|
|
|
|
pvCustomOptions = OptionsPickerBuilder(
|
|
|
this
|
|
|
) { options1, _, _, _ -> //返回的分别是三个级别的选中位置
|
|
|
val tx: String = cardItem!![options1].pickerViewText
|
|
|
binding.tvType.text = tx
|
|
|
private fun dialogShow() {
|
|
|
if (dialogFeedType == null) {
|
|
|
dialogFeedType =
|
|
|
DialogFeedType(this).setListener(object : DialogFeedType.ISelectFeedType {
|
|
|
override fun select(content: String, index: Int) {
|
|
|
binding.tvType.text = content
|
|
|
type = "${index + 1}"
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
.setLayoutRes(
|
|
|
R.layout.layout_tousu_type
|
|
|
) { v ->
|
|
|
val tvSubmit = v.findViewById<View>(R.id.tv_finish) as TextView
|
|
|
val ivCancel: TextView = v.findViewById<View>(R.id.iv_cancel) as TextView
|
|
|
tvSubmit.setOnClickListener {
|
|
|
pvCustomOptions?.returnData()
|
|
|
pvCustomOptions?.dismiss()
|
|
|
}
|
|
|
ivCancel.setOnClickListener { pvCustomOptions?.dismiss() }
|
|
|
}
|
|
|
.setSelectOptions(0)
|
|
|
.setOutSideCancelable(false)
|
|
|
.build()
|
|
|
pvCustomOptions?.setPicker(cardItem) //添加数据
|
|
|
pvCustomOptions?.show()
|
|
|
dialogFeedType?.show()
|
|
|
}
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|