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

Commit c1660006 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Print icons are now vector graphics.

Test: Looked at screens in setting that show this icon
Bug: 69175097
Change-Id: I06c4d37c7c3e641e83fa81d59b651c581e94a9f1
parent 3eec2834
Loading
Loading
Loading
Loading

res/drawable/ic_print.xml

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@*android:drawable/ic_print"
    android:tint="@*android:color/material_deep_teal_500" />

res/drawable/ic_print_error.xml

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@*android:drawable/ic_print_error"
    android:tint="@*android:color/material_deep_teal_500" />
+19 −5
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.settings.print;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.print.PrintJob;
import android.print.PrintJobId;
@@ -31,8 +33,8 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;

import android.view.ViewGroup;

import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
@@ -220,16 +222,28 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
                        info.getCreationTime(), info.getCreationTime(), DateFormat.SHORT,
                        DateFormat.SHORT)));

        TypedArray a = getActivity().obtainStyledAttributes(new int[]{
                android.R.attr.colorControlNormal});
        int tintColor = a.getColor(0, 0);
        a.recycle();

        switch (info.getState()) {
            case PrintJobInfo.STATE_QUEUED:
            case PrintJobInfo.STATE_STARTED: {
                mPrintJobPreference.setIcon(R.drawable.ic_print);
            } break;
                Drawable icon = getActivity().getDrawable(com.android.internal.R.drawable.ic_print);
                icon.setTint(tintColor);
                mPrintJobPreference.setIcon(icon);
                break;
            }

            case PrintJobInfo.STATE_FAILED:
            case PrintJobInfo.STATE_BLOCKED: {
                mPrintJobPreference.setIcon(R.drawable.ic_print_error);
            } break;
                Drawable icon = getActivity().getDrawable(
                        com.android.internal.R.drawable.ic_print_error);
                icon.setTint(tintColor);
                mPrintJobPreference.setIcon(icon);
                break;
            }
        }

        CharSequence status = info.getStatus(getPackageManager());
+19 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.Loader;
import android.content.pm.PackageManager;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
@@ -359,16 +360,30 @@ public class PrintSettingsFragment extends ProfileSettingsPreferenceFragment
                                    printJob.getCreationTime(), printJob.getCreationTime(),
                                    DateFormat.SHORT, DateFormat.SHORT)));

                    TypedArray a = getActivity().obtainStyledAttributes(new int[]{
                            android.R.attr.colorControlNormal});
                    int tintColor = a.getColor(0, 0);
                    a.recycle();

                    switch (printJob.getState()) {
                        case PrintJobInfo.STATE_QUEUED:
                        case PrintJobInfo.STATE_STARTED:
                            preference.setIcon(R.drawable.ic_print);
                        case PrintJobInfo.STATE_STARTED: {
                            Drawable icon = getActivity().getDrawable(
                                    com.android.internal.R.drawable.ic_print);
                            icon.setTint(tintColor);
                            preference.setIcon(icon);
                            break;
                        }

                        case PrintJobInfo.STATE_FAILED:
                        case PrintJobInfo.STATE_BLOCKED:
                            preference.setIcon(R.drawable.ic_print_error);
                        case PrintJobInfo.STATE_BLOCKED: {
                            Drawable icon = getActivity().getDrawable(
                                    com.android.internal.R.drawable.ic_print_error);
                            icon.setTint(tintColor);
                            preference.setIcon(icon);
                            break;
                        }
                    }

                    Bundle extras = preference.getExtras();
                    extras.putString(EXTRA_PRINT_JOB_ID, printJob.getId().flattenToString());