-
Notifications
You must be signed in to change notification settings - Fork 1
[21479] Dark Mode Support #235
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
Open
sg-jsonjuliane
wants to merge
11
commits into
develop
Choose a base branch
from
feature/21479-dark-mode-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
783b158
[21479] Provided initial night/colors for TripKitAndroidUI
sg-jsonjuliane 82ad5db
[21479] Phase 1: Update TripKitAndroidUI and tripkituisample themes t…
sg-jsonjuliane 5d89456
[21479] Phase 2: Apply TripKitAndroidUI dark mode fixes
sg-jsonjuliane 0e18a0c
[21479] Phase 2: Finalize shared drawable palette
sg-jsonjuliane e2ebcd6
[21479] Phase 2: Priority 3 - trip-kit-booking-ui dark mode support
sg-jsonjuliane eb53088
[21479] Add dark mode support for map style and info windows
sg-jsonjuliane 9c4590c
[21479] Phase 2: Implement theme-aware transport icon tinting and dar…
sg-jsonjuliane 70cb6b9
[21479] Adjust map pin tint to 60% gray for better visibility in dark…
sg-jsonjuliane 749ff4f
[21479] Bump tripkit-android submodule (booking-ui @color/white fix)
sg-jsonjuliane 1f9492a
[21479] Refactor isDarkMode() to Resources extension function
sg-jsonjuliane cdb898f
[21479] Replace hardcoded #FFFFFF with @android:color/white in shadow…
sg-jsonjuliane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...tAndroidUI/src/main/java/com/skedgo/tripkit/ui/tripresults/ThemeAwareApplyTintStrategy.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package com.skedgo.tripkit.ui.tripresults | ||
|
|
||
| import android.content.res.Resources | ||
| import android.graphics.Color | ||
| import android.graphics.drawable.Drawable | ||
| import com.skedgo.tripkit.ui.utils.isDarkMode | ||
| import com.skedgo.tripkit.ui.utils.tint | ||
| import com.skedgo.tripkit.routing.ServiceColor | ||
|
|
||
| /** | ||
| * Theme-aware tint strategy that applies white tint in dark mode when service colors are disabled. | ||
| * In light mode, returns drawable as-is. In dark mode, tints to white for visibility. | ||
| */ | ||
| class ThemeAwareApplyTintStrategy(private val resources: Resources) : TransportTintStrategy { | ||
|
|
||
| override fun apply( | ||
| remoteIconIsTemplate: Boolean, | ||
| remoteIconIsBranding: Boolean, | ||
| serviceColor: ServiceColor?, | ||
| drawable: Drawable | ||
| ): Drawable { | ||
| // Don't tint branding icons (like Beam) - they should show original logo colors | ||
| if (remoteIconIsBranding) { | ||
| return drawable | ||
| } | ||
|
|
||
| if (resources.isDarkMode()) { | ||
| // Dark mode: tint to white for visibility | ||
| return drawable.tint(Color.WHITE) | ||
| } | ||
| // Light mode: return drawable as-is (no tint) | ||
| return drawable | ||
| } | ||
| } | ||
|
|
13 changes: 13 additions & 0 deletions
13
TripKitAndroidUI/src/main/java/com/skedgo/tripkit/ui/utils/ResourcesExtensions.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.skedgo.tripkit.ui.utils | ||
|
|
||
| import android.content.res.Configuration | ||
| import android.content.res.Resources | ||
|
|
||
| /** | ||
| * Checks if the app is currently in dark mode. | ||
| */ | ||
| fun Resources.isDarkMode(): Boolean { | ||
| val nightModeFlags = configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK | ||
| return nightModeFlags == Configuration.UI_MODE_NIGHT_YES | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
TripKitAndroidUI/src/main/res/drawable-night/bottom_shadow.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <gradient | ||
| android:startColor="#212A33" | ||
| android:endColor="@android:color/transparent" | ||
| android:angle="90" /> | ||
| </shape> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <gradient | ||
| android:startColor="#212A33" | ||
| android:endColor="@android:color/transparent" | ||
| android:angle="270" /> | ||
| </shape> | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sg-jsonjuliane , just wanted to clarify, is this intended for dark mode only? If so, do we need a checker to detect whether the device is in dark mode? If not, then all good. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to both. There are already separate day and night variants for the drawables being used, so they will adjust automatically.