Skip to content
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

Color resources for drawable icons #454

Open
Anton-V-K opened this issue Aug 24, 2023 · 3 comments
Open

Color resources for drawable icons #454

Anton-V-K opened this issue Aug 24, 2023 · 3 comments

Comments

@Anton-V-K
Copy link
Contributor

Anton-V-K commented Aug 24, 2023

Icons refactoring (b80fde0) made most (all?) of drawable icons "non-themable" - they are drawn with hard-coded color values instead of colors from \app\src\main\res\values\colors.xml.
An example from \app\src\main\res\drawable\ic_launcher_foreground.xml (path is omitted for brevity):

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="108dp"
    android:height="108dp"
    android:viewportWidth="64"
    android:viewportHeight="64">
  <group android:scaleX="0.71"
      android:scaleY="0.71"
      android:translateX="9.28"
      android:translateY="9.28">
    <path
        android:pathData="..."
        android:strokeWidth=".84379"
        android:fillColor="#2e7d32"/>
  </group>
</vector>

The color should be specified as android:fillColor="@color/primary".
I'm not sure whether this issue hits end-users (it is worth checking whether the app adapts properly to UI theme tuning) - I've discovered it when customizing the look for a debug build with status widget (#429).

The list of icons to fix:

  • \app\src\main\res\drawable\ic_launcher_foreground.xml
  • \app\src\main\res\drawable\ic_sos_foreground.xml
  • \app\src\main\res\drawable\ic_start_foreground.xml
  • \app\src\main\res\drawable\ic_stop_foreground.xml
@tananaev
Copy link
Member

They should work just fine with Dynamic Color, if that's what you're talking about. But I don't mind using color resources if you want to send a PR for that.

@Anton-V-K Anton-V-K changed the title Hard-coded colors for icons Color resources for drawable icons Aug 24, 2023
@Anton-V-K
Copy link
Contributor Author

Anton-V-K commented Aug 24, 2023

May I add these changes to the existing PR #431 (into the same branch) or a new dedicated PR is needed?

@tananaev
Copy link
Member

I'd prefer to do a separate PR for that.

Anton-V-K added a commit to Anton-V-K/traccar-client-android that referenced this issue Aug 24, 2023
tananaev added a commit that referenced this issue Aug 24, 2023
Color resources for drawable icons #454
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants