Closed agrosner closed 8 years ago
I wonder if we can solve this without requiring the user to call dispose()
.
Can you try the following code and see if it solves the memory leak for you? LeakCanary keeps failing to analyze so I'm not able to verify.
fab.getViewTreeObserver()
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// Removing layout listener to avoid multiple calls
MaterialSheetFab.this.fab.getViewTreeObserver()
.removeGlobalOnLayoutListener(this);
// Initialize FAB anchor when the FAB view is laid out
updateFabAnchor();
}
});
Allows you to remove the
OnGlobalLayoutListener
from the FAB applied in theMaterialSheetFab
so that it doesn't leak theActivity
when used in aFragment
.