|
|
@ -23,7 +23,8 @@ class TextDialog : BaseDialogFragment() { |
|
|
|
fragmentManager: FragmentManager, |
|
|
|
fragmentManager: FragmentManager, |
|
|
|
content: String?, |
|
|
|
content: String?, |
|
|
|
mode: Int = 0, |
|
|
|
mode: Int = 0, |
|
|
|
time: Long = 0 |
|
|
|
time: Long = 0, |
|
|
|
|
|
|
|
autoClose: Boolean = false |
|
|
|
) { |
|
|
|
) { |
|
|
|
TextDialog().apply { |
|
|
|
TextDialog().apply { |
|
|
|
val bundle = Bundle() |
|
|
|
val bundle = Bundle() |
|
|
@ -32,6 +33,7 @@ class TextDialog : BaseDialogFragment() { |
|
|
|
bundle.putLong("time", time) |
|
|
|
bundle.putLong("time", time) |
|
|
|
arguments = bundle |
|
|
|
arguments = bundle |
|
|
|
isCancelable = false |
|
|
|
isCancelable = false |
|
|
|
|
|
|
|
this.autoClose = autoClose |
|
|
|
}.show(fragmentManager, "textDialog") |
|
|
|
}.show(fragmentManager, "textDialog") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -39,6 +41,8 @@ class TextDialog : BaseDialogFragment() { |
|
|
|
|
|
|
|
|
|
|
|
private var time = 0L |
|
|
|
private var time = 0L |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var autoClose: Boolean = false |
|
|
|
|
|
|
|
|
|
|
|
override fun onStart() { |
|
|
|
override fun onStart() { |
|
|
|
super.onStart() |
|
|
|
super.onStart() |
|
|
|
val dm = DisplayMetrics() |
|
|
|
val dm = DisplayMetrics() |
|
|
@ -79,6 +83,7 @@ class TextDialog : BaseDialogFragment() { |
|
|
|
if (time <= 0) { |
|
|
|
if (time <= 0) { |
|
|
|
view.post { |
|
|
|
view.post { |
|
|
|
dialog?.setCancelable(true) |
|
|
|
dialog?.setCancelable(true) |
|
|
|
|
|
|
|
if (autoClose) dialog?.cancel() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -86,6 +91,7 @@ class TextDialog : BaseDialogFragment() { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
view.post { |
|
|
|
view.post { |
|
|
|
dialog?.setCancelable(true) |
|
|
|
dialog?.setCancelable(true) |
|
|
|
|
|
|
|
if (autoClose) dialog?.cancel() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|