Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Glide.with(this)
- .asGif()
- .load(R.drawable.bg_splash)
- .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE)) // Saves no data to cache.
- .listener(object : RequestListener<GifDrawable> {
- override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<GifDrawable>?, isFirstResource: Boolean): Boolean {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- return false
- }
- override fun onResourceReady(resource: GifDrawable?, model: Any?, target: Target<GifDrawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
- resource!!.setLoopCount(1)
- resource!!.start()
- while (true) {
- Timber.d("resource: ${resource.frameIndex} / ${resource.frameCount}")
- if (!resource!!.isRunning) {
- break
- } else {
- if (resource.frameIndex == resource.frameCount - 1) {
- val intent = Intent(this@SplashActivity, MainActivity::class.java) // Intent 선언
- startActivity(intent)
- finish()
- overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out)
- }
- }
- }
- return false
- }
- })
- .into(iv_splash)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement