Advertisement
wildanfuady

SplashScreenActivity.kt

Feb 19th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. package com.wildanfuady.sekolahku
  2.  
  3. import android.content.Intent
  4. import androidx.appcompat.app.AppCompatActivity
  5. import android.os.Bundle
  6. import android.os.Handler
  7. import kotlinx.android.synthetic.main.activity_splash_screen.*
  8.  
  9. class SplashScreenActivity : AppCompatActivity() {
  10.  
  11. override fun onCreate(savedInstanceState: Bundle?) {
  12. super.onCreate(savedInstanceState)
  13. setContentView(R.layout.activity_splash_screen)
  14. // hide action bar
  15. actionBar?.hide()
  16. // generate progress
  17. updateProgress()
  18.  
  19. }
  20.  
  21. private fun updateProgress()
  22. {
  23. var handler = Handler()
  24. var run = Runnable {
  25.  
  26. var progress: Int = progressBar.progress
  27. progressBar.progress = progress + 10
  28.  
  29. if(progress < 100)
  30. {
  31. updateProgress()
  32. }
  33. else {
  34. val intent = Intent(this, ListActivity::class.java)
  35. startActivity(intent)
  36. finish()
  37. }
  38. }
  39. handler.postDelayed(run, 300)
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement