Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.root.digitalelka;
- import android.content.Intent;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.animation.Animation;
- import android.view.animation.AnimationUtils;
- import android.widget.ImageView;
- import android.widget.TextView;
- import com.example.root.digitalelka.R;
- import com.example.root.digitalelka.home.Homepage;
- import com.example.root.digitalelka.mahasiswa.HomeUsers;
- import com.example.root.digitalelka.mahasiswa.SessionManager;
- public class Splashscreen extends AppCompatActivity {
- private TextView tv, tv2;
- private ImageView iv;
- SessionManager sessionManager;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_splashscreen);
- sessionManager = new SessionManager(this);
- tv = (TextView) findViewById(R.id.text);
- tv2 = (TextView) findViewById(R.id.text2);
- iv = (ImageView) findViewById(R.id.image);
- Animation animation = AnimationUtils.loadAnimation(this, R.anim.mytransition);
- tv.startAnimation(animation);
- tv2.startAnimation(animation);
- iv.startAnimation(animation);
- if(sessionManager.isLoggin()){
- final Intent i = new Intent(this, HomeUsers.class);
- startActivity(i);
- } else {
- final Intent i = new Intent(this, Homepage.class);
- Thread timer = new Thread(){
- public void run(){
- try {
- sleep(3000);
- } catch (InterruptedException e){
- e.printStackTrace();
- }
- finally {
- startActivity(i);
- finish();
- }
- }
- };
- timer.start();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement