|
@@ -8,11 +8,15 @@ import android.view.animation.LinearInterpolator
|
|
|
import android.view.animation.RotateAnimation
|
|
|
import android.widget.ImageView
|
|
|
import com.sambath.kunkhmer.R
|
|
|
+import com.sambath.kunkhmer.app.AdminActivity
|
|
|
import com.sambath.kunkhmer.app.App
|
|
|
import com.sambath.kunkhmer.app.MainActivity
|
|
|
import com.sambath.kunkhmer.app.ShareActivity
|
|
|
import com.sambath.kunkhmer.base.BaseActivity
|
|
|
+import com.sambath.kunkhmer.remote.User
|
|
|
import com.sambath.kunkhmer.screen.login.LoginActivity
|
|
|
+import com.sambath.kunkhmer.util.Const
|
|
|
+import com.sambath.kunkhmer.util.ModelPreferencesManager
|
|
|
|
|
|
class SplashScreenActivity : BaseActivity() {
|
|
|
lateinit var imageLading: ImageView
|
|
@@ -28,6 +32,7 @@ class SplashScreenActivity : BaseActivity() {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
setContentView(R.layout.activity_splash)
|
|
@@ -48,25 +53,31 @@ class SplashScreenActivity : BaseActivity() {
|
|
|
rotate.interpolator = LinearInterpolator()
|
|
|
imageLading.startAnimation(rotate)
|
|
|
|
|
|
- rotate.setAnimationListener(object : Animation.AnimationListener{
|
|
|
+ rotate.setAnimationListener(object : Animation.AnimationListener {
|
|
|
override fun onAnimationRepeat(animation: Animation?) {
|
|
|
}
|
|
|
|
|
|
override fun onAnimationEnd(animation: Animation?) {
|
|
|
|
|
|
- //Test
|
|
|
- val intent = Intent(this@SplashScreenActivity, MainActivity::class.java)
|
|
|
- startActivity(intent)
|
|
|
+ //Test
|
|
|
+// val intent = Intent(this@SplashScreenActivity, MainActivity::class.java)
|
|
|
+// startActivity(intent)
|
|
|
|
|
|
- if (prefHelper.getToken().isNotEmpty()) {
|
|
|
- val intent = Intent(this@SplashScreenActivity, MainActivity::class.java)
|
|
|
+ if (prefHelper.getToken().isNotEmpty()) {
|
|
|
+ val user = ModelPreferencesManager.get<User>(Const.USER_KEY)!!
|
|
|
+ if (user.userName == "kk001") {
|
|
|
+ val intent = Intent(this@SplashScreenActivity, AdminActivity::class.java)
|
|
|
startActivity(intent)
|
|
|
- }else{
|
|
|
- val intent = Intent(this@SplashScreenActivity, LoginActivity::class.java)
|
|
|
+ } else {
|
|
|
+ val intent = Intent(this@SplashScreenActivity, MainActivity::class.java)
|
|
|
startActivity(intent)
|
|
|
}
|
|
|
+ } else {
|
|
|
+ val intent = Intent(this@SplashScreenActivity, LoginActivity::class.java)
|
|
|
+ startActivity(intent)
|
|
|
+ }
|
|
|
|
|
|
- finishAffinity()
|
|
|
+ finishAffinity()
|
|
|
|
|
|
}
|
|
|
|
|
@@ -78,6 +89,7 @@ class SplashScreenActivity : BaseActivity() {
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
override fun onDestroy() {
|
|
|
//handler.removeCallbacks(runnable)
|
|
|
super.onDestroy()
|
|
@@ -101,5 +113,5 @@ class SplashScreenActivity : BaseActivity() {
|
|
|
// // finishAffinity()
|
|
|
// }, 800)
|
|
|
//
|
|
|
- }
|
|
|
+ }
|
|
|
}
|