Merge "Print icons are now vector graphics."

This commit is contained in:
TreeHugger Robot
2017-11-14 22:58:02 +00:00
committed by Android (Google) Code Review
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;
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());

View File

@@ -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,15 +360,29 @@ 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();