Skip to content
Permalink
Browse files

Switch to an adaptive icon for version 4.0

This avoids an ugly white circle on newer devices.
I just put layers from misc/*.xcf into the Image Asset Studio.
  • Loading branch information...
pmarks-net committed Jun 24, 2019
1 parent 68a51f4 commit fa36ee73d4e7895369c12c6536975b5241a7159b
@@ -13,7 +13,7 @@
<application
android:allowBackup="true"
android:backupAgent=".TheBackupAgent"
android:icon="@drawable/chromadoze_icon"
android:icon="@mipmap/chromadoze_icon"
android:label="@string/app_name"
android:theme="@style/Theme.ChromaDozeTheme">
<activity
Binary file not shown.
@@ -93,7 +93,9 @@ public void onCreate(Bundle savedInstanceState) {
TypedValue tv = new TypedValue();
getTheme().resolveAttribute(R.attr.actionBarSize, tv, true);
int height = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
mToolbarIcon = getScaledImage(R.drawable.chromadoze_icon, height * 2 / 3);
// This originally used a scaled-down launcher icon, but I don't feel like figuring
// out how to render R.mipmap.chromadoze_icon correctly.
mToolbarIcon = ContextCompat.getDrawable(this, R.drawable.toolbar_icon);
}

// When this Activity is first created, set up the initial fragment.
@@ -303,10 +305,4 @@ public void onItemSelected(AdapterView<?> parent, View view, int position,
@Override
public void onNothingSelected(AdapterView<?> parent) {
}

private Drawable getScaledImage(int resource, int size) {
Bitmap b = ((BitmapDrawable) ContextCompat.getDrawable(this, resource)).getBitmap();
Bitmap bitmapResized = Bitmap.createScaledBitmap(b, size, size, true);
return new BitmapDrawable(getResources(), bitmapResized);
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/chromadoze_icon_background"/>
<foreground android:drawable="@mipmap/chromadoze_icon_foreground"/>
</adaptive-icon>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/chromadoze_icon_background"/>
<foreground android:drawable="@mipmap/chromadoze_icon_foreground"/>
</adaptive-icon>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit fa36ee7

Please sign in to comment.
You can’t perform that action at this time.