diff options
34 files changed, 616 insertions, 23 deletions
diff --git a/api/current.txt b/api/current.txt index aa8989d9e8da..131237a77277 100644 --- a/api/current.txt +++ b/api/current.txt @@ -54862,6 +54862,7 @@ package android.widget { method public int getCheckedItemPosition(); method public android.util.SparseBooleanArray getCheckedItemPositions(); method public int getChoiceMode(); + method public boolean getDrawSelectorOnTop(); method public int getListPaddingBottom(); method public int getListPaddingLeft(); method public int getListPaddingRight(); @@ -56476,6 +56477,7 @@ package android.widget { ctor public RelativeLayout(android.content.Context, android.util.AttributeSet, int, int); method public android.widget.RelativeLayout.LayoutParams generateLayoutParams(android.util.AttributeSet); method public int getGravity(); + method public int getIgnoreGravity(); method public void setGravity(int); method public void setHorizontalGravity(int); method public void setIgnoreGravity(int); @@ -56692,8 +56694,9 @@ package android.widget { method public CharSequence getQuery(); method @Nullable public CharSequence getQueryHint(); method public android.widget.CursorAdapter getSuggestionsAdapter(); - method public boolean isIconfiedByDefault(); + method @Deprecated public boolean isIconfiedByDefault(); method public boolean isIconified(); + method public boolean isIconifiedByDefault(); method public boolean isQueryRefinementEnabled(); method public boolean isSubmitButtonEnabled(); method public void onActionViewCollapsed(); @@ -57416,6 +57419,7 @@ package android.widget { ctor public ToggleButton(android.content.Context, android.util.AttributeSet, int); ctor public ToggleButton(android.content.Context, android.util.AttributeSet); ctor public ToggleButton(android.content.Context); + method public float getDisabledAlpha(); method public CharSequence getTextOff(); method public CharSequence getTextOn(); method public void setBackgroundDrawable(android.graphics.drawable.Drawable); @@ -57576,6 +57580,7 @@ package android.widget { @android.widget.RemoteViews.RemoteView public class ViewFlipper extends android.widget.ViewAnimator { ctor public ViewFlipper(android.content.Context); ctor public ViewFlipper(android.content.Context, android.util.AttributeSet); + method public int getFlipInterval(); method public boolean isAutoStart(); method public boolean isFlipping(); method public void setAutoStart(boolean); diff --git a/api/test-current.txt b/api/test-current.txt index fd46d792d046..3ab4086c6426 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -2745,7 +2745,7 @@ package android.widget { } public class DatePicker extends android.widget.FrameLayout { - method public int getMode(); + method @android.view.inspector.InspectableProperty(name="datePickerMode", enumMapping={@android.view.inspector.InspectableProperty.EnumMap(value=android.widget.DatePicker.MODE_SPINNER, name="spinner"), @android.view.inspector.InspectableProperty.EnumMap(value=android.widget.DatePicker.MODE_CALENDAR, name="calendar")}) public int getMode(); field public static final int MODE_CALENDAR = 2; // 0x2 field public static final int MODE_SPINNER = 1; // 0x1 } @@ -2781,7 +2781,7 @@ package android.widget { method public android.view.View getAmView(); method public android.view.View getHourView(); method public android.view.View getMinuteView(); - method public int getMode(); + method @android.view.inspector.InspectableProperty(name="timePickerMode", enumMapping={@android.view.inspector.InspectableProperty.EnumMap(name="clock", value=android.widget.TimePicker.MODE_CLOCK), @android.view.inspector.InspectableProperty.EnumMap(name="spinner", value=android.widget.TimePicker.MODE_SPINNER)}) public int getMode(); method public android.view.View getPmView(); field public static final int MODE_CLOCK = 2; // 0x2 field public static final int MODE_SPINNER = 1; // 0x1 diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a35b1887e1fe..33d42d7d0873 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -21733,6 +21733,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @return The known solid color background for this view, or 0 if the color may vary */ @ViewDebug.ExportedProperty(category = "drawing") + @InspectableProperty @ColorInt public int getSolidColor() { return 0; diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index e0e784368bbb..d2b40f75a6a8 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -60,6 +60,8 @@ import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; import android.view.animation.Transformation; import android.view.autofill.Helper; +import android.view.inspector.InspectableProperty; +import android.view.inspector.InspectableProperty.EnumMap; import com.android.internal.R; @@ -773,6 +775,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @ViewDebug.IntToString(from = FOCUS_AFTER_DESCENDANTS, to = "FOCUS_AFTER_DESCENDANTS"), @ViewDebug.IntToString(from = FOCUS_BLOCK_DESCENDANTS, to = "FOCUS_BLOCK_DESCENDANTS") }) + @InspectableProperty(enumMapping = { + @EnumMap(value = FOCUS_BEFORE_DESCENDANTS, name = "beforeDescendants"), + @EnumMap(value = FOCUS_AFTER_DESCENDANTS, name = "afterDescendants"), + @EnumMap(value = FOCUS_BLOCK_DESCENDANTS, name = "blocksDescendants") + }) public int getDescendantFocusability() { return mGroupFlags & FLAG_MASK_FOCUSABILITY; } @@ -1391,6 +1398,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * Check whether this ViewGroup should ignore focus requests for itself and its children. */ @ViewDebug.ExportedProperty(category = "focus") + @InspectableProperty public boolean getTouchscreenBlocksFocus() { return (mGroupFlags & FLAG_TOUCHSCREEN_BLOCKS_FOCUS) != 0; } @@ -3116,6 +3124,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * Returns true if MotionEvents dispatched to this ViewGroup can be split to multiple children. * @return true if MotionEvents dispatched to this ViewGroup can be split to multiple children. */ + @InspectableProperty(name = "splitMotionEvents") public boolean isMotionEventSplittingEnabled() { return (mGroupFlags & FLAG_SPLIT_MOTION_EVENTS) == FLAG_SPLIT_MOTION_EVENTS; } @@ -3132,6 +3141,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * {@link android.view.ViewOutlineProvider#BACKGROUND} was given to * {@link #setOutlineProvider(ViewOutlineProvider)} and false otherwise. */ + @InspectableProperty public boolean isTransitionGroup() { if ((mGroupFlags & FLAG_IS_TRANSITION_GROUP_SET) != 0) { return ((mGroupFlags & FLAG_IS_TRANSITION_GROUP) != 0); @@ -4436,6 +4446,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * false otherwise. */ @ViewDebug.ExportedProperty(category = "drawing") + @InspectableProperty public boolean getClipChildren() { return ((mGroupFlags & FLAG_CLIP_CHILDREN) != 0); } @@ -4493,6 +4504,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * @attr ref android.R.styleable#ViewGroup_clipToPadding */ @ViewDebug.ExportedProperty(category = "drawing") + @InspectableProperty public boolean getClipToPadding() { return hasBooleanFlag(FLAG_CLIP_TO_PADDING); } @@ -6340,6 +6352,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * * @return the current animation controller */ + @InspectableProperty public LayoutAnimationController getLayoutAnimation() { return mLayoutAnimationController; } @@ -6359,6 +6372,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * Caching behavior of children may be controlled through {@link View#setLayerType(int, Paint)}. */ @Deprecated + @InspectableProperty(name = "animationCache") public boolean isAnimationCacheEnabled() { return (mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE; } @@ -6396,6 +6410,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * Child views may no longer have their caching behavior disabled by parents. */ @Deprecated + @InspectableProperty(name = "alwaysDrawnWithCache") public boolean isAlwaysDrawnWithCacheEnabled() { return (mGroupFlags & FLAG_ALWAYS_DRAWN_WITH_CACHE) == FLAG_ALWAYS_DRAWN_WITH_CACHE; } @@ -6539,6 +6554,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @ViewDebug.IntToString(from = PERSISTENT_SCROLLING_CACHE, to = "SCROLLING"), @ViewDebug.IntToString(from = PERSISTENT_ALL_CACHES, to = "ALL") }) + @InspectableProperty(enumMapping = { + @EnumMap(value = PERSISTENT_NO_CACHE, name = "none"), + @EnumMap(value = PERSISTENT_ANIMATION_CACHE, name = "animation"), + @EnumMap(value = PERSISTENT_SCROLLING_CACHE, name = "scrolling"), + @EnumMap(value = PERSISTENT_ALL_CACHES, name = "all"), + }) public int getPersistentDrawingCache() { return mPersistentDrawingCache; } @@ -6616,6 +6637,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * * @see #setLayoutMode(int) */ + @InspectableProperty(enumMapping = { + @EnumMap(value = LAYOUT_MODE_CLIP_BOUNDS, name = "clipBounds"), + @EnumMap(value = LAYOUT_MODE_OPTICAL_BOUNDS, name = "opticalBounds") + }) public int getLayoutMode() { if (mLayoutMode == LAYOUT_MODE_UNDEFINED) { int inheritedLayoutMode = (mParent instanceof ViewGroup) ? @@ -7307,6 +7332,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * make a group appear to be focused when its child EditText or button * is focused. */ + @InspectableProperty public boolean addStatesFromChildren() { return (mGroupFlags & FLAG_ADD_STATES_FROM_CHILDREN) != 0; } diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 99895bd65398..4dd7d3a2fa71 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -82,6 +82,8 @@ import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputContentInfo; import android.view.inputmethod.InputMethodManager; +import android.view.inspector.InspectableProperty; +import android.view.inspector.InspectableProperty.EnumMap; import android.widget.RemoteViews.OnClickHandler; import com.android.internal.R; @@ -1221,6 +1223,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * * @return The current choice mode */ + @InspectableProperty(enumMapping = { + @EnumMap(value = CHOICE_MODE_NONE, name = "none"), + @EnumMap(value = CHOICE_MODE_SINGLE, name = "singleChoice"), + @EnumMap(value = CHOICE_MODE_MULTIPLE, name = "multipleChoice"), + @EnumMap(value = CHOICE_MODE_MULTIPLE_MODAL, name = "multipleChoiceModal") + }) public int getChoiceMode() { return mChoiceMode; } @@ -1421,6 +1429,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @return true if fast scroll is enabled, false otherwise */ @ViewDebug.ExportedProperty + @InspectableProperty public boolean isFastScrollEnabled() { if (mFastScroll == null) { return mFastScrollEnabled; @@ -1485,6 +1494,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @see #setSmoothScrollbarEnabled(boolean) */ @ViewDebug.ExportedProperty + @InspectableProperty(name = "smoothScrollbar") public boolean isSmoothScrollbarEnabled() { return mSmoothScrollbarEnabled; } @@ -1620,6 +1630,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @see View#setDrawingCacheEnabled(boolean) */ @ViewDebug.ExportedProperty + @InspectableProperty(name = "scrollingCache") public boolean isScrollingCacheEnabled() { return mScrollingCacheEnabled; } @@ -1667,6 +1678,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @see Filterable */ @ViewDebug.ExportedProperty + @InspectableProperty public boolean isTextFilterEnabled() { return mTextFilterEnabled; } @@ -1697,6 +1709,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @return true if the content is stacked from the bottom edge, false otherwise */ @ViewDebug.ExportedProperty + @InspectableProperty public boolean isStackFromBottom() { return mStackFromBottom; } @@ -2813,6 +2826,18 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } /** + * Returns whether the selection highlight drawable should be drawn on top of the item or + * behind it. + * + * @return true if selector is drawn on top, false otherwise + * @attr ref android.R.styleable#AbsListView_drawSelectorOnTop + */ + @InspectableProperty + public boolean getDrawSelectorOnTop() { + return mDrawSelectorOnTop; + } + + /** * Set a Drawable that should be used to highlight the currently selected item. * * @param resID A Drawable resource to use as the selection highlight. @@ -2845,6 +2870,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * * @return the drawable used to display the selector */ + @InspectableProperty(name = "listSelector") public Drawable getSelector() { return mSelector; } @@ -6272,6 +6298,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @return {@link #TRANSCRIPT_MODE_DISABLED}, {@link #TRANSCRIPT_MODE_NORMAL} or * {@link #TRANSCRIPT_MODE_ALWAYS_SCROLL} */ + @InspectableProperty(enumMapping = { + @EnumMap(value = TRANSCRIPT_MODE_DISABLED, name = "disabled"), + @EnumMap(value = TRANSCRIPT_MODE_NORMAL, name = "normal"), + @EnumMap(value = TRANSCRIPT_MODE_ALWAYS_SCROLL, name = "alwaysScroll") + }) public int getTranscriptMode() { return mTranscriptMode; } @@ -6309,6 +6340,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @return The cache color hint */ @ViewDebug.ExportedProperty(category = "drawing") + @InspectableProperty @ColorInt public int getCacheColorHint() { return mCacheColorHint; diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index a85c5854d05a..c8be1d66ed4a 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -34,6 +34,7 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -252,6 +253,7 @@ public abstract class AbsSeekBar extends ProgressBar { * @attr ref android.R.styleable#SeekBar_thumbTint * @see #setThumbTintList(ColorStateList) */ + @InspectableProperty(name = "thumbTint") @Nullable public ColorStateList getThumbTintList() { return mThumbTintList; @@ -284,6 +286,7 @@ public abstract class AbsSeekBar extends ProgressBar { * @attr ref android.R.styleable#SeekBar_thumbTintMode * @see #setThumbTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getThumbTintMode() { return mThumbTintMode; @@ -406,6 +409,7 @@ public abstract class AbsSeekBar extends ProgressBar { * @attr ref android.R.styleable#SeekBar_tickMarkTint * @see #setTickMarkTintList(ColorStateList) */ + @InspectableProperty(name = "tickMarkTint") @Nullable public ColorStateList getTickMarkTintList() { return mTickMarkTintList; @@ -438,6 +442,7 @@ public abstract class AbsSeekBar extends ProgressBar { * @attr ref android.R.styleable#SeekBar_tickMarkTintMode * @see #setTickMarkTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getTickMarkTintMode() { return mTickMarkTintMode; diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index 7d6564fd91fb..9bc055e7111b 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -35,12 +35,12 @@ import android.view.ContextThemeWrapper; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -362,27 +362,33 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe * * @attr ref android.R.styleable#AutoCompleteTextView_completionHint */ + @InspectableProperty public CharSequence getCompletionHint() { return mHintText; } /** - * <p>Returns the current width for the auto-complete drop down list. This can - * be a fixed width, or {@link ViewGroup.LayoutParams#MATCH_PARENT} to fill the screen, or - * {@link ViewGroup.LayoutParams#WRAP_CONTENT} to fit the width of its anchor view.</p> + * Returns the current width for the auto-complete drop down list. + * + * This can be a fixed width, or {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT} + * to fill the screen, or {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} + * to fit the width of its anchor view. * * @return the width for the drop down list * * @attr ref android.R.styleable#AutoCompleteTextView_dropDownWidth */ + @InspectableProperty public int getDropDownWidth() { return mPopup.getWidth(); } /** - * <p>Sets the current width for the auto-complete drop down list. This can - * be a fixed width, or {@link ViewGroup.LayoutParams#MATCH_PARENT} to fill the screen, or - * {@link ViewGroup.LayoutParams#WRAP_CONTENT} to fit the width of its anchor view.</p> + * Sets the current width for the auto-complete drop down list. + * + * This can be a fixed width, or {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT} + * to fill the screen, or {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} + * to fit the width of its anchor view. * * @param width the width to use * @@ -393,24 +399,27 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe } /** - * <p>Returns the current height for the auto-complete drop down list. This can - * be a fixed height, or {@link ViewGroup.LayoutParams#MATCH_PARENT} to fill - * the screen, or {@link ViewGroup.LayoutParams#WRAP_CONTENT} to fit the height - * of the drop down's content.</p> + * <p>Returns the current height for the auto-complete drop down list. + * + * This can be a fixed width, or {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT} + * to fill the screen, or {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} + * to fit the width of its anchor view. * * @return the height for the drop down list * * @attr ref android.R.styleable#AutoCompleteTextView_dropDownHeight */ + @InspectableProperty public int getDropDownHeight() { return mPopup.getHeight(); } /** - * <p>Sets the current height for the auto-complete drop down list. This can - * be a fixed height, or {@link ViewGroup.LayoutParams#MATCH_PARENT} to fill - * the screen, or {@link ViewGroup.LayoutParams#WRAP_CONTENT} to fit the height - * of the drop down's content.</p> + * Sets the current height for the auto-complete drop down list. + * + * This can be a fixed width, or {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT} + * to fill the screen, or {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} + * to fit the width of its anchor view. * * @param height the height to use * @@ -452,6 +461,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe * * @attr ref android.R.styleable#PopupWindow_popupBackground */ + @InspectableProperty(name = "popupBackground") public Drawable getDropDownBackground() { return mPopup.getBackground(); } @@ -496,6 +506,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe * * @attr ref android.R.styleable#ListPopupWindow_dropDownVerticalOffset */ + @InspectableProperty public int getDropDownVerticalOffset() { return mPopup.getVerticalOffset(); } @@ -518,6 +529,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe * * @attr ref android.R.styleable#ListPopupWindow_dropDownHorizontalOffset */ + @InspectableProperty public int getDropDownHorizontalOffset() { return mPopup.getHorizontalOffset(); } @@ -610,6 +622,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe * * @attr ref android.R.styleable#AutoCompleteTextView_completionThreshold */ + @InspectableProperty(name = "completionThreshold") public int getThreshold() { return mThreshold; } diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java index 2ff815d6e309..6c74c8c24c44 100644 --- a/core/java/android/widget/CalendarView.java +++ b/core/java/android/widget/CalendarView.java @@ -34,6 +34,7 @@ import android.icu.util.Calendar; import android.icu.util.TimeZone; import android.util.AttributeSet; import android.util.Log; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -149,6 +150,7 @@ public class CalendarView extends FrameLayout { * @attr ref android.R.styleable#CalendarView_shownWeekCount * @deprecated No longer used by Material-style CalendarView. */ + @InspectableProperty @Deprecated public int getShownWeekCount() { return mDelegate.getShownWeekCount(); @@ -175,6 +177,7 @@ public class CalendarView extends FrameLayout { * @attr ref android.R.styleable#CalendarView_selectedWeekBackgroundColor * @deprecated No longer used by Material-style CalendarView. */ + @InspectableProperty @ColorInt @Deprecated public int getSelectedWeekBackgroundColor() { @@ -202,6 +205,7 @@ public class CalendarView extends FrameLayout { * @attr ref android.R.styleable#CalendarView_focusedMonthDateColor * @deprecated No longer used by Material-style CalendarView. */ + @InspectableProperty @ColorInt @Deprecated public int getFocusedMonthDateColor() { @@ -229,6 +233,7 @@ public class CalendarView extends FrameLayout { * @attr ref android.R.styleable#CalendarView_unfocusedMonthDateColor * @deprecated No longer used by Material-style CalendarView. */ + @InspectableProperty @ColorInt @Deprecated public int getUnfocusedMonthDateColor() { @@ -256,6 +261,7 @@ public class CalendarView extends FrameLayout { * @attr ref android.R.styleable#CalendarView_weekNumberColor * @deprecated No longer used by Material-style CalendarView. */ + @InspectableProperty @ColorInt @Deprecated public int getWeekNumberColor() { @@ -285,6 +291,7 @@ public class CalendarView extends FrameLayout { */ @ColorInt @Deprecated + @InspectableProperty public int getWeekSeparatorLineColor() { return mDelegate.getWeekSeparatorLineColor(); } @@ -324,6 +331,7 @@ public class CalendarView extends FrameLayout { * @return The vertical bar drawable. * @deprecated No longer used by Material-style CalendarView. */ + @InspectableProperty @Deprecated public Drawable getSelectedDateVerticalBar() { return mDelegate.getSelectedDateVerticalBar(); @@ -347,6 +355,7 @@ public class CalendarView extends FrameLayout { * * @attr ref android.R.styleable#CalendarView_weekDayTextAppearance */ + @InspectableProperty public @StyleRes int getWeekDayTextAppearance() { return mDelegate.getWeekDayTextAppearance(); } @@ -369,6 +378,7 @@ public class CalendarView extends FrameLayout { * * @attr ref android.R.styleable#CalendarView_dateTextAppearance */ + @InspectableProperty public @StyleRes int getDateTextAppearance() { return mDelegate.getDateTextAppearance(); } @@ -385,6 +395,7 @@ public class CalendarView extends FrameLayout { * * @attr ref android.R.styleable#CalendarView_minDate */ + @InspectableProperty public long getMinDate() { return mDelegate.getMinDate(); } @@ -414,6 +425,7 @@ public class CalendarView extends FrameLayout { * * @attr ref android.R.styleable#CalendarView_maxDate */ + @InspectableProperty public long getMaxDate() { return mDelegate.getMaxDate(); } @@ -452,6 +464,7 @@ public class CalendarView extends FrameLayout { * * @attr ref android.R.styleable#CalendarView_showWeekNumber */ + @InspectableProperty @Deprecated public boolean getShowWeekNumber() { return mDelegate.getShowWeekNumber(); @@ -472,6 +485,7 @@ public class CalendarView extends FrameLayout { * * @attr ref android.R.styleable#CalendarView_firstDayOfWeek */ + @InspectableProperty public int getFirstDayOfWeek() { return mDelegate.getFirstDayOfWeek(); } diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index 1472b01b7af4..b7fdcbe2b399 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -35,6 +35,7 @@ import android.view.ViewDebug; import android.view.ViewHierarchyEncoder; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -121,6 +122,7 @@ public class CheckedTextView extends TextView implements Checkable { } @ViewDebug.ExportedProperty + @InspectableProperty public boolean isChecked() { return mChecked; } @@ -237,6 +239,7 @@ public class CheckedTextView extends TextView implements Checkable { * @attr ref android.R.styleable#CheckedTextView_checkMarkTint * @see #setCheckMarkTintList(ColorStateList) */ + @InspectableProperty(name = "checkMarkTint") @Nullable public ColorStateList getCheckMarkTintList() { return mCheckMarkTintList; @@ -269,6 +272,7 @@ public class CheckedTextView extends TextView implements Checkable { * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode * @see #setCheckMarkTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getCheckMarkTintMode() { return mCheckMarkTintMode; @@ -328,6 +332,7 @@ public class CheckedTextView extends TextView implements Checkable { * * @attr ref android.R.styleable#CheckedTextView_checkMark */ + @InspectableProperty(name = "checkMark") public Drawable getCheckMarkDrawable() { return mCheckMarkDrawable; } diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java index d11c03ad6878..66c35d903366 100644 --- a/core/java/android/widget/Chronometer.java +++ b/core/java/android/widget/Chronometer.java @@ -29,6 +29,7 @@ import android.text.format.DateUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -145,6 +146,7 @@ public class Chronometer extends TextView { * * @see #setCountDown(boolean) */ + @InspectableProperty public boolean isCountDown() { return mCountDown; } @@ -206,6 +208,7 @@ public class Chronometer extends TextView { /** * Returns the current format string as set through {@link #setFormat}. */ + @InspectableProperty public String getFormat() { return mFormat; } diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index d35bec8d08d5..a0f93da90847 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -39,6 +39,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -145,6 +146,7 @@ public abstract class CompoundButton extends Button implements Checkable { return handled; } + @InspectableProperty @ViewDebug.ExportedProperty @Override public boolean isChecked() { @@ -282,6 +284,7 @@ public abstract class CompoundButton extends Button implements Checkable { * @see #setButtonDrawable(Drawable) * @see #setButtonDrawable(int) */ + @InspectableProperty(name = "button") @Nullable public Drawable getButtonDrawable() { return mButtonDrawable; @@ -314,6 +317,7 @@ public abstract class CompoundButton extends Button implements Checkable { * @attr ref android.R.styleable#CompoundButton_buttonTint * @see #setButtonTintList(ColorStateList) */ + @InspectableProperty(name = "buttonTint") @Nullable public ColorStateList getButtonTintList() { return mButtonTintList; @@ -342,6 +346,7 @@ public abstract class CompoundButton extends Button implements Checkable { * @attr ref android.R.styleable#CompoundButton_buttonTintMode * @see #setButtonTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getButtonTintMode() { return mButtonTintMode; diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java index df53795941ab..cca951ca9298 100644 --- a/core/java/android/widget/DatePicker.java +++ b/core/java/android/widget/DatePicker.java @@ -37,6 +37,7 @@ import android.view.ViewStructure; import android.view.accessibility.AccessibilityEvent; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -212,6 +213,10 @@ public class DatePicker extends FrameLayout { * @attr ref android.R.styleable#DatePicker_datePickerMode * @hide Visible for testing only. */ + @InspectableProperty(name = "datePickerMode", enumMapping = { + @InspectableProperty.EnumMap(value = MODE_SPINNER, name = "spinner"), + @InspectableProperty.EnumMap(value = MODE_CALENDAR, name = "calendar") + }) @DatePickerMode @TestApi public int getMode() { @@ -257,6 +262,7 @@ public class DatePicker extends FrameLayout { /** * @return The selected year. */ + @InspectableProperty(hasAttributeId = false) public int getYear() { return mDelegate.getYear(); } @@ -264,6 +270,7 @@ public class DatePicker extends FrameLayout { /** * @return The selected month. */ + @InspectableProperty(hasAttributeId = false) public int getMonth() { return mDelegate.getMonth(); } @@ -271,6 +278,7 @@ public class DatePicker extends FrameLayout { /** * @return The selected day of month. */ + @InspectableProperty(hasAttributeId = false) public int getDayOfMonth() { return mDelegate.getDayOfMonth(); } @@ -285,6 +293,7 @@ public class DatePicker extends FrameLayout { * * @return The minimal supported date. */ + @InspectableProperty public long getMinDate() { return mDelegate.getMinDate().getTimeInMillis(); } @@ -310,6 +319,7 @@ public class DatePicker extends FrameLayout { * * @return The maximal supported date. */ + @InspectableProperty public long getMaxDate() { return mDelegate.getMaxDate().getTimeInMillis(); } @@ -411,6 +421,7 @@ public class DatePicker extends FrameLayout { * * @attr ref android.R.styleable#DatePicker_firstDayOfWeek */ + @InspectableProperty public int getFirstDayOfWeek() { return mDelegate.getFirstDayOfWeek(); } @@ -426,6 +437,7 @@ public class DatePicker extends FrameLayout { * @see #getCalendarView() * @deprecated Not supported by Material-style {@code calendar} mode */ + @InspectableProperty @Deprecated public boolean getCalendarViewShown() { return mDelegate.getCalendarViewShown(); @@ -476,6 +488,7 @@ public class DatePicker extends FrameLayout { * @return {@code true} if the spinners are shown * @deprecated Not supported by Material-style {@code calendar} mode */ + @InspectableProperty @Deprecated public boolean getSpinnersShown() { return mDelegate.getSpinnersShown(); diff --git a/core/java/android/widget/DateTimeView.java b/core/java/android/widget/DateTimeView.java index bf2762a6d727..0469dbd00dc9 100644 --- a/core/java/android/widget/DateTimeView.java +++ b/core/java/android/widget/DateTimeView.java @@ -35,6 +35,7 @@ import android.os.Handler; import android.text.format.Time; import android.util.AttributeSet; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -142,6 +143,16 @@ public class DateTimeView extends TextView { update(); } + /** + * Returns whether this view shows relative time + * + * @return True if it shows relative time, false otherwise + */ + @InspectableProperty(name = "showReleative", hasAttributeId = false) + public boolean isShowRelativeTime() { + return mShowRelativeTime; + } + @Override @android.view.RemotableViewMethod public void setVisibility(@Visibility int visibility) { diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index 865f52082f28..5723b9467aa2 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -31,6 +31,7 @@ import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ViewHierarchyEncoder; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -367,6 +368,7 @@ public class FrameLayout extends ViewGroup { * * @return Whether all children are considered when measuring. */ + @InspectableProperty public boolean getMeasureAllChildren() { return mMeasureAllChildren; } diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 13c086c89d8f..c8abf18f88f9 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -46,6 +46,7 @@ import android.util.Printer; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -327,6 +328,10 @@ public class GridLayout extends ViewGroup { * @attr ref android.R.styleable#GridLayout_orientation */ @Orientation + @InspectableProperty(enumMapping = { + @InspectableProperty.EnumMap(value = HORIZONTAL, name = "horizontal"), + @InspectableProperty.EnumMap(value = VERTICAL, name = "vertical") + }) public int getOrientation() { return mOrientation; } @@ -387,6 +392,7 @@ public class GridLayout extends ViewGroup { * * @attr ref android.R.styleable#GridLayout_rowCount */ + @InspectableProperty public int getRowCount() { return mVerticalAxis.getCount(); } @@ -420,6 +426,7 @@ public class GridLayout extends ViewGroup { * * @attr ref android.R.styleable#GridLayout_columnCount */ + @InspectableProperty public int getColumnCount() { return mHorizontalAxis.getCount(); } @@ -451,6 +458,7 @@ public class GridLayout extends ViewGroup { * * @attr ref android.R.styleable#GridLayout_useDefaultMargins */ + @InspectableProperty public boolean getUseDefaultMargins() { return mUseDefaultMargins; } @@ -499,6 +507,10 @@ public class GridLayout extends ViewGroup { * @attr ref android.R.styleable#GridLayout_alignmentMode */ @AlignmentMode + @InspectableProperty(enumMapping = { + @InspectableProperty.EnumMap(value = ALIGN_BOUNDS, name = "alignBounds"), + @InspectableProperty.EnumMap(value = ALIGN_MARGINS, name = "alignMargins"), + }) public int getAlignmentMode() { return mAlignmentMode; } @@ -533,6 +545,7 @@ public class GridLayout extends ViewGroup { * * @attr ref android.R.styleable#GridLayout_rowOrderPreserved */ + @InspectableProperty public boolean isRowOrderPreserved() { return mVerticalAxis.isOrderPreserved(); } @@ -569,6 +582,7 @@ public class GridLayout extends ViewGroup { * * @attr ref android.R.styleable#GridLayout_columnOrderPreserved */ + @InspectableProperty public boolean isColumnOrderPreserved() { return mHorizontalAxis.isOrderPreserved(); } diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index f78180276373..bf65ec0d5de3 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -42,6 +42,7 @@ import android.view.accessibility.AccessibilityNodeInfo.CollectionInfo; import android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo; import android.view.accessibility.AccessibilityNodeProvider; import android.view.animation.GridLayoutAnimationController; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -2061,6 +2062,7 @@ public class GridView extends AbsListView { * * @attr ref android.R.styleable#GridView_gravity */ + @InspectableProperty(valueType = InspectableProperty.ValueType.GRAVITY) public int getGravity() { return mGravity; } @@ -2096,6 +2098,7 @@ public class GridView extends AbsListView { * * @attr ref android.R.styleable#GridView_horizontalSpacing */ + @InspectableProperty public int getHorizontalSpacing() { return mHorizontalSpacing; } @@ -2147,6 +2150,7 @@ public class GridView extends AbsListView { * * @attr ref android.R.styleable#GridView_verticalSpacing */ + @InspectableProperty public int getVerticalSpacing() { return mVerticalSpacing; } @@ -2167,6 +2171,13 @@ public class GridView extends AbsListView { } @StretchMode + @InspectableProperty(enumMapping = { + @InspectableProperty.EnumMap(value = NO_STRETCH, name = "none"), + @InspectableProperty.EnumMap(value = STRETCH_SPACING, name = "spacingWidth"), + @InspectableProperty.EnumMap( + value = STRETCH_SPACING_UNIFORM, name = "spacingWidthUniform"), + @InspectableProperty.EnumMap(value = STRETCH_COLUMN_WIDTH, name = "columnWidth"), + }) public int getStretchMode() { return mStretchMode; } @@ -2197,6 +2208,7 @@ public class GridView extends AbsListView { * * @attr ref android.R.styleable#GridView_columnWidth */ + @InspectableProperty public int getColumnWidth() { return mColumnWidth; } @@ -2241,6 +2253,7 @@ public class GridView extends AbsListView { * @see #setNumColumns(int) */ @ViewDebug.ExportedProperty + @InspectableProperty public int getNumColumns() { return mNumColumns; } diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index bf9dffd52e33..1c5f837728a0 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -43,6 +43,7 @@ import android.view.ViewParent; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.AnimationUtils; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -293,6 +294,7 @@ public class HorizontalScrollView extends FrameLayout { * * @attr ref android.R.styleable#HorizontalScrollView_fillViewport */ + @InspectableProperty public boolean isFillViewport() { return mFillViewport; } diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index c21182ca597f..e9c31db8110b 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -51,6 +51,7 @@ import android.view.View; import android.view.ViewDebug; import android.view.ViewHierarchyEncoder; import android.view.accessibility.AccessibilityEvent; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -326,6 +327,7 @@ public class ImageView extends View { * * @attr ref android.R.styleable#ImageView_adjustViewBounds */ + @InspectableProperty public boolean getAdjustViewBounds() { return mAdjustViewBounds; } @@ -364,6 +366,7 @@ public class ImageView extends View { * * @attr ref android.R.styleable#ImageView_maxWidth */ + @InspectableProperty public int getMaxWidth() { return mMaxWidth; } @@ -402,6 +405,7 @@ public class ImageView extends View { * * @attr ref android.R.styleable#ImageView_maxHeight */ + @InspectableProperty public int getMaxHeight() { return mMaxHeight; } @@ -438,6 +442,7 @@ public class ImageView extends View { * @return the view's drawable, or null if no drawable has been * assigned. */ + @InspectableProperty(name = "src") public Drawable getDrawable() { if (mDrawable == mRecycleableBitmapDrawable) { // Consider our cached version dirty since app code now has a reference to it @@ -650,6 +655,7 @@ public class ImageView extends View { * @see #setImageTintList(ColorStateList) */ @Nullable + @InspectableProperty(name = "tint") public ColorStateList getImageTintList() { return mDrawableTintList; } @@ -679,6 +685,7 @@ public class ImageView extends View { * @see #setImageTintMode(PorterDuff.Mode) */ @Nullable + @InspectableProperty(name = "tintMode") public PorterDuff.Mode getImageTintMode() { return mDrawableTintMode; } @@ -844,6 +851,7 @@ public class ImageView extends View { * @see ImageView.ScaleType * @attr ref android.R.styleable#ImageView_scaleType */ + @InspectableProperty public ScaleType getScaleType() { return mScaleType; } @@ -893,6 +901,7 @@ public class ImageView extends View { * * @attr ref android.R.styleable#ImageView_cropToPadding */ + @InspectableProperty public boolean getCropToPadding() { return mCropToPadding; } @@ -1404,6 +1413,7 @@ public class ImageView extends View { * if baseline alignment is not supported. */ @Override + @InspectableProperty @ViewDebug.ExportedProperty(category = "layout") public int getBaseline() { if (mBaselineAlignBottom) { @@ -1451,6 +1461,7 @@ public class ImageView extends View { * @return True if the ImageView's baseline is considered the bottom of the view, false if otherwise. * @see #setBaselineAlignBottom(boolean) */ + @InspectableProperty public boolean getBaselineAlignBottom() { return mBaselineAlignBottom; } diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index 15910bbd36d8..64769b5337df 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -31,6 +31,7 @@ import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ViewHierarchyEncoder; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -342,6 +343,7 @@ public class LinearLayout extends ViewGroup { * * @attr ref android.R.styleable#LinearLayout_divider */ + @InspectableProperty(name = "divider") public Drawable getDividerDrawable() { return mDivider; } @@ -526,6 +528,7 @@ public class LinearLayout extends ViewGroup { * * @return true when widgets are baseline-aligned, false otherwise */ + @InspectableProperty public boolean isBaselineAligned() { return mBaselineAligned; } @@ -554,6 +557,7 @@ public class LinearLayout extends ViewGroup { * * @attr ref android.R.styleable#LinearLayout_measureWithLargestChild */ + @InspectableProperty(name = "measureWithLargestChild") public boolean isMeasureWithLargestChildEnabled() { return mUseLargestChild; } @@ -633,6 +637,7 @@ public class LinearLayout extends ViewGroup { * part of a larger layout that is baseline aligned, or -1 if none has * been set. */ + @InspectableProperty public int getBaselineAlignedChildIndex() { return mBaselineAlignedChildIndex; } @@ -686,6 +691,7 @@ public class LinearLayout extends ViewGroup { * a number lower than or equals to 0.0f if not weight sum is * to be used. */ + @InspectableProperty public float getWeightSum() { return mWeightSum; } @@ -1841,6 +1847,10 @@ public class LinearLayout extends ViewGroup { * @return either {@link #HORIZONTAL} or {@link #VERTICAL} */ @OrientationMode + @InspectableProperty(enumMapping = { + @InspectableProperty.EnumMap(value = HORIZONTAL, name = "horizontal"), + @InspectableProperty.EnumMap(value = VERTICAL, name = "vertical") + }) public int getOrientation() { return mOrientation; } @@ -1877,6 +1887,7 @@ public class LinearLayout extends ViewGroup { * @return the current gravity. * @see #setGravity */ + @InspectableProperty(valueType = InspectableProperty.ValueType.GRAVITY) public int getGravity() { return mGravity; } diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 9b497866486d..311f8968150c 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -49,6 +49,7 @@ import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.view.accessibility.AccessibilityNodeInfo.CollectionInfo; import android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo; import android.view.accessibility.AccessibilityNodeProvider; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -3637,6 +3638,7 @@ public class ListView extends AbsListView { * @return the current drawable drawn between list elements * @attr ref R.styleable#ListView_divider */ + @InspectableProperty @Nullable public Drawable getDivider() { return mDivider; @@ -3666,6 +3668,7 @@ public class ListView extends AbsListView { /** * @return Returns the height of the divider that will be drawn between each item in the list. */ + @InspectableProperty public int getDividerHeight() { return mDividerHeight; } @@ -3701,6 +3704,7 @@ public class ListView extends AbsListView { * * @see #setHeaderDividersEnabled(boolean) */ + @InspectableProperty(name = "headerDividersEnabled") public boolean areHeaderDividersEnabled() { return mHeaderDividersEnabled; } @@ -3724,6 +3728,7 @@ public class ListView extends AbsListView { * * @see #setFooterDividersEnabled(boolean) */ + @InspectableProperty(name = "footerDividersEnabled") public boolean areFooterDividersEnabled() { return mFooterDividersEnabled; } diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index 1fc72f5ea032..3519afd32662 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -58,6 +58,7 @@ import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.Transformation; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -556,6 +557,7 @@ public class ProgressBar extends View { * * @return true if the progress bar is in indeterminate mode */ + @InspectableProperty @ViewDebug.ExportedProperty(category = "progress") public synchronized boolean isIndeterminate() { return mIndeterminate; @@ -610,6 +612,7 @@ public class ProgressBar extends View { * @see #setIndeterminateDrawable(android.graphics.drawable.Drawable) * @see #setIndeterminate(boolean) */ + @InspectableProperty public Drawable getIndeterminateDrawable() { return mIndeterminateDrawable; } @@ -677,6 +680,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_indeterminateTint * @see #setIndeterminateTintList(ColorStateList) */ + @InspectableProperty(name = "indeterminateTint") @Nullable public ColorStateList getIndeterminateTintList() { return mProgressTintInfo != null ? mProgressTintInfo.mIndeterminateTintList : null; @@ -712,6 +716,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_indeterminateTintMode * @see #setIndeterminateTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getIndeterminateTintMode() { return mProgressTintInfo != null ? mProgressTintInfo.mIndeterminateTintMode : null; @@ -768,6 +773,7 @@ public class ProgressBar extends View { * @see #setProgressDrawable(android.graphics.drawable.Drawable) * @see #setIndeterminate(boolean) */ + @InspectableProperty public Drawable getProgressDrawable() { return mProgressDrawable; } @@ -821,6 +827,7 @@ public class ProgressBar extends View { /** * @hide */ + @InspectableProperty public boolean getMirrorForRtl() { return mMirrorForRtl; } @@ -951,6 +958,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_progressTint * @see #setProgressTintList(ColorStateList) */ + @InspectableProperty(name = "progressTint") @Nullable public ColorStateList getProgressTintList() { return mProgressTintInfo != null ? mProgressTintInfo.mProgressTintList : null; @@ -988,6 +996,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_progressTintMode * @see #setProgressTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getProgressTintMode() { return mProgressTintInfo != null ? mProgressTintInfo.mProgressTintMode : null; @@ -1033,6 +1042,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_progressBackgroundTint * @see #setProgressBackgroundTintList(ColorStateList) */ + @InspectableProperty(name = "progressBackgroundTint") @Nullable public ColorStateList getProgressBackgroundTintList() { return mProgressTintInfo != null ? mProgressTintInfo.mProgressBackgroundTintList : null; @@ -1067,6 +1077,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_progressBackgroundTintMode * @see #setProgressBackgroundTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getProgressBackgroundTintMode() { return mProgressTintInfo != null ? mProgressTintInfo.mProgressBackgroundTintMode : null; @@ -1112,6 +1123,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_secondaryProgressTint * @see #setSecondaryProgressTintList(ColorStateList) */ + @InspectableProperty(name = "secondaryProgressTint") @Nullable public ColorStateList getSecondaryProgressTintList() { return mProgressTintInfo != null ? mProgressTintInfo.mSecondaryProgressTintList : null; @@ -1150,6 +1162,7 @@ public class ProgressBar extends View { * @attr ref android.R.styleable#ProgressBar_secondaryProgressTintMode * @see #setSecondaryProgressTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getSecondaryProgressTintMode() { return mProgressTintInfo != null ? mProgressTintInfo.mSecondaryProgressTintMode : null; @@ -1477,6 +1490,7 @@ public class ProgressBar extends View { * @see #getMax() */ @ViewDebug.ExportedProperty(category = "progress") + @InspectableProperty public synchronized int getProgress() { return mIndeterminate ? 0 : mProgress; } @@ -1494,6 +1508,7 @@ public class ProgressBar extends View { * @see #getMax() */ @ViewDebug.ExportedProperty(category = "progress") + @InspectableProperty public synchronized int getSecondaryProgress() { return mIndeterminate ? 0 : mSecondaryProgress; } @@ -1508,6 +1523,7 @@ public class ProgressBar extends View { * @see #getSecondaryProgress() */ @ViewDebug.ExportedProperty(category = "progress") + @InspectableProperty public synchronized int getMin() { return mMin; } @@ -1522,6 +1538,7 @@ public class ProgressBar extends View { * @see #getSecondaryProgress() */ @ViewDebug.ExportedProperty(category = "progress") + @InspectableProperty public synchronized int getMax() { return mMax; } @@ -1687,6 +1704,7 @@ public class ProgressBar extends View { * * @return the {@link Interpolator} associated to this animation */ + @InspectableProperty public Interpolator getInterpolator() { return mInterpolator; } diff --git a/core/java/android/widget/RatingBar.java b/core/java/android/widget/RatingBar.java index d343d499a712..9f9fdee46fdf 100644 --- a/core/java/android/widget/RatingBar.java +++ b/core/java/android/widget/RatingBar.java @@ -23,6 +23,7 @@ import android.graphics.drawable.shapes.RectShape; import android.graphics.drawable.shapes.Shape; import android.util.AttributeSet; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -164,6 +165,7 @@ public class RatingBar extends AbsSeekBar { * * @attr ref android.R.styleable#RatingBar_isIndicator */ + @InspectableProperty(name = "isIndicator") public boolean isIndicator() { return !mIsUserSeekable; } @@ -190,6 +192,7 @@ public class RatingBar extends AbsSeekBar { * Returns the number of stars shown. * @return The number of stars shown. */ + @InspectableProperty public int getNumStars() { return mNumStars; } @@ -208,6 +211,7 @@ public class RatingBar extends AbsSeekBar { * * @return The current rating. */ + @InspectableProperty public float getRating() { return getProgress() / getProgressPerStar(); } @@ -234,6 +238,7 @@ public class RatingBar extends AbsSeekBar { * * @return The step size. */ + @InspectableProperty public float getStepSize() { return (float) getNumStars() / getMax(); } diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 506d615fc077..556bfd19f942 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -34,6 +34,7 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ViewHierarchyEncoder; import android.view.accessibility.AccessibilityEvent; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; import com.android.internal.R; @@ -289,6 +290,16 @@ public class RelativeLayout extends ViewGroup { } /** + * Get the id of the View to be ignored by gravity + * + * @attr ref android.R.styleable#RelativeLayout_ignoreGravity + */ + @InspectableProperty + public int getIgnoreGravity() { + return mIgnoreGravity; + } + + /** * Describes how the child views are positioned. * * @return the gravity. @@ -298,6 +309,7 @@ public class RelativeLayout extends ViewGroup { * * @attr ref android.R.styleable#RelativeLayout_gravity */ + @InspectableProperty(valueType = InspectableProperty.ValueType.GRAVITY) public int getGravity() { return mGravity; } diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 4658d7353355..fc4e9ec3caad 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -45,6 +45,7 @@ import android.view.ViewParent; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.AnimationUtils; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -324,6 +325,7 @@ public class ScrollView extends FrameLayout { * * @attr ref android.R.styleable#ScrollView_fillViewport */ + @InspectableProperty public boolean isFillViewport() { return mFillViewport; } diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index 10e1dfb30a5a..af3b8c0afe08 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -62,6 +62,7 @@ import android.view.ViewConfiguration; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; +import android.view.inspector.InspectableProperty; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.TextView.OnEditorActionListener; @@ -563,6 +564,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { * * @return the query string */ + @InspectableProperty(hasAttributeId = false) public CharSequence getQuery() { return mSearchSrcTextView.getText(); } @@ -620,6 +622,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { * @return the displayed query hint text, or {@code null} if none set * @attr ref android.R.styleable#SearchView_queryHint */ + @InspectableProperty @Nullable public CharSequence getQueryHint() { final CharSequence hint; @@ -656,13 +659,25 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { * Returns the default iconified state of the search field. * @return * + * @deprecated use {@link #isIconifiedByDefault()} * @attr ref android.R.styleable#SearchView_iconifiedByDefault */ + @Deprecated public boolean isIconfiedByDefault() { return mIconifiedByDefault; } /** + * Returns the default iconified state of the search field. + * + * @attr ref android.R.styleable#SearchView_iconifiedByDefault + */ + @InspectableProperty + public boolean isIconifiedByDefault() { + return mIconifiedByDefault; + } + + /** * Iconifies or expands the SearchView. Any query text is cleared when iconified. This is * a temporary state and does not override the default iconified state set by * {@link #setIconifiedByDefault(boolean)}. If the default state is iconified, then @@ -686,6 +701,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { * @return true if the SearchView is currently iconified, false if the search field is * fully visible. */ + @InspectableProperty(hasAttributeId = false) public boolean isIconified() { return mIconified; } @@ -780,6 +796,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { * * @attr ref android.R.styleable#SearchView_maxWidth */ + @InspectableProperty public int getMaxWidth() { return mMaxWidth; } diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index 1705ba8c38e8..fb56d9739435 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -45,6 +45,7 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.inspector.InspectableProperty; import android.widget.PopupWindow.OnDismissListener; import com.android.internal.R; @@ -360,6 +361,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { * * @attr ref android.R.styleable#Spinner_popupBackground */ + @InspectableProperty public Drawable getPopupBackground() { return mPopup.getBackground(); } @@ -392,6 +394,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { * * @attr ref android.R.styleable#ListPopupWindow_dropDownVerticalOffset */ + @InspectableProperty public int getDropDownVerticalOffset() { return mPopup.getVerticalOffset(); } @@ -416,6 +419,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { * * @attr ref android.R.styleable#ListPopupWindow_dropDownHorizontalOffset */ + @InspectableProperty public int getDropDownHorizontalOffset() { return mPopup.getHorizontalOffset(); } @@ -452,6 +456,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { * * @attr ref android.R.styleable#Spinner_dropDownWidth */ + @InspectableProperty public int getDropDownWidth() { return mDropDownWidth; } @@ -491,6 +496,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { * * @return A {@link android.view.Gravity Gravity} value */ + @InspectableProperty(valueType = InspectableProperty.ValueType.GRAVITY) public int getGravity() { return mGravity; } @@ -828,6 +834,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { /** * @return The prompt to display when the dialog is shown */ + @InspectableProperty public CharSequence getPrompt() { return mPopup.getHintText(); } diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index 79dc6708f9c3..af4f0202fd6a 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -52,6 +52,7 @@ import android.view.ViewConfiguration; import android.view.ViewStructure; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -444,6 +445,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_switchPadding */ + @InspectableProperty public int getSwitchPadding() { return mSwitchPadding; } @@ -469,6 +471,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_switchMinWidth */ + @InspectableProperty public int getSwitchMinWidth() { return mSwitchMinWidth; } @@ -492,6 +495,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_thumbTextPadding */ + @InspectableProperty public int getThumbTextPadding() { return mThumbTextPadding; } @@ -532,6 +536,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_track */ + @InspectableProperty(name = "track") public Drawable getTrackDrawable() { return mTrackDrawable; } @@ -562,6 +567,7 @@ public class Switch extends CompoundButton { * @attr ref android.R.styleable#Switch_trackTint * @see #setTrackTintList(ColorStateList) */ + @InspectableProperty(name = "trackTint") @Nullable public ColorStateList getTrackTintList() { return mTrackTintList; @@ -591,6 +597,7 @@ public class Switch extends CompoundButton { * @attr ref android.R.styleable#Switch_trackTintMode * @see #setTrackTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getTrackTintMode() { return mTrackTintMode; @@ -655,6 +662,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_thumb */ + @InspectableProperty(name = "thumb") public Drawable getThumbDrawable() { return mThumbDrawable; } @@ -685,6 +693,7 @@ public class Switch extends CompoundButton { * @attr ref android.R.styleable#Switch_thumbTint * @see #setThumbTintList(ColorStateList) */ + @InspectableProperty(name = "thumbTint") @Nullable public ColorStateList getThumbTintList() { return mThumbTintList; @@ -714,6 +723,7 @@ public class Switch extends CompoundButton { * @attr ref android.R.styleable#Switch_thumbTintMode * @see #setThumbTintMode(PorterDuff.Mode) */ + @InspectableProperty @Nullable public PorterDuff.Mode getThumbTintMode() { return mThumbTintMode; @@ -758,6 +768,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_splitTrack */ + @InspectableProperty public boolean getSplitTrack() { return mSplitTrack; } @@ -767,6 +778,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_textOn */ + @InspectableProperty public CharSequence getTextOn() { return mTextOn; } @@ -786,6 +798,7 @@ public class Switch extends CompoundButton { * * @attr ref android.R.styleable#Switch_textOff */ + @InspectableProperty public CharSequence getTextOff() { return mTextOff; } @@ -817,6 +830,7 @@ public class Switch extends CompoundButton { * @return whether the on/off text should be displayed * @attr ref android.R.styleable#Switch_showText */ + @InspectableProperty public boolean getShowText() { return mShowText; } diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java index 4865808b3531..7f462cb3289b 100644 --- a/core/java/android/widget/TextClock.java +++ b/core/java/android/widget/TextClock.java @@ -39,6 +39,7 @@ import android.text.format.DateFormat; import android.util.AttributeSet; import android.view.RemotableViewMethod; import android.view.ViewHierarchyEncoder; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -285,6 +286,7 @@ public class TextClock extends TextView { * @see #setFormat12Hour(CharSequence) * @see #is24HourModeEnabled() */ + @InspectableProperty @ExportedProperty public CharSequence getFormat12Hour() { return mFormat12; @@ -344,6 +346,7 @@ public class TextClock extends TextView { * @see #setFormat24Hour(CharSequence) * @see #is24HourModeEnabled() */ + @InspectableProperty @ExportedProperty public CharSequence getFormat24Hour() { return mFormat24; @@ -435,6 +438,7 @@ public class TextClock extends TextView { * @see #setFormat24Hour(CharSequence) * @see #getFormat24Hour() */ + @InspectableProperty(hasAttributeId = false) public boolean is24HourModeEnabled() { if (mShowCurrentUserTime) { return DateFormat.is24HourFormat(getContext(), ActivityManager.getCurrentUser()); @@ -453,6 +457,7 @@ public class TextClock extends TextView { * @see java.util.TimeZone#getAvailableIDs() * @see #setTimeZone(String) */ + @InspectableProperty public String getTimeZone() { return mTimeZone; } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 8029cf0eb50e..d790c0cab886 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -172,6 +172,9 @@ import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; +import android.view.inspector.InspectableProperty; +import android.view.inspector.InspectableProperty.EnumMap; +import android.view.inspector.InspectableProperty.FlagMap; import android.view.textclassifier.TextClassification; import android.view.textclassifier.TextClassificationContext; import android.view.textclassifier.TextClassificationManager; @@ -1889,6 +1892,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setAutoSizeTextTypeUniformWithConfiguration(int, int, int, int) * @see #setAutoSizeTextTypeUniformWithPresetSizes(int[], int) */ + @InspectableProperty(enumMapping = { + @EnumMap(name = "none", value = AUTO_SIZE_TEXT_TYPE_NONE), + @EnumMap(name = "uniform", value = AUTO_SIZE_TEXT_TYPE_UNIFORM) + }) @AutoSizeTextType public int getAutoSizeTextType() { return mAutoSizeTextType; @@ -1901,6 +1908,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @see #setAutoSizeTextTypeUniformWithConfiguration(int, int, int, int) */ + @InspectableProperty public int getAutoSizeStepGranularity() { return Math.round(mAutoSizeStepGranularityInPx); } @@ -1914,6 +1922,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setAutoSizeTextTypeUniformWithConfiguration(int, int, int, int) * @see #setAutoSizeTextTypeUniformWithPresetSizes(int[], int) */ + @InspectableProperty public int getAutoSizeMinTextSize() { return Math.round(mAutoSizeMinTextSizeInPx); } @@ -1927,6 +1936,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setAutoSizeTextTypeUniformWithConfiguration(int, int, int, int) * @see #setAutoSizeTextTypeUniformWithPresetSizes(int[], int) */ + @InspectableProperty public int getAutoSizeMaxTextSize() { return Math.round(mAutoSizeMaxTextSizeInPx); } @@ -2271,6 +2281,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @attr ref android.R.styleable#TextView_text */ @ViewDebug.CapturedViewProperty + @InspectableProperty public CharSequence getText() { return mText; } @@ -2308,6 +2319,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * contain additional first-or last-line padding. * @return The height of one standard line in pixels. */ + @InspectableProperty public int getLineHeight() { return FastMath.round(mTextPaint.getFontMetricsInt(null) * mSpacingMult + mSpacingAdd); } @@ -3231,6 +3243,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_drawablePadding */ + @InspectableProperty(name = "drawablePadding") public int getCompoundDrawablePadding() { final Drawables dr = mDrawables; return dr != null ? dr.mDrawablePadding : 0; @@ -3267,6 +3280,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @attr ref android.R.styleable#TextView_drawableTint * @see #setCompoundDrawableTintList(ColorStateList) */ + @InspectableProperty(name = "drawableTint") public ColorStateList getCompoundDrawableTintList() { return mDrawables != null ? mDrawables.mTintList : null; } @@ -3301,6 +3315,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @attr ref android.R.styleable#TextView_drawableTintMode * @see #setCompoundDrawableTintMode(PorterDuff.Mode) */ + @InspectableProperty(name = "drawableTintMode") public PorterDuff.Mode getCompoundDrawableTintMode() { return mDrawables != null ? mDrawables.mTintMode : null; } @@ -3481,6 +3496,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setFirstBaselineToTopHeight(int) * @attr ref android.R.styleable#TextView_firstBaselineToTopHeight */ + @InspectableProperty public int getFirstBaselineToTopHeight() { return getPaddingTop() - getPaint().getFontMetricsInt().top; } @@ -3491,17 +3507,24 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setLastBaselineToBottomHeight(int) * @attr ref android.R.styleable#TextView_lastBaselineToBottomHeight */ + @InspectableProperty public int getLastBaselineToBottomHeight() { return getPaddingBottom() + getPaint().getFontMetricsInt().bottom; } /** - * Gets the autolink mask of the text. See {@link - * android.text.util.Linkify#ALL Linkify.ALL} and peers for - * possible values. + * Gets the autolink mask of the text. + * + * See {@link Linkify#ALL} and peers for possible values. * * @attr ref android.R.styleable#TextView_autoLink */ + @InspectableProperty(name = "autoLink", flagMapping = { + @FlagMap(name = "web", target = Linkify.WEB_URLS), + @FlagMap(name = "email", target = Linkify.EMAIL_ADDRESSES), + @FlagMap(name = "phone", target = Linkify.PHONE_NUMBERS), + @FlagMap(name = "map", target = Linkify.MAP_ADDRESSES) + }) public final int getAutoLinkMask() { return mAutoLinkMask; } @@ -4150,6 +4173,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener /** * @return the size (in pixels) of the default text size in this TextView. */ + @InspectableProperty @ViewDebug.ExportedProperty(category = "text") public float getTextSize() { return mTextPaint.getTextSize(); @@ -4243,6 +4267,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * This will usually be 1.0. * @return The horizontal scale factor. */ + @InspectableProperty public float getTextScaleX() { return mTextPaint.getTextScaleX(); } @@ -4303,6 +4328,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @attr ref android.R.styleable#TextView_typeface * @attr ref android.R.styleable#TextView_textStyle */ + @InspectableProperty public Typeface getTypeface() { return mTextPaint.getTypeface(); } @@ -4363,6 +4389,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_fallbackLineSpacing */ + @InspectableProperty public boolean isFallbackLineSpacing() { return mUseFallbackLineSpacing; } @@ -4376,6 +4403,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setElegantTextHeight(boolean) * @see Paint#setElegantTextHeight(boolean) */ + @InspectableProperty public boolean isElegantTextHeight() { return mTextPaint.isElegantTextHeight(); } @@ -4388,6 +4416,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setLetterSpacing(float) * @see Paint#setLetterSpacing */ + @InspectableProperty public float getLetterSpacing() { return mTextPaint.getLetterSpacing(); } @@ -4426,6 +4455,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setFontFeatureSettings(String) * @see Paint#setFontFeatureSettings(String) Paint.setFontFeatureSettings(String) */ + @InspectableProperty @Nullable public String getFontFeatureSettings() { return mTextPaint.getFontFeatureSettings(); @@ -4477,6 +4507,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @attr ref android.R.styleable#TextView_breakStrategy * @see #setBreakStrategy(int) */ + @InspectableProperty(enumMapping = { + @EnumMap(name = "simple", value = Layout.BREAK_STRATEGY_SIMPLE), + @EnumMap(name = "high_quality", value = Layout.BREAK_STRATEGY_HIGH_QUALITY), + @EnumMap(name = "balanced", value = Layout.BREAK_STRATEGY_BALANCED) + }) @Layout.BreakStrategy public int getBreakStrategy() { return mBreakStrategy; @@ -4523,6 +4558,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @attr ref android.R.styleable#TextView_hyphenationFrequency * @see #setHyphenationFrequency(int) */ + @InspectableProperty(enumMapping = { + @EnumMap(name = "none", value = Layout.HYPHENATION_FREQUENCY_NONE), + @EnumMap(name = "normal", value = Layout.HYPHENATION_FREQUENCY_NORMAL), + @EnumMap(name = "full", value = Layout.HYPHENATION_FREQUENCY_FULL) + }) @Layout.HyphenationFrequency public int getHyphenationFrequency() { return mHyphenationFrequency; @@ -4580,6 +4620,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @see #setJustificationMode(int) */ + @InspectableProperty(enumMapping = { + @EnumMap(name = "none", value = Layout.JUSTIFICATION_MODE_NONE), + @EnumMap(name = "inter_word", value = Layout.JUSTIFICATION_MODE_INTER_WORD) + }) public @Layout.JustificationMode int getJustificationMode() { return mJustificationMode; } @@ -4720,6 +4764,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_textColor */ + @InspectableProperty(name = "textColor") public final ColorStateList getTextColors() { return mTextColor; } @@ -4754,6 +4799,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_textColorHighlight */ + @InspectableProperty(name = "textColorHighlight") @ColorInt public int getHighlightColor() { return mHighlightColor; @@ -4819,6 +4865,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_shadowRadius */ + @InspectableProperty public float getShadowRadius() { return mShadowRadius; } @@ -4830,6 +4877,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_shadowDx */ + @InspectableProperty public float getShadowDx() { return mShadowDx; } @@ -4842,6 +4890,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_shadowDy */ + @InspectableProperty public float getShadowDy() { return mShadowDy; } @@ -4854,6 +4903,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_shadowColor */ + @InspectableProperty @ColorInt public int getShadowColor() { return mShadowColor; @@ -4901,6 +4951,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_linksClickable */ + @InspectableProperty public final boolean getLinksClickable() { return mLinksClickable; } @@ -4961,6 +5012,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_textColorHint */ + @InspectableProperty(name = "textColorHint") public final ColorStateList getHintTextColors() { return mHintTextColor; } @@ -5013,6 +5065,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_textColorLink */ + @InspectableProperty(name = "textColorLink") public final ColorStateList getLinkTextColors() { return mLinkTextColor; } @@ -5062,6 +5115,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see android.view.Gravity * @attr ref android.R.styleable#TextView_gravity */ + @InspectableProperty(valueType = InspectableProperty.ValueType.GRAVITY) public int getGravity() { return mGravity; } @@ -5118,6 +5172,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @attr ref android.R.styleable#TextView_scrollHorizontally * @see #setHorizontallyScrolling(boolean) */ + @InspectableProperty(name = "scrollHorizontally") public final boolean isHorizontallyScrollable() { return mHorizontallyScrolling; } @@ -5170,6 +5225,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_minLines */ + @InspectableProperty public int getMinLines() { return mMinMode == LINES ? mMinimum : -1; } @@ -5252,6 +5308,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_maxLines */ + @InspectableProperty public int getMaxLines() { return mMaxMode == LINES ? mMaximum : -1; } @@ -5291,6 +5348,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_maxHeight */ + @InspectableProperty public int getMaxHeight() { return mMaxMode == PIXELS ? mMaximum : -1; } @@ -5375,6 +5433,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_minEms */ + @InspectableProperty public int getMinEms() { return mMinWidthMode == EMS ? mMinWidth : -1; } @@ -5418,6 +5477,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_minWidth */ + @InspectableProperty public int getMinWidth() { return mMinWidthMode == PIXELS ? mMinWidth : -1; } @@ -5457,6 +5517,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_maxEms */ + @InspectableProperty public int getMaxEms() { return mMaxWidthMode == EMS ? mMaxWidth : -1; } @@ -5496,6 +5557,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_maxWidth */ + @InspectableProperty public int getMaxWidth() { return mMaxWidthMode == PIXELS ? mMaxWidth : -1; } @@ -5579,6 +5641,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_lineSpacingMultiplier */ + @InspectableProperty public float getLineSpacingMultiplier() { return mSpacingMult; } @@ -5593,6 +5656,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_lineSpacingExtra */ + @InspectableProperty public float getLineSpacingExtra() { return mSpacingAdd; } @@ -5877,6 +5941,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @see #setFreezesText */ + @InspectableProperty public boolean getFreezesText() { return mFreezesText; } @@ -6340,6 +6405,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_hint */ + @InspectableProperty @ViewDebug.CapturedViewProperty public CharSequence getHint() { return mHint; @@ -6351,6 +6417,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_singleLine */ + @InspectableProperty public boolean isSingleLine() { return mSingleLine; } @@ -6592,6 +6659,147 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setInputType(int) * @see android.text.InputType */ + @InspectableProperty(flagMapping = { + @FlagMap(name = "none", mask = 0xffffffff, target = InputType.TYPE_NULL), + @FlagMap( + name = "text", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL), + @FlagMap( + name = "textUri", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI), + @FlagMap( + name = "textEmailAddress", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS), + @FlagMap( + name = "textEmailSubject", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT), + @FlagMap( + name = "textShortMessage", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE), + @FlagMap( + name = "textLongMessage", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE), + @FlagMap( + name = "textPersonName", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_PERSON_NAME), + @FlagMap( + name = "textPostalAddress", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS), + @FlagMap( + name = "textPassword", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD), + @FlagMap( + name = "textVisiblePassword", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD), + @FlagMap( + name = "textWebEditText", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT), + @FlagMap( + name = "textFilter", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_FILTER), + @FlagMap( + name = "textPhonetic", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PHONETIC), + @FlagMap( + name = "textWebEmailAddress", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS), + @FlagMap( + name = "textWebPassword", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD), + @FlagMap( + name = "number", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL), + @FlagMap( + name = "numberPassword", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_NUMBER + | InputType.TYPE_NUMBER_VARIATION_PASSWORD), + @FlagMap( + name = "phone", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_PHONE), + @FlagMap( + name = "datetime", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_DATETIME + | InputType.TYPE_DATETIME_VARIATION_NORMAL), + @FlagMap( + name = "date", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_DATETIME + | InputType.TYPE_DATETIME_VARIATION_DATE), + @FlagMap( + name = "time", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION, + target = InputType.TYPE_CLASS_DATETIME + | InputType.TYPE_DATETIME_VARIATION_TIME), + @FlagMap( + name = "textCapCharacters", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS), + @FlagMap( + name = "textCapWords", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS), + @FlagMap( + name = "textCapSentences", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES), + @FlagMap( + name = "textAutoCorrect", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT), + @FlagMap( + name = "textAutoComplete", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE), + @FlagMap( + name = "textMultiLine", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE), + @FlagMap( + name = "textImeMultiLine", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE), + @FlagMap( + name = "textNoSuggestions", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS), + @FlagMap( + name = "numberSigned", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED), + @FlagMap( + name = "numberDecimal", + mask = InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_FLAGS, + target = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL), + }) public int getInputType() { return mEditor == null ? EditorInfo.TYPE_NULL : mEditor.mInputType; } @@ -6614,8 +6822,55 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * Get the type of the Input Method Editor (IME). * @return the type of the IME * @see #setImeOptions(int) - * @see android.view.inputmethod.EditorInfo - */ + * @see EditorInfo + */ + @InspectableProperty(flagMapping = { + @FlagMap(name = "normal", mask = 0xffffffff, target = EditorInfo.IME_NULL), + @FlagMap( + name = "actionUnspecified", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_UNSPECIFIED), + @FlagMap( + name = "actionNone", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_NONE), + @FlagMap( + name = "actionGo", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_GO), + @FlagMap( + name = "actionSearch", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_SEARCH), + @FlagMap( + name = "actionSend", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_SEND), + @FlagMap( + name = "actionNext", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_NEXT), + @FlagMap( + name = "actionDone", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_DONE), + @FlagMap( + name = "actionPrevious", + mask = EditorInfo.IME_MASK_ACTION, + target = EditorInfo.IME_ACTION_PREVIOUS), + @FlagMap(name = "flagForceAscii", target = EditorInfo.IME_FLAG_FORCE_ASCII), + @FlagMap(name = "flagNavigateNext", target = EditorInfo.IME_FLAG_NAVIGATE_NEXT), + @FlagMap(name = "flagNavigatePrevious", target = EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS), + @FlagMap( + name = "flagNoAccessoryAction", + target = EditorInfo.IME_FLAG_NO_ACCESSORY_ACTION), + @FlagMap(name = "flagNoEnterAction", target = EditorInfo.IME_FLAG_NO_ENTER_ACTION), + @FlagMap(name = "flagNoExtractUi", target = EditorInfo.IME_FLAG_NO_EXTRACT_UI), + @FlagMap(name = "flagNoFullscreen", target = EditorInfo.IME_FLAG_NO_FULLSCREEN), + @FlagMap( + name = "flagNoPersonalizedLearning", + target = EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING), + }) public int getImeOptions() { return mEditor != null && mEditor.mInputContentType != null ? mEditor.mInputContentType.imeOptions : EditorInfo.IME_NULL; @@ -6644,6 +6899,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setImeActionLabel * @see android.view.inputmethod.EditorInfo */ + @InspectableProperty public CharSequence getImeActionLabel() { return mEditor != null && mEditor.mInputContentType != null ? mEditor.mInputContentType.imeActionLabel : null; @@ -6655,6 +6911,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setImeActionLabel * @see android.view.inputmethod.EditorInfo */ + @InspectableProperty public int getImeActionId() { return mEditor != null && mEditor.mInputContentType != null ? mEditor.mInputContentType.imeActionId : 0; @@ -6777,6 +7034,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setPrivateImeOptions(String) * @see EditorInfo#privateImeOptions */ + @InspectableProperty public String getPrivateImeOptions() { return mEditor != null && mEditor.mInputContentType != null ? mEditor.mInputContentType.privateImeOptions : null; @@ -7385,6 +7643,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_textIsSelectable */ + @InspectableProperty(name = "textIsSelectable") public boolean isTextSelectable() { return mEditor == null ? false : mEditor.mTextIsSelectable; } @@ -8924,6 +9183,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_includeFontPadding */ + @InspectableProperty public boolean getIncludeFontPadding() { return mIncludePad; } @@ -9870,6 +10130,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see #setAllCaps(boolean) * @see #setTransformationMethod(TransformationMethod) */ + @InspectableProperty(name = "textAllCaps") public boolean isAllCaps() { final TransformationMethod method = getTransformationMethod(); return method != null && method instanceof AllCapsTransformationMethod; @@ -9979,6 +10240,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_marqueeRepeatLimit */ + @InspectableProperty public int getMarqueeRepeatLimit() { return mMarqueeRepeatLimit; } @@ -9987,6 +10249,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * Returns where, if anywhere, words that are longer than the view * is wide should be ellipsized. */ + @InspectableProperty @ViewDebug.ExportedProperty public TextUtils.TruncateAt getEllipsize() { return mEllipsize; @@ -10038,6 +10301,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * * @attr ref android.R.styleable#TextView_cursorVisible */ + @InspectableProperty public boolean isCursorVisible() { // true is the default value return mEditor == null ? true : mEditor.mCursorVisible; diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java index 6a5c8cc9fac2..b239ce638e68 100644 --- a/core/java/android/widget/TimePicker.java +++ b/core/java/android/widget/TimePicker.java @@ -35,6 +35,7 @@ import android.view.ViewStructure; import android.view.accessibility.AccessibilityEvent; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; +import android.view.inspector.InspectableProperty; import com.android.internal.R; @@ -165,6 +166,10 @@ public class TimePicker extends FrameLayout { */ @TimePickerMode @TestApi + @InspectableProperty(name = "timePickerMode", enumMapping = { + @InspectableProperty.EnumMap(name = "clock", value = MODE_CLOCK), + @InspectableProperty.EnumMap(name = "spinner", value = MODE_SPINNER) + }) public int getMode() { return mMode; } @@ -185,6 +190,7 @@ public class TimePicker extends FrameLayout { * @return the currently selected hour, in the range (0-23) * @see #setHour(int) */ + @InspectableProperty(hasAttributeId = false) public int getHour() { return mDelegate.getHour(); } @@ -205,6 +211,7 @@ public class TimePicker extends FrameLayout { * @return the currently selected minute, in the range (0-59) * @see #setMinute(int) */ + @InspectableProperty(hasAttributeId = false) public int getMinute() { return mDelegate.getMinute(); } @@ -272,6 +279,7 @@ public class TimePicker extends FrameLayout { * {@code false} otherwise} * @see #setIs24HourView(Boolean) */ + @InspectableProperty(hasAttributeId = false, name = "24Hour") public boolean is24HourView() { return mDelegate.is24Hour(); } diff --git a/core/java/android/widget/ToggleButton.java b/core/java/android/widget/ToggleButton.java index 6a8449e73b7a..bba6da6b7b4c 100644 --- a/core/java/android/widget/ToggleButton.java +++ b/core/java/android/widget/ToggleButton.java @@ -21,6 +21,7 @@ import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; +import android.view.inspector.InspectableProperty; /** * Displays checked/unchecked states as a button @@ -87,6 +88,7 @@ public class ToggleButton extends CompoundButton { * * @return The text. */ + @InspectableProperty public CharSequence getTextOn() { return mTextOn; } @@ -105,6 +107,7 @@ public class ToggleButton extends CompoundButton { * * @return The text. */ + @InspectableProperty public CharSequence getTextOff() { return mTextOff; } @@ -118,6 +121,16 @@ public class ToggleButton extends CompoundButton { mTextOff = textOff; } + /** + * Returns the alpha value of the button when it is disabled + * + * @return the alpha value, 0.0-1.0 + */ + @InspectableProperty + public float getDisabledAlpha() { + return mDisabledAlpha; + } + @Override protected void onFinishInflate() { super.onFinishInflate(); diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java index adb7f2f89320..a33c47d86673 100644 --- a/core/java/android/widget/Toolbar.java +++ b/core/java/android/widget/Toolbar.java @@ -45,6 +45,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; +import android.view.inspector.InspectableProperty; import com.android.internal.R; import com.android.internal.view.menu.MenuBuilder; @@ -383,6 +384,7 @@ public class Toolbar extends ViewGroup { * 0 if menus are inflated against the toolbar theme * @see #setPopupTheme(int) */ + @InspectableProperty public int getPopupTheme() { return mPopupTheme; } @@ -414,6 +416,7 @@ public class Toolbar extends ViewGroup { * @see #setTitleMarginStart(int) * @attr ref android.R.styleable#Toolbar_titleMarginStart */ + @InspectableProperty public int getTitleMarginStart() { return mTitleMarginStart; } @@ -436,6 +439,7 @@ public class Toolbar extends ViewGroup { * @see #setTitleMarginTop(int) * @attr ref android.R.styleable#Toolbar_titleMarginTop */ + @InspectableProperty public int getTitleMarginTop() { return mTitleMarginTop; } @@ -458,6 +462,7 @@ public class Toolbar extends ViewGroup { * @see #setTitleMarginEnd(int) * @attr ref android.R.styleable#Toolbar_titleMarginEnd */ + @InspectableProperty public int getTitleMarginEnd() { return mTitleMarginEnd; } @@ -480,6 +485,7 @@ public class Toolbar extends ViewGroup { * @see #setTitleMarginBottom(int) * @attr ref android.R.styleable#Toolbar_titleMarginBottom */ + @InspectableProperty public int getTitleMarginBottom() { return mTitleMarginBottom; } @@ -650,6 +656,7 @@ public class Toolbar extends ViewGroup { * @see #setLogo(int) * @see #setLogo(android.graphics.drawable.Drawable) */ + @InspectableProperty public Drawable getLogo() { return mLogoView != null ? mLogoView.getDrawable() : null; } @@ -688,6 +695,7 @@ public class Toolbar extends ViewGroup { * * @return A description of the logo */ + @InspectableProperty public CharSequence getLogoDescription() { return mLogoView != null ? mLogoView.getContentDescription() : null; } @@ -735,6 +743,7 @@ public class Toolbar extends ViewGroup { * * @return The current title. */ + @InspectableProperty public CharSequence getTitle() { return mTitleText; } @@ -791,6 +800,7 @@ public class Toolbar extends ViewGroup { * * @return The current subtitle */ + @InspectableProperty public CharSequence getSubtitle() { return mSubtitleText; } @@ -895,6 +905,7 @@ public class Toolbar extends ViewGroup { * * @attr ref android.R.styleable#Toolbar_navigationContentDescription */ + @InspectableProperty @Nullable public CharSequence getNavigationContentDescription() { return mNavButtonView != null ? mNavButtonView.getContentDescription() : null; @@ -987,6 +998,7 @@ public class Toolbar extends ViewGroup { * * @attr ref android.R.styleable#Toolbar_navigationIcon */ + @InspectableProperty @Nullable public Drawable getNavigationIcon() { return mNavButtonView != null ? mNavButtonView.getDrawable() : null; @@ -1024,6 +1036,7 @@ public class Toolbar extends ViewGroup { * * @attr ref android.R.styleable#Toolbar_collapseContentDescription */ + @InspectableProperty @Nullable public CharSequence getCollapseContentDescription() { return mCollapseButtonView != null ? mCollapseButtonView.getContentDescription() : null; @@ -1069,6 +1082,7 @@ public class Toolbar extends ViewGroup { * * @attr ref android.R.styleable#Toolbar_collapseIcon */ + @InspectableProperty @Nullable public Drawable getCollapseIcon() { return mCollapseButtonView != null ? mCollapseButtonView.getDrawable() : null; @@ -1234,6 +1248,7 @@ public class Toolbar extends ViewGroup { * @see #getContentInsetRight() * @attr ref android.R.styleable#Toolbar_contentInsetStart */ + @InspectableProperty public int getContentInsetStart() { return mContentInsets != null ? mContentInsets.getStart() : 0; } @@ -1254,6 +1269,7 @@ public class Toolbar extends ViewGroup { * @see #getContentInsetRight() * @attr ref android.R.styleable#Toolbar_contentInsetEnd */ + @InspectableProperty public int getContentInsetEnd() { return mContentInsets != null ? mContentInsets.getEnd() : 0; } @@ -1297,6 +1313,7 @@ public class Toolbar extends ViewGroup { * @see #getContentInsetRight() * @attr ref android.R.styleable#Toolbar_contentInsetLeft */ + @InspectableProperty public int getContentInsetLeft() { return mContentInsets != null ? mContentInsets.getLeft() : 0; } @@ -1317,6 +1334,7 @@ public class Toolbar extends ViewGroup { * @see #getContentInsetLeft() * @attr ref android.R.styleable#Toolbar_contentInsetRight */ + @InspectableProperty public int getContentInsetRight() { return mContentInsets != null ? mContentInsets.getRight() : 0; } @@ -1333,6 +1351,7 @@ public class Toolbar extends ViewGroup { * @see #setContentInsetStartWithNavigation(int) * @attr ref android.R.styleable#Toolbar_contentInsetStartWithNavigation */ + @InspectableProperty public int getContentInsetStartWithNavigation() { return mContentInsetStartWithNavigation != RtlSpacingHelper.UNDEFINED ? mContentInsetStartWithNavigation @@ -1376,6 +1395,7 @@ public class Toolbar extends ViewGroup { * @see #setContentInsetEndWithActions(int) * @attr ref android.R.styleable#Toolbar_contentInsetEndWithActions */ + @InspectableProperty public int getContentInsetEndWithActions() { return mContentInsetEndWithActions != RtlSpacingHelper.UNDEFINED ? mContentInsetEndWithActions diff --git a/core/java/android/widget/ViewAnimator.java b/core/java/android/widget/ViewAnimator.java index 598a40779cd1..80ea363a6ad6 100644 --- a/core/java/android/widget/ViewAnimator.java +++ b/core/java/android/widget/ViewAnimator.java @@ -26,6 +26,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.view.inspector.InspectableProperty; /** * Base class for a {@link FrameLayout} container that will perform animations @@ -265,6 +266,7 @@ public class ViewAnimator extends FrameLayout { * @see #setInAnimation(android.view.animation.Animation) * @see #setInAnimation(android.content.Context, int) */ + @InspectableProperty public Animation getInAnimation() { return mInAnimation; } @@ -289,6 +291,7 @@ public class ViewAnimator extends FrameLayout { * @see #setOutAnimation(android.view.animation.Animation) * @see #setOutAnimation(android.content.Context, int) */ + @InspectableProperty public Animation getOutAnimation() { return mOutAnimation; } @@ -340,6 +343,7 @@ public class ViewAnimator extends FrameLayout { * * @see #setAnimateFirstView(boolean) */ + @InspectableProperty public boolean getAnimateFirstView() { return mAnimateFirstTime; } diff --git a/core/java/android/widget/ViewFlipper.java b/core/java/android/widget/ViewFlipper.java index 5e72b2eee9ae..414b1369d23e 100644 --- a/core/java/android/widget/ViewFlipper.java +++ b/core/java/android/widget/ViewFlipper.java @@ -25,6 +25,7 @@ import android.content.res.TypedArray; import android.os.Message; import android.util.AttributeSet; import android.util.Log; +import android.view.inspector.InspectableProperty; import android.widget.RemoteViews.RemoteView; /** @@ -134,6 +135,16 @@ public class ViewFlipper extends ViewAnimator { } /** + * Get the delay before flipping to the next view. + * + * @return delay time in milliseconds + */ + @InspectableProperty + public int getFlipInterval() { + return mFlipInterval; + } + + /** * Start a timer to cycle through child views */ public void startFlipping() { @@ -191,6 +202,7 @@ public class ViewFlipper extends ViewAnimator { /** * Returns true if the child views are flipping. */ + @InspectableProperty(hasAttributeId = false) public boolean isFlipping() { return mStarted; } @@ -207,6 +219,7 @@ public class ViewFlipper extends ViewAnimator { * Returns true if this view automatically calls {@link #startFlipping()} * when it becomes attached to a window. */ + @InspectableProperty public boolean isAutoStart() { return mAutoStart; } |