Print icons are now vector graphics.

Test: Looked at screens in setting that show this icon
Bug: 69175097
Change-Id: I06c4d37c7c3e641e83fa81d59b651c581e94a9f1
This commit is contained in:
Philip P. Moltmann
2017-11-13 10:21:05 -08:00
parent 3eec2834e0
commit c16600066a
4 changed files with 38 additions and 47 deletions

View File

@@ -1,19 +0,0 @@
<?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" />

View File

@@ -1,19 +0,0 @@
<?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" />

View File

@@ -17,6 +17,8 @@
package com.android.settings.print; package com.android.settings.print;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.print.PrintJob; import android.print.PrintJob;
import android.print.PrintJobId; import android.print.PrintJobId;
@@ -31,8 +33,8 @@ import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment; import com.android.settings.SettingsPreferenceFragment;
@@ -220,16 +222,28 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
info.getCreationTime(), info.getCreationTime(), DateFormat.SHORT, info.getCreationTime(), info.getCreationTime(), DateFormat.SHORT,
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()) { switch (info.getState()) {
case PrintJobInfo.STATE_QUEUED: case PrintJobInfo.STATE_QUEUED:
case PrintJobInfo.STATE_STARTED: { case PrintJobInfo.STATE_STARTED: {
mPrintJobPreference.setIcon(R.drawable.ic_print); Drawable icon = getActivity().getDrawable(com.android.internal.R.drawable.ic_print);
} break; icon.setTint(tintColor);
mPrintJobPreference.setIcon(icon);
break;
}
case PrintJobInfo.STATE_FAILED: case PrintJobInfo.STATE_FAILED:
case PrintJobInfo.STATE_BLOCKED: { case PrintJobInfo.STATE_BLOCKED: {
mPrintJobPreference.setIcon(R.drawable.ic_print_error); Drawable icon = getActivity().getDrawable(
} break; com.android.internal.R.drawable.ic_print_error);
icon.setTint(tintColor);
mPrintJobPreference.setIcon(icon);
break;
}
} }
CharSequence status = info.getStatus(getPackageManager()); CharSequence status = info.getStatus(getPackageManager());

View File

@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.Loader; import android.content.Loader;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@@ -359,15 +360,29 @@ public class PrintSettingsFragment extends ProfileSettingsPreferenceFragment
printJob.getCreationTime(), printJob.getCreationTime(), printJob.getCreationTime(), printJob.getCreationTime(),
DateFormat.SHORT, DateFormat.SHORT))); 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()) { switch (printJob.getState()) {
case PrintJobInfo.STATE_QUEUED: case PrintJobInfo.STATE_QUEUED:
case PrintJobInfo.STATE_STARTED: case PrintJobInfo.STATE_STARTED: {
preference.setIcon(R.drawable.ic_print); Drawable icon = getActivity().getDrawable(
com.android.internal.R.drawable.ic_print);
icon.setTint(tintColor);
preference.setIcon(icon);
break; break;
}
case PrintJobInfo.STATE_FAILED: case PrintJobInfo.STATE_FAILED:
case PrintJobInfo.STATE_BLOCKED: case PrintJobInfo.STATE_BLOCKED: {
preference.setIcon(R.drawable.ic_print_error); Drawable icon = getActivity().getDrawable(
com.android.internal.R.drawable.ic_print_error);
icon.setTint(tintColor);
preference.setIcon(icon);
break; break;
}
} }
Bundle extras = preference.getExtras(); Bundle extras = preference.getExtras();