Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Remove non-Compose material

Alex Vanyo4523129fd4a5
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 7f9fb1b30..ed7d996b1 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import com.google.samples.apps.nowinandroid.FlavorDimension
import com.google.samples.apps.nowinandroid.Flavor
+import com.google.samples.apps.nowinandroid.FlavorDimension
plugins {
id("nowinandroid.android.application")
@@ -117,7 +117,6 @@ dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.compose.material3.windowSizeClass)
implementation(libs.androidx.window.manager)
- implementation(libs.material3)
implementation(libs.androidx.profileinstaller)
implementation(libs.coil.kt)
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index 78ed557f4..461c21cd5 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -14,13 +14,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
- <!-- Our dark theme -->
- <style name="Theme.Nia" parent="Platform.Theme.Nia">
- <item name="colorPrimary">@color/purple_200</item>
- <item name="colorPrimaryDark">@color/purple_700</item>
- <item name="colorAccent">@color/teal_200</item>
+ <style name="NightAdjusted.Theme" parent="android:Theme.Material.NoActionBar">
+ <item name="android:windowLightStatusBar" tools:targetApi="23">false</item>
+ <item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>
</style>
</resources>
diff --git a/app/src/main/res/values-v23/themes.xml b/app/src/main/res/values-v23/themes.xml
index 2a13f9c35..b637b1413 100644
--- a/app/src/main/res/values-v23/themes.xml
+++ b/app/src/main/res/values-v23/themes.xml
@@ -16,8 +16,7 @@
-->
<resources>
- <style name="Platform.Theme.Nia" parent="Theme.Material3.DayNight">
+ <style name="PlatformAdjusted.Theme.Nia" parent="NightAdjusted.Theme.Nia">
<item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>
</resources>
diff --git a/app/src/main/res/values-v27/themes.xml b/app/src/main/res/values-v27/themes.xml
index b322aee6b..969e51914 100644
--- a/app/src/main/res/values-v27/themes.xml
+++ b/app/src/main/res/values-v27/themes.xml
@@ -16,10 +16,8 @@
-->
<resources>
- <style name="Platform.Theme.Nia" parent="Theme.Material3.DayNight">
+ <style name="PlatformAdjusted.Theme.Nia" parent="NightAdjusted.Theme.Nia">
<item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:windowLightStatusBar">?attr/isLightTheme</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
- <item name="android:windowLightNavigationBar">?attr/isLightTheme</item>
</style>
</resources>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 9ace165b5..8c7705178 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -14,29 +14,22 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
+
+ <!-- Allows us to override night specific attributes in the
+ values-night folder. -->
+ <style name="NightAdjusted.Theme.Nia" parent="android:Theme.Material.Light.NoActionBar">
+ <item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
+ <item name="android:windowLightNavigationBar" tools:targetApi="27">true</item>
+ </style>
<!-- Allows us to override platform level specific attributes in their
respective values-vXX folder. -->
- <style name="Platform.Theme.Nia" parent="Theme.Material3.DayNight">
+ <style name="PlatformAdjusted.Theme.Nia" parent="NightAdjusted.Theme.Nia">
<item name="android:statusBarColor">@color/black30</item>
</style>
- <!-- The actual theme we use. This varies for light theme (here),
- and values-night for dark theme. -->
- <!-- TODO Change colors here and in values-night when implementing M3 theme -->
- <style name="Theme.Nia" parent="Platform.Theme.Nia">
- <item name="colorPrimary">@color/purple_500</item>
- <item name="colorPrimaryDark">@color/purple_700</item>
- <item name="colorAccent">@color/teal_200</item>
- </style>
-
- <style name="Theme.Nia.NoActionBar">
- <item name="windowActionBar">false</item>
- <item name="windowNoTitle">true</item>
- </style>
-
- <style name="Theme.Nia.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />
+ <!-- The final theme we use -->
+ <style name="Theme.Nia" parent="PlatformAdjusted.Theme.Nia" />
- <style name="Theme.Nia.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />
</resources>
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index a58115498..0f399c7c1 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -37,7 +37,6 @@ kotlinxSerializationJson = "1.3.3"
ksp = "1.7.0-1.0.6"
ktlint = "0.43.0"
lint = "30.2.1"
-material3 = "1.6.1"
okhttp = "4.10.0"
protobuf = "3.21.1"
protobufPlugin = "0.8.19"
@@ -108,7 +107,6 @@ kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-cor
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
lint-api = { group = "com.android.tools.lint", name = "lint-api", version.ref = "lint" }
-material3 = { group = "com.google.android.material", name = "material", version.ref = "material3" }
okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
protobuf-protoc = { group = "com.google.protobuf", name = "protoc", version.ref = "protobuf" }
protobuf-kotlin-lite = { group = "com.google.protobuf", name = "protobuf-kotlin-lite", version.ref = "protobuf" }