-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sam43/java_implementation
Java implementation of the library
- Loading branch information
Showing
6 changed files
with
112 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
app/src/main/java/com/app/splashapplication/JavaSplashActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.app.splashapplication; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.animation.Animation; | ||
import android.widget.ImageView; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.app.lets_go_splash.CreateAnim; | ||
import com.app.lets_go_splash.OnAnimationListener; | ||
import com.app.lets_go_splash.StarterAnimation; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class JavaSplashActivity extends AppCompatActivity { | ||
|
||
private ImageView appLogo; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_starter); | ||
useStarterLibrary(); | ||
} | ||
|
||
private void useStarterLibrary() { | ||
appLogo = findViewById(R.id.imageView); | ||
new StarterAnimation(getAnimList(), new OnAnimationListener() { | ||
@Override | ||
public void onStartAnim() { // TODO:: | ||
} | ||
|
||
@Override | ||
public void onRepeat() { // TODO:: | ||
} | ||
|
||
@Override | ||
public void onEnd() { | ||
whatToDoNext(); | ||
} | ||
}).startSequentialAnimation(appLogo); | ||
} | ||
|
||
private void whatToDoNext() { | ||
appLogo.setVisibility(View.GONE); | ||
Intent intent = new Intent(this, MainActivity.class); | ||
startActivity(intent); | ||
overridePendingTransition(R.anim.whole_animation, R.anim.no_animaiton); | ||
finish(); | ||
} | ||
|
||
private ArrayList<Animation> getAnimList() { | ||
ArrayList<Animation> animList = new ArrayList<>(); | ||
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.no_animaiton)); | ||
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.rotate)); | ||
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.zoom_out_fast)); | ||
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.fade_in)); | ||
|
||
return animList; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".JavaSplashActivity"> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
14 changes: 14 additions & 0 deletions
14
lets_go_splash/src/main/java/com/app/lets_go_splash/CreateAnim.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.app.lets_go_splash | ||
|
||
import android.content.Context | ||
import android.view.animation.Animation | ||
import android.view.animation.AnimationUtils | ||
|
||
object CreateAnim { | ||
fun createAnimation(applicationContext: Context, animFile: Int): Animation { | ||
return AnimationUtils.loadAnimation( | ||
applicationContext, | ||
animFile | ||
) | ||
} | ||
} |