Merge "Implicitly cast views obtained via View.findView methods"
This commit is contained in:
committed by
Android (Google) Code Review
commit
592637dc69
@@ -44666,8 +44666,8 @@ package android.view {
|
||||
method public void drawableHotspotChanged(float, float);
|
||||
method protected void drawableStateChanged();
|
||||
method public android.view.View findFocus();
|
||||
method public final android.view.View findViewById(int);
|
||||
method public final android.view.View findViewWithTag(java.lang.Object);
|
||||
method public final <T extends android.view.View> T findViewById(int);
|
||||
method public final <T extends android.view.View> T findViewWithTag(java.lang.Object);
|
||||
method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence, int);
|
||||
method protected deprecated boolean fitSystemWindows(android.graphics.Rect);
|
||||
method public android.view.View focusSearch(int);
|
||||
|
||||
@@ -48011,8 +48011,8 @@ package android.view {
|
||||
method public void drawableHotspotChanged(float, float);
|
||||
method protected void drawableStateChanged();
|
||||
method public android.view.View findFocus();
|
||||
method public final android.view.View findViewById(int);
|
||||
method public final android.view.View findViewWithTag(java.lang.Object);
|
||||
method public final <T extends android.view.View> T findViewById(int);
|
||||
method public final <T extends android.view.View> T findViewWithTag(java.lang.Object);
|
||||
method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence, int);
|
||||
method protected deprecated boolean fitSystemWindows(android.graphics.Rect);
|
||||
method public android.view.View focusSearch(int);
|
||||
|
||||
@@ -45021,8 +45021,8 @@ package android.view {
|
||||
method public void drawableHotspotChanged(float, float);
|
||||
method protected void drawableStateChanged();
|
||||
method public android.view.View findFocus();
|
||||
method public final android.view.View findViewById(int);
|
||||
method public final android.view.View findViewWithTag(java.lang.Object);
|
||||
method public final <T extends android.view.View> T findViewById(int);
|
||||
method public final <T extends android.view.View> T findViewWithTag(java.lang.Object);
|
||||
method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence, int);
|
||||
method protected deprecated boolean fitSystemWindows(android.graphics.Rect);
|
||||
method public android.view.View focusSearch(int);
|
||||
|
||||
@@ -20260,9 +20260,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @return the view of the specified id, null if cannot be found
|
||||
* @hide
|
||||
*/
|
||||
protected View findViewTraversal(@IdRes int id) {
|
||||
protected <T extends View> T findViewTraversal(@IdRes int id) {
|
||||
if (id == mID) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -20272,9 +20272,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @return the view of specified tag, null if cannot be found
|
||||
* @hide
|
||||
*/
|
||||
protected View findViewWithTagTraversal(Object tag) {
|
||||
protected <T extends View> T findViewWithTagTraversal(Object tag) {
|
||||
if (tag != null && tag.equals(mTag)) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -20285,9 +20285,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @return The first view that matches the predicate or null.
|
||||
* @hide
|
||||
*/
|
||||
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
|
||||
protected <T extends View> T findViewByPredicateTraversal(Predicate<View> predicate,
|
||||
View childToSkip) {
|
||||
if (predicate.test(this)) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -20300,7 +20301,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @return The view that has the given id in the hierarchy or null
|
||||
*/
|
||||
@Nullable
|
||||
public final View findViewById(@IdRes int id) {
|
||||
public final <T extends View> T findViewById(@IdRes int id) {
|
||||
if (id < 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -20313,11 +20314,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @param accessibilityId The searched accessibility id.
|
||||
* @return The found view.
|
||||
*/
|
||||
final View findViewByAccessibilityId(int accessibilityId) {
|
||||
final <T extends View> T findViewByAccessibilityId(int accessibilityId) {
|
||||
if (accessibilityId < 0) {
|
||||
return null;
|
||||
}
|
||||
View view = findViewByAccessibilityIdTraversal(accessibilityId);
|
||||
T view = findViewByAccessibilityIdTraversal(accessibilityId);
|
||||
if (view != null) {
|
||||
return view.includeForAccessibility() ? view : null;
|
||||
}
|
||||
@@ -20336,12 +20337,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
*
|
||||
* @param accessibilityId The accessibility id.
|
||||
* @return The found view.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public View findViewByAccessibilityIdTraversal(int accessibilityId) {
|
||||
public <T extends View> T findViewByAccessibilityIdTraversal(int accessibilityId) {
|
||||
if (getAccessibilityViewId() == accessibilityId) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -20353,7 +20353,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @param tag The tag to search for, using "tag.equals(getTag())".
|
||||
* @return The View that has the given tag in the hierarchy or null
|
||||
*/
|
||||
public final View findViewWithTag(Object tag) {
|
||||
public final <T extends View> T findViewWithTag(Object tag) {
|
||||
if (tag == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -20368,7 +20368,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @return The first view that matches the predicate or null.
|
||||
* @hide
|
||||
*/
|
||||
public final View findViewByPredicate(Predicate<View> predicate) {
|
||||
public final <T extends View> T findViewByPredicate(Predicate<View> predicate) {
|
||||
return findViewByPredicateTraversal(predicate, null);
|
||||
}
|
||||
|
||||
@@ -20388,10 +20388,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @return The first view that matches the predicate or null.
|
||||
* @hide
|
||||
*/
|
||||
public final View findViewByPredicateInsideOut(View start, Predicate<View> predicate) {
|
||||
public final <T extends View> T findViewByPredicateInsideOut(
|
||||
View start, Predicate<View> predicate) {
|
||||
View childToSkip = null;
|
||||
for (;;) {
|
||||
View view = start.findViewByPredicateTraversal(predicate, childToSkip);
|
||||
T view = start.findViewByPredicateTraversal(predicate, childToSkip);
|
||||
if (view != null || start == this) {
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -4324,9 +4324,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
* {@hide}
|
||||
*/
|
||||
@Override
|
||||
protected View findViewTraversal(@IdRes int id) {
|
||||
protected <T extends View> T findViewTraversal(@IdRes int id) {
|
||||
if (id == mID) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
final View[] where = mChildren;
|
||||
@@ -4339,7 +4339,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
v = v.findViewById(id);
|
||||
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4351,9 +4351,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
* {@hide}
|
||||
*/
|
||||
@Override
|
||||
protected View findViewWithTagTraversal(Object tag) {
|
||||
protected <T extends View> T findViewWithTagTraversal(Object tag) {
|
||||
if (tag != null && tag.equals(mTag)) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
final View[] where = mChildren;
|
||||
@@ -4366,7 +4366,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
v = v.findViewWithTag(tag);
|
||||
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4378,9 +4378,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
* {@hide}
|
||||
*/
|
||||
@Override
|
||||
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
|
||||
protected <T extends View> T findViewByPredicateTraversal(Predicate<View> predicate,
|
||||
View childToSkip) {
|
||||
if (predicate.test(this)) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
final View[] where = mChildren;
|
||||
@@ -4393,7 +4394,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
v = v.findViewByPredicate(predicate);
|
||||
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
||||
mDefaultActivityButton = (FrameLayout) findViewById(R.id.default_activity_button);
|
||||
mDefaultActivityButton.setOnClickListener(mCallbacks);
|
||||
mDefaultActivityButton.setOnLongClickListener(mCallbacks);
|
||||
mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.image);
|
||||
mDefaultActivityButtonImage = mDefaultActivityButton.findViewById(R.id.image);
|
||||
|
||||
final FrameLayout expandButton = (FrameLayout) findViewById(R.id.expand_activities_button);
|
||||
expandButton.setOnClickListener(mCallbacks);
|
||||
@@ -282,7 +282,7 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
||||
mExpandActivityOverflowButton = expandButton;
|
||||
|
||||
mExpandActivityOverflowButtonImage =
|
||||
(ImageView) expandButton.findViewById(R.id.image);
|
||||
expandButton.findViewById(R.id.image);
|
||||
mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);
|
||||
|
||||
mAdapter = new ActivityChooserViewAdapter();
|
||||
@@ -760,7 +760,7 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
||||
convertView = LayoutInflater.from(getContext()).inflate(
|
||||
R.layout.activity_chooser_view_list_item, parent, false);
|
||||
convertView.setId(ITEM_VIEW_TYPE_FOOTER);
|
||||
TextView titleView = (TextView) convertView.findViewById(R.id.title);
|
||||
TextView titleView = convertView.findViewById(R.id.title);
|
||||
titleView.setText(mContext.getString(
|
||||
R.string.activity_chooser_view_see_all));
|
||||
}
|
||||
@@ -772,11 +772,11 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
||||
}
|
||||
PackageManager packageManager = mContext.getPackageManager();
|
||||
// Set the icon
|
||||
ImageView iconView = (ImageView) convertView.findViewById(R.id.icon);
|
||||
ImageView iconView = convertView.findViewById(R.id.icon);
|
||||
ResolveInfo activity = (ResolveInfo) getItem(position);
|
||||
iconView.setImageDrawable(activity.loadIcon(packageManager));
|
||||
// Set the title.
|
||||
TextView titleView = (TextView) convertView.findViewById(R.id.title);
|
||||
TextView titleView = convertView.findViewById(R.id.title);
|
||||
titleView.setText(activity.loadLabel(packageManager));
|
||||
// Highlight the default.
|
||||
if (mShowDefaultActivity && position == 0 && mHighlightDefaultActivity) {
|
||||
|
||||
@@ -451,7 +451,7 @@ public class AppSecurityPermissions {
|
||||
|
||||
private View getPermissionsView(int which, boolean showRevokeUI) {
|
||||
LinearLayout permsView = (LinearLayout) mInflater.inflate(R.layout.app_perms_summary, null);
|
||||
LinearLayout displayList = (LinearLayout) permsView.findViewById(R.id.perms_list);
|
||||
LinearLayout displayList = permsView.findViewById(R.id.perms_list);
|
||||
View noPermsView = permsView.findViewById(R.id.no_permissions);
|
||||
|
||||
displayPermissions(mPermGroupsList, displayList, which, showRevokeUI);
|
||||
@@ -517,8 +517,8 @@ public class AppSecurityPermissions {
|
||||
CharSequence grpName, CharSequence permList, boolean dangerous, Drawable icon) {
|
||||
View permView = inflater.inflate(R.layout.app_permission_item_old, null);
|
||||
|
||||
TextView permGrpView = (TextView) permView.findViewById(R.id.permission_group);
|
||||
TextView permDescView = (TextView) permView.findViewById(R.id.permission_list);
|
||||
TextView permGrpView = permView.findViewById(R.id.permission_group);
|
||||
TextView permDescView = permView.findViewById(R.id.permission_list);
|
||||
|
||||
ImageView imgView = (ImageView)permView.findViewById(R.id.perm_icon);
|
||||
imgView.setImageDrawable(icon);
|
||||
|
||||
@@ -388,7 +388,7 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable, ThemedSp
|
||||
text = (TextView) view;
|
||||
} else {
|
||||
// Otherwise, find the TextView field within the layout
|
||||
text = (TextView) view.findViewById(mFieldId);
|
||||
text = view.findViewById(mFieldId);
|
||||
|
||||
if (text == null) {
|
||||
throw new RuntimeException("Failed to find view with ID "
|
||||
|
||||
@@ -316,9 +316,9 @@ class CalendarViewLegacyDelegate extends CalendarView.AbstractCalendarViewDelega
|
||||
View content = layoutInflater.inflate(R.layout.calendar_view, null, false);
|
||||
mDelegator.addView(content);
|
||||
|
||||
mListView = (ListView) mDelegator.findViewById(R.id.list);
|
||||
mDayNamesHeader = (ViewGroup) content.findViewById(R.id.day_names);
|
||||
mMonthName = (TextView) content.findViewById(R.id.month_name);
|
||||
mListView = mDelegator.findViewById(R.id.list);
|
||||
mDayNamesHeader = content.findViewById(R.id.day_names);
|
||||
mMonthName = content.findViewById(R.id.month_name);
|
||||
|
||||
setUpHeader();
|
||||
setUpListView();
|
||||
|
||||
@@ -115,10 +115,10 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {
|
||||
mDelegator.addView(mContainer);
|
||||
|
||||
// Set up header views.
|
||||
final ViewGroup header = (ViewGroup) mContainer.findViewById(R.id.date_picker_header);
|
||||
mHeaderYear = (TextView) header.findViewById(R.id.date_picker_header_year);
|
||||
final ViewGroup header = mContainer.findViewById(R.id.date_picker_header);
|
||||
mHeaderYear = header.findViewById(R.id.date_picker_header_year);
|
||||
mHeaderYear.setOnClickListener(mOnHeaderClickListener);
|
||||
mHeaderMonthDay = (TextView) header.findViewById(R.id.date_picker_header_date);
|
||||
mHeaderMonthDay = header.findViewById(R.id.date_picker_header_date);
|
||||
mHeaderMonthDay.setOnClickListener(mOnHeaderClickListener);
|
||||
|
||||
// For the sake of backwards compatibility, attempt to extract the text
|
||||
@@ -154,10 +154,10 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {
|
||||
a.recycle();
|
||||
|
||||
// Set up picker container.
|
||||
mAnimator = (ViewAnimator) mContainer.findViewById(R.id.animator);
|
||||
mAnimator = mContainer.findViewById(R.id.animator);
|
||||
|
||||
// Set up day picker view.
|
||||
mDayPickerView = (DayPickerView) mAnimator.findViewById(R.id.date_picker_day_picker);
|
||||
mDayPickerView = mAnimator.findViewById(R.id.date_picker_day_picker);
|
||||
mDayPickerView.setFirstDayOfWeek(mFirstDayOfWeek);
|
||||
mDayPickerView.setMinDate(mMinDate.getTimeInMillis());
|
||||
mDayPickerView.setMaxDate(mMaxDate.getTimeInMillis());
|
||||
@@ -165,7 +165,7 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {
|
||||
mDayPickerView.setOnDaySelectedListener(mOnDaySelectedListener);
|
||||
|
||||
// Set up year picker view.
|
||||
mYearPickerView = (YearPickerView) mAnimator.findViewById(R.id.date_picker_year_picker);
|
||||
mYearPickerView = mAnimator.findViewById(R.id.date_picker_year_picker);
|
||||
mYearPickerView.setRange(mMinDate, mMaxDate);
|
||||
mYearPickerView.setYear(mCurrentDate.get(Calendar.YEAR));
|
||||
mYearPickerView.setOnYearSelectedListener(mOnYearSelectedListener);
|
||||
|
||||
@@ -225,7 +225,7 @@ class DayPickerPagerAdapter extends PagerAdapter {
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
final View itemView = mInflater.inflate(mLayoutResId, container, false);
|
||||
|
||||
final SimpleMonthView v = (SimpleMonthView) itemView.findViewById(mCalendarViewId);
|
||||
final SimpleMonthView v = itemView.findViewById(mCalendarViewId);
|
||||
v.setOnDayClickListener(mOnDayClickListener);
|
||||
v.setMonthTextAppearance(mMonthTextAppearance);
|
||||
v.setDayOfWeekTextAppearance(mDayOfWeekTextAppearance);
|
||||
|
||||
@@ -137,9 +137,10 @@ class DayPickerViewPager extends ViewPager {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
|
||||
protected <T extends View> T findViewByPredicateTraversal(Predicate<View> predicate,
|
||||
View childToSkip) {
|
||||
if (predicate.test(this)) {
|
||||
return this;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
// Always try the selected view first.
|
||||
@@ -148,7 +149,7 @@ class DayPickerViewPager extends ViewPager {
|
||||
if (current != childToSkip && current != null) {
|
||||
final View v = current.findViewByPredicate(predicate);
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +161,7 @@ class DayPickerViewPager extends ViewPager {
|
||||
final View v = child.findViewByPredicate(predicate);
|
||||
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3740,20 +3740,21 @@ public class ListView extends AbsListView {
|
||||
* @removed For internal use only. This should have been hidden.
|
||||
*/
|
||||
@Override
|
||||
protected View findViewTraversal(@IdRes int id) {
|
||||
View v;
|
||||
v = super.findViewTraversal(id);
|
||||
protected <T extends View> T findViewTraversal(@IdRes int id) {
|
||||
// First look in our children, then in any header and footer views that
|
||||
// may be scrolled off.
|
||||
View v = super.findViewTraversal(id);
|
||||
if (v == null) {
|
||||
v = findViewInHeadersOrFooters(mHeaderViewInfos, id);
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
v = findViewInHeadersOrFooters(mFooterViewInfos, id);
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
|
||||
View findViewInHeadersOrFooters(ArrayList<FixedViewInfo> where, int id) {
|
||||
@@ -3782,21 +3783,22 @@ public class ListView extends AbsListView {
|
||||
* @removed For internal use only. This should have been hidden.
|
||||
*/
|
||||
@Override
|
||||
protected View findViewWithTagTraversal(Object tag) {
|
||||
View v;
|
||||
v = super.findViewWithTagTraversal(tag);
|
||||
protected <T extends View> T findViewWithTagTraversal(Object tag) {
|
||||
// First look in our children, then in any header and footer views that
|
||||
// may be scrolled off.
|
||||
View v = super.findViewWithTagTraversal(tag);
|
||||
if (v == null) {
|
||||
v = findViewWithTagInHeadersOrFooters(mHeaderViewInfos, tag);
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
|
||||
v = findViewWithTagInHeadersOrFooters(mFooterViewInfos, tag);
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
|
||||
View findViewWithTagInHeadersOrFooters(ArrayList<FixedViewInfo> where, Object tag) {
|
||||
@@ -3829,21 +3831,21 @@ public class ListView extends AbsListView {
|
||||
* @hide
|
||||
*/
|
||||
@Override
|
||||
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
|
||||
View v;
|
||||
v = super.findViewByPredicateTraversal(predicate, childToSkip);
|
||||
protected <T extends View> T findViewByPredicateTraversal(
|
||||
Predicate<View> predicate, View childToSkip) {
|
||||
View v = super.findViewByPredicateTraversal(predicate, childToSkip);
|
||||
if (v == null) {
|
||||
v = findViewByPredicateInHeadersOrFooters(mHeaderViewInfos, predicate, childToSkip);
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
|
||||
v = findViewByPredicateInHeadersOrFooters(mFooterViewInfos, predicate, childToSkip);
|
||||
if (v != null) {
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
}
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -257,13 +257,13 @@ public class MediaController extends FrameLayout {
|
||||
.getText(com.android.internal.R.string.lockscreen_transport_play_description);
|
||||
mPauseDescription = res
|
||||
.getText(com.android.internal.R.string.lockscreen_transport_pause_description);
|
||||
mPauseButton = (ImageButton) v.findViewById(com.android.internal.R.id.pause);
|
||||
mPauseButton = v.findViewById(com.android.internal.R.id.pause);
|
||||
if (mPauseButton != null) {
|
||||
mPauseButton.requestFocus();
|
||||
mPauseButton.setOnClickListener(mPauseListener);
|
||||
}
|
||||
|
||||
mFfwdButton = (ImageButton) v.findViewById(com.android.internal.R.id.ffwd);
|
||||
mFfwdButton = v.findViewById(com.android.internal.R.id.ffwd);
|
||||
if (mFfwdButton != null) {
|
||||
mFfwdButton.setOnClickListener(mFfwdListener);
|
||||
if (!mFromXml) {
|
||||
@@ -271,7 +271,7 @@ public class MediaController extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
mRewButton = (ImageButton) v.findViewById(com.android.internal.R.id.rew);
|
||||
mRewButton = v.findViewById(com.android.internal.R.id.rew);
|
||||
if (mRewButton != null) {
|
||||
mRewButton.setOnClickListener(mRewListener);
|
||||
if (!mFromXml) {
|
||||
@@ -280,16 +280,16 @@ public class MediaController extends FrameLayout {
|
||||
}
|
||||
|
||||
// By default these are hidden. They will be enabled when setPrevNextListeners() is called
|
||||
mNextButton = (ImageButton) v.findViewById(com.android.internal.R.id.next);
|
||||
mNextButton = v.findViewById(com.android.internal.R.id.next);
|
||||
if (mNextButton != null && !mFromXml && !mListenersSet) {
|
||||
mNextButton.setVisibility(View.GONE);
|
||||
}
|
||||
mPrevButton = (ImageButton) v.findViewById(com.android.internal.R.id.prev);
|
||||
mPrevButton = v.findViewById(com.android.internal.R.id.prev);
|
||||
if (mPrevButton != null && !mFromXml && !mListenersSet) {
|
||||
mPrevButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mProgress = (ProgressBar) v.findViewById(com.android.internal.R.id.mediacontroller_progress);
|
||||
mProgress = v.findViewById(com.android.internal.R.id.mediacontroller_progress);
|
||||
if (mProgress != null) {
|
||||
if (mProgress instanceof SeekBar) {
|
||||
SeekBar seeker = (SeekBar) mProgress;
|
||||
@@ -298,8 +298,8 @@ public class MediaController extends FrameLayout {
|
||||
mProgress.setMax(1000);
|
||||
}
|
||||
|
||||
mEndTime = (TextView) v.findViewById(com.android.internal.R.id.time);
|
||||
mCurrentTime = (TextView) v.findViewById(com.android.internal.R.id.time_current);
|
||||
mEndTime = v.findViewById(com.android.internal.R.id.time);
|
||||
mCurrentTime = v.findViewById(com.android.internal.R.id.time_current);
|
||||
mFormatBuilder = new StringBuilder();
|
||||
mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
|
||||
|
||||
|
||||
@@ -1578,7 +1578,7 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
@Override
|
||||
public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
|
||||
final Context context = root.getContext();
|
||||
final ViewGroup target = (ViewGroup) root.findViewById(viewId);
|
||||
final ViewGroup target = root.findViewById(viewId);
|
||||
if (target == null) return;
|
||||
if (nestedViews != null) {
|
||||
// Inflate nested views and add as children
|
||||
@@ -1757,7 +1757,7 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
|
||||
@Override
|
||||
public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
|
||||
final TextView target = (TextView) root.findViewById(viewId);
|
||||
final TextView target = root.findViewById(viewId);
|
||||
if (target == null) return;
|
||||
if (drawablesLoaded) {
|
||||
if (isRelative) {
|
||||
@@ -1857,7 +1857,7 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
|
||||
@Override
|
||||
public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
|
||||
final TextView target = (TextView) root.findViewById(viewId);
|
||||
final TextView target = root.findViewById(viewId);
|
||||
if (target == null) return;
|
||||
target.setTextSize(units, size);
|
||||
}
|
||||
@@ -2045,7 +2045,7 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
|
||||
@Override
|
||||
public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
|
||||
final TextView target = (TextView) root.findViewById(viewId);
|
||||
final TextView target = root.findViewById(viewId);
|
||||
if (target == null) return;
|
||||
Drawable[] drawables = isRelative
|
||||
? target.getCompoundDrawablesRelative()
|
||||
|
||||
@@ -286,7 +286,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
||||
v.setTag(new ChildViewCache(v));
|
||||
|
||||
// Set up icon.
|
||||
final ImageView iconRefine = (ImageView) v.findViewById(R.id.edit_query);
|
||||
final ImageView iconRefine = v.findViewById(R.id.edit_query);
|
||||
iconRefine.setImageResource(mCommitIconResId);
|
||||
|
||||
return v;
|
||||
@@ -304,11 +304,11 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
||||
public final ImageView mIconRefine;
|
||||
|
||||
public ChildViewCache(View v) {
|
||||
mText1 = (TextView) v.findViewById(com.android.internal.R.id.text1);
|
||||
mText2 = (TextView) v.findViewById(com.android.internal.R.id.text2);
|
||||
mIcon1 = (ImageView) v.findViewById(com.android.internal.R.id.icon1);
|
||||
mIcon2 = (ImageView) v.findViewById(com.android.internal.R.id.icon2);
|
||||
mIconRefine = (ImageView) v.findViewById(com.android.internal.R.id.edit_query);
|
||||
mText1 = v.findViewById(com.android.internal.R.id.text1);
|
||||
mText2 = v.findViewById(com.android.internal.R.id.text2);
|
||||
mIcon1 = v.findViewById(com.android.internal.R.id.icon1);
|
||||
mIcon2 = v.findViewById(com.android.internal.R.id.icon2);
|
||||
mIconRefine = v.findViewById(com.android.internal.R.id.edit_query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -619,7 +619,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
mTabWidget, // tab widget is the parent
|
||||
false); // no inflate params
|
||||
|
||||
final TextView tv = (TextView) tabIndicator.findViewById(R.id.title);
|
||||
final TextView tv = tabIndicator.findViewById(R.id.title);
|
||||
tv.setText(mLabel);
|
||||
|
||||
if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) {
|
||||
@@ -653,8 +653,8 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
mTabWidget, // tab widget is the parent
|
||||
false); // no inflate params
|
||||
|
||||
final TextView tv = (TextView) tabIndicator.findViewById(R.id.title);
|
||||
final ImageView iconView = (ImageView) tabIndicator.findViewById(R.id.icon);
|
||||
final TextView tv = tabIndicator.findViewById(R.id.title);
|
||||
final ImageView iconView = tabIndicator.findViewById(R.id.icon);
|
||||
|
||||
// when icon is gone by default, we're in exclusive mode
|
||||
final boolean exclusive = iconView.getVisibility() == View.GONE;
|
||||
|
||||
@@ -86,7 +86,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate {
|
||||
inflater.inflate(layoutResourceId, mDelegator, true);
|
||||
|
||||
// hour
|
||||
mHourSpinner = (NumberPicker) delegator.findViewById(R.id.hour);
|
||||
mHourSpinner = delegator.findViewById(R.id.hour);
|
||||
mHourSpinner.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
|
||||
public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
|
||||
updateInputState();
|
||||
@@ -100,17 +100,17 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate {
|
||||
onTimeChanged();
|
||||
}
|
||||
});
|
||||
mHourSpinnerInput = (EditText) mHourSpinner.findViewById(R.id.numberpicker_input);
|
||||
mHourSpinnerInput = mHourSpinner.findViewById(R.id.numberpicker_input);
|
||||
mHourSpinnerInput.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
||||
|
||||
// divider (only for the new widget style)
|
||||
mDivider = (TextView) mDelegator.findViewById(R.id.divider);
|
||||
mDivider = mDelegator.findViewById(R.id.divider);
|
||||
if (mDivider != null) {
|
||||
setDividerText();
|
||||
}
|
||||
|
||||
// minute
|
||||
mMinuteSpinner = (NumberPicker) mDelegator.findViewById(R.id.minute);
|
||||
mMinuteSpinner = mDelegator.findViewById(R.id.minute);
|
||||
mMinuteSpinner.setMinValue(0);
|
||||
mMinuteSpinner.setMaxValue(59);
|
||||
mMinuteSpinner.setOnLongPressUpdateInterval(100);
|
||||
@@ -138,7 +138,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate {
|
||||
onTimeChanged();
|
||||
}
|
||||
});
|
||||
mMinuteSpinnerInput = (EditText) mMinuteSpinner.findViewById(R.id.numberpicker_input);
|
||||
mMinuteSpinnerInput = mMinuteSpinner.findViewById(R.id.numberpicker_input);
|
||||
mMinuteSpinnerInput.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
||||
|
||||
// Get the localized am/pm strings and use them in the spinner.
|
||||
@@ -173,13 +173,13 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate {
|
||||
onTimeChanged();
|
||||
}
|
||||
});
|
||||
mAmPmSpinnerInput = (EditText) mAmPmSpinner.findViewById(R.id.numberpicker_input);
|
||||
mAmPmSpinnerInput = mAmPmSpinner.findViewById(R.id.numberpicker_input);
|
||||
mAmPmSpinnerInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
}
|
||||
|
||||
if (isAmPmAtStart()) {
|
||||
// Move the am/pm view to the beginning
|
||||
ViewGroup amPmParent = (ViewGroup) delegator.findViewById(R.id.timePickerLayout);
|
||||
ViewGroup amPmParent = delegator.findViewById(R.id.timePickerLayout);
|
||||
amPmParent.removeView(amPmView);
|
||||
amPmParent.addView(amPmView, 0);
|
||||
// Swap layout margins if needed. They may be not symmetrical (Old Standard Theme
|
||||
|
||||
@@ -299,7 +299,7 @@ public class Toast {
|
||||
if (mNextView == null) {
|
||||
throw new RuntimeException("This Toast was not created with Toast.makeText()");
|
||||
}
|
||||
TextView tv = (TextView) mNextView.findViewById(com.android.internal.R.id.message);
|
||||
TextView tv = mNextView.findViewById(com.android.internal.R.id.message);
|
||||
if (tv == null) {
|
||||
throw new RuntimeException("This Toast was not created with Toast.makeText()");
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ public class ZoomButtonsController implements View.OnTouchListener {
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(com.android.internal.R.layout.zoom_container, container);
|
||||
|
||||
mControls = (ZoomControls) container.findViewById(com.android.internal.R.id.zoomControls);
|
||||
mControls = container.findViewById(com.android.internal.R.id.zoomControls);
|
||||
mControls.setOnZoomInClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
dismissControlsDelayed(ZOOM_CONTROLS_TIMEOUT);
|
||||
|
||||
@@ -91,13 +91,14 @@ public class WatchHeaderListView extends ListView {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View findViewByPredicateTraversal(Predicate<View> predicate, View childToSkip) {
|
||||
protected <T extends View> T findViewByPredicateTraversal(
|
||||
Predicate<View> predicate, View childToSkip) {
|
||||
View v = super.findViewByPredicateTraversal(predicate, childToSkip);
|
||||
if (v == null && mTopPanel != null && mTopPanel != childToSkip
|
||||
&& !mTopPanel.isRootNamespace()) {
|
||||
return mTopPanel.findViewByPredicate(predicate);
|
||||
return (T) mTopPanel.findViewByPredicate(predicate);
|
||||
}
|
||||
return v;
|
||||
return (T) v;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user