| | |
| | | import com.sinata.xqmuse.ui.discovery.adapter.CommentAdapter |
| | | import com.sinata.xqmuse.utils.interfaces.StringCallback |
| | | import kotlinx.android.synthetic.main.dialog_comment.* |
| | | import org.jetbrains.anko.support.v4.toast |
| | | |
| | | class CommentDialog:BaseDialogFragment() { |
| | | override fun setContentView() = R.layout.dialog_comment |
| | |
| | | private val voiceId by lazy { arguments?.getString("id")?:"" } |
| | | private var page = 1 |
| | | private val list = arrayListOf<Comment>() |
| | | private val adapter = CommentAdapter(list) |
| | | private val adapter by lazy { CommentAdapter(list,requireActivity() as BaseActivity) } |
| | | var callback:StringCallback? = null |
| | | |
| | | override fun initView() { |
| | |
| | | page++ |
| | | getData() |
| | | } |
| | | tv_action.setOnClickListener { |
| | | val content = et_content.text.toString() |
| | | if (content.isNullOrEmpty()) |
| | | toast("请输入内容") |
| | | else{ |
| | | tv_action.isEnabled = false |
| | | HttpManager.addQuestion(voiceId,content).request(requireActivity() as BaseActivity,success = {_,_-> |
| | | et_content.setText("") |
| | | tv_action.isEnabled = true |
| | | refreshLayout.autoRefresh() |
| | | }){_,_-> |
| | | tv_action.isEnabled = true |
| | | } |
| | | } |
| | | } |
| | | getData() |
| | | } |
| | | |