如何在项目单击时显示“进度”对话框和关闭

时间:2018-01-02 04:49:17

标签: android kotlin rx-java rx-kotlin

 override fun itemclick(position: Int) {
        binding.progressbar.visibility=View.VISIBLE
        binding?.barcode?.setImageBitmap(exchngeViewModel.getQrImageBitmap(qrCodeData[position], this!!.activity!!))
        showDetail(position)
        binding.progressbar.visibility=View.GONE
    }    

fun getQrImageBitmap(data: String, context: Context): Bitmap? {
        bitMap = AppUtils.TextToImageEncode(data, context, bus) 
        return this!!.bitMap
    }

这是我的代码我希望在项目点击时显示进度dialog它应该解除,直到getQrImageBitmap和showDetail功能完成但我不工作的时候请建议我如何实现这个如何显示和隐藏项目点击的细节。谢谢!!

1 个答案:

答案 0 :(得分:0)

showDetail()方法

中添加Prorgressbar
  fun showDetail(position: Int) {
    SharedPreferenceUtils.setExchangePagePostion(this!!.activity!!, position)
    binding?.textHeader?.text = exchangeData[position]
    binding?.backButton?.visibility = View.VISIBLE
    binding?.recyclerView?.visibility = View.GONE
    binding?.barcode?.visibility = View.VISIBLE
    binding?.header1?.setBackgroundResource(R.color.colorOrangeGray)
    binding?.exchangeButton?.visibility = View.VISIBLE


    binding.progressbar.visibility=View.GONE
}