lmw
2024-07-16 935a87b3578806ca37fee37f03da8c419a3896ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.dollearn.student.dialog
 
import android.view.Gravity
import androidx.fragment.app.FragmentManager
import com.dollearn.student.R
import com.dollearn.student.utils.extention.clickDelay
import com.dollearn.student.utils.interfaces.StringCallback
import kotlinx.android.synthetic.main.dialog_sex.*
 
class SexDialog:BaseDialogFragment() {
    override fun setContentView() = R.layout.dialog_sex
 
    override fun setGravity() = Gravity.BOTTOM
 
    override fun initView() {
        button1.clickDelay {
            callback?.onResult("男")
            dismissAllowingStateLoss()
        }
        button2.clickDelay {
            callback?.onResult("女")
            dismissAllowingStateLoss()
        }
        button3.clickDelay {
            dismissAllowingStateLoss()
        }
    }
 
    var callback: StringCallback? = null
 
    companion object{
        fun show(fm:FragmentManager, callback: StringCallback){
            val sexDialog = SexDialog()
            sexDialog.callback = callback
            sexDialog.show(fm,"sex")
        }
    }
}