fix splash light/dark implementation

This commit is contained in:
Harry Bond 2024-12-19 18:37:16 +00:00
parent ebbe713f8f
commit 9d6a1fb1ba
5 changed files with 16 additions and 26 deletions

View file

@ -61,16 +61,6 @@ public class SplashActivity extends AppCompatActivity
{
super.onCreate(savedInstanceState);
final Context context = getApplicationContext();
final String theme = Config.getUiThemeSettings(context);
//Need to change this to use android theme system instead of manually setting
// if (ThemeUtils.isDefaultTheme(context, theme))
// setTheme(R.style.MwmTheme_Splash);
// else if (ThemeUtils.isNightTheme(context, theme))
// setTheme(R.style.MwmTheme_Night_Splash);
// else
// throw new IllegalArgumentException("Attempt to apply unsupported theme: " + theme);
UiThread.cancelDelayedTasks(mInitCoreDelayedTask);
setContentView(R.layout.activity_splash);
mPermissionRequest = registerForActivityResult(new ActivityResultContracts.RequestMultiplePermissions(),

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="?attr/colorPrimary"/>
<item android:drawable="@drawable/ic_splash" android:gravity="center"/>
</layer-list>

View file

@ -5,14 +5,15 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:gravity="center">
android:gravity="center"
android:theme="@style/MwmTheme.Splash">
<ImageView
android:id="@+id/iv__logo"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:contentDescription="@null"
app:srcCompat="@drawable/splash"
app:srcCompat="@drawable/ic_splash"
android:layout_weight="1000"
android:layout_margin="@dimen/margin_double"/>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MwmTheme" parent="MwmTheme.Base"/>
<style name="MwmTheme.Night" parent="MwmTheme.Night.Base"/>
<style name="MwmTheme.Splash">
<item name="android:background">@color/bg_primary_night</item>
<item name="android:textColorPrimary">@color/white_primary</item>
<item name="android:navigationBarColor">@color/bg_primary_night</item>
<item name="android:statusBarColor">@color/bg_primary_night</item>
</style>
</resources>

View file

@ -4,19 +4,12 @@
<style name="MwmTheme.Night" parent="MwmTheme.Night.Base"/>
<style name="MwmTheme.Splash">
<item name="android:windowBackground">@color/bg_primary</item>
<item name="android:background">@color/bg_primary</item>
<item name="android:textColorPrimary">@color/white_primary</item>
<item name="android:navigationBarColor">@color/bg_primary</item>
<item name="android:statusBarColor">@color/bg_primary</item>
</style>
<style name="MwmTheme.Night.Splash">
<item name="android:windowBackground">@color/bg_primary_night</item>
<item name="android:textColorPrimary">@color/white_primary</item>
<item name="android:navigationBarColor">@color/bg_primary_night</item>
<item name="android:statusBarColor">@color/bg_primary_night</item>
</style>
<!-- Theme is overridden in v27 folder to handle cutouts -->
<style name="MwmTheme.MainActivity">
<item name="android:colorPrimaryDark">@android:color/black</item>