mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 04:22:30 +01:00
Implement splash screen using Core Splashscreen library
This commit is contained in:
parent
13585ca0be
commit
d424656dc8
@ -240,6 +240,7 @@ dependencies {
|
|||||||
implementation "androidx.work:work-runtime-ktx:${androidxWorkVersion}"
|
implementation "androidx.work:work-runtime-ktx:${androidxWorkVersion}"
|
||||||
implementation "androidx.work:work-rxjava3:${androidxWorkVersion}"
|
implementation "androidx.work:work-rxjava3:${androidxWorkVersion}"
|
||||||
implementation 'com.google.android.material:material:1.11.0'
|
implementation 'com.google.android.material:material:1.11.0'
|
||||||
|
implementation 'androidx.core:core-splashscreen:1.0.1'
|
||||||
|
|
||||||
/** Third-party libraries **/
|
/** Third-party libraries **/
|
||||||
// Instance state boilerplate elimination
|
// Instance state boilerplate elimination
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:logo="@mipmap/ic_launcher"
|
android:logo="@mipmap/ic_launcher"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
android:theme="@style/OpeningTheme"
|
android:theme="@style/Base.SplashTheme"
|
||||||
tools:ignore="AllowBackup">
|
tools:ignore="AllowBackup">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
@ -48,6 +48,7 @@ import androidx.appcompat.app.ActionBar;
|
|||||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.splashscreen.SplashScreen;
|
||||||
import androidx.core.view.GravityCompat;
|
import androidx.core.view.GravityCompat;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@ -131,11 +132,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
+ "savedInstanceState = [" + savedInstanceState + "]");
|
+ "savedInstanceState = [" + savedInstanceState + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SplashScreen.installSplashScreen(this);
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
ThemeHelper.setDayNightMode(this);
|
ThemeHelper.setDayNightMode(this);
|
||||||
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
|
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
|
||||||
|
|
||||||
assureCorrectAppLanguage(this);
|
assureCorrectAppLanguage(this);
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
mainBinding = ActivityMainBinding.inflate(getLayoutInflater());
|
mainBinding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
drawerLayoutBinding = mainBinding.drawerLayout;
|
drawerLayoutBinding = mainBinding.drawerLayout;
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:drawable="@color/dark_youtube_primary_color"/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:width="80dp"
|
|
||||||
android:height="80dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:drawable="@drawable/splash_foreground"/>
|
|
||||||
</layer-list>
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:drawable="@color/dark_youtube_primary_color"/>
|
|
||||||
|
|
||||||
<item>
|
|
||||||
<bitmap
|
|
||||||
android:src="@drawable/ic_newpipe_triangle_white"
|
|
||||||
android:gravity="center_vertical|center_horizontal" />
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:drawable="@color/light_youtube_primary_color"/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:width="80dp"
|
|
||||||
android:height="80dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:drawable="@drawable/splash_foreground"/>
|
|
||||||
</layer-list>
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:drawable="@color/light_youtube_primary_color"/>
|
|
||||||
|
|
||||||
<item>
|
|
||||||
<bitmap
|
|
||||||
android:src="@drawable/ic_newpipe_triangle_white"
|
|
||||||
android:gravity="center_vertical|center_horizontal" />
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
@ -2,9 +2,15 @@
|
|||||||
android:width="100dp"
|
android:width="100dp"
|
||||||
android:height="100dp"
|
android:height="100dp"
|
||||||
android:viewportWidth="100"
|
android:viewportWidth="100"
|
||||||
android:viewportHeight="100">
|
android:viewportHeight="100"
|
||||||
|
android:gravity="center">
|
||||||
|
<group android:scaleX="0.57"
|
||||||
|
android:scaleY="0.57"
|
||||||
|
android:translateX="21.5"
|
||||||
|
android:translateY="21.5">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#ffffff"
|
android:fillColor="#ffffff"
|
||||||
android:pathData="m23.909,10.211v78.869c0,0 7.7,-4.556 12.4,-7.337V67.477,56.739 31.686c0,0 3.707,2.173 8.948,5.24 6.263,3.579 14.57,8.565 21.473,12.655 -9.358,5.483 -16.8,9.876 -22.496,13.234V77.053C57.974,68.927 75.176,58.762 90.762,49.581 75.551,40.634 57.144,29.768 43.467,21.715 31.963,14.94 23.909,10.211 23.909,10.211Z"
|
android:pathData="m23.909,10.211v78.869c0,0 7.7,-4.556 12.4,-7.337V67.477,56.739 31.686c0,0 3.707,2.173 8.948,5.24 6.263,3.579 14.57,8.565 21.473,12.655 -9.358,5.483 -16.8,9.876 -22.496,13.234V77.053C57.974,68.927 75.176,58.762 90.762,49.581 75.551,40.634 57.144,29.768 43.467,21.715 31.963,14.94 23.909,10.211 23.909,10.211Z"
|
||||||
android:strokeWidth="1.2782383" />
|
android:strokeWidth="1.2782383" />
|
||||||
|
</group>
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Opening Theme -->
|
<style name="Base.SplashTheme" parent="Theme.SplashScreen.IconBackground">
|
||||||
<style name="Base.OpeningTheme" parent="Base.V21.OpeningTheme">
|
<item name="windowSplashScreenIconBackgroundColor">@color/dark_youtube_primary_color</item>
|
||||||
<item name="android:navigationBarColor">@color/dark_youtube_primary_color</item>
|
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_foreground</item>
|
||||||
|
<item name="postSplashScreenTheme">@style/Base.DarkTheme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Opening Theme -->
|
<style name="Base.SplashTheme" parent="Theme.SplashScreen.IconBackground">
|
||||||
<style name="Base.V21.OpeningTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
<item name="windowSplashScreenIconBackgroundColor">@color/light_youtube_primary_color</item>
|
||||||
<item name="colorPrimary">@android:color/transparent</item>
|
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_foreground</item>
|
||||||
<item name="colorPrimaryDark">@android:color/transparent</item>
|
<item name="postSplashScreenTheme">@style/Base.LightTheme</item>
|
||||||
<item name="colorAccent">@android:color/transparent</item>
|
|
||||||
|
|
||||||
<item name="android:windowBackground">@drawable/splash_background</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="Base.OpeningTheme" parent="Base.V21.OpeningTheme">
|
|
||||||
<item name="android:navigationBarColor">@color/light_youtube_primary_color</item>
|
|
||||||
</style>
|
|
||||||
<style name="OpeningTheme" parent="Base.OpeningTheme" />
|
|
||||||
|
|
||||||
<!-- Base Theme -->
|
<!-- Base Theme -->
|
||||||
<style name="Base.V21" parent="Theme.AppCompat.DayNight.NoActionBar">
|
<style name="Base.V21" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||||
|
Loading…
Reference in New Issue
Block a user