package my.com.salihin.tafumt.taf_umt;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;

import static java.lang.Thread.sleep;

/**
 * Created by m on 18/01/2017.
 */

public class SplashActivity extends AppCompatActivity implements Animation.AnimationListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

//        ImageView img = (ImageView)findViewById(R.id.imageView);
//        Animation animation = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.zoom_in);
//        img.startAnimation(animation);

        move();
//        animation.setAnimationListener(this);

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {

                    sleep(5000);
                    Intent startMain = new Intent("my.com.salihin.tafumt.taf_umt.MainActivity");

                    startActivity(startMain);

                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        thread.start();
    }

    @Override
    public void onAnimationStart(Animation animation) {

    }

    @Override
    public void onAnimationEnd(Animation animation) {

    }

    @Override
    public void onAnimationRepeat(Animation animation) {

    }

    public void move(){
        ImageView img_animation = (ImageView) findViewById(R.id.taficon);

        TranslateAnimation animation = new TranslateAnimation(600.0f, 0.0f, 0.0f, 0.0f);
        animation.setDuration(5000);

        img_animation.startAnimation(animation);
    }
}
