android: QuickTileService: Do not use slashed icon on Android P
Android P features circle masked QS tiles which make use of colors to denote STATE_ACTIVE/STATE_INACTIVE rather than a slash across the drawable as seen on Android Oreo. Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
ae5bf6fbb2
commit
df03bdd7f9
@ -55,6 +55,10 @@ public class QuickTileService extends TileService {
|
|||||||
icon.setBounds(0, 0, c.getWidth(), c.getHeight());
|
icon.setBounds(0, 0, c.getWidth(), c.getHeight());
|
||||||
icon.draw(c);
|
icon.draw(c);
|
||||||
iconOn = Icon.createWithBitmap(b);
|
iconOn = Icon.createWithBitmap(b);
|
||||||
|
/* TODO(msf): Change this to an explicit test for P when we start targetting SDK 28 */
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1) {
|
||||||
|
iconOff = iconOn;
|
||||||
|
} else {
|
||||||
icon.setSlashed(true);
|
icon.setSlashed(true);
|
||||||
b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||||
c = new Canvas(b);
|
c = new Canvas(b);
|
||||||
@ -62,6 +66,7 @@ public class QuickTileService extends TileService {
|
|||||||
icon.draw(c);
|
icon.draw(c);
|
||||||
iconOff = Icon.createWithBitmap(b);
|
iconOff = Icon.createWithBitmap(b);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
|
Loading…
Reference in New Issue
Block a user