Merge "Use accessors for @hidden fields."

This commit is contained in:
John Spurlock
2014-01-13 19:06:43 +00:00
committed by Android (Google) Code Review
12 changed files with 64 additions and 63 deletions

View File

@@ -195,9 +195,10 @@ public class LoadAverageService extends Service {
int systemW = (systemTime*W)/totalTime;
int irqW = ((iowaitTime+irqTime+softIrqTime)*W)/totalTime;
int x = RIGHT - mPaddingRight;
int top = mPaddingTop + 2;
int bottom = mPaddingTop + mFH - 2;
int paddingRight = getPaddingRight();
int x = RIGHT - paddingRight;
int top = getPaddingTop() + 2;
int bottom = getPaddingTop() + mFH - 2;
if (irqW > 0) {
canvas.drawRect(x-irqW, top, x, bottom, mIrqPaint);
@@ -212,16 +213,16 @@ public class LoadAverageService extends Service {
x -= userW;
}
int y = mPaddingTop - (int)mAscent;
canvas.drawText(stats.mLoadText, RIGHT-mPaddingRight-stats.mLoadWidth-1,
int y = getPaddingTop() - (int)mAscent;
canvas.drawText(stats.mLoadText, RIGHT-paddingRight-stats.mLoadWidth-1,
y-1, mShadowPaint);
canvas.drawText(stats.mLoadText, RIGHT-mPaddingRight-stats.mLoadWidth-1,
canvas.drawText(stats.mLoadText, RIGHT-paddingRight-stats.mLoadWidth-1,
y+1, mShadowPaint);
canvas.drawText(stats.mLoadText, RIGHT-mPaddingRight-stats.mLoadWidth+1,
canvas.drawText(stats.mLoadText, RIGHT-paddingRight-stats.mLoadWidth+1,
y-1, mShadow2Paint);
canvas.drawText(stats.mLoadText, RIGHT-mPaddingRight-stats.mLoadWidth+1,
canvas.drawText(stats.mLoadText, RIGHT-paddingRight-stats.mLoadWidth+1,
y+1, mShadow2Paint);
canvas.drawText(stats.mLoadText, RIGHT-mPaddingRight-stats.mLoadWidth,
canvas.drawText(stats.mLoadText, RIGHT-paddingRight-stats.mLoadWidth,
y, mLoadPaint);
int N = stats.countWorkingStats();
@@ -233,7 +234,7 @@ public class LoadAverageService extends Service {
userW = (st.rel_utime*W)/totalTime;
systemW = (st.rel_stime*W)/totalTime;
x = RIGHT - mPaddingRight;
x = RIGHT - paddingRight;
if (systemW > 0) {
canvas.drawRect(x-systemW, top, x, bottom, mSystemPaint);
x -= systemW;
@@ -243,18 +244,18 @@ public class LoadAverageService extends Service {
x -= userW;
}
canvas.drawText(st.name, RIGHT-mPaddingRight-st.nameWidth-1,
canvas.drawText(st.name, RIGHT-paddingRight-st.nameWidth-1,
y-1, mShadowPaint);
canvas.drawText(st.name, RIGHT-mPaddingRight-st.nameWidth-1,
canvas.drawText(st.name, RIGHT-paddingRight-st.nameWidth-1,
y+1, mShadowPaint);
canvas.drawText(st.name, RIGHT-mPaddingRight-st.nameWidth+1,
canvas.drawText(st.name, RIGHT-paddingRight-st.nameWidth+1,
y-1, mShadow2Paint);
canvas.drawText(st.name, RIGHT-mPaddingRight-st.nameWidth+1,
canvas.drawText(st.name, RIGHT-paddingRight-st.nameWidth+1,
y+1, mShadow2Paint);
Paint p = mLoadPaint;
if (st.added) p = mAddedPaint;
if (st.removed) p = mRemovedPaint;
canvas.drawText(st.name, RIGHT-mPaddingRight-st.nameWidth, y, p);
canvas.drawText(st.name, RIGHT-paddingRight-st.nameWidth, y, p);
}
}
@@ -270,8 +271,8 @@ public class LoadAverageService extends Service {
}
}
int neededWidth = mPaddingLeft + mPaddingRight + maxWidth;
int neededHeight = mPaddingTop + mPaddingBottom + (mFH*(1+NW));
int neededWidth = getPaddingLeft() + getPaddingRight() + maxWidth;
int neededHeight = getPaddingTop() + getPaddingBottom() + (mFH*(1+NW));
if (neededWidth != mNeededWidth || neededHeight != mNeededHeight) {
mNeededWidth = neededWidth;
mNeededHeight = neededHeight;

View File

@@ -57,7 +57,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
public RecentsHorizontalScrollView(Context context, AttributeSet attrs) {
super(context, attrs, 0);
float densityScale = getResources().getDisplayMetrics().density;
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper = new SwipeHelper(SwipeHelper.Y, this, densityScale, pagingTouchSlop);
mFadedEdgeDrawHelper = FadedEdgeDrawHelper.create(context, attrs, this, false);
mRecycledViews = new HashSet<View>();
@@ -239,9 +239,9 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
if (mFadedEdgeDrawHelper != null) {
mFadedEdgeDrawHelper.drawCallback(canvas,
left, right, top, bottom, mScrollX, mScrollY,
left, right, top, bottom, getScrollX(), getScrollY(),
0, 0,
getLeftFadingEdgeStrength(), getRightFadingEdgeStrength(), mPaddingTop);
getLeftFadingEdgeStrength(), getRightFadingEdgeStrength(), getPaddingTop());
}
}
@@ -280,7 +280,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
super.onFinishInflate();
setScrollbarFadingEnabled(true);
mLinearLayout = (LinearLayout) findViewById(R.id.recents_linear_layout);
final int leftPadding = mContext.getResources()
final int leftPadding = getContext().getResources()
.getDimensionPixelOffset(R.dimen.status_bar_recents_thumbnail_left_margin);
setOverScrollEffectPadding(leftPadding, 0);
}
@@ -297,7 +297,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
super.onConfigurationChanged(newConfig);
float densityScale = getResources().getDisplayMetrics().density;
mSwipeHelper.setDensityScale(densityScale);
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
}

View File

@@ -330,7 +330,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
private void showImpl(boolean show) {
sendCloseSystemWindows(mContext, BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
sendCloseSystemWindows(getContext(), BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
mShowing = show;
@@ -372,11 +372,11 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
public void dismiss() {
((RecentsActivity) mContext).dismissAndGoHome();
((RecentsActivity) getContext()).dismissAndGoHome();
}
public void dismissAndGoBack() {
((RecentsActivity) mContext).dismissAndGoBack();
((RecentsActivity) getContext()).dismissAndGoBack();
}
public void onAnimationCancel(Animator animation) {
@@ -424,7 +424,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
public void updateValuesFromResources() {
final Resources res = mContext.getResources();
final Resources res = getContext().getResources();
mThumbnailWidth = Math.round(res.getDimension(R.dimen.status_bar_recents_thumbnail_width));
mFitThumbnailToXY = res.getBoolean(R.bool.config_recents_thumbnail_image_fits_to_xy);
}
@@ -440,7 +440,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
invalidate();
}
});
mListAdapter = new TaskDescriptionAdapter(mContext);
mListAdapter = new TaskDescriptionAdapter(getContext());
mRecentsContainer.setAdapter(mListAdapter);
mRecentsContainer.setCallback(this);
@@ -474,7 +474,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
if (show && h.iconView.getVisibility() != View.VISIBLE) {
if (anim) {
h.iconView.setAnimation(
AnimationUtils.loadAnimation(mContext, R.anim.recent_appear));
AnimationUtils.loadAnimation(getContext(), R.anim.recent_appear));
}
h.iconView.setVisibility(View.VISIBLE);
}
@@ -506,7 +506,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
if (show && h.thumbnailView.getVisibility() != View.VISIBLE) {
if (anim) {
h.thumbnailView.setAnimation(
AnimationUtils.loadAnimation(mContext, R.anim.recent_appear));
AnimationUtils.loadAnimation(getContext(), R.anim.recent_appear));
}
h.thumbnailView.setVisibility(View.VISIBLE);
}
@@ -617,7 +617,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
} else {
mRecentTaskDescriptions.addAll(tasks);
}
if (((RecentsActivity) mContext).isActivityShowing()) {
if (((RecentsActivity) getContext()).isActivityShowing()) {
refreshViews();
}
}
@@ -726,13 +726,13 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
// Currently, either direction means the same thing, so ignore direction and remove
// the task.
final ActivityManager am = (ActivityManager)
mContext.getSystemService(Context.ACTIVITY_SERVICE);
getContext().getSystemService(Context.ACTIVITY_SERVICE);
if (am != null) {
am.removeTask(ad.persistentTaskId, ActivityManager.REMOVE_TASK_KILL_PROCESS);
// Accessibility feedback
setContentDescription(
mContext.getString(R.string.accessibility_recents_item_dismissed, ad.getLabel()));
getContext().getString(R.string.accessibility_recents_item_dismissed, ad.getLabel()));
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
setContentDescription(null);
}
@@ -741,7 +741,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
private void startApplicationDetailsActivity(String packageName) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", packageName, null));
intent.setComponent(intent.resolveActivity(mContext.getPackageManager()));
intent.setComponent(intent.resolveActivity(getContext().getPackageManager()));
TaskStackBuilder.create(getContext())
.addNextIntentWithParentStack(intent).startActivities();
}
@@ -758,7 +758,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
final View selectedView, final View anchorView, final View thumbnailView) {
thumbnailView.setSelected(true);
final PopupMenu popup =
new PopupMenu(mContext, anchorView == null ? selectedView : anchorView);
new PopupMenu(getContext(), anchorView == null ? selectedView : anchorView);
mPopup = popup;
popup.getMenuInflater().inflate(R.menu.recent_popup_menu, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@@ -793,15 +793,15 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
int paddingLeft = mPaddingLeft;
int paddingLeft = getPaddingLeft();
final boolean offsetRequired = isPaddingOffsetRequired();
if (offsetRequired) {
paddingLeft += getLeftPaddingOffset();
}
int left = mScrollX + paddingLeft;
int right = left + mRight - mLeft - mPaddingRight - paddingLeft;
int top = mScrollY + getFadeTop(offsetRequired);
int left = getScrollX() + paddingLeft;
int right = left + getRight() - getLeft() - getPaddingRight() - paddingLeft;
int top = getScrollY() + getFadeTop(offsetRequired);
int bottom = top + getFadeHeight(offsetRequired);
if (offsetRequired) {

View File

@@ -57,7 +57,7 @@ public class RecentsVerticalScrollView extends ScrollView
public RecentsVerticalScrollView(Context context, AttributeSet attrs) {
super(context, attrs, 0);
float densityScale = getResources().getDisplayMetrics().density;
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
mFadedEdgeDrawHelper = FadedEdgeDrawHelper.create(context, attrs, this, true);
@@ -69,7 +69,7 @@ public class RecentsVerticalScrollView extends ScrollView
}
private int scrollPositionOfMostRecent() {
return mLinearLayout.getHeight() - getHeight() + mPaddingTop;
return mLinearLayout.getHeight() - getHeight() + getPaddingTop();
}
private void addToRecycledViews(View v) {
@@ -248,9 +248,9 @@ public class RecentsVerticalScrollView extends ScrollView
if (mFadedEdgeDrawHelper != null) {
final boolean offsetRequired = isPaddingOffsetRequired();
mFadedEdgeDrawHelper.drawCallback(canvas,
left, right, top + getFadeTop(offsetRequired), bottom, mScrollX, mScrollY,
left, right, top + getFadeTop(offsetRequired), bottom, getScrollX(), getScrollY(),
getTopFadingEdgeStrength(), getBottomFadingEdgeStrength(),
0, 0, mPaddingTop);
0, 0, getPaddingTop());
}
}
@@ -289,7 +289,7 @@ public class RecentsVerticalScrollView extends ScrollView
super.onFinishInflate();
setScrollbarFadingEnabled(true);
mLinearLayout = (LinearLayout) findViewById(R.id.recents_linear_layout);
final int leftPadding = mContext.getResources()
final int leftPadding = getContext().getResources()
.getDimensionPixelOffset(R.dimen.status_bar_recents_thumbnail_left_margin);
setOverScrollEffectPadding(leftPadding, 0);
}
@@ -306,7 +306,7 @@ public class RecentsVerticalScrollView extends ScrollView
super.onConfigurationChanged(newConfig);
float densityScale = getResources().getDisplayMetrics().density;
mSwipeHelper.setDensityScale(densityScale);
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
}

View File

@@ -119,7 +119,7 @@ public class StatusBarIconView extends AnimatedImageView {
}
if (!numberEquals) {
if (icon.number > 0 && mContext.getResources().getBoolean(
if (icon.number > 0 && getContext().getResources().getBoolean(
R.bool.config_statusBarShowNumber)) {
if (mNumberBackground == null) {
mNumberBackground = getContext().getResources().getDrawable(
@@ -240,10 +240,10 @@ public class StatusBarIconView extends AnimatedImageView {
void placeNumber() {
final String str;
final int tooBig = mContext.getResources().getInteger(
final int tooBig = getContext().getResources().getInteger(
android.R.integer.status_bar_notification_info_maxnum);
if (mIcon.number > tooBig) {
str = mContext.getResources().getString(
str = getContext().getResources().getString(
android.R.string.status_bar_notification_info_overflow);
} else {
NumberFormat f = NumberFormat.getIntegerInstance();

View File

@@ -143,7 +143,7 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode {
}
}
StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.CURRENT, iconId, 0, 0, "Demo");
StatusBarIconView v = new StatusBarIconView(mContext, null);
StatusBarIconView v = new StatusBarIconView(getContext(), null);
v.setTag(slot);
v.set(icon);
addView(v, 0, new LinearLayout.LayoutParams(mIconSize, mIconSize));

View File

@@ -222,7 +222,7 @@ public class NavigationBarView extends LinearLayout {
mDisplay = ((WindowManager)context.getSystemService(
Context.WINDOW_SERVICE)).getDefaultDisplay();
final Resources res = mContext.getResources();
final Resources res = getContext().getResources();
mBarSize = res.getDimensionPixelSize(R.dimen.navigation_bar_size);
mVertical = false;
mShowMenu = false;
@@ -240,7 +240,7 @@ public class NavigationBarView extends LinearLayout {
private void watchForDevicePolicyChanges() {
final IntentFilter filter = new IntentFilter();
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
mContext.registerReceiver(new BroadcastReceiver() {
getContext().registerReceiver(new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
post(new Runnable() {
@Override
@@ -324,7 +324,7 @@ public class NavigationBarView extends LinearLayout {
@Override
public void setLayoutDirection(int layoutDirection) {
getIcons(mContext.getResources());
getIcons(getContext().getResources());
super.setLayoutDirection(layoutDirection);
}
@@ -345,7 +345,7 @@ public class NavigationBarView extends LinearLayout {
mTransitionListener.onBackAltCleared();
}
if (DEBUG) {
android.widget.Toast.makeText(mContext,
android.widget.Toast.makeText(getContext(),
"Navigation icon hints = " + hints,
500).show();
}
@@ -417,7 +417,7 @@ public class NavigationBarView extends LinearLayout {
private boolean isCameraDisabledByDpm() {
final DevicePolicyManager dpm =
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
(DevicePolicyManager) getContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
if (dpm != null) {
try {
final int userId = ActivityManagerNative.getDefault().getCurrentUser().id;
@@ -479,7 +479,7 @@ public class NavigationBarView extends LinearLayout {
private void watchForAccessibilityChanges() {
final AccessibilityManager am =
(AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
(AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
// Set the initial state
enableAccessibility(am.isTouchExplorationEnabled());
@@ -516,7 +516,7 @@ public class NavigationBarView extends LinearLayout {
if (hasCamera) {
// Warm up KeyguardTouchDelegate so it's ready by the time the camera button is touched.
// This will connect to KeyguardService so that touch events are processed.
KeyguardTouchDelegate.getInstance(mContext);
KeyguardTouchDelegate.getInstance(getContext());
}
}
@@ -592,7 +592,7 @@ public class NavigationBarView extends LinearLayout {
private String getResourceName(int resId) {
if (resId != 0) {
final android.content.res.Resources res = mContext.getResources();
final android.content.res.Resources res = getContext().getResources();
try {
return res.getResourceName(resId);
} catch (android.content.res.Resources.NotFoundException ex) {

View File

@@ -42,7 +42,7 @@ public class QuickSettingsScrollView extends ScrollView {
if (getChildCount() > 0) {
View child = getChildAt(0);
scrollRange = Math.max(0,
child.getHeight() - (getHeight() - mPaddingBottom - mPaddingTop));
child.getHeight() - (getHeight() - getPaddingBottom() - getPaddingTop()));
}
return scrollRange;
}

View File

@@ -60,7 +60,7 @@ public class StatusBarWindowView extends FrameLayout
mNotificationPanel = (NotificationPanelView) findViewById(R.id.notification_panel);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
mExpandHelper = new ExpandHelper(mContext, latestItems, minHeight, maxHeight);
mExpandHelper = new ExpandHelper(getContext(), latestItems, minHeight, maxHeight);
mExpandHelper.setEventSource(this);
mExpandHelper.setScrollView(mScrollView);

View File

@@ -70,7 +70,7 @@ public class DateView extends TextView {
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
filter.addAction(Intent.ACTION_LOCALE_CHANGED);
mContext.registerReceiver(mIntentReceiver, filter, null, null);
getContext().registerReceiver(mIntentReceiver, filter, null, null);
updateClock();
}
@@ -80,7 +80,7 @@ public class DateView extends TextView {
super.onDetachedFromWindow();
mDateFormat = null; // reload the locale next time
mContext.unregisterReceiver(mIntentReceiver);
getContext().unregisterReceiver(mIntentReceiver);
}
protected void updateClock() {

View File

@@ -126,7 +126,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
mExpandHelper = new ExpandHelper(mContext, this, minHeight, maxHeight);
mExpandHelper = new ExpandHelper(getContext(), this, minHeight, maxHeight);
mContentHolder = (ViewGroup) findViewById(R.id.content_holder);
mContentSlider = (ViewGroup) findViewById(R.id.content_slider);

View File

@@ -93,7 +93,7 @@ public class NotificationRowLayout
}
float densityScale = getResources().getDisplayMetrics().density;
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
}
@@ -218,7 +218,7 @@ public class NotificationRowLayout
super.onConfigurationChanged(newConfig);
float densityScale = getResources().getDisplayMetrics().density;
mSwipeHelper.setDensityScale(densityScale);
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
}