style: customize v31 splash screen
Remove the icon background from the Android 12 splash screen, making it alot more cleaner than it was before.
This commit is contained in:
parent
64c9a4a4a7
commit
2f0df83cb2
6 changed files with 15 additions and 14 deletions
|
@ -117,12 +117,11 @@ class WidgetProvider : AppWidgetProvider() {
|
||||||
) {
|
) {
|
||||||
check(views.isNotEmpty()) { "Must provide a non-empty map" }
|
check(views.isNotEmpty()) { "Must provide a non-empty map" }
|
||||||
|
|
||||||
|
val name = ComponentName(context, WidgetProvider::class.java)
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
// Widgets are automatically responsive on Android 12, no need to do anything.
|
// Widgets are automatically responsive on Android 12, no need to do anything.
|
||||||
updateAppWidget(
|
updateAppWidget(name, RemoteViews(views))
|
||||||
ComponentName(context, WidgetProvider::class.java),
|
|
||||||
RemoteViews(views)
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we try our best to backport the responsive behavior to older versions.
|
// Otherwise, we try our best to backport the responsive behavior to older versions.
|
||||||
// This is mostly a guess based on RemoteView's documentation, and it has some
|
// This is mostly a guess based on RemoteView's documentation, and it has some
|
||||||
|
@ -131,15 +130,11 @@ class WidgetProvider : AppWidgetProvider() {
|
||||||
|
|
||||||
// Each widget has independent dimensions, so we iterate through them all
|
// Each widget has independent dimensions, so we iterate through them all
|
||||||
// and do this for each.
|
// and do this for each.
|
||||||
val ids = getAppWidgetIds(ComponentName(context, WidgetProvider::class.java))
|
val ids = getAppWidgetIds(name)
|
||||||
|
|
||||||
// Most of the major launchers seem to provide widget sizes that don't include
|
// Most of the major launchers seem to provide widget sizes that don't include
|
||||||
// padding. Query for the padding here so we can get a sane result later on.
|
// padding. Query for the padding here so we can get a sane result later on.
|
||||||
val padding = AppWidgetHostView.getDefaultPaddingForWidget(
|
val padding = AppWidgetHostView.getDefaultPaddingForWidget(context, name, null)
|
||||||
context,
|
|
||||||
ComponentName(context, WidgetProvider::class.java),
|
|
||||||
null
|
|
||||||
)
|
|
||||||
|
|
||||||
val density = context.resources.displayMetrics.density
|
val density = context.resources.displayMetrics.density
|
||||||
val padW = ((padding.left + padding.right) / density).toInt()
|
val padW = ((padding.left + padding.right) / density).toInt()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
||||||
<style name="Theme.Template" parent="Theme.Master">
|
<style name="Theme.Edge" parent="Theme.Master">
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@color/nav_color</item>
|
<item name="android:navigationBarColor">@color/nav_color</item>
|
||||||
<item name="android:windowLightStatusBar">false</item>
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
||||||
<style name="Theme.Template" parent="Theme.Master">
|
<style name="Theme.Edge" parent="Theme.Master">
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@color/nav_color</item>
|
<item name="android:navigationBarColor">@color/nav_color</item>
|
||||||
<item name="android:windowLightStatusBar">true</item>
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<style name="Theme.Splash" parent="Theme.Edge">
|
||||||
|
<item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Widget" parent="@android:style/Theme.DeviceDefault.DayNight">
|
<style name="Theme.Widget" parent="@android:style/Theme.DeviceDefault.DayNight">
|
||||||
<item name="colorAccent">?android:attr/colorAccent</item>
|
<item name="colorAccent">?android:attr/colorAccent</item>
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_width">wrap_content</item>
|
<item name="android:layout_width">wrap_content</item>
|
||||||
<item name="android:fontFamily">@font/inter_semibold</item>
|
<item name="android:fontFamily">@font/inter_semibold</item>
|
||||||
|
<item name="android:textColor">?attr/colorAccent</item>
|
||||||
<item name="android:textAppearance">?android:attr/textAppearanceButton</item>
|
<item name="android:textAppearance">?android:attr/textAppearanceButton</item>
|
||||||
<item name="rippleColor">?android:attr/colorControlHighlight</item>
|
<item name="rippleColor">?android:attr/colorControlHighlight</item>
|
||||||
<item name="cornerRadius">0dp</item>
|
<item name="cornerRadius">0dp</item>
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
<!-- Master parent theme based off of Theme.MaterialComponents.DayNight.NoActionBar.Bridge -->
|
<!-- Master parent theme based off of Theme.MaterialComponents.DayNight.NoActionBar.Bridge -->
|
||||||
<style name="Theme.Master" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge" />
|
<style name="Theme.Master" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge" />
|
||||||
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
||||||
<style name="Theme.Template" parent="Theme.Master" />
|
<style name="Theme.Edge" parent="Theme.Master" />
|
||||||
|
<!-- Android-12 Splashscreen config -->
|
||||||
|
<style name="Theme.Splash" parent="Theme.Edge" />
|
||||||
|
|
||||||
<!-- Base theme -->
|
<!-- Base theme -->
|
||||||
<style name="Theme.Base" parent="Theme.Template">
|
<style name="Theme.Base" parent="Theme.Splash">
|
||||||
<!-- Colors -->
|
<!-- Colors -->
|
||||||
<item name="colorSurface">@color/surface_color</item>
|
<item name="colorSurface">@color/surface_color</item>
|
||||||
<item name="colorAccent">@color/design_default_color_primary</item>
|
<item name="colorAccent">@color/design_default_color_primary</item>
|
||||||
|
|
Loading…
Reference in a new issue