|
@@ -5,7 +5,6 @@ import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
|
import androidx.appcompat.widget.AppCompatImageView
|
|
import androidx.appcompat.widget.AppCompatImageView
|
|
|
-import androidx.appcompat.widget.AppCompatTextView
|
|
|
|
|
import androidx.fragment.app.DialogFragment
|
|
import androidx.fragment.app.DialogFragment
|
|
|
import com.bumptech.glide.Glide
|
|
import com.bumptech.glide.Glide
|
|
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|
@@ -24,7 +23,7 @@ class CountdownDialog : DialogFragment() {
|
|
|
private lateinit var rxTimer: RxTimer
|
|
private lateinit var rxTimer: RxTimer
|
|
|
private var url = ""
|
|
private var url = ""
|
|
|
private var gameImage: AppCompatImageView? = null
|
|
private var gameImage: AppCompatImageView? = null
|
|
|
- private var tvCountdown: AppCompatTextView? = null
|
|
|
|
|
|
|
+ private var imageCountdown: AppCompatImageView? = null
|
|
|
var onDialogClickListener: ((bean: String) -> Unit)? = null
|
|
var onDialogClickListener: ((bean: String) -> Unit)? = null
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
@@ -64,7 +63,7 @@ class CountdownDialog : DialogFragment() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun findId(rootView: View) {
|
|
private fun findId(rootView: View) {
|
|
|
- tvCountdown = rootView.findViewById(R.id.tvCountdown)
|
|
|
|
|
|
|
+ imageCountdown = rootView.findViewById(R.id.imageCountdown)
|
|
|
gameImage = rootView.findViewById(R.id.gameImage)
|
|
gameImage = rootView.findViewById(R.id.gameImage)
|
|
|
val options: RequestOptions = RequestOptions()
|
|
val options: RequestOptions = RequestOptions()
|
|
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
|
@@ -77,7 +76,17 @@ class CountdownDialog : DialogFragment() {
|
|
|
val time: Long = 3
|
|
val time: Long = 3
|
|
|
rxTimer.interval(m) {
|
|
rxTimer.interval(m) {
|
|
|
val date = time - it
|
|
val date = time - it
|
|
|
- tvCountdown!!.text = date.toString()
|
|
|
|
|
|
|
+ when (date.toString()) {
|
|
|
|
|
+ "1" -> {
|
|
|
|
|
+ imageCountdown!!.setBackgroundResource(R.mipmap.icon_one)
|
|
|
|
|
+ }
|
|
|
|
|
+ "2" -> {
|
|
|
|
|
+ imageCountdown!!.setBackgroundResource(R.mipmap.icon_two)
|
|
|
|
|
+ }
|
|
|
|
|
+ "3" -> {
|
|
|
|
|
+ imageCountdown!!.setBackgroundResource(R.mipmap.icon_three)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (it == time) {
|
|
if (it == time) {
|
|
|
onDialogClickListener?.invoke("")
|
|
onDialogClickListener?.invoke("")
|
|
|
dismiss()
|
|
dismiss()
|