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

Commit 06c2fffd authored by Alan Viverette's avatar Alan Viverette
Browse files

Implicitly cast views obtained via View.findView methods

Removes all explicit casts from android.widget classes. Also @removes
methods on ListView that were overriding @hidden methods and should
never have been exposed as public API.

Bug: 24137209
Test: make
Change-Id: I6ccfc6f001b355c4880f2b54e1a5474df78d6228
parent df9a4f9a
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -44020,8 +44020,8 @@ package android.view {
    method public void drawableHotspotChanged(float, float);
    method protected void drawableStateChanged();
    method public android.view.View findFocus();
    method public final android.view.View findViewById(int);
    method public final android.view.View findViewWithTag(java.lang.Object);
    method public final <T extends android.view.View> T findViewById(int);
    method public final <T extends android.view.View> T findViewWithTag(java.lang.Object);
    method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence, int);
    method protected deprecated boolean fitSystemWindows(android.graphics.Rect);
    method public android.view.View focusSearch(int);
@@ -48964,8 +48964,6 @@ package android.widget {
    method public void addHeaderView(android.view.View);
    method public boolean areFooterDividersEnabled();
    method public boolean areHeaderDividersEnabled();
    method protected android.view.View findViewTraversal(int);
    method protected android.view.View findViewWithTagTraversal(java.lang.Object);
    method public android.widget.ListAdapter getAdapter();
    method public deprecated long[] getCheckItemIds();
    method public android.graphics.drawable.Drawable getDivider();
+2 −4
Original line number Diff line number Diff line
@@ -47422,8 +47422,8 @@ package android.view {
    method public void drawableHotspotChanged(float, float);
    method protected void drawableStateChanged();
    method public android.view.View findFocus();
    method public final android.view.View findViewById(int);
    method public final android.view.View findViewWithTag(java.lang.Object);
    method public final <T extends android.view.View> T findViewById(int);
    method public final <T extends android.view.View> T findViewWithTag(java.lang.Object);
    method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence, int);
    method protected deprecated boolean fitSystemWindows(android.graphics.Rect);
    method public android.view.View focusSearch(int);
@@ -52730,8 +52730,6 @@ package android.widget {
    method public void addHeaderView(android.view.View);
    method public boolean areFooterDividersEnabled();
    method public boolean areHeaderDividersEnabled();
    method protected android.view.View findViewTraversal(int);
    method protected android.view.View findViewWithTagTraversal(java.lang.Object);
    method public android.widget.ListAdapter getAdapter();
    method public deprecated long[] getCheckItemIds();
    method public android.graphics.drawable.Drawable getDivider();
+2 −4
Original line number Diff line number Diff line
@@ -44326,8 +44326,8 @@ package android.view {
    method public void drawableHotspotChanged(float, float);
    method protected void drawableStateChanged();
    method public android.view.View findFocus();
    method public final android.view.View findViewById(int);
    method public final android.view.View findViewWithTag(java.lang.Object);
    method public final <T extends android.view.View> T findViewById(int);
    method public final <T extends android.view.View> T findViewWithTag(java.lang.Object);
    method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence, int);
    method protected deprecated boolean fitSystemWindows(android.graphics.Rect);
    method public android.view.View focusSearch(int);
@@ -49281,8 +49281,6 @@ package android.widget {
    method public void addHeaderView(android.view.View);
    method public boolean areFooterDividersEnabled();
    method public boolean areHeaderDividersEnabled();
    method protected android.view.View findViewTraversal(int);
    method protected android.view.View findViewWithTagTraversal(java.lang.Object);
    method public android.widget.ListAdapter getAdapter();
    method public deprecated long[] getCheckItemIds();
    method public android.graphics.drawable.Drawable getDivider();
+22 −21
Original line number Diff line number Diff line
@@ -19967,38 +19967,39 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    /**
     * {@hide}
     * @param id the id of the view to be found
     * @return the view of the specified id, null if cannot be found
     * @hide
     */
    protected View findViewTraversal(@IdRes int id) {
    protected <T extends View> T findViewTraversal(@IdRes int id) {
        if (id == mID) {
            return this;
            return (T) this;
        }
        return null;
    }
    /**
     * {@hide}
     * @param tag the tag of the view to be found
     * @return the view of specified tag, null if cannot be found
     * @hide
     */
    protected View findViewWithTagTraversal(Object tag) {
    protected <T extends View> T findViewWithTagTraversal(Object tag) {
        if (tag != null && tag.equals(mTag)) {
            return this;
            return (T) this;
        }
        return null;
    }
    /**
     * {@hide}
     * @param predicate The predicate to evaluate.
     * @param childToSkip If not null, ignores this child during the recursive traversal.
     * @return The first view that matches the predicate or null.
     * @hide
     */
    protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
    protected <T extends View> T findViewByPredicateTraversal(Predicate<View> predicate,
            View childToSkip) {
        if (predicate.apply(this)) {
            return this;
            return (T) this;
        }
        return null;
    }
@@ -20011,7 +20012,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @return The view that has the given id in the hierarchy or null
     */
    @Nullable
    public final View findViewById(@IdRes int id) {
    public final <T extends View> T findViewById(@IdRes int id) {
        if (id < 0) {
            return null;
        }
@@ -20024,11 +20025,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param accessibilityId The searched accessibility id.
     * @return The found view.
     */
    final View findViewByAccessibilityId(int accessibilityId) {
    final <T extends View> T  findViewByAccessibilityId(int accessibilityId) {
        if (accessibilityId < 0) {
            return null;
        }
        View view = findViewByAccessibilityIdTraversal(accessibilityId);
        T view = findViewByAccessibilityIdTraversal(accessibilityId);
        if (view != null) {
            return view.includeForAccessibility() ? view : null;
        }
@@ -20047,12 +20048,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @param accessibilityId The accessibility id.
     * @return The found view.
     *
     * @hide
     */
    public View findViewByAccessibilityIdTraversal(int accessibilityId) {
    public <T extends View> T findViewByAccessibilityIdTraversal(int accessibilityId) {
        if (getAccessibilityViewId() == accessibilityId) {
            return this;
            return (T) this;
        }
        return null;
    }
@@ -20064,7 +20064,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param tag The tag to search for, using "tag.equals(getTag())".
     * @return The View that has the given tag in the hierarchy or null
     */
    public final View findViewWithTag(Object tag) {
    public final <T extends View> T findViewWithTag(Object tag) {
        if (tag == null) {
            return null;
        }
@@ -20072,19 +20072,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    /**
     * {@hide}
     * Look for a child view that matches the specified predicate.
     * If this view matches the predicate, return this view.
     *
     * @param predicate The predicate to evaluate.
     * @return The first view that matches the predicate or null.
     * @hide
     */
    public final View findViewByPredicate(Predicate<View> predicate) {
    public final <T extends View> T findViewByPredicate(Predicate<View> predicate) {
        return findViewByPredicateTraversal(predicate, null);
    }
    /**
     * {@hide}
     * Look for a child view that matches the specified predicate,
     * starting with the specified view and its descendents and then
     * recusively searching the ancestors and siblings of that view
@@ -20098,11 +20097,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param start The view to start from.
     * @param predicate The predicate to evaluate.
     * @return The first view that matches the predicate or null.
     * @hide
     */
    public final View findViewByPredicateInsideOut(View start, Predicate<View> predicate) {
    public final <T extends View> T findViewByPredicateInsideOut(
            View start, Predicate<View> predicate) {
        View childToSkip = null;
        for (;;) {
            View view = start.findViewByPredicateTraversal(predicate, childToSkip);
            T view = start.findViewByPredicateTraversal(predicate, childToSkip);
            if (view != null || start == this) {
                return view;
            }
+10 −9
Original line number Diff line number Diff line
@@ -4208,9 +4208,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * {@hide}
     */
    @Override
    protected View findViewTraversal(@IdRes int id) {
    protected <T extends View> T findViewTraversal(@IdRes int id) {
        if (id == mID) {
            return this;
            return (T) this;
        }

        final View[] where = mChildren;
@@ -4223,7 +4223,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                v = v.findViewById(id);

                if (v != null) {
                    return v;
                    return (T) v;
                }
            }
        }
@@ -4235,9 +4235,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * {@hide}
     */
    @Override
    protected View findViewWithTagTraversal(Object tag) {
    protected <T extends View> T findViewWithTagTraversal(Object tag) {
        if (tag != null && tag.equals(mTag)) {
            return this;
            return (T) this;
        }

        final View[] where = mChildren;
@@ -4250,7 +4250,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                v = v.findViewWithTag(tag);

                if (v != null) {
                    return v;
                    return (T) v;
                }
            }
        }
@@ -4262,9 +4262,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * {@hide}
     */
    @Override
    protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
    protected <T extends View> T findViewByPredicateTraversal(Predicate<View> predicate,
            View childToSkip) {
        if (predicate.apply(this)) {
            return this;
            return (T) this;
        }

        final View[] where = mChildren;
@@ -4277,7 +4278,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                v = v.findViewByPredicate(predicate);

                if (v != null) {
                    return v;
                    return (T) v;
                }
            }
        }
Loading