Skip to content

Instantly share code, notes, and snippets.

@Cassie-von-Clausewitz
Created April 17, 2017 19:02
Show Gist options
  • Save Cassie-von-Clausewitz/67a6f3bbf15da506e8565dd9d9add5eb to your computer and use it in GitHub Desktop.
Save Cassie-von-Clausewitz/67a6f3bbf15da506e8565dd9d9add5eb to your computer and use it in GitHub Desktop.
Clean up the state of the NestedScrollView inside the CoordinatorLayout. Use to test if this would work before subclassing CoordinatorLayout and calling the protected method directly.
try {
Class c = parent.getClass().getSuperclass();
Method cleanupLayoutState = c.getDeclaredMethod("cleanupLayoutState", View.class);
if(!cleanupLayoutState.isAccessible()) {
cleanupLayoutState.setAccessible(true);
}
cleanupLayoutState.invoke(parent, this);
Log.i("BottomSheet", "invoked method");
} catch (Exception ignored) {
Log.e("BottomSheet", ignored.getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment