glomadrian / RoadRunner

Road Runner is a library for android which allow you to make your own loading animation using a SVG image
1.16k stars 132 forks source link

Error when used my path #7

Open jainkuniya opened 8 years ago

jainkuniya commented 8 years ago

When I used my path(points) it crashes.

Error 07-11 09:13:19.320 19436-19436/example.com.sampleprogress E/IndeterminateLoading: Path parse exception: java.text.ParseException: Expected command (at offset 0) at com.github.glomadrian.roadrunner.svg.SvgPathParser.consumeCommand(SvgPathParser.java:189) at com.github.glomadrian.roadrunner.svg.SvgPathParser.parsePath(SvgPathParser.java:63) at com.github.glomadrian.roadrunner.RoadRunner.parsePath(RoadRunner.java:47) at com.github.glomadrian.roadrunner.RoadRunner.buildPathData(RoadRunner.java:32) at com.github.glomadrian.roadrunner.IndeterminateRoadRunner.onSizeChanged(IndeterminateRoadRunner.java:91) at android.view.View.sizeChange(View.java:15743) at android.view.View.setFrame(View.java:15716) at android.view.View.layout(View.java:15632) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557) at android.widget.LinearLayout.onLayout(LinearLayout.java:1466) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573) at android.widget.FrameLayout.onLayout(FrameLayout.java:508) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:435) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573) at android.widget.FrameLayout.onLayout(FrameLayout.java:508) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557) at android.widget.LinearLayout.onLayout(LinearLayout.java:1466) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573) at android.widget.FrameLayout.onLayout(FrameLayout.java:508) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5786) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767) at android.view.Choreographer.doCallbacks(Choreographer.java:580) at android.view.Choreographer.doFrame(Choreographer.java:550) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5289) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 07-11 09:13:19.321 19436-19436/example.com.sampleprogress D/AndroidRuntime: Shutting down VM 07-11 09:13:19.322 19436-19436/example.com.sampleprogress E/AndroidRuntime: FATAL EXCEPTION: main Process: example.com.sampleprogress, PID: 19436 java.lang.NullPointerException: Attempt to invoke interface method 'void com.github.glomadrian.roadrunner.painter.indeterminate.IndeterminatePathPainter.start()' on a null object reference at com.github.glomadrian.roadrunner.IndeterminateRoadRunner.onSizeChanged(IndeterminateRoadRunner.java:97) at android.view.View.sizeChange(View.java:15743) at android.view.View.setFrame(View.java:15716) at android.view.View.layout(View.java:15632) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557) at android.widget.LinearLayout.onLayout(LinearLayout.java:1466) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573) at android.widget.FrameLayout.onLayout(FrameLayout.java:508) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:435) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573) at android.widget.FrameLayout.onLayout(FrameLayout.java:508) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557) at android.widget.LinearLayout.onLayout(LinearLayout.java:1466) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573) at android.widget.FrameLayout.onLayout(FrameLayout.java:508) at android.view.View.layout(View.java:15636) at android.view.ViewGroup.layout(ViewGroup.java:4967) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5786) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767) at android.view.Choreographer.doCallbacks(Choreographer.java:580) at android.view.Choreographer.doFrame(Choreographer.java:550) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5289) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

My path 3.006,2.446 32.627,12.65 45.63,4.603 53.618,9.501 56.534,10.201 63.064,5.362 71.927,2.971 75.017,6.644 78.108,11.542 83.064,7.548 84.988,4.079 90.761,3.787 93.385,8.394 93.91,11.834 92.102,19.181 90.644,24.487 84.755,30.201 77.933,36.09 68.137,37.373 52.102,38.073 38.05,35.566 30.12,33.758 21.84,32.184 19.332,35.566 13.735,37.49 7.379,32.65 4.055,26.703 3.356,23.671 2.773,20.259 2.19,15.682 2.19,10.959 2.19,6.819 2.889,2.738

Drjacky commented 7 years ago

I'm not sure, but it's not a valid SVG path; You can save it in a valid SVG structure, and open it via IE, then you see nothing. It must have a 'M' character at the first of string. I mean: "M3.006,2.446 32.627,12.65 45.63,4.603 53.618,9.501 56.534,10.201 63.064,5.362 71.927,2.971 75.017,6.644 78.108,11.542 83.064,7.548 84.988,4.079 90.761,3.787 93.385,8.394 93.91,11.834 92.102,19.181 90.644,24.487 84.755,30.201 77.933,36.09 68.137,37.373 52.102,38.073 38.05,35.566 30.12,33.758 21.84,32.184 19.332,35.566 13.735,37.49 7.379,32.65 4.055,26.703 3.356,23.671 2.773,20.259 2.19,15.682 2.19,10.959 2.19,6.819 2.889,2.738"

Valid SVG structure:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
 "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
 width="512.000000pt" height="512.000000pt" viewBox="0 0 512.000000 512.000000"
 preserveAspectRatio="xMidYMid meet">

<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M184 3774 c-54 -19 -118 -75 -152 -132 l-27 -47 -3 -1423 -2 -1423
25 -53 c30 -64 93 -128 155 -159 42 -21 60 -22 292 -25 l246 -3 18 -65 c49
-184 203 -345 399 -418 73 -27 260 -34 345 -12 213 53 387 223 446 434 l17 62
496 0 c303 0 510 4 532 10 20 6 53 22 74 35 l36 25 28 -20 c48 -34 83 -43 180
-49 l94 -6 13 -52 c52 -205 232 -383 441 -437 70 -18 218 -21 295 -5 203 41
402 231 455 433 l17 65 146 3 c127 3 151 6 192 26 61 30 120 90 152 155 l26
51 0 571 c0 648 2 632 -85 805 -64 127 -494 699 -599 797 -92 86 -191 139
-287 154 -77 12 -925 8 -951 -4 -15 -8 -17 11 -20 245 -3 248 -3 254 -29 308
-32 68 -79 115 -144 146 l-50 24 -1365 -1 c-1170 0 -1371 -3 -1406 -15z m2729
-206 c12 -6 27 -18 34 -27 10 -12 12 -325 13 -1388 0 -754 -3 -1379 -6 -1388
-17 -43 -38 -45 -537 -45 l-474 0 -17 62 c-57 206 -230 376 -435 429 -146 37
-310 21 -439 -45 -153 -78 -262 -208 -314 -375 l-22 -71 -208 0 c-167 0 -215
3 -238 15 -64 33 -60 -60 -60 1430 l0 1357 29 29 29 29 1312 0 c978 0 1317 -3
1333 -12z m1301 -751 c32 -21 80 -62 107 -90 l50 -52 -273 -5 -274 -5 -67 -33
c-48 -24 -79 -48 -107 -83 -67 -85 -72 -112 -68 -416 l3 -268 27 -50 c32 -62
103 -129 166 -158 46 -22 58 -22 590 -25 l542 -3 0 -410 c0 -450 0 -453 -60
-484 -21 -11 -60 -15 -137 -15 l-108 0 -17 63 c-52 200 -236 380 -443 432 -69
18 -211 20 -287 4 -205 -42 -402 -228 -458 -434 l-17 -60 -57 -3 c-65 -3 -114
20 -134 63 -9 19 -12 281 -12 1016 l0 991 34 34 35 35 454 -3 454 -3 57 -38z
m453 -539 c71 -95 144 -198 161 -230 32 -56 72 -158 72 -185 0 -11 -91 -13
-515 -13 l-515 0 -38 34 -37 34 -3 209 c-4 227 2 269 45 302 25 20 38 21 363
21 l338 0 129 -172z m-3242 -1274 c307 -79 409 -448 188 -672 -198 -200 -524
-141 -647 118 -28 59 -31 74 -31 165 0 91 3 106 31 165 51 108 153 194 266
224 70 19 121 19 193 0z m2647 5 c209 -45 356 -255 319 -458 -51 -278 -359
-425 -597 -285 -157 92 -238 286 -189 452 32 108 111 204 208 253 94 48 163
58 259 38z"/>
</g>
</svg>