|
@@ -60,19 +60,30 @@ class CountdownDialog : DialogFragment() {
|
|
|
)
|
|
)
|
|
|
findId(rootView)
|
|
findId(rootView)
|
|
|
initData()
|
|
initData()
|
|
|
|
|
+ initTimer()
|
|
|
return rootView
|
|
return rootView
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun findId(rootView: View) {
|
|
private fun findId(rootView: View) {
|
|
|
- imageCountdown = rootView.findViewById(R.id.imageCountdown)
|
|
|
|
|
gameImage = rootView.findViewById(R.id.gameImage)
|
|
gameImage = rootView.findViewById(R.id.gameImage)
|
|
|
- loadingImage = rootView.findViewById(R.id.loadingImage)
|
|
|
|
|
val options: RequestOptions = RequestOptions()
|
|
val options: RequestOptions = RequestOptions()
|
|
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
|
|
Glide.with(requireActivity()).load(url).apply(options).into(gameImage!!)
|
|
Glide.with(requireActivity()).load(url).apply(options).into(gameImage!!)
|
|
|
|
|
+ imageCountdown = rootView.findViewById(R.id.imageCountdown)
|
|
|
|
|
+ loadingImage = rootView.findViewById(R.id.loadingImage)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun initData() {
|
|
private fun initData() {
|
|
|
|
|
+ Glide.with(requireActivity())
|
|
|
|
|
+ .asGif()
|
|
|
|
|
+ .load(R.drawable.fish)
|
|
|
|
|
+ .into(loadingImage!!)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 初始化定时器
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun initTimer() {
|
|
|
rxTimer = RxTimer()
|
|
rxTimer = RxTimer()
|
|
|
val m: Long = 1000
|
|
val m: Long = 1000
|
|
|
val time: Long = 3
|
|
val time: Long = 3
|
|
@@ -91,14 +102,9 @@ class CountdownDialog : DialogFragment() {
|
|
|
}
|
|
}
|
|
|
if (it == time) {
|
|
if (it == time) {
|
|
|
onDialogClickListener?.invoke("")
|
|
onDialogClickListener?.invoke("")
|
|
|
|
|
+ rxTimer.cancel()
|
|
|
dismiss()
|
|
dismiss()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- Glide.with(requireActivity())
|
|
|
|
|
- .asGif()
|
|
|
|
|
- .load(R.drawable.fish)
|
|
|
|
|
- .into(loadingImage!!)
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|