Merge "Refactor to fix java/kotlin issue affecting sysui-studo"
This commit is contained in:
@@ -16,9 +16,6 @@
|
||||
|
||||
package com.android.settingslib.widget;
|
||||
|
||||
import static com.android.settingslib.widget.AdaptiveOutlineDrawable.AdaptiveOutlineIconType.TYPE_ADVANCED;
|
||||
import static com.android.settingslib.widget.AdaptiveOutlineDrawable.AdaptiveOutlineIconType.TYPE_DEFAULT;
|
||||
|
||||
import android.annotation.ColorInt;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -48,11 +45,12 @@ public class AdaptiveOutlineDrawable extends DrawableWrapper {
|
||||
private static final float ADVANCED_ICON_CENTER = 50f;
|
||||
private static final float ADVANCED_ICON_RADIUS = 48f;
|
||||
|
||||
public static final int ICON_TYPE_DEFAULT = 0;
|
||||
public static final int ICON_TYPE_ADVANCED = 1;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({TYPE_DEFAULT, TYPE_ADVANCED})
|
||||
@IntDef({ICON_TYPE_DEFAULT, ICON_TYPE_ADVANCED})
|
||||
public @interface AdaptiveOutlineIconType {
|
||||
int TYPE_DEFAULT = 0;
|
||||
int TYPE_ADVANCED = 1;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -66,7 +64,7 @@ public class AdaptiveOutlineDrawable extends DrawableWrapper {
|
||||
public AdaptiveOutlineDrawable(Resources resources, Bitmap bitmap) {
|
||||
super(new AdaptiveIconShapeDrawable(resources));
|
||||
|
||||
init(resources, bitmap, TYPE_DEFAULT);
|
||||
init(resources, bitmap, ICON_TYPE_DEFAULT);
|
||||
}
|
||||
|
||||
public AdaptiveOutlineDrawable(Resources resources, Bitmap bitmap,
|
||||
@@ -96,10 +94,10 @@ public class AdaptiveOutlineDrawable extends DrawableWrapper {
|
||||
private @ColorInt int getColor(Resources resources, @AdaptiveOutlineIconType int type) {
|
||||
int resId;
|
||||
switch (type) {
|
||||
case TYPE_ADVANCED:
|
||||
case ICON_TYPE_ADVANCED:
|
||||
resId = R.color.advanced_outline_color;
|
||||
break;
|
||||
case TYPE_DEFAULT:
|
||||
case ICON_TYPE_DEFAULT:
|
||||
default:
|
||||
resId = R.color.bt_outline_color;
|
||||
break;
|
||||
@@ -110,10 +108,10 @@ public class AdaptiveOutlineDrawable extends DrawableWrapper {
|
||||
private int getDimensionPixelSize(Resources resources, @AdaptiveOutlineIconType int type) {
|
||||
int resId;
|
||||
switch (type) {
|
||||
case TYPE_ADVANCED:
|
||||
case ICON_TYPE_ADVANCED:
|
||||
resId = R.dimen.advanced_dashboard_tile_foreground_image_inset;
|
||||
break;
|
||||
case TYPE_DEFAULT:
|
||||
case ICON_TYPE_DEFAULT:
|
||||
default:
|
||||
resId = R.dimen.dashboard_tile_foreground_image_inset;
|
||||
break;
|
||||
@@ -133,7 +131,7 @@ public class AdaptiveOutlineDrawable extends DrawableWrapper {
|
||||
final int count = canvas.save();
|
||||
canvas.scale(scaleX, scaleY);
|
||||
// Draw outline
|
||||
if (mType == TYPE_DEFAULT) {
|
||||
if (mType == ICON_TYPE_DEFAULT) {
|
||||
canvas.drawPath(mPath, mOutlinePaint);
|
||||
} else {
|
||||
canvas.drawCircle(ADVANCED_ICON_CENTER, ADVANCED_ICON_CENTER, ADVANCED_ICON_RADIUS,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.android.settingslib.bluetooth;
|
||||
|
||||
import static com.android.settingslib.widget.AdaptiveOutlineDrawable.AdaptiveOutlineIconType.TYPE_ADVANCED;
|
||||
import static com.android.settingslib.widget.AdaptiveOutlineDrawable.ICON_TYPE_ADVANCED;
|
||||
|
||||
import android.bluetooth.BluetoothClass;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
@@ -238,7 +238,7 @@ public class BluetoothUtils {
|
||||
final Bitmap resizedBitmap = Bitmap.createScaledBitmap(bitmap, iconSize,
|
||||
iconSize, false);
|
||||
bitmap.recycle();
|
||||
return new AdaptiveOutlineDrawable(resources, resizedBitmap, TYPE_ADVANCED);
|
||||
return new AdaptiveOutlineDrawable(resources, resizedBitmap, ICON_TYPE_ADVANCED);
|
||||
}
|
||||
|
||||
return drawable;
|
||||
|
||||
Reference in New Issue
Block a user