| | |
| | | */ |
| | | object DialogUtil2 { |
| | | |
| | | fun showLoadingDialog(context: Context, message: CharSequence?, cancelable: Boolean, cancelListener: DialogInterface.OnCancelListener?): Dialog? { |
| | | val dialog = Dialog(context) |
| | | val view = LayoutInflater.from(context).inflate(R.layout.layout_loading, null) |
| | | dialog.setContentView(view) |
| | | if (message.isNullOrBlank()) { |
| | | view.findViewById<TextView>(R.id.txt_tip).visibility = View.GONE |
| | | } else { |
| | | view.findViewById<TextView>(R.id.txt_tip).apply { |
| | | visibility = View.VISIBLE |
| | | text = message |
| | | } |
| | | } |
| | | dialog.setCanceledOnTouchOutside(false) |
| | | dialog.setCancelable(cancelable) |
| | | dialog.setOnCancelListener(cancelListener) |
| | | dialog.window?.attributes?.gravity = Gravity.CENTER |
| | | val lp = dialog.window?.attributes |
| | | lp?.dimAmount = 0.2f |
| | | dialog.window?.attributes = lp |
| | | dialog.show() |
| | | return dialog |
| | | } |
| | | |
| | | fun showAlertDialog( |
| | | context: Context?, |
| | | content: String, |