Merge pull request #2408 from ecency/sa/splash-screen

splash screen fix
This commit is contained in:
Feruz M 2022-08-05 15:37:44 +03:00 committed by GitHub
commit fb3f1f5543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 10 deletions

View File

@ -28,16 +28,25 @@
android:allowBackup="false" android:allowBackup="false"
android:largeHeap="true" android:largeHeap="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<!-- Add this SplashActivity -->
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize"
<intent-filter> android:exported="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="Ecency" android:autoVerify="true"> <intent-filter android:label="Ecency" android:autoVerify="true">
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />

View File

@ -0,0 +1,16 @@
package app.esteem.mobile.android;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}

View File

@ -6,6 +6,8 @@ import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import org.devio.rn.splashscreen.SplashScreen;
import android.os.Bundle;
public class MainActivity extends ReactActivity { public class MainActivity extends ReactActivity {
/** /**
@ -33,6 +35,11 @@ public class MainActivity extends ReactActivity {
setIntent(intent); setIntent(intent);
} }
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
super.onCreate(savedInstanceState);
}
//native side reference: https://github.com/facebook/react-native/issues/28823#issuecomment-642032481 //native side reference: https://github.com/facebook/react-native/issues/28823#issuecomment-642032481
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/splashscreen_bg"/>
<item
android:drawable="@drawable/ecency_logo"
android:gravity="center" />
</layer-list>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?><vector xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android" android:height="104dp" android:viewportHeight="103.66" android:viewportWidth="107.0" android:width="107dp">
<path android:fillColor="#FF004BD8" android:pathData="M67.49,103.52c-13.16 0.11 -44.19 0.39 -51.15-0.42C10.69,102.44 0.28 ,98.67 0.16 ,84.45c-0.08-8.19-0.55-41.59 0.62 -49,2.43-15.4,6.56-25.06,24.16-33C39.88-4,71.78,1.37,75.23,27.15c0.65,4.9,1.83,5.45,3.63,5.83,28.55,6,34.86,38.23,21.25,55.8C91.45,100,82.1,102.14,67.49,103.52ZM62.3,35.88C63.29,19.1,46.27,7,29.08,16,16.81,22.37,15.75,31.66,15,42.24c-1,13.4-0.37,23.16-0.14,36.59 0.11 ,6,1.85,9.67,8.3,10.25,1.67 0.15 ,24.74,0,36.73 0.09 ,15.63 0.08 ,35-7.12,31.93-26.15A18.46,18.46,0,0,0,76.08,48.14a3.07,3.07,0,0,0-3.22,1.44C62.74,70.49,40.38,69.45,31.29,58c-8.18-10.28-3.94-27.27,6.81-30.87,4-1.36,7.43-0.16,9.09,2.71,2.68,4.64 0.18 ,8.83-3.62,11.14s-3.57,5.71-2,8c3.73,5.23,11.07,4.19,15.72-0.4C61.07,44.83,62,40.57,62.3,35.88Z "/>
</vector>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_splash"
android:orientation="vertical">
</LinearLayout>

View File

@ -2,4 +2,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/> <background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

View File

@ -2,4 +2,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/> <background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

View File

@ -3,4 +3,6 @@
<item name="splashBackground" type="color">#ffffff</item> <item name="splashBackground" type="color">#ffffff</item>
<item name="notification_icon" type="color">#ffffff</item> <item name="notification_icon" type="color">#ffffff</item>
<color name="primary_dark">#000000</color> <color name="primary_dark">#000000</color>
</resources> <color name="splashscreen_bg">#ffffff</color>
<color name="app_bg">#ffffff</color>
</resources>

View File

@ -1,6 +1,23 @@
<resources> <resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowExitAnimation">@android:anim/fade_out</item> <!-- Customize your theme here. -->
<item name="android:editTextBackground">@android:color/transparent</item> <item name="android:textColor">#000000</item>
<!-- Add the following line to set the default status bar color for all the app. -->
<item name="android:statusBarColor">@color/app_bg</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">false</item>
<!-- Add the following line to set the default background color for all the app. -->
<item name="android:windowBackground">@color/app_bg</item>
</style> </style>
<!-- Adds the splash screen definition -->
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">@color/splashscreen_bg</item>
<item name="android:background">@drawable/background_splash</item>
</style>
</resources> </resources>