{"action":"closed","issue":{"url":"https://api.github.com/repos/JohannBlake/JBHeaderScroll/issues/1","labels_url":"https://api.github.com/repos/JohannBlake/JBHeaderScroll/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/JohannBlake/JBHeaderScroll/issues/1/comments","events_url":"https://api.github.com/repos/JohannBlake/JBHeaderScroll/issues/1/events","html_url":"https://github.com/JohannBlake/JBHeaderScroll/issues/1","id":92949675,"number":1,"title":"Toolbar disappears forever after first scroll event","user":{"login":"SWalls","id":6632279,"avatar_url":"https://avatars.githubusercontent.com/u/6632279?v=3","gravatar_id":"","url":"https://api.github.com/users/SWalls","html_url":"https://github.com/SWalls","followers_url":"https://api.github.com/users/SWalls/followers","following_url":"https://api.github.com/users/SWalls/following{/other_user}","gists_url":"https://api.github.com/users/SWalls/gists{/gist_id}","starred_url":"https://api.github.com/users/SWalls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SWalls/subscriptions","organizations_url":"https://api.github.com/users/SWalls/orgs","repos_url":"https://api.github.com/users/SWalls/repos","events_url":"https://api.github.com/users/SWalls/events{/privacy}","received_events_url":"https://api.github.com/users/SWalls/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-03T23:43:30Z","updated_at":"2015-07-04T00:18:29Z","closed_at":"2015-07-04T00:18:29Z","body":"Thanks for making this library!\r\n\r\nUpon opening my app, the toolbar is visible as usual, but as soon as I scroll a tiny little bit (not enough to cause the hide animation), the toolbar becomes invisible and is replaced by just a blank white box. I think this might be a problem with `bringToFront()` but I'm not sure. Other than it turning into a white box, everything else seems to be working absolutely fine. The view's top margin changes appropriately while scrolling as expected.\r\n\r\nHere's the code for the function that is called in my `onCreate()` method. It's copy-pasted directly from your README file, with a few slight changes. Just so you know, I'm using a `RecyclerView` instead of a `ListView`, but these are essentially the same thing, so it's easily supported by your library.\r\n\r\n```java\r\nprivate void setupJBHeaderScroll() {\r\n    toolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()\r\n    {\r\n        @Override\r\n        public void onGlobalLayout()\r\n        {\r\n            try\r\n            {\r\n                scroller.setY(toolbar.getHeight());\r\n                jbHeaderScroll = new JBHeaderScroll(toolbar, 0);\r\n                jbHeaderScroll.registerScroller(scroller, new JBHeaderScroll.IJBHeaderScroll()\r\n                {\r\n                    @Override\r\n                    public void onReposition(float top, boolean scrollingUp, float scrollDelta)\r\n                    {\r\n                        try\r\n                        {\r\n                            LibraryFragment currentPageFragment = pagerAdapter.getCurrentFragment();\r\n                            RecyclerView playList = currentPageFragment.getRecyclerView();\r\n                            LinearLayoutManager listLayoutManager = currentPageFragment.getRecyclerViewLayoutManager();\r\n\r\n                            int pos = listLayoutManager.findFirstVisibleItemPosition();\r\n                            float y = playList.getChildAt(pos).getY();\r\n\r\n                            // The list's view top edge must be adjusted during scrolling.\r\n                            // IMPORTANT: Make sure you use the correct type of LayoutParams which is the type that applies to the parent\r\n                            // container of the listview.\r\n\r\n                            // When the user releases their finger while scrolling very slowly, the jitter from their finger\r\n                            // may result in a slight amount of scrolling downward. This can result in a side effect of the\r\n                            // header animating down when it might have animated up depending on its current position. To\r\n                            // avoid this, avoid repositioning the scroller for small amounts of scrolling. You may need to\r\n                            // play with this value.\r\n\r\n                            if (scrollingUp || (!scrollingUp && (scrollDelta > 5)))\r\n                            {\r\n                                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);\r\n                                layoutParams.setMargins(0, (int) top, 0, 0);\r\n                                scroller.setLayoutParams(layoutParams);\r\n                                toolbar.bringToFront(); // Necessary if your scroller is rendered last.\r\n                            }\r\n                        }\r\n                        catch (Exception e)\r\n                        {\r\n                            LogP.e(LogP.TAG_SCRIPTREADER, \"onReposition: \" + e.toString());\r\n                        }\r\n                    }\r\n\r\n                    @Override\r\n                    public int onHeaderBeforeAnimation(boolean scrollingUp, float scrollDelta)\r\n                    {\r\n                        return JBHeaderScroll.ANIMATE_HEADER_USE_DEFAULT;\r\n                    }\r\n\r\n                    @Override\r\n                    public void onHeaderAfterAnimation(boolean animatedUp, float scrollDelta)\r\n                    {\r\n                    }\r\n                });\r\n\r\n                scroller.setJBHeaderRef(jbHeaderScroll);\r\n                toolbar.getViewTreeObserver().removeOnGlobalLayoutListener(this);\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                LogP.e(LogP.TAG_SCRIPTREADER, \"onGlobalLayout: \" + e.toString());\r\n            }\r\n        }\r\n    });\r\n}\r\n```\r\n\r\nDoes this look right to you, or am I doing something wrong?"}}