Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. Glide.with(this)
  2. .asGif()
  3. .load(R.drawable.bg_splash)
  4. .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE)) // Saves no data to cache.
  5. .listener(object : RequestListener<GifDrawable> {
  6. override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<GifDrawable>?, isFirstResource: Boolean): Boolean {
  7. TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
  8.  
  9. return false
  10. }
  11.  
  12. override fun onResourceReady(resource: GifDrawable?, model: Any?, target: Target<GifDrawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
  13. resource!!.setLoopCount(1)
  14. resource!!.start()
  15. while (true) {
  16. Timber.d("resource: ${resource.frameIndex} / ${resource.frameCount}")
  17. if (!resource!!.isRunning) {
  18. break
  19. } else {
  20. if (resource.frameIndex == resource.frameCount - 1) {
  21. val intent = Intent(this@SplashActivity, MainActivity::class.java) // Intent 선언
  22. startActivity(intent)
  23. finish()
  24. overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out)
  25. }
  26. }
  27. }
  28. return false
  29. }
  30.  
  31. })
  32. .into(iv_splash)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement