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

Commit f929bbd1 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "New View.dispatchDisplayHint() API. Bug #2399147"

parents 15900779 43c9cdff
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -169579,6 +169579,19 @@
 visibility="public"
>
</method>
<method name="dispatchDisplayHint"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="hint" type="int">
</parameter>
</method>
<method name="dispatchDraw"
 return="void"
 abstract="false"
@@ -171307,6 +171320,19 @@
 visibility="protected"
>
</method>
<method name="onDisplayHint"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="protected"
>
<parameter name="hint" type="int">
</parameter>
</method>
<method name="onDraw"
 return="void"
 abstract="false"
+29 −2
Original line number Diff line number Diff line
@@ -3789,7 +3789,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * ViewGroups should override to route to their children.
     * @param changedView The view whose visibility changed. Could be 'this' or
     * an ancestor view.
     * @param visibility The new visibility of changedView.
     * @param visibility The new visibility of changedView: {@link #VISIBLE},
     * {@link #INVISIBLE} or {@link #GONE}.
     */
    protected void dispatchVisibilityChanged(View changedView, int visibility) {
        onVisibilityChanged(changedView, visibility);
@@ -3799,11 +3800,37 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * Called when the visibility of the view or an ancestor of the view is changed.
     * @param changedView The view whose visibility changed. Could be 'this' or
     * an ancestor view.
     * @param visibility The new visibility of changedView.
     * @param visibility The new visibility of changedView: {@link #VISIBLE},
     * {@link #INVISIBLE} or {@link #GONE}.
     */
    protected void onVisibilityChanged(View changedView, int visibility) {
    }

    /**
     * Dispatch a hint about whether this view is displayed. For instance, when
     * a View moves out of the screen, it might receives a display hint indicating
     * the view is not displayed. Applications should not <em>rely</em> on this hint
     * as there is no guarantee that they will receive one.
     * 
     * @param hint A hint about whether or not this view is displayed:
     * {@link #VISIBLE} or {@link #INVISIBLE}.
     */
    public void dispatchDisplayHint(int hint) {
        onDisplayHint(hint);
    }

    /**
     * Gives this view a hint about whether is displayed or not. For instance, when
     * a View moves out of the screen, it might receives a display hint indicating
     * the view is not displayed. Applications should not <em>rely</em> on this hint
     * as there is no guarantee that they will receive one.
     * 
     * @param hint A hint about whether or not this view is displayed:
     * {@link #VISIBLE} or {@link #INVISIBLE}.
     */
    protected void onDisplayHint(int hint) {
    }

    /**
     * Dispatch a window visibility change down the view hierarchy.
     * ViewGroups should override to route to their children.
+13 −0
Original line number Diff line number Diff line
@@ -680,6 +680,19 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }
    }
    
    /**
     * {@inheritDoc}
     */
    @Override
    public void dispatchDisplayHint(int hint) {
        super.dispatchDisplayHint(hint);
        final int count = mChildrenCount;
        final View[] children = mChildren;
        for (int i = 0; i < count; i++) {
            children[i].dispatchDisplayHint(hint);
        }
    }

    /**
     * {@inheritDoc}
     */
+18 −1
Original line number Diff line number Diff line
@@ -2852,6 +2852,23 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        checkSelectionChanged();
    }

    @Override
    protected void onDisplayHint(int hint) {
        super.onDisplayHint(hint);
        switch (hint) {
            case INVISIBLE:
                if (mPopup != null && mPopup.isShowing()) {
                    dismissPopup();
                }
                break;
            case VISIBLE:
                if (mFiltered && mPopup != null && !mPopup.isShowing()) {
                    showPopup();
                }
                break;
        }
    }

    /**
     * Removes the filter window
     */
@@ -3140,7 +3157,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            }
        } else {
            // Hide the popup when we are no longer visible
            if (mPopup.isShowing()) {
            if (mPopup != null && mPopup.isShowing()) {
                dismissPopup();
            }
        }
+12 −0
Original line number Diff line number Diff line
@@ -1032,6 +1032,18 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
        }
    }

    @Override
    protected void onDisplayHint(int hint) {
        super.onDisplayHint(hint);
        switch (hint) {
            case INVISIBLE:
                if (!mDropDownAlwaysVisible) {
                    dismissDropDown();
                }
                break;
        }
    }

    @Override
    protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
        super.onFocusChanged(focused, direction, previouslyFocusedRect);