|
| 1 | +package com.app.splashapplication; |
| 2 | + |
| 3 | +import android.content.Intent; |
| 4 | +import android.os.Bundle; |
| 5 | +import android.view.View; |
| 6 | +import android.view.animation.Animation; |
| 7 | +import android.widget.ImageView; |
| 8 | + |
| 9 | +import androidx.appcompat.app.AppCompatActivity; |
| 10 | + |
| 11 | +import com.app.lets_go_splash.CreateAnim; |
| 12 | +import com.app.lets_go_splash.OnAnimationListener; |
| 13 | +import com.app.lets_go_splash.StarterAnimation; |
| 14 | + |
| 15 | +import java.util.ArrayList; |
| 16 | + |
| 17 | +public class JavaSplashActivity extends AppCompatActivity { |
| 18 | + |
| 19 | + private ImageView appLogo; |
| 20 | + |
| 21 | + @Override |
| 22 | + protected void onCreate(Bundle savedInstanceState) { |
| 23 | + super.onCreate(savedInstanceState); |
| 24 | + setContentView(R.layout.activity_starter); |
| 25 | + useStarterLibrary(); |
| 26 | + } |
| 27 | + |
| 28 | + private void useStarterLibrary() { |
| 29 | + appLogo = findViewById(R.id.imageView); |
| 30 | + new StarterAnimation(getAnimList(), new OnAnimationListener() { |
| 31 | + @Override |
| 32 | + public void onStartAnim() { // TODO:: |
| 33 | + } |
| 34 | + |
| 35 | + @Override |
| 36 | + public void onRepeat() { // TODO:: |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + public void onEnd() { |
| 41 | + whatToDoNext(); |
| 42 | + } |
| 43 | + }).startSequentialAnimation(appLogo); |
| 44 | + } |
| 45 | + |
| 46 | + private void whatToDoNext() { |
| 47 | + appLogo.setVisibility(View.GONE); |
| 48 | + Intent intent = new Intent(this, MainActivity.class); |
| 49 | + startActivity(intent); |
| 50 | + overridePendingTransition(R.anim.whole_animation, R.anim.no_animaiton); |
| 51 | + finish(); |
| 52 | + } |
| 53 | + |
| 54 | + private ArrayList<Animation> getAnimList() { |
| 55 | + ArrayList<Animation> animList = new ArrayList<>(); |
| 56 | + animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.no_animaiton)); |
| 57 | + animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.rotate)); |
| 58 | + animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.zoom_out_fast)); |
| 59 | + animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.fade_in)); |
| 60 | + |
| 61 | + return animList; |
| 62 | + } |
| 63 | +} |
0 commit comments