alexjlockwood / avocado

🥑 Vector Drawable optimization tool 🥑
MIT License
1.35k stars 48 forks source link

Graphical errors in RemoteViews after converting #26

Open henningBunk opened 6 years ago

henningBunk commented 6 years ago

Hi! I've got another one for you ;) This graphical error only appears when the drawable is used inside a RemoteViews element of an app widget. When the same drawable is used inside the main app it looks fine. For this reason I think AppCompat isn't an option since it can't be used inside RemoteViews.

The error happened on a Samsung Note 3 with Android 5.0. The Nexus 5 with Android 6 was fine.

Here are two Screenshots before and after running avdo:

Before After
grafik grafik

Here are the xml files:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="50dp"
        android:height="35dp"
        android:viewportWidth="50"
        android:viewportHeight="35">

        <path
            android:fillColor="#595959"
            android:pathData="M11.9375,27.7266 C12.0898,27.7306,12.2227,27.8126,12.293,27.9414 C12.3633,28.0704,12.3594,28.2227,12.2773,28.3477 L10.8983,30.5469 C10.8477,30.6289,10.832,30.7382,10.8516,30.8359 C10.8711,30.9296,10.9258,31.0116,11.0078,31.0585 L12.2228,31.8241 C12.3984,31.9296,12.6368,31.8749,12.75,31.7031 L14.328,29.1951 C14.4023,29.0781,14.5273,29.0038,14.668,29.0038 C14.8047,29.0038,14.9297,29.074,15.004,29.1873 L16.6055,31.6678 C16.6602,31.7498,16.7539,31.8084,16.8555,31.8278 C16.9492,31.8475,17.0469,31.8278,17.125,31.7771 L18.3125,31.0037 C18.4883,30.8825,18.5352,30.6637,18.418,30.4802 L17.0117,28.2849 C16.9337,28.1639,16.9297,28.0075,17,27.8747 C17.0703,27.7457,17.203,27.6677,17.3477,27.6677 L19.8827,27.652 C19.9844,27.648,20.0859,27.6052,20.1563,27.531 C20.2227,27.4606,20.2578,27.3708,20.2539,27.277 L20.2499,25.863 C20.2459,25.7653,20.2029,25.6716,20.1327,25.5974 C20.0624,25.531,19.9765,25.4919,19.8827,25.4919 L19.871,25.4919 L17.332,25.5075 C17.1836,25.5075,17.0508,25.4255,16.9805,25.2965 C16.9063,25.1638,16.9141,25.0153,16.9961,24.8865 L18.3751,22.6911 C18.4845,22.5153,18.4298,22.2888,18.2501,22.1755 L17.0391,21.4215 C16.9531,21.3669,16.8517,21.3475,16.7541,21.3708 C16.6641,21.3943,16.5899,21.449,16.5471,21.5232 L16.5431,21.535 L14.9649,24.0428 C14.8907,24.16,14.7657,24.2303,14.6251,24.2303 S14.3595,24.1639,14.2891,24.0467 L12.6876,21.5505 C12.5704,21.3785,12.3321,21.3239,12.1681,21.4411 L10.9571,22.2145 C10.7813,22.3317,10.7384,22.5545,10.8517,22.738 L12.2579,24.9333 C12.3359,25.0543,12.3439,25.2106,12.2696,25.3395 C12.1993,25.4685,12.0704,25.5465,11.9259,25.5465 L11.9219,25.5465 L9.3869,25.5505 C9.1799,25.5583,9.0119,25.7263,9.0157,25.9295 L9.0235,27.3708 C9.0235,27.4725,9.0625,27.5662,9.1329,27.6365 C9.2032,27.7068,9.3009,27.7498,9.3985,27.7459 Z M12.4219,32.1914 C12.2969,32.1914,12.1719,32.1602,12.0585,32.0937 L10.8397,31.3281 C10.6874,31.2345,10.5819,31.0821,10.5429,30.8985 C10.5039,30.7189,10.5389,30.5392,10.6289,30.379 L12.0116,28.1797 C12.0351,28.1407,12.0272,28.1055,12.0156,28.0897 C12.0116,28.0781,11.9882,28.043,11.9374,28.043 L9.4061,28.0586 C9.2381,28.0546,9.0468,27.9922,8.9141,27.8594 C8.7811,27.7304,8.7069,27.5547,8.7108,27.3711 L8.7028,25.9337 C8.699,25.754,8.7693,25.5782,8.8982,25.4493 C9.0272,25.3165,9.199,25.2423,9.3826,25.2383 L11.9256,25.2345 C11.9686,25.2345,11.9881,25.2032,11.9959,25.1915 C11.9999,25.1798,12.0194,25.1407,11.9959,25.1017 L10.5859,22.9063 C10.3789,22.5783,10.4647,22.1681,10.7851,21.9493 L11.9961,21.1759 C12.3007,20.9689,12.7343,21.0587,12.9491,21.3751 L14.5546,23.8791 C14.578,23.9141,14.6093,23.9181,14.6249,23.9181 C14.6405,23.9181,14.6757,23.9141,14.6952,23.8751 L16.2772,21.3673 C16.3632,21.2149,16.5077,21.1095,16.6796,21.0665 C16.8632,21.0235,17.0546,21.0548,17.2108,21.1603 L18.4178,21.9103 C18.742,22.1173,18.8436,22.5431,18.6404,22.8595 L17.2614,25.0548 C17.2342,25.0978,17.2459,25.129,17.2537,25.1446 C17.2614,25.1563,17.2849,25.1954,17.3317,25.1954 L19.8669,25.1798 L19.8864,25.1798 C20.2497,25.1798,20.5504,25.4806,20.5622,25.8595 L20.57,27.2735 C20.574,27.4455,20.5075,27.6173,20.3825,27.7462 C20.2535,27.883,20.0739,27.9612,19.8865,27.969 L17.3475,27.9807 C17.3045,27.9807,17.2849,28.0119,17.277,28.0275 C17.2692,28.0393,17.2536,28.0783,17.277,28.1135 L18.6872,30.3127 C18.8902,30.6369,18.8082,31.0471,18.488,31.2657 L17.2966,32.0393 C17.1519,32.137,16.9762,32.1761,16.7966,32.137 C16.6129,32.102,16.4488,31.9964,16.3433,31.84 L14.7379,29.3558 C14.7144,29.3206,14.6832,29.3206,14.6676,29.3206 C14.6519,29.3206,14.6168,29.3246,14.5973,29.3596 L13.0153,31.8714 C12.8823,32.0784,12.6558,32.1918,12.4215,32.1918"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="50dp" android:height="35dp" android:viewportWidth="50" android:viewportHeight="35">
    <path android:fillColor="#595959" android:pathData="M18.727 28.367c0.168 0 0.316 0.094 0.394 0.238 0.078 0.145 0.07 0.313-0.02 0.453L17.564 31.5c-0.06 0.094-0.079 0.215-0.055 0.32 0.02 0.11 0.082 0.2 0.172 0.254l1.351 0.856c0.196 0.117 0.461 0.058 0.586-0.133l1.766-2.793c0.082-0.13 0.223-0.207 0.379-0.207 0.152 0 0.293 0.074 0.37 0.203l1.778 2.766c0.063 0.09 0.164 0.16 0.277 0.18 0.106 0.019 0.211 0 0.301-0.06l1.325-0.855c0.195-0.133 0.25-0.379 0.12-0.582L24.375 29c-0.09-0.137-0.094-0.309-0.016-0.457 0.082-0.14 0.227-0.227 0.387-0.227h0.004l2.82-0.011c0.114-0.004 0.223-0.051 0.305-0.137 0.074-0.074 0.113-0.176 0.11-0.281l-0.005-1.57c0-0.114-0.046-0.22-0.128-0.298-0.075-0.078-0.176-0.117-0.278-0.117h-0.011l-2.825 0.008c-0.168 0-0.316-0.094-0.394-0.238-0.078-0.145-0.07-0.313 0.02-0.453l1.538-2.442c0.125-0.195 0.067-0.445-0.132-0.574l-1.348-0.844c-0.098-0.062-0.211-0.082-0.317-0.054-0.101 0.023-0.183 0.086-0.23 0.172l-0.004 0.007-1.77 2.79c-0.081 0.128-0.222 0.21-0.374 0.206h-0.004c-0.153 0-0.29-0.074-0.371-0.203l-1.774-2.785c-0.133-0.195-0.394-0.25-0.578-0.125l-1.352 0.86c-0.195 0.128-0.246 0.374-0.12 0.581l1.562 2.446c0.086 0.136 0.094 0.312 0.012 0.457-0.079 0.14-0.223 0.226-0.383 0.226H15.89c-0.23 0.008-0.418 0.195-0.41 0.418v1.61c0 0.109 0.042 0.215 0.12 0.293 0.083 0.078 0.188 0.125 0.297 0.12zm0.523 4.973c-0.137 0-0.277-0.04-0.402-0.113l-1.352-0.856c-0.172-0.105-0.293-0.273-0.332-0.48-0.043-0.196-0.008-0.403 0.098-0.574l1.543-2.446c0.027-0.043 0.015-0.082 0.008-0.101-0.008-0.012-0.036-0.051-0.086-0.051l-2.825 0.008c-0.183-0.004-0.398-0.075-0.546-0.22-0.145-0.144-0.227-0.343-0.223-0.546l-0.004-1.601c-0.004-0.2 0.074-0.395 0.219-0.54 0.144-0.144 0.336-0.226 0.539-0.23h2.832c0.047 0 0.07-0.035 0.078-0.047 0.004-0.016 0.027-0.058 0-0.098l-1.563-2.449c-0.23-0.367-0.132-0.824 0.223-1.062l1.352-0.86c0.34-0.23 0.82-0.132 1.058 0.223l1.781 2.793c0.024 0.039 0.063 0.043 0.079 0.043 0.02 0 0.054-0.008 0.078-0.047L23.57 21.3c0.098-0.172 0.258-0.29 0.453-0.336 0.204-0.047 0.418-0.012 0.59 0.105l1.344 0.836c0.36 0.23 0.469 0.707 0.242 1.059l-1.543 2.441c-0.027 0.047-0.015 0.082-0.004 0.102 0.008 0.012 0.032 0.055 0.086 0.055l2.82-0.012h0.02c0.407 0 0.742 0.336 0.754 0.758v1.574c0.008 0.195-0.066 0.383-0.207 0.527-0.14 0.153-0.344 0.238-0.55 0.246l-2.829 0.008c-0.047 0-0.07 0.035-0.078 0.05-0.008 0.013-0.027 0.056 0 0.099l1.563 2.449c0.226 0.363 0.132 0.82-0.223 1.062L24.68 33.18c-0.16 0.11-0.36 0.148-0.559 0.11-0.203-0.04-0.386-0.16-0.503-0.333l-1.782-2.77c-0.023-0.038-0.058-0.042-0.074-0.042-0.02 0-0.059 0.008-0.082 0.047l-1.766 2.793c-0.148 0.226-0.402 0.355-0.664 0.355"/>
</vector>

Cheers Henning

alexjlockwood commented 6 years ago

Weird... does this also happen in a non-RemoteView on the Samsung Note 3 when not using AppCompat? Because I have no idea why the bug would only occur inside a RemoteView...

henningBunk commented 6 years ago

Hey! I've finally got the time to check this issue again. I tested it again and you are right, the graphics are also broken inside of the app. When using AppCompat the problem is gone.

Is it somehow possible to prevent the conversion to relative coordinates?

alexjlockwood commented 6 years ago

Sounds like a good idea to me. I'll try to make some free time to work on it. :)