Skip to content

Improve "Material You" design #1595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat Feb 08 10:11:02 CET 2025
sdk.dir=C\:\\Users\\giorg\\AppData\\Local\\Android\\Sdk
9 changes: 6 additions & 3 deletions app/src/foss/res/layout/upgrade_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="?attr/colorSurfaceContainer">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Widget.MaterialComponents.Toolbar.Surface"
style="@style/SDMToolbar.Primary"
android:layout_width="0dp"
android:minHeight="?actionBarSize"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -42,7 +43,9 @@
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/cardRadius"
android:backgroundTint="?colorSurface">

<com.google.android.material.textview.MaterialTextView
style="@style/TextAppearance.Material3.BodyMedium"
Expand Down
47 changes: 45 additions & 2 deletions app/src/main/java/eu/darken/sdmse/common/theming/Theming.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ package eu.darken.sdmse.common.theming

import android.app.Activity
import android.app.Application
import android.content.res.Configuration
import android.content.res.Resources
import android.os.Bundle
import android.view.Window
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import com.google.android.material.color.DynamicColors
import eu.darken.sdmse.R
import eu.darken.sdmse.common.coroutine.AppScope
import eu.darken.sdmse.common.coroutine.DispatcherProvider
import eu.darken.sdmse.common.datastore.valueBlocking
Expand All @@ -13,7 +18,6 @@ import eu.darken.sdmse.common.debug.logging.Logging.Priority.VERBOSE
import eu.darken.sdmse.common.debug.logging.log
import eu.darken.sdmse.common.debug.logging.logTag
import eu.darken.sdmse.common.flow.setupCommonEventHandlers
import eu.darken.sdmse.common.getColorForAttr
import eu.darken.sdmse.main.core.GeneralSettings
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.combine
Expand Down Expand Up @@ -122,7 +126,46 @@ class Theming @Inject constructor(
log(TAG) { "Applying MATERIAL_YOU to $activity" }

DynamicColors.applyToActivityIfAvailable(activity)
activity.window.statusBarColor = activity.getColorForAttr(android.R.attr.colorPrimaryDark)

val uiMode = activity.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK

val color = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { // API 34+
try {
if (uiMode == Configuration.UI_MODE_NIGHT_YES) {
activity.getColor(android.R.color.system_surface_container_dark) // API 34+ Dark
} else {
activity.getColor(android.R.color.system_surface_container_light) // API 34+ Light
}
} catch (e: Resources.NotFoundException) {

if (uiMode == Configuration.UI_MODE_NIGHT_YES) {
ContextCompat.getColor(activity, R.color.md_theme_surfaceContainer)
} else {
ContextCompat.getColor(activity, R.color.md_theme_surfaceContainer)
}
}
} else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { // API 31+
try {
if (uiMode == Configuration.UI_MODE_NIGHT_YES) {
activity.getColor(android.R.color.system_accent1_700) // API 31+ Dark
} else {
activity.getColor(android.R.color.system_accent1_700) // API 31+ Light
}
} catch (e: Resources.NotFoundException) {

if (uiMode == Configuration.UI_MODE_NIGHT_YES) {
ContextCompat.getColor(activity, R.color.md_theme_surfaceContainer)
} else {
ContextCompat.getColor(activity, R.color.md_theme_surfaceContainer)
}
}
} else {
ContextCompat.getColor(activity, R.color.md_theme_surfaceContainer) // API < 31
}

val window = activity.window
window.statusBarColor = color
window.navigationBarColor = color
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/eu/darken/sdmse/main/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package eu.darken.sdmse.main.ui
import android.os.Bundle
import android.view.WindowManager
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import dagger.hilt.android.AndroidEntryPoint
import eu.darken.sdmse.R
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/analyzer_app_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/analyzer_app_vh_appcode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
android:layout_height="wrap_content">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_app_vh_appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_app_vh_appmedia.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_app_vh_extradata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/analyzer_app_vh_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/analyzer_apps_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_height="match_parent">

<com.google.android.material.appbar.MaterialToolbar
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/analyzer_content_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_dashboard_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content">

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/analyzer_device_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_device_vh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/analyzer_storage_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_storage_vh_apps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_storage_vh_media.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/analyzer_storage_vh_system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/appcleaner_appjunk_element_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content">

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/appcleaner_appjunk_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/appcleaner_details_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand All @@ -25,6 +26,7 @@
android:id="@+id/tablayout"
style="@style/Widget.Design.TabLayout"
android:layout_width="match_parent"
android:background="?attr/colorSurfaceContainer"
android:layout_height="wrap_content"
app:tabMode="scrollable" />

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/appcleaner_list_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/appcontrol_action_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="56dp"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:orientation="vertical">


Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/appcontrol_dashboard_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content">

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/appcontrol_list_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/automation_control_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.8"
android:background="?colorSurfaceContainerLowest"
android:background="@color/automation_scrim"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -45,6 +45,8 @@
<com.google.android.material.card.MaterialCardView
android:id="@+id/control_card"
style="@style/Widget.Material3.CardView.Elevated"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/layout/beta_goodbye_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down Expand Up @@ -49,6 +50,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:backgroundTint="?colorSecondaryContainer"
android:visibility="gone"
tools:visibility="visible">
Expand All @@ -74,6 +77,8 @@
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_margin="16dp"
android:text="@string/nudge_betagoodbye_reinstall_note" />
</com.google.android.material.card.MaterialCardView>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/corpsefinder_corpse_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/corpsefinder_details_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/corpsefinder_list_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/dashboard_debug_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/DashboardCardItem"
app:cardCornerRadius="@dimen/cardRadius"
app:cardBackgroundColor="?attr/colorSurface"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/dashboard_error_dataarea_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
style="@style/DashboardCardItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/cardRadius"
android:backgroundTint="?colorErrorContainer">

<androidx.constraintlayout.widget.ConstraintLayout
Expand Down
Loading