Skip to content

Commit

Permalink
Merge pull request #55 from jama5262/issue-53
Browse files Browse the repository at this point in the history
Add  a splash screen animation (Issue 53)
  • Loading branch information
michaelbukachi authored Mar 22, 2020
2 parents 253fdd2 + e5f3530 commit b41139c
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ dependencies {
implementation (Libraries.ktxCore)
api(Libraries.constraintLayout)
implementation (Libraries.materialComponents)
implementation(Libraries.androidAnimation)
api(Libraries.coil)
api(Libraries.shapedImageView)
testImplementation (TestLibraries.junit4)
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".HomeActivity"></activity>
<activity
android:name=".HomeActivity"
android:name=".SplashScreenActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.android254.droidconKE2020

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.example.android_animation.AndroidAnimation
import com.example.android_animation.enums.Easing
import kotlinx.android.synthetic.main.activity_splash_screen.*

class SplashScreenActivity : AppCompatActivity() {

private val MAX_SCALE = 1.5f
private val MIN_SCALE = .3f
private val MAX_ROTATION = 360f
private val MIN_ROTATION = -45f
private val MAX_TRANSLATION_X = 310f
private val MAX_TRANSLATION_Y = 170f

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
startAnimation()
}

private fun startAnimation() {
AndroidAnimation().apply {
delay = 1000
targetViews(imageViewLogo)
scaleX(MAX_SCALE)
scaleY(MAX_SCALE)
thenPlay()
easing = Easing.EXP_IN
translateX(MAX_TRANSLATION_X)
translateY(-MAX_TRANSLATION_Y + 40f)
scaleX(MAX_SCALE - 1f)
scaleY(MAX_SCALE - 1f)
rotate(MIN_ROTATION)
thenPlay()
easing = Easing.CIRC_OUT
translateX(-MAX_TRANSLATION_X)
translateY(-MAX_TRANSLATION_Y, delay = 5400)
scaleX(MIN_SCALE)
scaleY(MIN_SCALE)
rotate(MAX_ROTATION)
targetChildViews(linearLayout, stagger = 100, reverse = true)
scaleX((MIN_SCALE + .2f), 1f, MAX_SCALE, 1f)
scaleY((MIN_SCALE + .2f), 1f, MAX_SCALE, 1f)
alpha(1f)
onAnimationEnd {
startActivity(Intent(this@SplashScreenActivity, HomeActivity::class.java))
finish()
}
start()
}
}
}
84 changes: 84 additions & 0 deletions app/src/main/res/drawable-v24/ic_droidcon_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:fillColor="#fed64b"
android:pathData="M256,256m-256,0a256,256 0,1 1,512 0a256,256 0,1 1,-512 0" />
<path
android:fillColor="#68dea4"
android:pathData="M295.89,74.36A100.34,100.34 0,0 0,183.64 156.9a3.5,3.5 0,0 0,3 4l191.83,25.73a3.5,3.5 0,0 0,4 -3.11A100.34,100.34 0,0 0,295.89 74.36Z" />
<path
android:fillColor="#68dea4"
android:pathData="M286.93,141.15a42.69,42.69 0,0 1,-33 -24L224.71,55.79a5.83,5.83 0,1 1,10.53 -5l29.23,61.33A31.19,31.19 0,0 0,316.25 119l44,-51.05a5.84,5.84 0,1 1,8.84 7.62l-44,51.05A42.68,42.68 0,0 1,286.93 141.15Z" />
<path
android:fillColor="#fff"
android:pathData="M277.07,117.15a8.75,8.75 0,1 0,7.51 9.84A8.75,8.75 0,0 0,277.07 117.15Z" />
<path
android:fillColor="#fff"
android:pathData="M348.89,126.79a8.75,8.75 0,1 0,7.51 9.83A8.75,8.75 0,0 0,348.89 126.79Z" />
<path
android:fillColor="#68dea4"
android:pathData="M183.606,408.331L195.139,325.853A22.53,22.53 52.96,0 1,220.572 306.66L222.166,306.883A22.53,22.53 52.96,0 1,241.359 332.316L229.826,414.794A22.53,22.53 52.96,0 1,204.394 433.987L202.799,433.764A22.53,22.53 52.96,0 1,183.606 408.331z" />
<path
android:fillColor="#019547"
android:pathData="M190.183,361.319l3.601,-25.749l46.22,6.463l-3.601,25.749z" />
<path
android:fillColor="#68dea4"
android:pathData="M266.922,419.978L278.455,337.501A22.53,22.53 52.96,0 1,303.888 318.308L305.482,318.531A22.53,22.53 52.96,0 1,324.675 343.964L313.142,426.441A22.53,22.53 52.96,0 1,287.71 445.634L286.115,445.411A22.53,22.53 52.96,0 1,266.922 419.978z" />
<path
android:fillColor="#019547"
android:pathData="M273.499,372.967l3.601,-25.749l46.22,6.463l-3.601,25.749z" />
<path
android:fillColor="#68dea4"
android:pathData="M377.242,305.832L388.775,223.355A22.53,22.53 52.96,0 1,414.208 204.162L415.802,204.385A22.53,22.53 52.96,0 1,434.995 229.818L423.462,312.295A22.53,22.53 52.96,0 1,398.03 331.488L396.435,331.265A22.53,22.53 52.96,0 1,377.242 305.832z" />
<path
android:fillColor="#68dea4"
android:pathData="M118.358,252.159L171.767,188.26A22.53,22.53 84.89,0 1,203.503 185.422L204.738,186.455A22.53,22.53 84.89,0 1,207.576 218.19L154.167,282.089A22.53,22.53 84.89,0 1,122.432 284.927L121.196,283.895A22.53,22.53 84.89,0 1,118.358 252.159z" />
<path
android:fillColor="#68dea4"
android:pathData="M324.8,380.17 L185.24,360.64a30,30 0,0 1,-25.56 -33.87l20.88,-149.22a6,6 0,0 1,6.77 -5.11l187.1,26.18a6,6 0,0 1,5.11 6.77L358.67,354.61A30,30 0,0 1,324.8 380.17Z" />
<path
android:fillColor="#fff"
android:pathData="M290.99,166.18l-45.29,33.48l-9.1,-4.48l-9.54,4.88l-3.39,-7.57l8.66,-3.11l4.68,-9.49l53.98,-13.71z" />
<path
android:fillColor="#fff"
android:pathData="M143.35,93.35l0.99,56.31l9.1,4.49l1.93,10.54l8.07,-1.92l-2.81,-8.76l4.69,-9.49l-21.97,-51.17z" />
<path
android:fillColor="#fff"
android:pathData="M40.001,302.159l50.589,-25.025l2.346,4.742l-50.589,25.025z" />
<path
android:fillColor="#fff"
android:pathData="M173.134,319.118l5.19,-1.023l11.409,57.886l-5.19,1.023z" />
<path
android:fillColor="#FF000000"
android:pathData="M205,156.47c-4.35,0.46 -65,7.95 -93.73,64.4 -29.06,57.06 3,111.8 5.06,115.35 4.09,-0.5 67.9,-8 95.49,-65.74C239.13,213.32 207.3,160.21 205,156.47Z" />
<path
android:fillColor="#ed1c24"
android:pathData="M209,148.36c-4.75,0.5 -70.83,8.67 -102.18,70.2C75.11,280.76 110,340.43 112.3,344.3c4.46,-0.55 74,-8.68 104.1,-71.67C246.16,210.32 211.46,152.43 209,148.36Z" />
<path
android:fillColor="#ed1c24"
android:pathData="M111,347.12l-1,-1.48c-3.89,-6.61 -37.12,-66.36 -5.58,-128.28C136.7,154 205.76,146 208.69,145.73l1.66,-0.18 0.87,1.43c3.92,6.4 37.39,64.35 7.57,126.79 -29,60.84 -93.46,71.6 -106.08,73.14ZM207.58,151.2c-10.92,1.54 -69.79,12.33 -98.43,68.56s-1.65,110.49 4.57,121.68c15.48,-2.18 73.57,-14 100.29,-69.95C241.06,214.87 213.83,162.05 207.58,151.2Z" />
<path
android:fillColor="#191d1d"
android:pathData="M130.07,182.77S141,236.18 91.45,261.05C91.45,261.05 94.3,216.85 130.07,182.77Z" />
<path
android:fillColor="#191d1d"
android:pathData="M231.14,232.62s-49,23.85 -38.63,78.29C192.51,310.91 225.86,281.75 231.14,232.62Z" />
<path
android:fillColor="#fff"
android:pathData="M185.29,195.84c-8.3,16.82 -14.37,30.78 -15,30.46s3.56,-15.2 11.86,-32 17.53,-29.21 18.19,-28.89S193.58,179 185.29,195.84Z" />
<path
android:fillColor="#fff"
android:pathData="M187.16,196.77c-8.3,16.82 -15.68,30.13 -15,30.45s9.89,-12.07 18.18,-28.89 12.52,-31.69 11.86,-32S195.46,180 187.16,196.77Z" />
<path
android:fillColor="#fff"
android:pathData="M132.06,303.73c-8.3,16.82 -14.37,30.77 -15,30.45s3.56,-15.19 11.86,-32 17.53,-29.22 18.19,-28.89S140.36,286.91 132.06,303.73Z" />
<path
android:fillColor="#fff"
android:pathData="M133.93,304.65c-8.29,16.82 -15.67,30.13 -15,30.45S128.8,323 137.1,306.21s12.51,-31.69 11.86,-32S142.23,287.83 133.93,304.65Z" />
<path
android:fillColor="#fff"
android:pathData="M160.26,250.57m-7.96,0a7.96,7.96 0,1 1,15.92 0a7.96,7.96 0,1 1,-15.92 0" />
</vector>
7 changes: 7 additions & 0 deletions app/src/main/res/font/roboto_slab.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="Roboto Slab"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
150 changes: 150 additions & 0 deletions app/src/main/res/layout/activity_splash_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SplashScreenActivity">

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.39">

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="."
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="d"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="r"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="o"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="i"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="d"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="c"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="o"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="n"
android:textColor="@color/design_default_color_on_secondary"
android:textSize="40sp" />

<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="K"
android:textColor="#773498"
android:textSize="40sp" />

<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:fontFamily="@font/roboto_slab"
android:text="e"
android:textColor="#773498"
android:textSize="40sp" />
</LinearLayout>

<ImageView
android:id="@+id/imageViewLogo"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleX="0"
android:scaleY="0"
android:src="@drawable/ic_droidcon_logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4" />

</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/preloaded_fonts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<resources>
<array name="preloaded_fonts" translatable="false">
<item>@font/roboto</item>
<item>@font/roboto_slab</item>
</array>
</resources>
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ object Versions {
const val constraintLayout = "1.1.3"
const val ktx = "1.1.0"
const val material = "1.1.0-rc02"
const val androidAnimation = "0.2.0"
const val shapedImageView = "0.8.7"
const val coil = "0.9.5"
const val koin = "2.1.4"
Expand Down Expand Up @@ -45,6 +46,7 @@ object Libraries {
const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}"
const val ktxCore = "androidx.core:core-ktx:${Versions.ktx}"
const val materialComponents = "com.google.android.material:material:${Versions.material}"
const val androidAnimation = "com.github.jama5262:AndroidAnimation:${Versions.androidAnimation}"
const val shapedImageView = "cn.gavinliu:ShapedImageView:${Versions.shapedImageView}"
const val coil = "io.coil-kt:coil:${Versions.coil}"

Expand Down

0 comments on commit b41139c

Please sign in to comment.