Skip to content

Commit

Permalink
feat: support animated logo in splash screen on Android. (#537)
Browse files Browse the repository at this point in the history
* feat: support animated logo in splash screen on Android.

* chore: update animated logo.
  • Loading branch information
richardo2016x authored Dec 27, 2024
1 parent 9356846 commit 06a712d
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 16 deletions.
2 changes: 2 additions & 0 deletions apps/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ dependencies {

implementation project(':react-native-splash-screen')
// implementation project(':isudaji_react-native-install-apk')

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 15 additions & 12 deletions apps/mobile/android/app/src/main/res/layout/launch_screen.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
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"
android:background="@color/launchscreen_bg"
android:orientation="vertical">

<!-- https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android%3alayout_marginBottom -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="246sp"
android:scaleType="centerCrop"
android:src="@drawable/ic_launch_screen"
android:translationX="-1sp"
android:translationY="-40sp"
tools:ignore="ImageContrastCheck" />
<pl.droidsonroids.gif.GifImageView
android:id="@+id/gifImageView"
android:layout_width="389px"
android:layout_height="517px"
android:layout_centerInParent="true"
android:layout_marginTop="246sp"
android:scaleType="centerCrop"
android:src="@drawable/animated_logo"
android:translationX="-1sp"
android:translationY="-40sp"
app:loopCount="100"
tools:ignore="ImageContrastCheck" />

</RelativeLayout>
9 changes: 9 additions & 0 deletions apps/mobile/android/app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="text">#000000</color>
<color name="background">#ffffff</color>
<color name="primary">#7084ff</color>
<color name="primary_dark">#7084ff</color>
<color name="launchscreen_bg">#131416</color>
<color name="status_bar_color">#ffffff</color>
</resources>
5 changes: 5 additions & 0 deletions apps/mobile/android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
8 changes: 6 additions & 2 deletions apps/mobile/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
<!-- <item name="android:fontFamily">@font/sf_pro</item> -->
</style>
<style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
<item name="colorPrimaryDark">@color/status_bar_color</item>
<!-- <item name="android:statusBarColor">@color/primary</item> -->
<!-- Add the following line to set the default status bar text color for all the app to be a light color (false) or a dark color (true) -->
<item name="android:windowLightStatusBar">true</item>
<!-- <item name="android:windowBackground">@drawable/background_splash</item> -->
<!-- Prevents white screen from appearing when opening the app -->
<item name="android:windowDisablePreview">true</item>
</style>
<!-- <style name="SplashScreenThemeNotUsedNow" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">@color/status_bar_color</item>
<item name="android:windowBackground">@drawable/background_splash</item>
<item name="android:statusBarColor">@color/primary</item>
<item name="android:navigationBarColor">@color/primary</item>
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ buildscript {

allprojects {
repositories {
mavenCentral()
google() // Google's Maven repository
maven { url 'https://www.jitpack.io' }
}
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apply from: file("../node_modules/@react-native-community/cli-platform-android/n
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
// include ':react-native-splash-screen'
// project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')

// include ':isudaji_react-native-install-apk'
// project(':isudaji_react-native-install-apk').projectDir = new File(rootProject.projectDir, '../node_modules/@isudaji/react-native-install-apk/android')
Expand Down

0 comments on commit 06a712d

Please sign in to comment.