QuickTileService: Don't use deprecated getDrawable method

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2018-08-12 18:13:04 +05:30 committed by Jason A. Donenfeld
parent 6efbf65405
commit 535c611f2d

View File

@ -58,14 +58,13 @@ public class QuickTileService extends TileService {
return ret; return ret;
} }
@SuppressWarnings("deprecation")
@Override @Override
public void onCreate() { public void onCreate() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
iconOff = iconOn = Icon.createWithResource(this, R.drawable.ic_tile); iconOff = iconOn = Icon.createWithResource(this, R.drawable.ic_tile);
return; return;
} }
final SlashDrawable icon = new SlashDrawable(getResources().getDrawable(R.drawable.ic_tile)); final SlashDrawable icon = new SlashDrawable(getResources().getDrawable(R.drawable.ic_tile, Application.get().getTheme()));
icon.setAnimationEnabled(false); /* Unfortunately we can't have animations, since Icons are marshaled. */ icon.setAnimationEnabled(false); /* Unfortunately we can't have animations, since Icons are marshaled. */
icon.setSlashed(false); icon.setSlashed(false);
Bitmap b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Bitmap b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);