Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a357cd2 authored by Alan Viverette's avatar Alan Viverette
Browse files

Replace usages of deprecated Resources.getColor() and getColorStateList()

Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0
parent f2560e62
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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()) {
+2 −2
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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 {
+1 −1
Original line number Diff line number Diff line
@@ -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);
+4 −4
Original line number Diff line number Diff line
@@ -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(),
Loading