99 lines
3.3 KiB
Java
99 lines
3.3 KiB
Java
package com.rubenvandeven.emotionhero;
|
|
|
|
import android.animation.AnimatorSet;
|
|
import android.animation.ObjectAnimator;
|
|
import android.content.Intent;
|
|
import android.os.Handler;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.view.WindowManager;
|
|
import android.widget.ImageView;
|
|
import android.widget.Toast;
|
|
|
|
public class IntroActivity extends AppCompatActivity {
|
|
|
|
protected Player player;
|
|
|
|
protected Handler continueHandler;
|
|
|
|
protected Runnable continueRunnable = new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
continueToMenu();
|
|
}
|
|
};
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
if(getSupportActionBar() != null) {
|
|
getSupportActionBar().hide();
|
|
}
|
|
setContentView(R.layout.activity_intro);
|
|
|
|
player = Player.getInstance(getApplicationContext());
|
|
|
|
int extraLogoDelay = 0;
|
|
// if(player.isNew()) {
|
|
// extraLogoDelay = 1500;
|
|
// }
|
|
|
|
View introView = findViewById(R.id.activity_intro);
|
|
|
|
if(!player.isNew()) {
|
|
introView.setOnClickListener(new View.OnClickListener() {
|
|
@Override
|
|
public void onClick(View v) {
|
|
continueToMenu();
|
|
}
|
|
});
|
|
}
|
|
|
|
final ImageView logoV2 = (ImageView) findViewById(R.id.logoV2);
|
|
final ImageView logoArquivo = (ImageView) findViewById(R.id.logoArquivo);
|
|
final ImageView logoAffectiva = (ImageView) findViewById(R.id.logoAffectiva);
|
|
|
|
ObjectAnimator fadeOutV2 = ObjectAnimator.ofFloat(logoV2, "alpha", 0f);
|
|
fadeOutV2.setDuration(1000);
|
|
fadeOutV2.setStartDelay(0 + extraLogoDelay);
|
|
ObjectAnimator fadeInV2 = ObjectAnimator.ofFloat(logoV2, "alpha", 0f, 1f);
|
|
fadeInV2.setDuration(1000);
|
|
|
|
ObjectAnimator fadeOutArquivo = ObjectAnimator.ofFloat(logoArquivo, "alpha", 0f);
|
|
fadeOutArquivo.setDuration(1000);
|
|
fadeOutArquivo.setStartDelay(0 + extraLogoDelay);
|
|
ObjectAnimator fadeInArquivo = ObjectAnimator.ofFloat(logoArquivo, "alpha", 0f, 1f);
|
|
fadeInArquivo.setDuration(1000);
|
|
|
|
ObjectAnimator fadeOutAffectiva = ObjectAnimator.ofFloat(logoAffectiva, "alpha", 0f);
|
|
fadeOutAffectiva.setDuration(1000);
|
|
fadeOutAffectiva.setStartDelay(1000 + extraLogoDelay);
|
|
ObjectAnimator fadeInAffectiva = ObjectAnimator.ofFloat(logoAffectiva, "alpha", 0f, 1f);
|
|
fadeInAffectiva.setDuration(1000);
|
|
|
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
animatorSet.playSequentially(fadeInV2, fadeOutV2,
|
|
fadeInArquivo, fadeOutArquivo,
|
|
fadeInAffectiva, fadeOutAffectiva);
|
|
animatorSet.start();
|
|
|
|
|
|
continueHandler = new Handler();
|
|
continueHandler.postDelayed(continueRunnable, 7000 + (3*extraLogoDelay));
|
|
|
|
player.api.registerIfNeeded();
|
|
}
|
|
|
|
public void continueToMenu() {
|
|
continueHandler.removeCallbacks(continueRunnable);
|
|
Intent intent = new Intent(this, MenuActivity.class);
|
|
finish();
|
|
startActivity(intent);
|
|
//disable distracting transition when going to menu
|
|
IntroActivity.this.overridePendingTransition(0, 0);
|
|
}
|
|
}
|