Last active
December 19, 2019 19:10
-
-
Save AdamMc331/b3708fca7b77d2992c2e2400bda0a6f9 to your computer and use it in GitHub Desktop.
Lifting code from RecyclerView to share
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is from Android's RecyclerView.Java file | |
/** | |
* Note: this Runnable is only ever posted if: | |
* 1) We've been through first layout | |
* 2) We know we have a fixed size (mHasFixedSize) | |
* 3) We're attached | |
*/ | |
final Runnable mUpdateChildViewsRunnable = new Runnable() { | |
@Override | |
public void run() { | |
if (!mFirstLayoutComplete || isLayoutRequested()) { | |
// a layout request will happen, we should not do layout here. | |
return; | |
} | |
if (!mIsAttached) { | |
requestLayout(); | |
// if we are not attached yet, mark us as requiring layout and skip | |
return; | |
} | |
if (mLayoutSuppressed) { | |
mLayoutWasDefered = true; | |
return; //we'll process updates when ice age ends. | |
} | |
consumePendingUpdateOperations(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment