Expose public API to control mIsChildViewEnabled

This is needed to replace an @UnsupportedApiUsage of the field
in appcompat/widget/DropDownListView.java

Bug: 177008210
Test: AbsListViewTest.testSelectedChildViewEnabled

Change-Id: Ia0bfe3f70f62db8185e1d9784d921e2e1f291006
This commit is contained in:
Alexandre Elias
2022-01-10 19:41:20 -08:00
parent 84d11dd281
commit 5730e5c56c
2 changed files with 23 additions and 0 deletions

View File

@@ -54943,6 +54943,7 @@ package android.widget {
method protected boolean isInFilterMode();
method public boolean isItemChecked(int);
method public boolean isScrollingCacheEnabled();
method public boolean isSelectedChildViewEnabled();
method public boolean isSmoothScrollbarEnabled();
method public boolean isStackFromBottom();
method public boolean isTextFilterEnabled();
@@ -54978,6 +54979,7 @@ package android.widget {
method public void setRemoteViewsAdapter(android.content.Intent);
method public void setScrollIndicators(android.view.View, android.view.View);
method public void setScrollingCacheEnabled(boolean);
method public void setSelectedChildViewEnabled(boolean);
method public void setSelectionFromTop(int, int);
method public void setSelector(@DrawableRes int);
method public void setSelector(android.graphics.drawable.Drawable);

View File

@@ -2656,6 +2656,27 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
}
/**
* Returns whether the selected child view (from the adapter's getView) is enabled.
*
* @return true if enabled
*/
public boolean isSelectedChildViewEnabled() {
return mIsChildViewEnabled;
}
/**
* Set whether the selected child view (from the adapter's getView) is enabled.
*
* When refreshDrawableState is called, AbsListView will control the "enabled" state
* of the selector based on this.
*
* @param selectedChildViewEnabled true if enabled
*/
public void setSelectedChildViewEnabled(boolean selectedChildViewEnabled) {
mIsChildViewEnabled = selectedChildViewEnabled;
}
@Override
protected void dispatchDraw(Canvas canvas) {
int saveCount = 0;