diff options
author | Alan Viverette <alanv@google.com> | 2015-03-18 18:37:18 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2015-03-18 18:37:18 -0700 |
commit | 4a357cd2e55293402d7172766f7f9419815fc1e8 (patch) | |
tree | f2cedee7f41f48a8141a2798ca6100912553e4ef | |
parent | f2560e62cf26cae64f5751b0479743e09cb7bd7f (diff) | |
download | frameworks_base-4a357cd2e55293402d7172766f7f9419815fc1e8.zip frameworks_base-4a357cd2e55293402d7172766f7f9419815fc1e8.tar.gz frameworks_base-4a357cd2e55293402d7172766f7f9419815fc1e8.tar.bz2 |
Replace usages of deprecated Resources.getColor() and getColorStateList()
Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0
52 files changed, 102 insertions, 107 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 55d6ac8..b824e97 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -2870,7 +2870,7 @@ public class Notification implements Parcelable contentView.setProgressBar( R.id.progress, mProgressMax, mProgress, mProgressIndeterminate); contentView.setProgressBackgroundTintList( - R.id.progress, ColorStateList.valueOf(mContext.getResources().getColor( + R.id.progress, ColorStateList.valueOf(mContext.getColor( R.color.notification_progress_background_color))); if (mColor != COLOR_DEFAULT) { ColorStateList colorStateList = ColorStateList.valueOf(mColor); @@ -3044,7 +3044,7 @@ public class Notification implements Parcelable private void processLegacyAction(Action action, RemoteViews button) { if (!isLegacy() || mColorUtil.isGrayscaleIcon(mContext, action.icon)) { button.setTextViewCompoundDrawablesRelativeColorFilter(R.id.action0, 0, - mContext.getResources().getColor(R.color.notification_action_color_filter), + mContext.getColor(R.color.notification_action_color_filter), PorterDuff.Mode.MULTIPLY); } } @@ -3142,7 +3142,7 @@ public class Notification implements Parcelable private int resolveColor() { if (mColor == COLOR_DEFAULT) { - return mContext.getResources().getColor(R.color.notification_icon_bg_color); + return mContext.getColor(R.color.notification_icon_bg_color); } return mColor; } @@ -4321,9 +4321,9 @@ public class Notification implements Parcelable * Applies the special text colors for media notifications to all text views. */ private void styleText(RemoteViews contentView) { - int primaryColor = mBuilder.mContext.getResources().getColor( + int primaryColor = mBuilder.mContext.getColor( R.color.notification_media_primary_color); - int secondaryColor = mBuilder.mContext.getResources().getColor( + int secondaryColor = mBuilder.mContext.getColor( R.color.notification_media_secondary_color); contentView.setTextColor(R.id.title, primaryColor); if (mBuilder.showsTimeOrChronometer()) { diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 5dc9ef9..95ad57e 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -927,6 +927,7 @@ public class Resources { * @deprecated Use {@link #getColor(int, Theme)} instead. */ @ColorInt + @Deprecated public int getColor(@ColorRes int id) throws NotFoundException { return getColor(id, null); } @@ -996,6 +997,7 @@ public class Resources { * @deprecated Use {@link #getColorStateList(int, Theme)} instead. */ @Nullable + @Deprecated public ColorStateList getColorStateList(@ColorRes int id) throws NotFoundException { final ColorStateList csl = getColorStateList(id, null); if (csl != null && csl.canApplyTheme()) { @@ -1049,8 +1051,6 @@ public class Resources { return res; } - - /** * Return a boolean associated with a particular resource ID. This can be * used with any integral resource value, and will return true if it is diff --git a/core/java/android/content/res/StringBlock.java b/core/java/android/content/res/StringBlock.java index 9652db7..5cfc41f 100644 --- a/core/java/android/content/res/StringBlock.java +++ b/core/java/android/content/res/StringBlock.java @@ -328,7 +328,7 @@ final class StringBlock { String name = color.substring(1); int colorRes = res.getIdentifier(name, "color", "android"); if (colorRes != 0) { - ColorStateList colors = res.getColorStateList(colorRes); + ColorStateList colors = res.getColorStateList(colorRes, null); if (foreground) { return new TextAppearanceSpan(null, 0, 0, colors, null); } else { diff --git a/core/java/android/text/Html.java b/core/java/android/text/Html.java index dc93bc2..8cf1b4b 100644 --- a/core/java/android/text/Html.java +++ b/core/java/android/text/Html.java @@ -672,7 +672,7 @@ class HtmlToSpannedConverter implements ContentHandler { String name = f.mColor.substring(1); int colorRes = res.getIdentifier(name, "color", "android"); if (colorRes != 0) { - ColorStateList colors = res.getColorStateList(colorRes); + ColorStateList colors = res.getColorStateList(colorRes, null); text.setSpan(new TextAppearanceSpan(null, 0, 0, colors, null), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); diff --git a/core/java/android/view/PhoneWindow.java b/core/java/android/view/PhoneWindow.java index 543021e..05796bb 100644 --- a/core/java/android/view/PhoneWindow.java +++ b/core/java/android/view/PhoneWindow.java @@ -2981,8 +2981,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (mStatusGuard == null) { mStatusGuard = new View(mContext); - mStatusGuard.setBackgroundColor(mContext.getResources() - .getColor(R.color.input_method_navigation_guard)); + mStatusGuard.setBackgroundColor(mContext.getColor( + R.color.input_method_navigation_guard)); addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), new LayoutParams(LayoutParams.MATCH_PARENT, mlp.topMargin, Gravity.START | Gravity.TOP)); @@ -3041,8 +3041,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // position the navigation guard view, creating it if necessary if (mNavigationGuard == null) { mNavigationGuard = new View(mContext); - mNavigationGuard.setBackgroundColor(mContext.getResources() - .getColor(R.color.input_method_navigation_guard)); + mNavigationGuard.setBackgroundColor(mContext.getColor( + R.color.input_method_navigation_guard)); addView(mNavigationGuard, indexOfChild(mNavigationColorViewState.view), new LayoutParams(LayoutParams.MATCH_PARENT, insets.getSystemWindowInsetBottom(), diff --git a/core/java/android/widget/SuggestionsAdapter.java b/core/java/android/widget/SuggestionsAdapter.java index 4323851..aad0625 100644 --- a/core/java/android/widget/SuggestionsAdapter.java +++ b/core/java/android/widget/SuggestionsAdapter.java @@ -378,7 +378,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene // Lazily get the URL color from the current theme. TypedValue colorValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.textColorSearchUrl, colorValue, true); - mUrlColor = context.getResources().getColorStateList(colorValue.resourceId); + mUrlColor = context.getColorStateList(colorValue.resourceId); } SpannableString text = new SpannableString(url); diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 110d79b..c521f72 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -603,7 +603,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) { // Donut apps get old color scheme tabIndicator.setBackgroundResource(R.drawable.tab_indicator_v4); - tv.setTextColor(context.getResources().getColorStateList(R.color.tab_indicator_text_v4)); + tv.setTextColor(context.getColorStateList(R.color.tab_indicator_text_v4)); } return tabIndicator; @@ -648,7 +648,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) { // Donut apps get old color scheme tabIndicator.setBackgroundResource(R.drawable.tab_indicator_v4); - tv.setTextColor(context.getResources().getColorStateList(R.color.tab_indicator_text_v4)); + tv.setTextColor(context.getColorStateList(R.color.tab_indicator_text_v4)); } return tabIndicator; diff --git a/core/java/com/android/internal/util/UserIcons.java b/core/java/com/android/internal/util/UserIcons.java index c69d14f..daf745f 100644 --- a/core/java/com/android/internal/util/UserIcons.java +++ b/core/java/com/android/internal/util/UserIcons.java @@ -70,8 +70,8 @@ public class UserIcons { // Return colored icon instead colorResId = USER_ICON_COLORS[userId % USER_ICON_COLORS.length]; } - Drawable icon = Resources.getSystem().getDrawable(R.drawable.ic_account_circle).mutate(); - icon.setColorFilter(Resources.getSystem().getColor(colorResId), Mode.SRC_IN); + Drawable icon = Resources.getSystem().getDrawable(R.drawable.ic_account_circle, null).mutate(); + icon.setColorFilter(Resources.getSystem().getColor(colorResId, null), Mode.SRC_IN); icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); return icon; } diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 52bbabf..8be34e7 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -269,9 +269,9 @@ public class LockPatternView extends View { mPathPaint.setAntiAlias(true); mPathPaint.setDither(true); - mRegularColor = getResources().getColor(R.color.lock_pattern_view_regular_color); - mErrorColor = getResources().getColor(R.color.lock_pattern_view_error_color); - mSuccessColor = getResources().getColor(R.color.lock_pattern_view_success_color); + mRegularColor = context.getColor(R.color.lock_pattern_view_regular_color); + mErrorColor = context.getColor(R.color.lock_pattern_view_error_color); + mSuccessColor = context.getColor(R.color.lock_pattern_view_success_color); mRegularColor = a.getColor(R.styleable.LockPatternView_regularColor, mRegularColor); mErrorColor = a.getColor(R.styleable.LockPatternView_errorColor, mErrorColor); mSuccessColor = a.getColor(R.styleable.LockPatternView_successColor, mSuccessColor); diff --git a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java index 0a3e073..95b3eb3 100644 --- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java +++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java @@ -385,7 +385,7 @@ public class GpsNetInitiatedHandler { // if not to popup dialog immediately, pending intent will open the dialog Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent(); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, 0); - mNiNotification.color = mContext.getResources().getColor( + mNiNotification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); mNiNotification.setLatestEventInfo(mContext, title, message, pi); diff --git a/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java b/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java index 5378ea9..b43fedf 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java +++ b/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java @@ -268,7 +268,7 @@ public class IconUtils { public static Drawable applyTintColor(Context context, int drawableId, int tintColorId) { final Drawable icon = context.getDrawable(drawableId); icon.mutate(); - icon.setTintList(context.getResources().getColorStateList(tintColorId)); + icon.setTintList(context.getColorStateList(tintColorId)); return icon; } diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java b/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java index 5233c79..33db831 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java +++ b/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java @@ -125,7 +125,7 @@ final class NotificationController { .setWhen(System.currentTimeMillis()) .setOngoing(true) .setShowWhen(true) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); mNotificationManager.notify(0, builder.build()); } @@ -143,7 +143,7 @@ final class NotificationController { .setWhen(System.currentTimeMillis()) .setOngoing(true) .setShowWhen(true) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); mNotificationManager.notify(0, builder.build()); } @@ -159,7 +159,7 @@ final class NotificationController { .setWhen(System.currentTimeMillis()) .setOngoing(true) .setShowWhen(true) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); mNotificationManager.notify(0, builder.build()); } @@ -173,7 +173,7 @@ final class NotificationController { .setWhen(System.currentTimeMillis()) .setOngoing(true) .setShowWhen(true) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); mNotificationManager.notify(0, builder.build()); } @@ -206,7 +206,7 @@ final class NotificationController { builder.setNumber(printJobCount); builder.setStyle(inboxStyle); - builder.setColor(mContext.getResources().getColor( + builder.setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); mNotificationManager.notify(0, builder.build()); diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java index bfcd334..e6613fa 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java +++ b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java @@ -87,7 +87,7 @@ public final class PrintContentView extends ViewGroup implements View.OnClickLis super(context, attrs); mDragger = ViewDragHelper.create(this, new DragCallbacks()); - mScrimColor = context.getResources().getColor(R.color.print_preview_scrim_color); + mScrimColor = context.getColor(R.color.print_preview_scrim_color); // The options view is sliding under the static header but appears // after it in the layout, so we will draw in opposite order. diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java index 48ecaa5..e1bfc43 100644 --- a/packages/Shell/src/com/android/shell/BugreportReceiver.java +++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java @@ -93,7 +93,7 @@ public class BugreportReceiver extends BroadcastReceiver { context, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT)) .setAutoCancel(true) .setLocalOnly(true) - .setColor(context.getResources().getColor( + .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)); NotificationManager.from(context).notify(TAG, 0, builder.build()); diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index 9bb626d..2e95498 100755 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -193,7 +193,7 @@ public class BatteryMeterView extends View implements DemoMode, TypedArray atts = context.obtainStyledAttributes(attrs, R.styleable.BatteryMeterView, defStyle, 0); final int frameColor = atts.getColor(R.styleable.BatteryMeterView_frameColor, - res.getColor(R.color.batterymeter_frame_color)); + context.getColor(R.color.batterymeter_frame_color)); TypedArray levels = res.obtainTypedArray(R.array.batterymeter_color_levels); TypedArray colors = res.obtainTypedArray(R.array.batterymeter_color_values); @@ -240,10 +240,10 @@ public class BatteryMeterView extends View implements DemoMode, mWarningTextPaint.setTypeface(font); mWarningTextPaint.setTextAlign(Paint.Align.CENTER); - mChargeColor = getResources().getColor(R.color.batterymeter_charge_color); + mChargeColor = context.getColor(R.color.batterymeter_charge_color); mBoltPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - mBoltPaint.setColor(res.getColor(R.color.batterymeter_bolt_color)); + mBoltPaint.setColor(context.getColor(R.color.batterymeter_bolt_color)); mBoltPoints = loadBoltPoints(res); } diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelCircleView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelCircleView.java index d8fb6da..f33e2b8 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelCircleView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelCircleView.java @@ -132,8 +132,8 @@ public class SearchPanelCircleView extends FrameLayout { mDisappearInterpolator = AnimationUtils.loadInterpolator(mContext, android.R.interpolator.fast_out_linear_in); mBackgroundPaint.setAntiAlias(true); - mBackgroundPaint.setColor(getResources().getColor(R.color.search_panel_circle_color)); - mRipplePaint.setColor(getResources().getColor(R.color.search_panel_ripple_color)); + mBackgroundPaint.setColor(context.getColor(R.color.search_panel_circle_color)); + mRipplePaint.setColor(context.getColor(R.color.search_panel_ripple_color)); mRipplePaint.setAntiAlias(true); } diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java index 63dd17f..af1f795 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java @@ -159,7 +159,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setContentText(mContext.getString(R.string.invalid_charger_text)) .setPriority(Notification.PRIORITY_MAX) .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); final Notification n = nb.build(); if (n.headsUpContentView != null) { @@ -183,7 +183,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_WARNING)) .setPriority(Notification.PRIORITY_MAX) .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.battery_saver_mode_color)); if (hasBatterySettings()) { nb.setContentIntent(pendingBroadcast(ACTION_SHOW_BATTERY_SETTINGS)); @@ -214,7 +214,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setOngoing(true) .setShowWhen(false) .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.battery_saver_mode_color)); addStopSaverAction(nb); if (hasSaverSettings()) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java b/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java index d55ceaa..aff5d2b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java +++ b/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java @@ -44,10 +44,10 @@ public class DataUsageGraph extends View { public DataUsageGraph(Context context, AttributeSet attrs) { super(context, attrs); final Resources res = context.getResources(); - mTrackColor = res.getColor(R.color.data_usage_graph_track); - mUsageColor = res.getColor(R.color.system_accent_color); - mOverlimitColor = res.getColor(R.color.system_warning_color); - mWarningColor = res.getColor(R.color.data_usage_graph_warning); + mTrackColor = context.getColor(R.color.data_usage_graph_track); + mUsageColor = context.getColor(R.color.system_accent_color); + mOverlimitColor = context.getColor(R.color.system_warning_color); + mWarningColor = context.getColor(R.color.data_usage_graph_warning); mMarkerWidth = res.getDimensionPixelSize(R.dimen.data_usage_graph_marker_width); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index 16ae6b4..ec83ca7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -88,7 +88,7 @@ public class QSTileView extends ViewGroup { addView(mIcon); mDivider = new View(mContext); - mDivider.setBackgroundColor(res.getColor(R.color.qs_tile_divider)); + mDivider.setBackgroundColor(context.getColor(R.color.qs_tile_divider)); final int dh = res.getDimensionPixelSize(R.dimen.qs_tile_divider_height); mDivider.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, dh)); addView(mDivider); @@ -138,8 +138,8 @@ public class QSTileView extends ViewGroup { mDualLabel = new QSDualTileLabel(mContext); mDualLabel.setId(android.R.id.title); mDualLabel.setBackgroundResource(R.drawable.btn_borderless_rect); - mDualLabel.setFirstLineCaret(res.getDrawable(R.drawable.qs_dual_tile_caret)); - mDualLabel.setTextColor(res.getColor(R.color.qs_tile_text)); + mDualLabel.setFirstLineCaret(mContext.getDrawable(R.drawable.qs_dual_tile_caret)); + mDualLabel.setTextColor(mContext.getColor(R.color.qs_tile_text)); mDualLabel.setPadding(0, mDualTileVerticalPaddingPx, 0, mDualTileVerticalPaddingPx); mDualLabel.setTypeface(CONDENSED); mDualLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, @@ -157,7 +157,7 @@ public class QSTileView extends ViewGroup { } else { mLabel = new TextView(mContext); mLabel.setId(android.R.id.title); - mLabel.setTextColor(res.getColor(R.color.qs_tile_text)); + mLabel.setTextColor(mContext.getColor(R.color.qs_tile_text)); mLabel.setGravity(Gravity.CENTER_HORIZONTAL); mLabel.setMinLines(2); mLabel.setPadding(0, 0, 0, 0); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java index eb816b7..d0ae383 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java @@ -96,7 +96,7 @@ public class DataUsageDetailView extends LinearLayout { title.setText(titleId); final TextView usage = (TextView) findViewById(R.id.usage_text); usage.setText(formatBytes(bytes)); - usage.setTextColor(res.getColor(usageColor)); + usage.setTextColor(mContext.getColor(usageColor)); final DataUsageGraph graph = (DataUsageGraph) findViewById(R.id.usage_graph); graph.setLevels(info.limitLevel, info.warningLevel, info.usageLevel); final TextView carrier = (TextView) findViewById(R.id.usage_carrier_text); diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java index 1736c77..9263543 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java @@ -248,14 +248,11 @@ public class RecentsConfiguration { taskViewThumbnailAlpha = res.getFloat(R.dimen.recents_task_view_thumbnail_alpha); // Task bar colors - taskBarViewDefaultBackgroundColor = - res.getColor(R.color.recents_task_bar_default_background_color, null); - taskBarViewLightTextColor = - res.getColor(R.color.recents_task_bar_light_text_color, null); - taskBarViewDarkTextColor = - res.getColor(R.color.recents_task_bar_dark_text_color, null); - taskBarViewHighlightColor = - res.getColor(R.color.recents_task_bar_highlight_color, null); + taskBarViewDefaultBackgroundColor = context.getColor( + R.color.recents_task_bar_default_background_color); + taskBarViewLightTextColor = context.getColor(R.color.recents_task_bar_light_text_color); + taskBarViewDarkTextColor = context.getColor(R.color.recents_task_bar_dark_text_color); + taskBarViewHighlightColor = context.getColor(R.color.recents_task_bar_highlight_color); taskBarViewAffiliationColorMinAlpha = res.getFloat( R.dimen.recents_task_affiliation_color_min_alpha_percentage); diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java index 502862e..cbf5c05 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java @@ -144,7 +144,7 @@ public class ScreenPinningRequest implements View.OnClickListener { boolean isLandscape = isLandscapePhone(mContext); inflateView(isLandscape); - int bgColor = mContext.getResources().getColor( + int bgColor = mContext.getColor( R.color.screen_pinning_request_window_bg); if (ActivityManager.isHighEndGfx()) { mLayout.setAlpha(0f); diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 1b71668..9d349ab 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -724,7 +724,7 @@ class GlobalScreenshot { .setVisibility(Notification.VISIBILITY_PUBLIC) // ok to show outside lockscreen .setCategory(Notification.CATEGORY_ERROR) .setAutoCancel(true) - .setColor(context.getResources().getColor( + .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)); Notification n = new Notification.BigTextStyle(b) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 0e5fd94..c0b3a9b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -154,15 +154,15 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mAppearAnimationFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP); mRoundedRectCornerRadius = getResources().getDimensionPixelSize( R.dimen.notification_material_rounded_rect_radius); - mLegacyColor = getResources().getColor(R.color.notification_legacy_background_color); - mNormalColor = getResources().getColor(R.color.notification_material_background_color); - mLowPriorityColor = getResources().getColor( + mLegacyColor = context.getColor(R.color.notification_legacy_background_color); + mNormalColor = context.getColor(R.color.notification_material_background_color); + mLowPriorityColor = context.getColor( R.color.notification_material_background_low_priority_color); - mTintedRippleColor = context.getResources().getColor( + mTintedRippleColor = context.getColor( R.color.notification_ripple_tinted_color); - mLowPriorityRippleColor = context.getResources().getColor( + mLowPriorityRippleColor = context.getColor( R.color.notification_ripple_color_low_priority); - mNormalRippleColor = context.getResources().getColor( + mNormalRippleColor = context.getColor( R.color.notification_ripple_untinted_color); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index fab7409..55bdcac 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -661,7 +661,7 @@ public abstract class BaseStatusBar extends SystemUI implements .setContentText(mContext.getString(R.string.hidden_notifications_text)) .setPriority(Notification.PRIORITY_HIGH) .setOngoing(true) - .setColor(res.getColor(colorRes)) + .setColor(mContext.getColor(colorRes)) .setContentIntent(setupIntent) .addAction(R.drawable.ic_close, mContext.getString(R.string.hidden_notifications_cancel), @@ -789,7 +789,7 @@ public abstract class BaseStatusBar extends SystemUI implements final int color = sbn.getNotification().color; if (isMediaNotification(entry)) { entry.row.setTintColor(color == Notification.COLOR_DEFAULT - ? mContext.getResources().getColor( + ? mContext.getColor( R.color.notification_material_background_media_default_color) : color); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java index da8ef3e..88bb714 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java @@ -45,7 +45,7 @@ public class NotificationOverflowIconsView extends IconMerger { protected void onFinishInflate() { super.onFinishInflate(); mNotificationColorUtil = NotificationColorUtil.getInstance(getContext()); - mTintColor = getResources().getColor(R.color.keyguard_overflow_content_color); + mTintColor = getContext().getColor(R.color.keyguard_overflow_content_color); mIconSize = getResources().getDimensionPixelSize( com.android.internal.R.dimen.status_bar_icon_size); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java index 59b62e5..0abf552 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java @@ -60,7 +60,7 @@ public class NotificationTemplateViewWrapper extends NotificationViewWrapper { super(view); mIconDarkAlpha = ctx.getResources().getInteger(R.integer.doze_small_icon_alpha); mIconBackgroundDarkColor = - ctx.getResources().getColor(R.color.doze_small_icon_background_color); + ctx.getColor(R.color.doze_small_icon_background_color); mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(ctx, android.R.interpolator.linear_out_slow_in); resolveViews(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java index d02cd17..e6847d8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java @@ -55,7 +55,7 @@ public class StatusBarIconView extends AnimatedImageView { mSlot = slot; mNumberPain = new Paint(); mNumberPain.setTextAlign(Paint.Align.CENTER); - mNumberPain.setColor(res.getColor(R.drawable.notification_number_text_color)); + mNumberPain.setColor(context.getColor(R.drawable.notification_number_text_color)); mNumberPain.setAntiAlias(true); setNotification(notification); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java index 2d76645..1601b83 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java @@ -145,12 +145,12 @@ public class BarTransitions { mTransparent = 0x2f0000ff; mWarning = 0xffff0000; } else { - mOpaque = res.getColor(R.color.system_bar_background_opaque); - mSemiTransparent = res.getColor(R.color.system_bar_background_semi_transparent); - mTransparent = res.getColor(R.color.system_bar_background_transparent); - mWarning = res.getColor(com.android.internal.R.color.battery_saver_mode_color); + mOpaque = context.getColor(R.color.system_bar_background_opaque); + mSemiTransparent = context.getColor(R.color.system_bar_background_semi_transparent); + mTransparent = context.getColor(R.color.system_bar_background_transparent); + mWarning = context.getColor(com.android.internal.R.color.battery_saver_mode_color); } - mGradient = res.getDrawable(gradientResourceId); + mGradient = context.getDrawable(gradientResourceId); mInterpolator = new LinearInterpolator(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index f3ec34a..2c389fb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -535,8 +535,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, updateDisplaySize(); mScrimSrcModeEnabled = mContext.getResources().getBoolean( R.bool.config_status_bar_scrim_behind_use_src); - mLightModeIconColor = mContext.getResources().getColor(R.color.light_mode_icon_color, - mContext.getTheme()); + mLightModeIconColor = mContext.getColor(R.color.light_mode_icon_color); super.start(); // calls createAndAddWindows() @@ -613,7 +612,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (!ActivityManager.isHighEndGfx()) { mStatusBarWindow.setBackground(null); - mNotificationPanel.setBackground(new FastColorDrawable(context.getResources().getColor( + mNotificationPanel.setBackground(new FastColorDrawable(context.getColor( R.color.notification_panel_solid_background))); } if (ENABLE_HEADS_UP) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherScrim.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherScrim.java index 2d04d8e..353e07d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherScrim.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherScrim.java @@ -47,7 +47,7 @@ public class KeyguardUserSwitcherScrim extends Drawable public KeyguardUserSwitcherScrim(View host) { host.addOnLayoutChangeListener(this); - mDarkColor = host.getResources().getColor( + mDarkColor = host.getContext().getColor( R.color.keyguard_user_switcher_background_gradient_color); } diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index f804736..5771d22 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -327,7 +327,7 @@ public class StorageNotification extends SystemUI { pi = PendingIntent.getBroadcastAsUser(mContext, 0, intent, 0, UserHandle.CURRENT); } - mUsbStorageNotification.color = mContext.getResources().getColor( + mUsbStorageNotification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); mUsbStorageNotification.setLatestEventInfo(mContext, title, message, pi); mUsbStorageNotification.visibility = Notification.VISIBILITY_PUBLIC; @@ -422,7 +422,7 @@ public class StorageNotification extends SystemUI { } mMediaStorageNotification.icon = icon; - mMediaStorageNotification.color = mContext.getResources().getColor( + mMediaStorageNotification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); mMediaStorageNotification.setLatestEventInfo(mContext, title, message, pi); mMediaStorageNotification.visibility = Notification.VISIBILITY_PUBLIC; diff --git a/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java b/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java index 2f02f7c..5f5b881 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java +++ b/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java @@ -60,7 +60,7 @@ public class SegmentedButtons extends LinearLayout { final Object tag = c.getTag(); final boolean selected = Objects.equals(mSelectedValue, tag); c.setSelected(selected); - c.getCompoundDrawables()[1].setTint(mContext.getResources().getColor(selected + c.getCompoundDrawables()[1].setTint(mContext.getColor(selected ? R.color.segmented_button_selected : R.color.segmented_button_unselected)); } fireOnSelected(); diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java index 687452d..ac08904 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java @@ -330,7 +330,7 @@ public class VolumeUI extends SystemUI { PendingIntent.FLAG_UPDATE_CURRENT)) .setPriority(Notification.PRIORITY_MIN) .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)) .build()); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java index 6cecc8f..878ab712 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java @@ -124,9 +124,8 @@ public class ZenModePanel extends LinearLayout { mPrefs = new Prefs(); mInflater = LayoutInflater.from(mContext.getApplicationContext()); mIconPulser = new IconPulser(mContext); - final Resources res = mContext.getResources(); - mSubheadWarningColor = res.getColor(R.color.system_warning_color); - mSubheadColor = res.getColor(R.color.qs_subhead); + mSubheadWarningColor = context.getColor(R.color.system_warning_color); + mSubheadColor = context.getColor(R.color.qs_subhead); mInterpolator = AnimationUtils.loadInterpolator(mContext, com.android.internal.R.interpolator.fast_out_slow_in); mForeverId = Condition.newId(mContext).appendPath("forever").build(); diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 4569451..201c755 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2998,7 +2998,7 @@ public class ConnectivityService extends IConnectivityManager.Stub notification.icon = icon; notification.flags = Notification.FLAG_AUTO_CANCEL; notification.tickerText = title; - notification.color = mContext.getResources().getColor( + notification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); notification.setLatestEventInfo(mContext, title, details, notification.contentIntent); notification.contentIntent = intent; diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index 9ec886c..fd35b5e 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -1599,7 +1599,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final CharSequence summary = InputMethodUtils.getImeAndSubtypeDisplayName( mContext, imi, mCurrentSubtype); - mImeSwitcherNotification.color = mContext.getResources().getColor( + mImeSwitcherNotification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); mImeSwitcherNotification.setLatestEventInfo( mContext, title, summary, mImeSwitchPendingIntent); diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java index aeacd45..87dc420 100644 --- a/services/core/java/com/android/server/UiModeManagerService.java +++ b/services/core/java/com/android/server/UiModeManagerService.java @@ -596,7 +596,7 @@ final class UiModeManagerService extends SystemService { n.defaults = Notification.DEFAULT_LIGHTS; n.flags = Notification.FLAG_ONGOING_EVENT; n.when = 0; - n.color = context.getResources().getColor( + n.color = context.getColor( com.android.internal.R.color.system_notification_accent_color); n.setLatestEventInfo( context, diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java index 9339b35..a64e6c3 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -1736,7 +1736,7 @@ public class AccountManagerService } UserHandle user = new UserHandle(userId); Context contextForUser = getContextForUser(user); - n.color = contextForUser.getResources().getColor( + n.color = contextForUser.getColor( com.android.internal.R.color.system_notification_accent_color); n.setLatestEventInfo(contextForUser, title, subtitle, PendingIntent.getActivityAsUser(mContext, 0, intent, @@ -3009,7 +3009,7 @@ public class AccountManagerService Context contextForUser = getContextForUser(user); final String notificationTitleFormat = contextForUser.getText(R.string.notification_title).toString(); - n.color = contextForUser.getResources().getColor( + n.color = contextForUser.getColor( com.android.internal.R.color.system_notification_accent_color); n.setLatestEventInfo(contextForUser, String.format(notificationTitleFormat, account.name), diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index dcee96a..2c5a3d1 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -1591,7 +1591,7 @@ public final class ActivityManagerService extends ActivityManagerNative notification.defaults = 0; // please be quiet notification.sound = null; notification.vibrate = null; - notification.color = mContext.getResources().getColor( + notification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); notification.setLatestEventInfo(context, text, mContext.getText(R.string.heavy_weight_notification_detail), @@ -1862,7 +1862,7 @@ public final class ActivityManagerService extends ActivityManagerNative notification.defaults = 0; // please be quiet notification.sound = null; notification.vibrate = null; - notification.color = mContext.getResources().getColor( + notification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); Intent deleteIntent = new Intent(); deleteIntent.setAction(DumpHeapActivity.ACTION_DELETE_DUMPHEAP); diff --git a/services/core/java/com/android/server/am/ServiceRecord.java b/services/core/java/com/android/server/am/ServiceRecord.java index 6c2e120..f7d241e 100644 --- a/services/core/java/com/android/server/am/ServiceRecord.java +++ b/services/core/java/com/android/server/am/ServiceRecord.java @@ -463,7 +463,7 @@ final class ServiceRecord extends Binder { appInfo.packageName, null)); PendingIntent pi = PendingIntent.getActivity(ams.mContext, 0, runningIntent, PendingIntent.FLAG_UPDATE_CURRENT); - localForegroundNoti.color = ams.mContext.getResources().getColor( + localForegroundNoti.color = ams.mContext.getColor( com.android.internal .R.color.system_notification_accent_color); localForegroundNoti.setLatestEventInfo(ctx, diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index f9b6270..4c08960 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -478,7 +478,7 @@ public class Tethering extends BaseNetworkObserver { mTetheredNotification.flags = Notification.FLAG_ONGOING_EVENT; mTetheredNotification.tickerText = title; mTetheredNotification.visibility = Notification.VISIBILITY_PUBLIC; - mTetheredNotification.color = mContext.getResources().getColor( + mTetheredNotification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); mTetheredNotification.setLatestEventInfo(mContext, title, message, pi); mTetheredNotification.category = Notification.CATEGORY_STATUS; diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java index 1ea9673..191df2f 100644 --- a/services/core/java/com/android/server/content/SyncManager.java +++ b/services/core/java/com/android/server/content/SyncManager.java @@ -3119,7 +3119,7 @@ public class SyncManager { new Notification(R.drawable.stat_notify_sync_error, mContext.getString(R.string.contentServiceSync), System.currentTimeMillis()); - notification.color = contextForUser.getResources().getColor( + notification.color = contextForUser.getColor( com.android.internal.R.color.system_notification_accent_color); notification.setLatestEventInfo(contextForUser, contextForUser.getString(R.string.contentServiceSyncNotificationTitle), diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 15dcd44..17b4f9c 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -796,7 +796,7 @@ public class InputManagerService extends IInputManager.Stub .setContentIntent(keyboardLayoutIntent) .setSmallIcon(R.drawable.ic_settings_language) .setPriority(Notification.PRIORITY_LOW) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)) .build(); mNotificationManager.notifyAsUser(null, diff --git a/services/core/java/com/android/server/net/LockdownVpnTracker.java b/services/core/java/com/android/server/net/LockdownVpnTracker.java index 752614f..6ffe6ac 100644 --- a/services/core/java/com/android/server/net/LockdownVpnTracker.java +++ b/services/core/java/com/android/server/net/LockdownVpnTracker.java @@ -341,7 +341,7 @@ public class LockdownVpnTracker { .setOngoing(true) .addAction(R.drawable.ic_menu_refresh, mContext.getString(R.string.reset), mResetIntent) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); NotificationManager.from(mContext).notify(TAG, 0, builder.build()); diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index cc0fcf5..8044333 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -789,7 +789,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final Notification.Builder builder = new Notification.Builder(mContext); builder.setOnlyAlertOnce(true); builder.setWhen(0L); - builder.setColor(mContext.getResources().getColor( + builder.setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); final Resources res = mContext.getResources(); @@ -916,7 +916,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { builder.setTicker(title); builder.setContentTitle(title); builder.setContentText(body); - builder.setColor(mContext.getResources().getColor( + builder.setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); final Intent intent = buildAllowBackgroundDataIntent(); diff --git a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java index b819993..2673557 100644 --- a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java +++ b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java @@ -471,7 +471,7 @@ public class DeviceStorageMonitorService extends SystemService { Notification notification = new Notification.Builder(context) .setSmallIcon(com.android.internal.R.drawable.stat_notify_disk_full) .setTicker(title) - .setColor(context.getResources().getColor( + .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) .setContentTitle(title) .setContentText(details) diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java index b5d4caf..ae8832a 100644 --- a/services/core/java/com/android/server/wm/AccessibilityController.java +++ b/services/core/java/com/android/server/wm/AccessibilityController.java @@ -669,7 +669,7 @@ final class AccessibilityController { TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.colorActivatedHighlight, typedValue, true); - final int borderColor = context.getResources().getColor(typedValue.resourceId); + final int borderColor = context.getColor(typedValue.resourceId); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeWidth(mBorderWidth); diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 7e1fe48..67d7af1 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -1763,7 +1763,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { .setContentIntent(notifyIntent) .setPriority(Notification.PRIORITY_HIGH) .setShowWhen(false) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)) .build(); diff --git a/services/print/java/com/android/server/print/PrintManagerService.java b/services/print/java/com/android/server/print/PrintManagerService.java index 6785cb8..34347cf 100644 --- a/services/print/java/com/android/server/print/PrintManagerService.java +++ b/services/print/java/com/android/server/print/PrintManagerService.java @@ -761,7 +761,7 @@ public final class PrintManagerService extends SystemService { .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setShowWhen(true) - .setColor(mContext.getResources().getColor( + .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); NotificationManager notificationManager = (NotificationManager) mContext diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index b7ed8d1..41cf2ef 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -771,7 +771,7 @@ public class UsbDeviceManager { "com.android.settings.UsbSettings")); PendingIntent pi = PendingIntent.getActivityAsUser(mContext, 0, intent, 0, null, UserHandle.CURRENT); - notification.color = mContext.getResources().getColor( + notification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); notification.setLatestEventInfo(mContext, title, message, pi); notification.visibility = Notification.VISIBILITY_PUBLIC; @@ -809,7 +809,7 @@ public class UsbDeviceManager { "com.android.settings.DevelopmentSettings")); PendingIntent pi = PendingIntent.getActivityAsUser(mContext, 0, intent, 0, null, UserHandle.CURRENT); - notification.color = mContext.getResources().getColor( + notification.color = mContext.getColor( com.android.internal.R.color.system_notification_accent_color); notification.setLatestEventInfo(mContext, title, message, pi); notification.visibility = Notification.VISIBILITY_PUBLIC; diff --git a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java index b9a2a7e..dfbbd7e 100644 --- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java +++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java @@ -51,9 +51,9 @@ public class MainActivity extends Activity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Resources res = getResources(); - defaultColor = res.getColor(R.color.none_received); - startJobColor = res.getColor(R.color.start_received); - stopJobColor = res.getColor(R.color.stop_received); + defaultColor = getColor(R.color.none_received); + startJobColor = getColor(R.color.start_received); + stopJobColor = getColor(R.color.stop_received); // Set up UI. mShowStartView = (TextView) findViewById(R.id.onstart_textview); |