Timmy-zzh / TDialog

DialogFragment封装,高效实现各种弹窗效果
482 stars 93 forks source link

在某些机型上显示不全 #48

Open TianYu1022 opened 3 years ago

TianYu1022 commented 3 years ago
private fun showProtocolDialog(protocolTitle: String, protocolContent: String, url: String, name: String, idCard: String, companyName: String): TDialog {
        return TDialog
                .Builder(this.supportFragmentManager)
                .setLayoutRes(R.layout.dialog_protocol)
                .setCancelableOutside(false)
                .setScreenWidthAspect(this, CommonConstants.Dialog.WIDTH_ASPECT)
                .setOnBindViewListener { viewHolder ->
                    viewHolder.setText(R.id.tvProtocolTitleTop, protocolTitle)
                    viewHolder.setText(R.id.tvProtocolTitleBottom, protocolTitle)
                    if (protocolTitle.equals(getString(R.string.protocol_cooperation_agreement))) {
                        viewHolder.setText(R.id.tvProtocolContent, setProtocolCooperationAgreementContent(protocolContent, name, idCard, companyName))
                    } else {
                        viewHolder.setText(R.id.tvProtocolContent, protocolContent)
                    }
                }
                .setOnKeyListener(DialogInterface.OnKeyListener { _, keyCode, event ->
                    if (keyCode == KeyEvent.KEYCODE_BACK) {
                        return@OnKeyListener true //返回键无效
                    }
                    false
                })
                .addOnClickListener(R.id.btnCloseApp, R.id.btnShowProtocol)
                .setOnViewClickListener { _, view, tDialog ->
                    when (view.id) {
                        R.id.btnCloseApp -> {
                            HeartBeatService.stopHeartbeat()
                            MusicService.stopMusicService()
                            AppManager.getAppManager().AppExit(this, true)
                        }

                        R.id.btnShowProtocol -> {
                            if (ClickHelper.isFastDoubleClick) {
                                return@setOnViewClickListener
                            }
                            BrowserActivity.goWithTitle(this, protocolTitle, url)
                        }
                    }
                }.create().show()
    }
TianYu1022 commented 3 years ago

这一块代码有什么问题吗

Timmy-zzh commented 3 years ago

显示不全是什么情况呢?

Timmy-zzh commented 3 years ago

代码没问题,看下R.layout.dialog_protocol 文件内容