From 9c832263cdaaca4726926c0184f306340efa6697 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Wed, 16 Oct 2024 22:04:37 +0530 Subject: [PATCH] Implement splash screen using Core Splashscreen library --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 2 +- .../java/org/schabi/newpipe/MainActivity.java | 6 +++++- .../res/drawable-night-v23/splash_background.xml | 12 ------------ .../res/drawable-night/splash_background.xml | 12 ------------ .../main/res/drawable-v23/splash_background.xml | 12 ------------ app/src/main/res/drawable/splash_background.xml | 12 ------------ app/src/main/res/drawable/splash_foreground.xml | 16 +++++++++++----- app/src/main/res/values-night/styles.xml | 7 ++++--- app/src/main/res/values/styles.xml | 15 ++++----------- 10 files changed, 26 insertions(+), 69 deletions(-) delete mode 100644 app/src/main/res/drawable-night-v23/splash_background.xml delete mode 100644 app/src/main/res/drawable-night/splash_background.xml delete mode 100644 app/src/main/res/drawable-v23/splash_background.xml delete mode 100644 app/src/main/res/drawable/splash_background.xml diff --git a/app/build.gradle b/app/build.gradle index 98270fa70..d3fd952f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -242,6 +242,7 @@ dependencies { implementation "androidx.work:work-runtime-ktx:${androidxWorkVersion}" implementation "androidx.work:work-rxjava3:${androidxWorkVersion}" implementation 'com.google.android.material:material:1.11.0' + implementation 'androidx.core:core-splashscreen:1.0.1' /** Third-party libraries **/ // Instance state boilerplate elimination diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c44f8bf2c..ed5a1e3d0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,7 +34,7 @@ android:label="@string/app_name" android:logo="@mipmap/ic_launcher" android:resizeableActivity="true" - android:theme="@style/OpeningTheme" + android:theme="@style/Base.SplashTheme" tools:ignore="AllowBackup"> - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-night/splash_background.xml b/app/src/main/res/drawable-night/splash_background.xml deleted file mode 100644 index 237f4cdae..000000000 --- a/app/src/main/res/drawable-night/splash_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v23/splash_background.xml b/app/src/main/res/drawable-v23/splash_background.xml deleted file mode 100644 index a11787c8a..000000000 --- a/app/src/main/res/drawable-v23/splash_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/splash_background.xml b/app/src/main/res/drawable/splash_background.xml deleted file mode 100644 index c9b018add..000000000 --- a/app/src/main/res/drawable/splash_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/splash_foreground.xml b/app/src/main/res/drawable/splash_foreground.xml index 63fd0351f..9df2ee3f6 100644 --- a/app/src/main/res/drawable/splash_foreground.xml +++ b/app/src/main/res/drawable/splash_foreground.xml @@ -2,9 +2,15 @@ android:width="100dp" android:height="100dp" android:viewportWidth="100" - android:viewportHeight="100"> - + android:viewportHeight="100" + android:gravity="center"> + + + diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 7327ac145..3eaa41611 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -1,9 +1,10 @@ - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 164f10672..2e31c7aeb 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,17 +1,10 @@ - - - -