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

Error on detaching ChatHead #28

Open
icoolguy1995 opened this issue Jun 4, 2017 · 3 comments
Open

Error on detaching ChatHead #28

icoolguy1995 opened this issue Jun 4, 2017 · 3 comments

Comments

@icoolguy1995
Copy link

Hi there! Thanks for this wonderful library. I am having slight problem while removing ChatHead. Whenever, I try to detach ChatHead by moving it to the bottom I am getting this error:

java.lang.IllegalArgumentException: View=com.flipkart.chatheads.ui.container.WindowManagerContainer$MotionCaptureView{3f1e3c5 V.ED..... ......I. 0,0-480,767} not attached to window manager
06-05 00:32:50.318 30194-30194/com.jesture.phoenix W/System.err:     at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:473)
06-05 00:32:50.318 30194-30194/com.jesture.phoenix W/System.err:     at android.view.WindowManagerGlobal.updateViewLayout(WindowManagerGlobal.java:368)
06-05 00:32:50.318 30194-30194/com.jesture.phoenix W/System.err:     at android.view.WindowManagerImpl.updateViewLayout(WindowManagerImpl.java:101)
06-05 00:32:50.318 30194-30194/com.jesture.phoenix W/System.err:     at com.flipkart.chatheads.ui.container.WindowManagerContainer.onArrangementChanged(WindowManagerContainer.java:204)
06-05 00:32:50.318 30194-30194/com.jesture.phoenix W/System.err:     at com.flipkart.chatheads.ui.container.DefaultChatHeadManager.setArrangementImpl(DefaultChatHeadManager.java:398)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at com.flipkart.chatheads.ui.container.DefaultChatHeadManager.onMeasure(DefaultChatHeadManager.java:186)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at com.flipkart.chatheads.ui.HostFrameLayout.onLayout(HostFrameLayout.java:24)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.View.layout(View.java:17641)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.ViewGroup.layout(ViewGroup.java:5575)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2346)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2068)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6344)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.Choreographer.doCallbacks(Choreographer.java:686)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.Choreographer.doFrame(Choreographer.java:621)
06-05 00:32:50.319 30194-30194/com.jesture.phoenix W/System.err:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
06-05 00:32:50.320 30194-30194/com.jesture.phoenix W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
06-05 00:32:50.320 30194-30194/com.jesture.phoenix W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
06-05 00:32:50.320 30194-30194/com.jesture.phoenix W/System.err:     at android.os.Looper.loop(Looper.java:154)
06-05 00:32:50.320 30194-30194/com.jesture.phoenix W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6128)
06-05 00:32:50.320 30194-30194/com.jesture.phoenix W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
06-05 00:32:50.320 30194-30194/com.jesture.phoenix W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
06-05 00:32:50.320 30194-30194/com.jesture.phoenix W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)


Please help me out! Thanks!

@cazador4
Copy link

cazador4 commented Aug 4, 2017

@icoolguy1995 Look at my fork

@HungTDO
Copy link

HungTDO commented Aug 13, 2017

i got the same error! :(

@HungTDO
Copy link

HungTDO commented Aug 13, 2017

@icoolguy1995 I solved the problem
Just Check view is attached to window (in WindowManagerContainer.java#onArrangementChanged):

// TODO: ChatHeadLibs: Fix error here (not attached window)
        if (motionCaptureView != null && motionCaptureView.getWindowToken() != null)
        windowManager.updateViewLayout(motionCaptureView, layoutParams);

After resolved that, maybe raise error when minimized chathead. Plz edit code in MinimizedArrangement.java#getBundle()

if (hero != null && hero.getHorizontalSpring() != null && hero.getVerticalSpring() != null)  {
        relativeXPosition = hero.getHorizontalSpring().getCurrentValue() * 1.0 / maxWidth;
        relativeYPosition = hero.getVerticalSpring().getCurrentValue() * 1.0 / maxHeight;
    }

All worked.

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

3 participants