Skip to content

Commit

Permalink
Update Theme to match new MD3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamlooker committed Jan 5, 2024
1 parent 514c036 commit 4b6f2dc
Show file tree
Hide file tree
Showing 19 changed files with 407 additions and 211 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/MainTheme"
tools:targetApi="tiramisu">
tools:ignore="UnusedAttribute">

<receiver
android:name=".MainApplication$BootReceiver"
Expand Down
16 changes: 4 additions & 12 deletions app/src/main/kotlin/com/looker/droidify/service/DownloadService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.util.Log
Expand Down Expand Up @@ -245,10 +246,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
.Builder(this, Constants.NOTIFICATION_CHANNEL_DOWNLOADING)
.setAutoCancel(true)
.setSmallIcon(android.R.drawable.stat_notify_error)
.setColor(
ContextThemeWrapper(this, styleRes.Theme_Main_Light)
.getColor(CommonR.color.md_theme_dark_errorContainer)
)
.setColor(Color.GREEN)
.setOnlyAlertOnce(true)
.setContentIntent(intent)
.errorNotificationContent(task, errorType)
Expand Down Expand Up @@ -291,10 +289,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
.setAutoCancel(true)
.setOngoing(false)
.setSmallIcon(android.R.drawable.stat_sys_download_done)
.setColor(
ContextThemeWrapper(this, styleRes.Theme_Main_Light)
.getColor(CommonR.color.md_theme_dark_primaryContainer)
)
.setColor(Color.GREEN)
.setOnlyAlertOnce(true)
.setContentIntent(intent)
.setContentTitle(getString(stringRes.downloaded_FORMAT, task.name))
Expand Down Expand Up @@ -326,10 +321,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
NotificationCompat
.Builder(this, Constants.NOTIFICATION_CHANNEL_DOWNLOADING)
.setSmallIcon(android.R.drawable.stat_sys_download)
.setColor(
ContextThemeWrapper(this, styleRes.Theme_Main_Light)
.getColor(CommonR.color.md_theme_dark_primaryContainer)
)
.setColor(Color.GREEN)
.addAction(
0,
getString(stringRes.cancel),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,8 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
background = context.corneredBackground
setPadding(8.dp, 4.dp, 8.dp, 4.dp)
backgroundTintList =
context.getColorFromAttr(MaterialR.attr.colorSecondaryContainer)
setTextColor(context.getColorFromAttr(MaterialR.attr.colorSecondary))
context.getColorFromAttr(MaterialR.attr.colorTertiaryContainer)
setTextColor(context.getColorFromAttr(MaterialR.attr.colorOnTertiaryContainer))
}
} else {
if (background != null) {
Expand Down Expand Up @@ -1590,7 +1590,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
holder.itemView.apply {
background = context.corneredBackground
backgroundTintList =
holder.itemView.context.getColorFromAttr(MaterialR.attr.colorSurface)
holder.itemView.context.getColorFromAttr(MaterialR.attr.colorSurfaceContainerHigh)
}
} else {
holder.itemView.background = null
Expand All @@ -1609,9 +1609,14 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
)
background = context.corneredBackground
setPadding(15, 15, 15, 15)
val (background, foreground) = if (installed) {
MaterialR.attr.colorSecondaryContainer to MaterialR.attr.colorOnSecondaryContainer
} else {
MaterialR.attr.colorPrimaryContainer to MaterialR.attr.colorOnPrimaryContainer
}
backgroundTintList =
context.getColorFromAttr(MaterialR.attr.colorSecondaryContainer)
setTextColor(context.getColorFromAttr(MaterialR.attr.colorOnSecondaryContainer))
context.getColorFromAttr(background)
setTextColor(context.getColorFromAttr(foreground))
}
holder.source.text =
context.getString(stringRes.provided_by_FORMAT, item.repository.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,17 @@ class AppListAdapter(
when {
productItem.canUpdate -> {
backgroundTintList =
context.getColorFromAttr(MaterialR.attr.colorSecondaryContainer)
context.getColorFromAttr(MaterialR.attr.colorTertiaryContainer)
setTextColor(
context.getColorFromAttr(MaterialR.attr.colorOnSecondaryContainer)
context.getColorFromAttr(MaterialR.attr.colorOnTertiaryContainer)
)
}

isInstalled -> {
backgroundTintList =
context.getColorFromAttr(MaterialR.attr.colorPrimaryContainer)
context.getColorFromAttr(MaterialR.attr.colorSecondaryContainer)
setTextColor(
context.getColorFromAttr(MaterialR.attr.colorOnPrimaryContainer)
context.getColorFromAttr(MaterialR.attr.colorOnSecondaryContainer)
)
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/app_detail_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
android:layout_marginHorizontal="12dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="8dp"
android:backgroundTint="?colorSurfaceContainer"
android:background="@drawable/background_border">

<com.google.android.material.imageview.ShapeableImageView
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/edit_repository.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@
android:text="@string/skip" />

</LinearLayout>
</FrameLayout>
</FrameLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/expand_view_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
android:layout_height="48dp"
android:layout_marginHorizontal="48dp"
android:layout_marginTop="16dp"
android:textAllCaps="true" />
android:textAllCaps="true" />
9 changes: 4 additions & 5 deletions app/src/main/res/layout/fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:background="?colorSurface">
android:layout_height="match_parent">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_layout"
style="?attr/appBarLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurface"
android:background="?colorSurfaceContainer"
app:elevation="0dp"
app:liftOnScroll="false">

Expand All @@ -19,7 +18,7 @@
style="?attr/toolbarStyle"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="?colorSurface"
android:background="?colorSurfaceContainer"
android:elevation="0dp" />

<FrameLayout
Expand All @@ -34,4 +33,4 @@
android:layout_height="match_parent"
android:background="?android:colorBackground"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/repository_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/shape_margin_large"
android:tint="?colorOnSurface"
app:srcCompat="@drawable/ic_check" />

<LinearLayout
Expand All @@ -36,4 +37,4 @@
android:textAppearance="?textAppearanceBodyMedium"
android:textColor="?colorOutline" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/repository_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/shape_margin_large"
android:background="@drawable/background_border"
android:backgroundTint="?colorSurfaceContainer"
android:padding="28dp"
android:text="@string/enable_repo"
android:textAppearance="?textAppearanceHeadlineSmall"
Expand Down Expand Up @@ -69,4 +70,4 @@
android:layout_width="match_parent"
android:layout_height="20dp"/>

</LinearLayout>
</LinearLayout>
5 changes: 2 additions & 3 deletions app/src/main/res/layout/settings_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorSurface"
tools:context="com.looker.droidify.ui.settings.SettingsFragment">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_layout"
style="?attr/appBarLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurface"
android:background="?colorSurfaceContainer"
app:elevation="0dp"
app:liftOnScroll="false">

Expand All @@ -21,7 +20,7 @@
style="?attr/toolbarStyle"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="?colorSurface"
android:background="?colorSurfaceContainer"
android:elevation="0dp" />
</com.google.android.material.appbar.AppBarLayout>

Expand Down
3 changes: 1 addition & 2 deletions core/common/src/main/res/drawable/background_border.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorSurface" />
<corners android:radius="@dimen/shape_large_corner" />
</shape>
</shape>
8 changes: 8 additions & 0 deletions core/common/src/main/res/values-night/base_theme.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MainTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:colorBackground">@color/md_theme_d_background</item>
<item name="colorSurface">?android:attr/colorBackground</item>
<item name="android:colorPrimaryDark">?android:attr/colorBackground</item>
</style>
</resources>
Loading

0 comments on commit 4b6f2dc

Please sign in to comment.