Fix battery color tint issue.
Added test to verify fix. Bug: 128354921 Test: m RunSettingsRoboTests Change-Id: I24cbb966e549eec783912e4e118c00425b971ad0
This commit is contained in:
@@ -16,14 +16,13 @@
|
||||
|
||||
package com.android.settings.fuelgauge.batterytip.tips;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -154,15 +153,15 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
|
||||
preference.setTitle(getTitle(context));
|
||||
preference.setSummary(getSummary(context));
|
||||
preference.setIcon(getIconId());
|
||||
ColorStateList tint = getIconTint();
|
||||
if (tint != null) {
|
||||
preference.getIcon().setTintList(tint);
|
||||
@IdRes int iconTintColorId = getIconTintColorId();
|
||||
if (iconTintColorId != View.NO_ID) {
|
||||
preference.getIcon().setTint(context.getColor(iconTintColorId));
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the {@link ColorStateList} for tinting {@link #getIconId()} or null if none. */
|
||||
protected @Nullable ColorStateList getIconTint() {
|
||||
return null;
|
||||
/** Returns the color resid for tinting {@link #getIconId()} or {@link View#NO_ID} if none. */
|
||||
protected @IdRes int getIconTintColorId() {
|
||||
return View.NO_ID;
|
||||
}
|
||||
|
||||
public boolean shouldShowDialog() {
|
||||
|
Reference in New Issue
Block a user