Loading core/java/android/widget/ActionMenuPresenter.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package android.widget; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; import android.util.SparseBooleanArray; Loading Loading @@ -645,6 +647,23 @@ public class ActionMenuPresenter extends BaseMenuPresenter super.onInitializeAccessibilityNodeInfo(info); info.setCanOpenPopup(true); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // Set up the hotspot bounds to be centered on the image. final Drawable d = getDrawable(); final Drawable bg = getBackground(); if (d != null && bg != null) { final Rect bounds = d.getBounds(); final int height = bottom - top; final int offset = (height - bounds.width()) / 2; final int hotspotLeft = bounds.left - offset; final int hotspotRight = bounds.right + offset; bg.setHotspotBounds(hotspotLeft, 0, hotspotRight, height); } } } private class OverflowPopup extends MenuPopupHelper { Loading core/java/android/widget/AutoCompleteTextView.java +8 −16 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe } public AutoCompleteTextView(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.autoCompleteTextViewStyle); this(context, attrs, R.attr.autoCompleteTextViewStyle); } public AutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) { Loading @@ -140,22 +140,16 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mPopup = new ListPopupWindow(context, attrs, com.android.internal.R.attr.autoCompleteTextViewStyle); mPopup = new ListPopupWindow(context, attrs, defStyleAttr, defStyleRes); mPopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mPopup.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW); final TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.AutoCompleteTextView, defStyleAttr, defStyleRes); final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.AutoCompleteTextView, defStyleAttr, defStyleRes); mThreshold = a.getInt( R.styleable.AutoCompleteTextView_completionThreshold, 2); mThreshold = a.getInt(R.styleable.AutoCompleteTextView_completionThreshold, 2); mPopup.setListSelector(a.getDrawable(R.styleable.AutoCompleteTextView_dropDownSelector)); mPopup.setVerticalOffset((int) a.getDimension(R.styleable.AutoCompleteTextView_dropDownVerticalOffset, 0.0f)); mPopup.setHorizontalOffset((int) a.getDimension(R.styleable.AutoCompleteTextView_dropDownHorizontalOffset, 0.0f)); // Get the anchor's id now, but the view won't be ready, so wait to actually get the // view and store it in mDropDownAnchorView lazily in getDropDownAnchorView later. Loading @@ -166,11 +160,9 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe // For dropdown width, the developer can specify a specific width, or MATCH_PARENT // (for full screen width) or WRAP_CONTENT (to match the width of the anchored view). mPopup.setWidth(a.getLayoutDimension( R.styleable.AutoCompleteTextView_dropDownWidth, mPopup.setWidth(a.getLayoutDimension(R.styleable.AutoCompleteTextView_dropDownWidth, ViewGroup.LayoutParams.WRAP_CONTENT)); mPopup.setHeight(a.getLayoutDimension( R.styleable.AutoCompleteTextView_dropDownHeight, mPopup.setHeight(a.getLayoutDimension(R.styleable.AutoCompleteTextView_dropDownHeight, ViewGroup.LayoutParams.WRAP_CONTENT)); mHintResource = a.getResourceId(R.styleable.AutoCompleteTextView_completionHintView, Loading core/java/android/widget/ListPopupWindow.java +14 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.TypedArray; import android.database.DataSetObserver; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading @@ -40,6 +41,7 @@ import android.view.ViewGroup; import android.view.ViewParent; import android.view.animation.AccelerateDecelerateInterpolator; import com.android.internal.R; import com.android.internal.widget.AutoScrollHelper.AbsListViewAutoScroller; import java.util.Locale; Loading Loading @@ -208,6 +210,18 @@ public class ListPopupWindow { */ public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { mContext = context; final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPopupWindow, defStyleAttr, defStyleRes); mDropDownHorizontalOffset = a.getDimensionPixelOffset( R.styleable.ListPopupWindow_dropDownHorizontalOffset, 0); mDropDownVerticalOffset = a.getDimensionPixelOffset( R.styleable.ListPopupWindow_dropDownVerticalOffset, 0); if (mDropDownVerticalOffset != 0) { mDropDownVerticalOffsetSet = true; } a.recycle(); mPopup = new PopupWindow(context, attrs, defStyleAttr, defStyleRes); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); // Set the default layout direction to match the default locale one Loading core/java/android/widget/Spinner.java +0 −11 Original line number Diff line number Diff line Loading @@ -209,17 +209,6 @@ public class Spinner extends AbsSpinner implements OnClickListener { ViewGroup.LayoutParams.WRAP_CONTENT); popup.setBackgroundDrawable(a.getDrawable( com.android.internal.R.styleable.Spinner_popupBackground)); final int verticalOffset = a.getDimensionPixelOffset( com.android.internal.R.styleable.Spinner_dropDownVerticalOffset, 0); if (verticalOffset != 0) { popup.setVerticalOffset(verticalOffset); } final int horizontalOffset = a.getDimensionPixelOffset( com.android.internal.R.styleable.Spinner_dropDownHorizontalOffset, 0); if (horizontalOffset != 0) { popup.setHorizontalOffset(horizontalOffset); } mPopup = popup; mForwardingListener = new ForwardingListener(this) { Loading core/res/res/drawable/btn_borderless_material.xml +5 −7 Original line number Diff line number Diff line Loading @@ -14,10 +14,8 @@ limitations under the License. --> <inset xmlns:android="http://schemas.android.com/apk/res/android" android:inset="@dimen/control_inset_material"> <ripple android:color="?attr/colorControlHighlight"> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/colorControlHighlight"> <item android:id="@id/mask" android:drawable="@drawable/btn_default_mtrl_shape" /> </ripple> </inset> Loading
core/java/android/widget/ActionMenuPresenter.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package android.widget; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; import android.util.SparseBooleanArray; Loading Loading @@ -645,6 +647,23 @@ public class ActionMenuPresenter extends BaseMenuPresenter super.onInitializeAccessibilityNodeInfo(info); info.setCanOpenPopup(true); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // Set up the hotspot bounds to be centered on the image. final Drawable d = getDrawable(); final Drawable bg = getBackground(); if (d != null && bg != null) { final Rect bounds = d.getBounds(); final int height = bottom - top; final int offset = (height - bounds.width()) / 2; final int hotspotLeft = bounds.left - offset; final int hotspotRight = bounds.right + offset; bg.setHotspotBounds(hotspotLeft, 0, hotspotRight, height); } } } private class OverflowPopup extends MenuPopupHelper { Loading
core/java/android/widget/AutoCompleteTextView.java +8 −16 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe } public AutoCompleteTextView(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.autoCompleteTextViewStyle); this(context, attrs, R.attr.autoCompleteTextViewStyle); } public AutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) { Loading @@ -140,22 +140,16 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mPopup = new ListPopupWindow(context, attrs, com.android.internal.R.attr.autoCompleteTextViewStyle); mPopup = new ListPopupWindow(context, attrs, defStyleAttr, defStyleRes); mPopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mPopup.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW); final TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.AutoCompleteTextView, defStyleAttr, defStyleRes); final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.AutoCompleteTextView, defStyleAttr, defStyleRes); mThreshold = a.getInt( R.styleable.AutoCompleteTextView_completionThreshold, 2); mThreshold = a.getInt(R.styleable.AutoCompleteTextView_completionThreshold, 2); mPopup.setListSelector(a.getDrawable(R.styleable.AutoCompleteTextView_dropDownSelector)); mPopup.setVerticalOffset((int) a.getDimension(R.styleable.AutoCompleteTextView_dropDownVerticalOffset, 0.0f)); mPopup.setHorizontalOffset((int) a.getDimension(R.styleable.AutoCompleteTextView_dropDownHorizontalOffset, 0.0f)); // Get the anchor's id now, but the view won't be ready, so wait to actually get the // view and store it in mDropDownAnchorView lazily in getDropDownAnchorView later. Loading @@ -166,11 +160,9 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe // For dropdown width, the developer can specify a specific width, or MATCH_PARENT // (for full screen width) or WRAP_CONTENT (to match the width of the anchored view). mPopup.setWidth(a.getLayoutDimension( R.styleable.AutoCompleteTextView_dropDownWidth, mPopup.setWidth(a.getLayoutDimension(R.styleable.AutoCompleteTextView_dropDownWidth, ViewGroup.LayoutParams.WRAP_CONTENT)); mPopup.setHeight(a.getLayoutDimension( R.styleable.AutoCompleteTextView_dropDownHeight, mPopup.setHeight(a.getLayoutDimension(R.styleable.AutoCompleteTextView_dropDownHeight, ViewGroup.LayoutParams.WRAP_CONTENT)); mHintResource = a.getResourceId(R.styleable.AutoCompleteTextView_completionHintView, Loading
core/java/android/widget/ListPopupWindow.java +14 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.TypedArray; import android.database.DataSetObserver; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading @@ -40,6 +41,7 @@ import android.view.ViewGroup; import android.view.ViewParent; import android.view.animation.AccelerateDecelerateInterpolator; import com.android.internal.R; import com.android.internal.widget.AutoScrollHelper.AbsListViewAutoScroller; import java.util.Locale; Loading Loading @@ -208,6 +210,18 @@ public class ListPopupWindow { */ public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { mContext = context; final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPopupWindow, defStyleAttr, defStyleRes); mDropDownHorizontalOffset = a.getDimensionPixelOffset( R.styleable.ListPopupWindow_dropDownHorizontalOffset, 0); mDropDownVerticalOffset = a.getDimensionPixelOffset( R.styleable.ListPopupWindow_dropDownVerticalOffset, 0); if (mDropDownVerticalOffset != 0) { mDropDownVerticalOffsetSet = true; } a.recycle(); mPopup = new PopupWindow(context, attrs, defStyleAttr, defStyleRes); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); // Set the default layout direction to match the default locale one Loading
core/java/android/widget/Spinner.java +0 −11 Original line number Diff line number Diff line Loading @@ -209,17 +209,6 @@ public class Spinner extends AbsSpinner implements OnClickListener { ViewGroup.LayoutParams.WRAP_CONTENT); popup.setBackgroundDrawable(a.getDrawable( com.android.internal.R.styleable.Spinner_popupBackground)); final int verticalOffset = a.getDimensionPixelOffset( com.android.internal.R.styleable.Spinner_dropDownVerticalOffset, 0); if (verticalOffset != 0) { popup.setVerticalOffset(verticalOffset); } final int horizontalOffset = a.getDimensionPixelOffset( com.android.internal.R.styleable.Spinner_dropDownHorizontalOffset, 0); if (horizontalOffset != 0) { popup.setHorizontalOffset(horizontalOffset); } mPopup = popup; mForwardingListener = new ForwardingListener(this) { Loading
core/res/res/drawable/btn_borderless_material.xml +5 −7 Original line number Diff line number Diff line Loading @@ -14,10 +14,8 @@ limitations under the License. --> <inset xmlns:android="http://schemas.android.com/apk/res/android" android:inset="@dimen/control_inset_material"> <ripple android:color="?attr/colorControlHighlight"> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/colorControlHighlight"> <item android:id="@id/mask" android:drawable="@drawable/btn_default_mtrl_shape" /> </ripple> </inset>