New version of SwipeRefreshLayout causes the wrong view thread

I have a ViewPager (supported by AbstractBrowsePagerAdapter) consisting of fragments. Each fragment inflates the layout using SwipeRefreshLayout as the root. I recently updated the support-v4 library: 21.0.0. The new SwipeRefreshLayout uses a circle progress bar instead of a linear vertical progress bar, as shown in the screenshot below.

When I pull to refresh, swipe right, create a new fragment in the ViewPager with the same index as the one I pulled for the update, and then go to this new fragment, the previous view still appears on top of my new content.

Bug with new SwipeRefreshLayout

As you can see in the screenshot, the text view β€œempty catalog” and β€œcircle progress bar” still appear from the previous fragment that was destroyed.

  • This only happens when SwipeRefreshLayout is in boot state (the bootloader is displayed on the screen)
  • This does not happen with a previous version of SwipeRefreshLayout
  • The hierarchyviewer tool does not work when an error occurs. It works before that, it works if I restart the application, but does not work when in the listening state.
  • When I reset the view using DDMS, the views from the previous snippet are not displayed.

This seems like a bug in the new SwipeRefreshLayout, but I could not find anyone having the same problem, and it does not seem to be reported about https://code.google.com/p/android/issues/list?can=1&q = SwipeRefreshLayout & colspec = ID + Type + Status + Owner + Summary + Stars & cells = tiles

I am looking for a workaround that makes the views from the previous fragment be removed forever.

+6
source share
1 answer

I managed to solve this problem by calling clearAnimation () in the onPause () method of my fragment

@Override public void onPause() { swipeLayout.clearAnimation(); super.onPause(); } 
+8
source

Source: https://habr.com/ru/post/979423/


All Articles