Loading core/java/android/view/ViewStub.java +15 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.util.AttributeSet; import com.android.internal.R; import java.lang.ref.WeakReference; /** * A ViewStub is an invisible, zero-sized View that can be used to lazily inflate * layout resources at runtime. Loading Loading @@ -68,6 +70,8 @@ public final class ViewStub extends View { private int mLayoutResource = 0; private int mInflatedId; private WeakReference<View> mInflatedViewRef; private OnInflateListener mInflateListener; public ViewStub(Context context) { Loading Loading @@ -196,9 +200,15 @@ public final class ViewStub extends View { */ @Override public void setVisibility(int visibility) { if (mInflatedViewRef != null) { View view = mInflatedViewRef.get(); if (view != null) { view.setVisibility(visibility); } else { throw new IllegalStateException("setVisibility called on un-referenced view"); } } else if (visibility == VISIBLE || visibility == INVISIBLE) { super.setVisibility(visibility); if (visibility == VISIBLE || visibility == INVISIBLE) { inflate(); } } Loading Loading @@ -234,6 +244,8 @@ public final class ViewStub extends View { parent.addView(view, index); } mInflatedViewRef = new WeakReference(view); if (mInflateListener != null) { mInflateListener.onInflate(this, view); } Loading core/java/android/widget/AdapterView.java +1 −1 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { /** * View to show if there are no items to show. */ View mEmptyView; private View mEmptyView; /** * The number of items in the current adapter. Loading Loading
core/java/android/view/ViewStub.java +15 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.util.AttributeSet; import com.android.internal.R; import java.lang.ref.WeakReference; /** * A ViewStub is an invisible, zero-sized View that can be used to lazily inflate * layout resources at runtime. Loading Loading @@ -68,6 +70,8 @@ public final class ViewStub extends View { private int mLayoutResource = 0; private int mInflatedId; private WeakReference<View> mInflatedViewRef; private OnInflateListener mInflateListener; public ViewStub(Context context) { Loading Loading @@ -196,9 +200,15 @@ public final class ViewStub extends View { */ @Override public void setVisibility(int visibility) { if (mInflatedViewRef != null) { View view = mInflatedViewRef.get(); if (view != null) { view.setVisibility(visibility); } else { throw new IllegalStateException("setVisibility called on un-referenced view"); } } else if (visibility == VISIBLE || visibility == INVISIBLE) { super.setVisibility(visibility); if (visibility == VISIBLE || visibility == INVISIBLE) { inflate(); } } Loading Loading @@ -234,6 +244,8 @@ public final class ViewStub extends View { parent.addView(view, index); } mInflatedViewRef = new WeakReference(view); if (mInflateListener != null) { mInflateListener.onInflate(this, view); } Loading
core/java/android/widget/AdapterView.java +1 −1 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { /** * View to show if there are no items to show. */ View mEmptyView; private View mEmptyView; /** * The number of items in the current adapter. Loading