SHARE
TWEET

Untitled

a guest Jun 20th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.root.digitalelka;
  2.  
  3. import android.content.Intent;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.os.Bundle;
  6. import android.view.animation.Animation;
  7. import android.view.animation.AnimationUtils;
  8. import android.widget.ImageView;
  9. import android.widget.TextView;
  10.  
  11. import com.example.root.digitalelka.R;
  12. import com.example.root.digitalelka.home.Homepage;
  13. import com.example.root.digitalelka.mahasiswa.HomeUsers;
  14. import com.example.root.digitalelka.mahasiswa.SessionManager;
  15.  
  16. public class Splashscreen extends AppCompatActivity {
  17.     private TextView tv, tv2;
  18.     private ImageView iv;
  19.     SessionManager sessionManager;
  20.  
  21.     @Override
  22.     protected void onCreate(Bundle savedInstanceState) {
  23.         super.onCreate(savedInstanceState);
  24.         setContentView(R.layout.activity_splashscreen);
  25.  
  26.         sessionManager = new SessionManager(this);
  27.  
  28.         tv = (TextView) findViewById(R.id.text);
  29.         tv2 = (TextView) findViewById(R.id.text2);
  30.         iv = (ImageView) findViewById(R.id.image);
  31.  
  32.         Animation animation = AnimationUtils.loadAnimation(this, R.anim.mytransition);
  33.         tv.startAnimation(animation);
  34.         tv2.startAnimation(animation);
  35.         iv.startAnimation(animation);
  36.        
  37.         if(sessionManager.isLoggin()){
  38.             final Intent i = new Intent(this, HomeUsers.class);
  39.             startActivity(i);
  40.            
  41.         } else {
  42.  
  43.             final Intent i = new Intent(this, Homepage.class);
  44.  
  45.             Thread timer = new Thread(){
  46.                 public void run(){
  47.                     try {
  48.                         sleep(3000);
  49.                     } catch (InterruptedException e){
  50.                         e.printStackTrace();
  51.                     }
  52.                     finally {
  53.                         startActivity(i);
  54.                         finish();
  55.  
  56.                     }
  57.                 }
  58.  
  59.             };
  60.             timer.start();
  61.            
  62.         }
  63.  
  64.        
  65.  
  66.  
  67.     }
  68.  
  69.  
  70.  
  71. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top