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

Commit c41adfac authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge "Expose selector draw condition for test"

parents 1266a4f5 8e5bd81c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1036,6 +1036,10 @@ package android.view.autofill {

package android.widget {

  public abstract class AbsListView extends android.widget.AdapterView implements android.widget.Filter.FilterListener android.text.TextWatcher android.view.ViewTreeObserver.OnGlobalLayoutListener android.view.ViewTreeObserver.OnTouchModeChangeListener {
    method public final boolean shouldDrawSelector();
  }

  public class CalendarView extends android.widget.FrameLayout {
    method public boolean getBoundsForDate(long, android.graphics.Rect);
  }
+10 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.widget;
import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
@@ -2744,13 +2745,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
    }

    private void drawSelector(Canvas canvas) {
        if (!mSelectorRect.isEmpty()) {
        if (shouldDrawSelector()) {
            final Drawable selector = mSelector;
            selector.setBounds(mSelectorRect);
            selector.draw(canvas);
        }
    }

    /**
     * @hide
     */
    @TestApi
    public final boolean shouldDrawSelector() {
        return !mSelectorRect.isEmpty();
    }

    /**
     * Controls whether the selection highlight drawable should be drawn on top of the item or
     * behind it.