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

The run on current drawable makes it "empty" in Studio preview and app #98

Closed
emartynov opened this issue Oct 14, 2024 · 4 comments · Fixed by #103
Closed

The run on current drawable makes it "empty" in Studio preview and app #98

emartynov opened this issue Oct 14, 2024 · 4 comments · Fixed by #103
Labels
bug Something isn't working

Comments

@emartynov
Copy link

Here is our drawable file:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
  <path
      android:pathData="M13.1707,17C13.5825,15.8348 14.6938,15 16,15C17.3062,15 18.4175,15.8348 18.8293,17H20C20.5523,17 21,17.4477 21,18C21,18.5523 20.5523,19 20,19H18.8293C18.4174,20.1652 17.3062,21 16,21C14.6938,21 13.5825,20.1652 13.1707,19H4C3.4477,19 3,18.5523 3,18C3,17.4477 3.4477,17 4,17H13.1707ZM15,18.0034C15.0018,18.5532 15.4497,19 16,19C16.5514,19 17,18.5514 17,18C17,17.4486 16.5514,17 16,17C15.4497,17 15.0018,17.4468 15,17.9966V18.0034ZM10.8293,13C10.4174,14.1652 9.3062,15 8,15C6.6938,15 5.5825,14.1652 5.1707,13H4C3.4477,13 3,12.5523 3,12C3,11.4477 3.4477,11 4,11H5.1707C5.5825,9.8348 6.6938,9 8,9C9.3062,9 10.4175,9.8348 10.8293,11H20C20.5523,11 21,11.4477 21,12C21,12.5523 20.5523,13 20,13H10.8293ZM7,12.0035C7.0019,12.5533 7.4498,13 8,13C8.5514,13 9,12.5514 9,12C9,11.4486 8.5514,11 8,11C7.4498,11 7.0019,11.4467 7,11.9965V12.0035ZM18.8293,7C18.4174,8.1652 17.3062,9 16,9C14.6938,9 13.5825,8.1652 13.1707,7H4C3.4477,7 3,6.5523 3,6C3,5.4477 3.4477,5 4,5H13.1707C13.5825,3.8348 14.6938,3 16,3C17.3062,3 18.4175,3.8348 18.8293,5H20C20.5523,5 21,5.4477 21,6C21,6.5523 20.5523,7 20,7H18.8293ZM15,6.0034C15.0018,6.5532 15.4497,7 16,7C16.5514,7 17,6.5514 17,6C17,5.4486 16.5514,5 16,5C15.4497,5 15.0018,5.4468 15,5.9966V6.0034Z"
      android:fillColor="#00716B"
      android:fillType="evenOdd"/>
</vector>

And here is result on running ago on it:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportHeight="24"
    android:viewportWidth="24">
    <path
        android:fillColor="#00716B"
        android:fillType="evenOdd"
        android:pathData="M13,171,17a3,001,3,001,0,0,1,5,659,0H20a1,1,0,0,1,0,2h-1,171a3,001,3,001,0,0,1,-5,659,0H4a1,1,0,0,1,0-2h9,171ZM15,18,003A1,001,1,001,0,0,0,16,19c0,551,0 1-0,449 1-1s-0,449-1-1-1a1,001,1,001,0,0,0,-1,0,997v0,007ZM10,829,13a3,001,3,001,0,0,1,-5,659,0H4a1,1,0,0,1,0-2h1,171a3,001,3,001,0,0,1,5,659,0H20a1,1,0,0,1,0,2h-9,171ZM7,12,003A1,001,1,001,0,0,0,8,13c0,551,0 1-0,449 1-1s-0,449-1-1-1a1,001,1,001,0,0,0,-1,0,997v0,007ZM18,829,7a3,001,3,001,0,0,1,-5,659,0H4a1,1,0,0,1,0-2h9,171a3,001,3,001,0,0,1,5,659,0H20a1,1,0,0,1,0,2h-1,171ZM15,6,003A1,001,1,001,0,0,0,16,7c0,551,0 1-0,449 1-1s-0,449-1-1-1a1,001,1,001,0,0,0,-1,0,997v0,007Z" />
</vector>

Not sure what happens and why.

@emartynov emartynov added the bug Something isn't working label Oct 14, 2024
@emartynov
Copy link
Author

Off topic for this issue - tool tries to sort attributes that were not changed. Fine but makes harder to spot changed things.

@jzbrooks
Copy link
Owner

What version of vgo produced this? This appears to be the same issue as #60, which was fixed in https://github.com/jzbrooks/vgo/releases/tag/v2.2.3.

@emartynov
Copy link
Author

I'm on 2.4 from brew

@jzbrooks
Copy link
Owner

Thanks. I think I see the problem. It is related to #78 but is a little different. The decimal format is using locale-specific digit separators, which in your locale is a comma. vector drawables (and svgs) use commas as command parameter separators, so it confuses things.

This is what I get when I run on a US locale JVM.

<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
  <path android:fillColor="#00716b" android:fillType="evenOdd" android:pathData="M13.171,17a3.001,3.001,0,0,1,5.659,0H20a1,1,0,0,1,0,2h-1.171a3.001,3.001,0,0,1,-5.659,0H4a1,1,0,0,1,0-2h9.171ZM15,18.003A1.001,1.001,0,0,0,16,19c0.551,0 1-0.449 1-1s-0.449-1-1-1a1.001,1.001,0,0,0,-1,0.997v0.007ZM10.829,13a3.001,3.001,0,0,1,-5.659,0H4a1,1,0,0,1,0-2h1.171a3.001,3.001,0,0,1,5.659,0H20a1,1,0,0,1,0,2h-9.171ZM7,12.003A1.001,1.001,0,0,0,8,13c0.551,0 1-0.449 1-1s-0.449-1-1-1a1.001,1.001,0,0,0,-1,0.997v0.007ZM18.829,7a3.001,3.001,0,0,1,-5.659,0H4a1,1,0,0,1,0-2h9.171a3.001,3.001,0,0,1,5.659,0H20a1,1,0,0,1,0,2h-1.171ZM15,6.003A1.001,1.001,0,0,0,16,7c0.551,0 1-0.449 1-1s-0.449-1-1-1a1.001,1.001,0,0,0,-1,0.997v0.007Z"/>
</vector>

You can see the parameters of the first arc are different. (a3.001,3.001 in mine)

The good news is the fix will be simple. Feel free to PR it if you like, but I'll get it in the next release.

I recommend excluding that file from your shrink set for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants