From e102578ebfc95c27aeb13dce13fb82af53a2bead Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 25 二月 2021 17:07:23 +0800
Subject: [PATCH] 1. 新增夜间施工查询界面 2. 新增夜间施工管理统计界面
---
app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt b/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt
index fb3bc41..4bef372 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt
@@ -13,12 +13,36 @@
import android.widget.TextView
import cn.flightfeather.thirdapp.R
import cn.flightfeather.thirdapp.module.base.BaseActivity
+import cn.flightfeather.thirdapp.view.PopupWindowWithMask
/**
* @author riku
* Date: 2020/5/14
*/
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?,
@@ -56,7 +80,7 @@
) {
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_bottom_sheet, null)
activity?.let {
- PopupWindow(it).apply popupWindow@{
+ PopupWindowWithMask(it).apply popupWindow@{
isFocusable = true
isOutsideTouchable = true
contentView = view
@@ -80,17 +104,8 @@
width = ViewGroup.LayoutParams.MATCH_PARENT
animationStyle = R.style.PopWin_bottom_anim_style
background.alpha = 0
- setOnDismissListener {
- val wl = activity.window.attributes
- wl.alpha = 1f
- activity.window.attributes = wl
- }
}.run {
- val wl = activity.window.attributes
- wl.alpha = 0.9f
- activity.window.attributes = wl
showAtLocation(anchorView, Gravity.BOTTOM, 0, 0)
-
}
}
}
--
Gitblit v1.9.3