Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58acbafc authored by Adam Powell's avatar Adam Powell
Browse files

Fix for http://b/issue?id=2323459 and generics correctness on a WeakReference

ViewStub.setVisibility now passes View.GONE through. Even though this doesn't
make a lot of sense to do in practice, it preserves the value for future
ViewStub.getVisibility calls.
parent 3beb2fa4
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -207,11 +207,13 @@ public final class ViewStub extends View {
            } else {
                throw new IllegalStateException("setVisibility called on un-referenced view");
            }
        } else if (visibility == VISIBLE || visibility == INVISIBLE) {
        } else {
            super.setVisibility(visibility);
            if (visibility == VISIBLE || visibility == INVISIBLE) {
                inflate();
            }
        }
    }

    /**
     * Inflates the layout resource identified by {@link #getLayoutResource()}
@@ -244,7 +246,7 @@ public final class ViewStub extends View {
                    parent.addView(view, index);
                }

                mInflatedViewRef = new WeakReference(view);
                mInflatedViewRef = new WeakReference<View>(view);

                if (mInflateListener != null) {
                    mInflateListener.onInflate(this, view);