Use custom drawable for Battery saver condition icon.

- Updated condition interface to use Drawable instead of Icon for icons.
- Converted all conditions to return drawable instead of Icon.
- Created a BatterySaverDrawable to draw a static battery saver icon.

Change-Id: Ie964f3439009c7658603a8ff352a05e964a0a795
Fixes: 76168403
Test: robotests
This commit is contained in:
Fan Zhang
2018-03-26 15:31:10 -07:00
parent 553c2778af
commit 0c8f8a8b46
15 changed files with 86 additions and 48 deletions

View File

@@ -16,7 +16,7 @@
package com.android.settings.dashboard.conditional;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.graphics.drawable.Drawable;
import android.net.NetworkPolicyManager;
import android.util.FeatureFlagUtils;
@@ -37,8 +37,8 @@ public class BackgroundDataCondition extends Condition {
}
@Override
public Icon getIcon() {
return Icon.createWithResource(mManager.getContext(), R.drawable.ic_data_saver);
public Drawable getIcon() {
return mManager.getContext().getDrawable(R.drawable.ic_data_saver);
}
@Override
@@ -53,7 +53,7 @@ public class BackgroundDataCondition extends Condition {
@Override
public CharSequence[] getActions() {
return new CharSequence[] { mManager.getContext().getString(R.string.condition_turn_off) };
return new CharSequence[] {mManager.getContext().getString(R.string.condition_turn_off)};
}
@Override