From dbd70d1d0b5da29aeb5f17c9fd8c0cea2888451c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Wed, 7 May 2025 13:23:27 +0200 Subject: [PATCH] [UI] Upgrade to Material 4 --- app/src/main/AndroidManifest.xml | 14 ++--- .../edziennik/core/manager/UiManager.kt | 6 +- .../edziennik/data/config/Config.kt | 2 +- .../config/migration/ConfigMigration14.kt | 4 +- .../edziennik/data/enums/Theme.kt | 34 +++++------ .../edziennik/ext/DialogExtensions.kt | 4 +- .../edziennik/ui/debug/DebugFragment.java | 2 +- .../dialogs/settings/ProfileConfigDialog.kt | 2 +- .../edziennik/ui/login/LoginActivity.kt | 2 +- app/src/main/res/drawable/emoji_glasses.xml | 2 +- app/src/main/res/drawable/ic_announcement.xml | 4 +- app/src/main/res/drawable/ic_archive.xml | 2 +- app/src/main/res/drawable/ic_attendance.xml | 8 +-- app/src/main/res/drawable/ic_behavior.xml | 4 +- app/src/main/res/drawable/ic_bell.xml | 4 +- .../main/res/drawable/ic_calendar_event.xml | 8 +-- app/src/main/res/drawable/ic_no_messages.xml | 2 +- .../main/res/drawable/ic_no_notifications.xml | 4 +- app/src/main/res/drawable/ic_note.xml | 4 +- app/src/main/res/drawable/ic_rip.xml | 10 ++-- app/src/main/res/drawable/ic_sunbed.xml | 2 +- app/src/main/res/drawable/ic_timetable.xml | 8 +-- .../res/drawable/ic_web_push_no_browsers.xml | 2 +- .../main/res/drawable/profile_archived.xml | 2 +- app/src/main/res/layout/activity_counter.xml | 4 +- app/src/main/res/layout/card_home.xml | 2 +- .../res/layout/material_drawer_header.xml | 2 +- .../res/layout/messages_compose_fragment.xml | 2 +- .../main/res/values-night/styles_black.xml | 12 ++-- app/src/main/res/values/styles.xml | 44 +++++++------- app/src/main/res/values/styles_black.xml | 12 ++-- app/src/main/res/values/styles_m2.xml | 2 +- app/src/main/res/values/styles_m3.xml | 58 +++++++++---------- 33 files changed, 137 insertions(+), 137 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8f6aabd4..8f7c4628 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,7 +25,7 @@ android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" - android:theme="@style/AppTheme.M3.Blue" + android:theme="@style/AppTheme.M4.Blue" android:usesCleartextTraffic="true" tools:ignore="UnusedAttribute"> @@ -67,7 +67,7 @@ android:excludeFromRecents="true" android:noHistory="true" android:exported="true" - android:theme="@style/AppTheme.M3.NoDisplay"> + android:theme="@style/AppTheme.M4.NoDisplay"> @@ -91,7 +91,7 @@ android:excludeFromRecents="true" android:noHistory="true" android:exported="true" - android:theme="@style/AppTheme.M3.NoDisplay" /> + android:theme="@style/AppTheme.M4.NoDisplay" /> + android:theme="@style/AppTheme.M4" /> + android:theme="@style/AppTheme.M4" /> + android:theme="@style/AppTheme.M4" /> + android:theme="@style/AppTheme.M4" /> R.style.AppTheme_M2_NoDisplay - Type.M3 -> R.style.AppTheme_M3_NoDisplay + Type.M4 -> R.style.AppTheme_M4_NoDisplay } } else { var color = app.config.ui.themeColor if ( Build.VERSION.SDK_INT < Build.VERSION_CODES.S && color == Theme.DEFAULT - && type == Type.M3 + && type == Type.M4 ) { color = Theme.BLUE } Timber.d("Applying theme $color($type, $mode)") - color.styleRes[type to mode] ?: color.styleRes[Type.M3 to Mode.DAYNIGHT]!! + color.styleRes[type to mode] ?: color.styleRes[Type.M4 to Mode.DAYNIGHT]!! } activity.setTheme(themeRes) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/config/Config.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/config/Config.kt index 4db241f8..7d976a84 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/config/Config.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/config/Config.kt @@ -69,7 +69,7 @@ class Config(app: App) : BaseConfig(app, profileId = null) { inner class UI { var themeColor by config(Theme.DEFAULT) - var themeType by config(Theme.Type.M3) + var themeType by config(Theme.Type.M4) var themeMode by config(Theme.Mode.DAYNIGHT) var themeNightMode by config(null) var themeBlackMode by config(false) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/config/migration/ConfigMigration14.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/config/migration/ConfigMigration14.kt index 1d76859b..4b61e6c8 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/config/migration/ConfigMigration14.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/config/migration/ConfigMigration14.kt @@ -16,7 +16,7 @@ import pl.szczodrzynski.edziennik.data.enums.Theme.Mode.FULL import pl.szczodrzynski.edziennik.data.enums.Theme.PURPLE import pl.szczodrzynski.edziennik.data.enums.Theme.RED import pl.szczodrzynski.edziennik.data.enums.Theme.TEAL -import pl.szczodrzynski.edziennik.data.enums.Theme.Type.M3 +import pl.szczodrzynski.edziennik.data.enums.Theme.Type.M4 import pl.szczodrzynski.edziennik.ext.toJsonArray class ConfigMigration14 : BaseMigration() { @@ -38,7 +38,7 @@ class ConfigMigration14 : BaseMigration() { 6 -> TEAL else -> DEFAULT } - ui.themeType = M3 + ui.themeType = M4 ui.themeMode = when (it) { // Light, Dark, Black, Red, Amber 0, 1, 2, 13, 16 -> DAYNIGHT diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/enums/Theme.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/enums/Theme.kt index f3f98471..9ba81f4a 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/enums/Theme.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/enums/Theme.kt @@ -14,7 +14,7 @@ enum class Theme( nameRes = R.string.theme_default, styleRes = mapOf( (Type.M2 to Mode.DAYNIGHT) to R.style.AppTheme_M2, - (Type.M3 to Mode.DAYNIGHT) to R.style.AppTheme_M3, + (Type.M4 to Mode.DAYNIGHT) to R.style.AppTheme_M4, ), ), RED( @@ -22,9 +22,9 @@ enum class Theme( styleRes = mapOf( (Type.M2 to Mode.DAYNIGHT) to R.style.AppTheme_M2_Red, (Type.M2 to Mode.FULL) to R.style.AppTheme_M2_Red_Full, - (Type.M3 to Mode.DAYNIGHT) to R.style.AppTheme_M3_Red, - (Type.M3 to Mode.FULL) to R.style.AppTheme_M3_Red_Full, - (Type.M3 to Mode.CLASSIC) to R.style.AppTheme_M3_Red_Classic, + (Type.M4 to Mode.DAYNIGHT) to R.style.AppTheme_M4_Red, + (Type.M4 to Mode.FULL) to R.style.AppTheme_M4_Red_Full, + (Type.M4 to Mode.CLASSIC) to R.style.AppTheme_M4_Red_Classic, ), ), GREEN( @@ -32,9 +32,9 @@ enum class Theme( styleRes = mapOf( (Type.M2 to Mode.DAYNIGHT) to R.style.AppTheme_M2_Green, (Type.M2 to Mode.FULL) to R.style.AppTheme_M2_Green_Full, - (Type.M3 to Mode.DAYNIGHT) to R.style.AppTheme_M3_Green, - (Type.M3 to Mode.FULL) to R.style.AppTheme_M3_Green_Full, - (Type.M3 to Mode.CLASSIC) to R.style.AppTheme_M3_Green_Classic, + (Type.M4 to Mode.DAYNIGHT) to R.style.AppTheme_M4_Green, + (Type.M4 to Mode.FULL) to R.style.AppTheme_M4_Green_Full, + (Type.M4 to Mode.CLASSIC) to R.style.AppTheme_M4_Green_Classic, ), ), BLUE( @@ -42,9 +42,9 @@ enum class Theme( styleRes = mapOf( (Type.M2 to Mode.DAYNIGHT) to R.style.AppTheme_M2_Blue, (Type.M2 to Mode.FULL) to R.style.AppTheme_M2_Blue_Full, - (Type.M3 to Mode.DAYNIGHT) to R.style.AppTheme_M3_Blue, - (Type.M3 to Mode.FULL) to R.style.AppTheme_M3_Blue_Full, - (Type.M3 to Mode.CLASSIC) to R.style.AppTheme_M3_Blue_Classic, + (Type.M4 to Mode.DAYNIGHT) to R.style.AppTheme_M4_Blue, + (Type.M4 to Mode.FULL) to R.style.AppTheme_M4_Blue_Full, + (Type.M4 to Mode.CLASSIC) to R.style.AppTheme_M4_Blue_Classic, ), ), PURPLE( @@ -52,9 +52,9 @@ enum class Theme( styleRes = mapOf( (Type.M2 to Mode.DAYNIGHT) to R.style.AppTheme_M2_Purple, (Type.M2 to Mode.FULL) to R.style.AppTheme_M2_Purple_Full, - (Type.M3 to Mode.DAYNIGHT) to R.style.AppTheme_M3_Purple, - (Type.M3 to Mode.FULL) to R.style.AppTheme_M3_Purple_Full, - (Type.M3 to Mode.CLASSIC) to R.style.AppTheme_M3_Purple_Classic, + (Type.M4 to Mode.DAYNIGHT) to R.style.AppTheme_M4_Purple, + (Type.M4 to Mode.FULL) to R.style.AppTheme_M4_Purple_Full, + (Type.M4 to Mode.CLASSIC) to R.style.AppTheme_M4_Purple_Classic, ), ), TEAL( @@ -62,15 +62,15 @@ enum class Theme( styleRes = mapOf( (Type.M2 to Mode.DAYNIGHT) to R.style.AppTheme_M2_Teal, (Type.M2 to Mode.FULL) to R.style.AppTheme_M2_Teal_Full, - (Type.M3 to Mode.DAYNIGHT) to R.style.AppTheme_M3_Teal, - (Type.M3 to Mode.FULL) to R.style.AppTheme_M3_Teal_Full, - (Type.M3 to Mode.CLASSIC) to R.style.AppTheme_M3_Teal_Classic, + (Type.M4 to Mode.DAYNIGHT) to R.style.AppTheme_M4_Teal, + (Type.M4 to Mode.FULL) to R.style.AppTheme_M4_Teal_Full, + (Type.M4 to Mode.CLASSIC) to R.style.AppTheme_M4_Teal_Classic, ), ); enum class Type { M2, - M3, + M4, } enum class Mode { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ext/DialogExtensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ext/DialogExtensions.kt index f887f3ea..5c065be6 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ext/DialogExtensions.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ext/DialogExtensions.kt @@ -30,13 +30,13 @@ fun AlertDialog.overlayBackgroundColor(color: Int, alpha: Int) { val backgroundInsets = MaterialDialogs.getDialogBackgroundInsets( context, R.attr.alertDialogStyle, - R.style.MaterialAlertDialog_Material3, + R.style.MaterialAlertDialog_Material4, ) val background = MaterialShapeDrawable( context, null, R.attr.alertDialogStyle, - R.style.MaterialAlertDialog_Material3 + R.style.MaterialAlertDialog_Material4 ) with(background) { initializeElevationOverlay(context) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/DebugFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/DebugFragment.java index c409575b..06302b37 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/DebugFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/DebugFragment.java @@ -210,7 +210,7 @@ public class DebugFragment extends Fragment { mRecyclerView.bindJson(result); } catch (Exception e) { - new MaterialAlertDialogBuilder(getActivity(), R.style.AppStyle_M3_MaterialAlertDialog_Monospace) + new MaterialAlertDialogBuilder(getActivity(), R.style.AppStyle_M4_MaterialAlertDialog_Monospace) .setTitle("Result") .setMessage(result) .setPositiveButton(R.string.ok, null) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/ProfileConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/ProfileConfigDialog.kt index 0977a20f..4932133a 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/ProfileConfigDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/ProfileConfigDialog.kt @@ -42,7 +42,7 @@ class ProfileConfigDialog( activity, null, R.attr.alertDialogStyle, - R.style.MaterialAlertDialog_Material3 + R.style.MaterialAlertDialog_Material4 ) val surface = MaterialColors.getColor(activity, R.attr.colorSurface, 0) shape.setCornerSize(18.dp.toFloat()) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginActivity.kt index c1197c2a..d9ba0fe5 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/login/LoginActivity.kt @@ -88,7 +88,7 @@ class LoginActivity : AppCompatActivity(), CoroutineScope { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setTheme(R.style.AppTheme_M3) + setTheme(R.style.AppTheme_M4) navOptionsBuilder = NavOptions.Builder() .setEnterAnim(R.anim.slide_in_right) diff --git a/app/src/main/res/drawable/emoji_glasses.xml b/app/src/main/res/drawable/emoji_glasses.xml index 88460e0d..cbe3f1b5 100644 --- a/app/src/main/res/drawable/emoji_glasses.xml +++ b/app/src/main/res/drawable/emoji_glasses.xml @@ -23,6 +23,6 @@ android:pathData="M95.94,45.05c-6.62,0.23 -11.65,1.31 -11.65,1.31c-9.84,2.06 -10.55,8.14 -9.93,12.97c0.8,6.07 3.29,13.75 10.04,18.49c0.53,0.38 1.76,0.79 2.35,-0.77c0,0 -0.02,0.11 0,0c2.22,-10.48 5.52,-20.14 10.78,-29.89l0,0C98.14,45.37 96.71,45.02 95.94,45.05z" android:fillColor="#FFFFFF"/> diff --git a/app/src/main/res/drawable/ic_announcement.xml b/app/src/main/res/drawable/ic_announcement.xml index 96e798dd..86bcebe0 100644 --- a/app/src/main/res/drawable/ic_announcement.xml +++ b/app/src/main/res/drawable/ic_announcement.xml @@ -4,7 +4,7 @@ android:viewportWidth="48" android:viewportHeight="48"> diff --git a/app/src/main/res/drawable/ic_archive.xml b/app/src/main/res/drawable/ic_archive.xml index a61f71cc..e843d0d3 100644 --- a/app/src/main/res/drawable/ic_archive.xml +++ b/app/src/main/res/drawable/ic_archive.xml @@ -14,6 +14,6 @@ android:pathData="m54,22h-44c-1.657,0 -3,-1.343 -3,-3v-5c0,-1.657 1.343,-3 3,-3h44c1.657,0 3,1.343 3,3v5c0,1.657 -1.343,3 -3,3z" android:fillColor="#ffa54a"/> diff --git a/app/src/main/res/drawable/ic_attendance.xml b/app/src/main/res/drawable/ic_attendance.xml index b1474616..2e7392eb 100644 --- a/app/src/main/res/drawable/ic_attendance.xml +++ b/app/src/main/res/drawable/ic_attendance.xml @@ -7,7 +7,7 @@ android:pathData="M40,45L8,45 8,3 30,3 40,13z" android:fillColor="#90CAF9"/> diff --git a/app/src/main/res/drawable/ic_bell.xml b/app/src/main/res/drawable/ic_bell.xml index 61d88dce..faef062a 100644 --- a/app/src/main/res/drawable/ic_bell.xml +++ b/app/src/main/res/drawable/ic_bell.xml @@ -10,7 +10,7 @@ android:fillType="nonZero" android:strokeColor="#00000000"/> diff --git a/app/src/main/res/drawable/ic_no_messages.xml b/app/src/main/res/drawable/ic_no_messages.xml index dfbf4678..0b1f55ed 100644 --- a/app/src/main/res/drawable/ic_no_messages.xml +++ b/app/src/main/res/drawable/ic_no_messages.xml @@ -6,5 +6,5 @@ android:viewportWidth="512" android:width="128dp" xmlns:android="http://schemas.android.com/apk/res/android"> - + diff --git a/app/src/main/res/drawable/ic_no_notifications.xml b/app/src/main/res/drawable/ic_no_notifications.xml index b94f7e12..b85c675e 100644 --- a/app/src/main/res/drawable/ic_no_notifications.xml +++ b/app/src/main/res/drawable/ic_no_notifications.xml @@ -26,10 +26,10 @@ android:pathData="m72,54h18c2.211,0 4,1.789 4,4 0,2.211 -1.789,4 -4,4h-18c-2.211,0 -4,-1.789 -4,-4 0,-2.211 1.789,-4 4,-4z" android:fillColor="#f1fcff"/> @@ -14,22 +14,22 @@ android:fillColor="#8bc34a" android:strokeColor="#00000000"/> diff --git a/app/src/main/res/drawable/ic_sunbed.xml b/app/src/main/res/drawable/ic_sunbed.xml index fb220a41..ac4fd819 100644 --- a/app/src/main/res/drawable/ic_sunbed.xml +++ b/app/src/main/res/drawable/ic_sunbed.xml @@ -25,7 +25,7 @@ android:pathData="m9.5936,32.3883c-1.938,0.7935 -3.9978,1.3279 -5.8043,2.4099 0.5001,1.8853 3.6227,2.7936 4.9126,1.1279 0.9838,-0.9115 0.8752,-2.3214 0.8917,-3.5379z" android:fillColor="#20abe3"/> + android:pathData="m42.75,31.75a4,4 0,0 0,-3.453 1.984l-7,12a4,4 0,0 0,-0.547 2.016v48c0,4.372 3.628,8 8,8h56c4.372,0 8,-3.628 8,-8v-48a4,4 0,0 0,-0.547 -2.016l-7,-12a4,4 0,0 0,-3.453 -1.984zM45.047,39.75h45.406l4.664,8h-54.734zM49.75,55.75h56v40h-56zM55.75,63.75v8h24v-8z" android:strokeWidth="4"/> diff --git a/app/src/main/res/layout/activity_counter.xml b/app/src/main/res/layout/activity_counter.xml index 4b9f56de..d846a3e8 100644 --- a/app/src/main/res/layout/activity_counter.xml +++ b/app/src/main/res/layout/activity_counter.xml @@ -44,7 +44,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" - android:textAppearance="@style/TextAppearance.Material3.HeadlineLarge" + android:textAppearance="@style/TextAppearance.Material4.HeadlineLarge" tools:text="urządzenia techniki komputerowej" /> diff --git a/app/src/main/res/layout/card_home.xml b/app/src/main/res/layout/card_home.xml index 9f394c30..8f6838b4 100644 --- a/app/src/main/res/layout/card_home.xml +++ b/app/src/main/res/layout/card_home.xml @@ -13,4 +13,4 @@ android:clickable="true" android:focusable="true" android:padding="16dp" - app:shapeAppearance="@style/ShapeAppearance.Material3.Corner.ExtraLarge" /> + app:shapeAppearance="@style/ShapeAppearance.Material4.Corner.ExtraLarge" /> diff --git a/app/src/main/res/layout/material_drawer_header.xml b/app/src/main/res/layout/material_drawer_header.xml index 047abd84..ccb9001d 100644 --- a/app/src/main/res/layout/material_drawer_header.xml +++ b/app/src/main/res/layout/material_drawer_header.xml @@ -58,7 +58,7 @@ android:singleLine="true" app:layout_constraintBottom_toBottomOf="@id/material_drawer_account_header_current" app:layout_constraintStart_toStartOf="@id/material_drawer_account_header_current" - app:shapeAppearanceOverlay="@style/ShapeAppearance.Material3.Corner.Full" + app:shapeAppearanceOverlay="@style/ShapeAppearance.Material4.Corner.Full" tools:text="99" /> #FF000000 - - - - - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 715a2209..79efdbf2 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -6,7 +6,7 @@ @@ -71,7 +71,7 @@ @color/windowBackgroundDefault - - - @@ -136,13 +136,13 @@ monospace - - @@ -185,37 +185,37 @@ 14sp - - - - - - - - diff --git a/app/src/main/res/values/styles_black.xml b/app/src/main/res/values/styles_black.xml index 50b2d1f3..01336dd2 100644 --- a/app/src/main/res/values/styles_black.xml +++ b/app/src/main/res/values/styles_black.xml @@ -16,16 +16,16 @@ - - - - - - - - - - - - - - -