Skip to content

Commit

Permalink
Merge pull request #172 from MajedDH/master
Browse files Browse the repository at this point in the history
fix IllegalStateException when view is not attached.
  • Loading branch information
deano2390 committed Apr 18, 2019
2 parents 0901acd + 0405d39 commit f2ec8f6
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -992,8 +992,14 @@ public boolean show(final Activity activity) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {

if (mShouldAnimate) {
boolean attached;
// taken from https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/core/src/main/java/androidx/core/view/ViewCompat.java#3310
if (Build.VERSION.SDK_INT >= 19) {
attached = isAttachedToWindow();
} else {
attached = getWindowToken() != null;
}
if (mShouldAnimate && attached) {
fadeIn();
} else {
setVisibility(VISIBLE);
Expand Down

0 comments on commit f2ec8f6

Please sign in to comment.