summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff DeCew <jeffdq@google.com> 2020-06-18 16:02:22 -0400
committer Sunny Goyal <sunnygoyal@google.com> 2020-07-07 18:36:21 +0000
commit7241be7abfde8ac715237037c60beb0cb1dcd494 (patch)
tree663e17da71a6b0563b6fe0cb18f1a75d12d6809e
parent78a8a85659d12bb49958fa8c64ac1c93908b2f0e (diff)
Refactor to fix java/kotlin issue affecting sysui-studo
Bug: 152086714 Test: make Change-Id: Ie946929ca7060f65b345e9c81e35e997dfd15854
-rw-r--r--packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveOutlineDrawable.java22
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java4
2 files changed, 12 insertions, 14 deletions
diff --git a/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveOutlineDrawable.java b/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveOutlineDrawable.java
index 3565b0e3a9ae..e82997431290 100644
--- a/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveOutlineDrawable.java
+++ b/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveOutlineDrawable.java
@@ -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,
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
index 95e916b9871a..68f72896c251 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
@@ -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;