geftimov / android-pathview

Android view with both path from constructed path or from svg.
Apache License 2.0
2.91k stars 513 forks source link

Crash on Battery Saver Mode #12

Open hiteshdua1 opened 9 years ago

hiteshdua1 commented 9 years ago

Hi, Once you have the project configured and running, It crashes when the phone is in Battery saving mode [android 5.1 ], Tested it on device Moto E 1st Gen android.

geftimov commented 9 years ago

Strange. I will test it and keep you posted.

hiteshdua1 commented 9 years ago

Here is the Log : java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.RectF com.caverock.androidsvg.SVG.getDocumentViewBox()' on a null object reference at com.eftimoff.androipathview.SvgUtils.rescaleCanvas(SvgUtils.java:129) at com.eftimoff.androipathview.SvgUtils.drawSvgAfter(SvgUtils.java:76) at com.eftimoff.androipathview.PathView.fillAfter(PathView.java:216) at com.eftimoff.androipathview.PathView.onDraw(PathView.java:204) at android.view.View.draw(View.java:15249) at android.view.View.updateDisplayListIfDirty(View.java:14185) at android.view.View.getDisplayList(View.java:14207) at android.view.View.draw(View.java:14977) at android.view.ViewGroup.drawChild(ViewGroup.java:3407) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3200) at android.view.View.draw(View.java:15252) at android.view.View.updateDisplayListIfDirty(View.java:14185) at android.view.View.getDisplayList(View.java:14207) at android.view.View.draw(View.java:14977) at android.view.ViewGroup.drawChild(ViewGroup.java:3407) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3200) at android.view.View.updateDisplayListIfDirty(View.java:14180) at android.view.View.getDisplayList(View.java:14207) at android.view.View.draw(View.java:14977) at android.view.ViewGroup.drawChild(ViewGroup.java:3407) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3200) at android.view.View.updateDisplayListIfDirty(View.java:14180) at android.view.View.getDisplayList(View.java:14207) at android.view.View.draw(View.java:14977) at android.view.ViewGroup.drawChild(ViewGroup.java:3407) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3200) at android.view.View.updateDisplayListIfDirty(View.java:14180) at android.view.View.getDisplayList(View.java:14207) at android.view.View.draw(View.java:14977) at android.view.ViewGroup.drawChild(ViewGroup.java:3407) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3200) at android.view.View.updateDisplayListIfDirty(View.java:14180) at android.view.View.getDisplayList(View.java:14207) at android.view.View.draw(View.java:14977) at android.view.ViewGroup.drawChild(ViewGroup.java:3407) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3200) at android.view.View.draw(View.java:15252) at android.widget.FrameLayout.draw(FrameLayout.java:598) at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2650) at android.view.View.updateDisplayListIfDirty(View.java:14185) at android.view.View.getDisplayList(View.java:14207) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:318) at android.view.ViewRootImpl.draw(ViewRootImpl.java:2560) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2382) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2012) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1084) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5990) 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:5343) 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:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

geftimov commented 9 years ago

I found the problem. It is destroying the SVG object when trying to fill after. I will fix it today and increase the version.

hiteshdua1 commented 9 years ago

Sure that would be great ! (y)

b3stia commented 9 years ago

Hi, what about update? It will be great if u can make this :)

waynesford commented 9 years ago

Would love to see an update too!

geftimov commented 9 years ago

@hdcoder @b3stia @waynesford Hey I will fix , sorry for the delay (2 months).

I have a question though : As VectorDrawable is up VectorDrawable

is it better to deprecate this library and create on for supporting PathVectorDrawable?

waynesford commented 9 years ago

Unfortunately, VectorDrawable is only available for API 21+. I think it's probably better to just fix this bug. We've been using your library in production for quite some time now, and it's worked great, this has been the only bug that's come up for us!

Swati4star commented 8 years ago

Getting same error on device with android version 4.4.4

annshsingh commented 6 years ago

Using this logic to handle this bug -

PowerManager powerManager = (PowerManager)
            getActivity().getSystemService(Context.POWER_SERVICE);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
            && powerManager.isPowerSaveMode())
    {
        //Disable pathView here 
    }
ccone1995 commented 9 months ago

[自动回复]已收到来信。