112 lines
3.7 KiB
Kotlin
112 lines
3.7 KiB
Kotlin
package com.qidian.zhongkesmart.dialog
|
|
|
|
import android.content.Context
|
|
import android.graphics.Color
|
|
import android.text.Editable
|
|
import android.text.TextWatcher
|
|
import android.view.View
|
|
import android.widget.LinearLayout
|
|
import android.widget.TextView
|
|
import com.flyco.dialog.utils.CornerUtils
|
|
import com.flyco.dialog.widget.base.BaseDialog
|
|
import com.github.mikephil.charting.charts.LineChart
|
|
import com.github.mikephil.charting.data.Entry
|
|
import com.github.mikephil.charting.data.LineData
|
|
import com.github.mikephil.charting.data.LineScatterCandleRadarDataSet
|
|
import com.qidian.zhongkesmart.R
|
|
import com.qidian.zhongkesmart.utils.ChartUtils
|
|
import com.qidian.zhongkesmart.utils.InputLimitUtil.ShowEdittextStyle
|
|
import com.qidian.zhongkesmart.views.ClearEditText
|
|
import kotlinx.android.synthetic.main.layout_barchart.*
|
|
import kotlinx.android.synthetic.main.pop_model_init_verify.*
|
|
import kotlinx.coroutines.flow.callbackFlow
|
|
import java.util.*
|
|
import kotlin.collections.ArrayList
|
|
|
|
/*取消绑定*/
|
|
class ModeInitVerifyDialog {
|
|
private var callBack: PopupYearWindowCallBack? = null
|
|
private var activity: Context? = null
|
|
var dialog: CustomCommonDialog? = null
|
|
var values:ArrayList<Entry>? = null
|
|
var xValues: ArrayList<String>? = null
|
|
// var index = 0
|
|
var line_Chart:LineChart? = null
|
|
fun getShareDialog(context: Context?, callBack: PopupYearWindowCallBack?,lineData: ArrayList<Entry>,xData:ArrayList<String>) {
|
|
activity = context
|
|
this.callBack = callBack
|
|
values = lineData
|
|
xValues = xData
|
|
dialog = CustomCommonDialog(activity)
|
|
dialog!!.widthScale(0.8f)
|
|
dialog!!.setCanceledOnTouchOutside(false)
|
|
dialog!!.show()
|
|
// dialog.getWindow().setBackgroundDrawable( CornerUtils.cornerDrawable(Color.parseColor("#00000000"), dp2px(0)));
|
|
}
|
|
|
|
fun setDismiss() {
|
|
if (dialog != null && dialog!!.isShowing) {
|
|
dialog!!.dismiss()
|
|
}
|
|
}
|
|
|
|
fun isShowing(): Boolean {
|
|
return dialog != null && dialog!!.isShowing
|
|
}
|
|
|
|
fun updateData(xData:ArrayList<String>,lineData: ArrayList<Entry>){
|
|
if(isShowing()) {
|
|
ChartUtils.initLineChart(
|
|
line_Chart!!,
|
|
xData!!,
|
|
lineData!!,
|
|
true
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
interface PopupYearWindowCallBack {
|
|
fun doWork()
|
|
}
|
|
|
|
inner class CustomCommonDialog(context: Context?) : BaseDialog<CustomCommonDialog?>(context) {
|
|
var li_close: LinearLayout? = null
|
|
override fun onCreateView(): View {
|
|
val inflate = View.inflate(mContext, R.layout.pop_model_init_verify, null)
|
|
inflate.setBackgroundDrawable(
|
|
CornerUtils.cornerDrawable(Color.parseColor("#ffffff"), dp2px(10f).toFloat())
|
|
)
|
|
li_close = inflate.findViewById<LinearLayout>(R.id.li_close) as LinearLayout
|
|
line_Chart = inflate.findViewById<LineChart>(R.id.linechart) as LineChart
|
|
return inflate
|
|
}
|
|
|
|
override fun setUiBeforShow() {
|
|
li_close!!.setOnClickListener {
|
|
callBack!!.doWork()
|
|
dismiss()
|
|
}
|
|
|
|
ChartUtils.initLineChart(
|
|
line_Chart!!,
|
|
xValues!!,
|
|
values!!,
|
|
false
|
|
)
|
|
}
|
|
}
|
|
|
|
companion object {
|
|
private var popupWindowPrivinceListUtils: ModeInitVerifyDialog? = null
|
|
|
|
// @get:Synchronized
|
|
val instance: ModeInitVerifyDialog?
|
|
get() {
|
|
if (popupWindowPrivinceListUtils == null) {
|
|
popupWindowPrivinceListUtils = ModeInitVerifyDialog()
|
|
}
|
|
return popupWindowPrivinceListUtils
|
|
}
|
|
}
|
|
} |