Cache bitmap icon (#1426)
This commit is contained in:
parent
9b7b8c762a
commit
6d098e9ba8
|
|
@ -48,6 +48,8 @@ import rikka.material.app.MaterialActivity;
|
||||||
|
|
||||||
public class BaseActivity extends MaterialActivity {
|
public class BaseActivity extends MaterialActivity {
|
||||||
|
|
||||||
|
private static Bitmap icon = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
@ -79,7 +81,7 @@ public class BaseActivity extends MaterialActivity {
|
||||||
for (var task : getSystemService(ActivityManager.class).getAppTasks()) {
|
for (var task : getSystemService(ActivityManager.class).getAppTasks()) {
|
||||||
task.setExcludeFromRecents(false);
|
task.setExcludeFromRecents(false);
|
||||||
}
|
}
|
||||||
Bitmap icon;
|
if (icon == null) {
|
||||||
var drawable = getApplicationInfo().loadIcon(getPackageManager());
|
var drawable = getApplicationInfo().loadIcon(getPackageManager());
|
||||||
if (drawable instanceof BitmapDrawable) {
|
if (drawable instanceof BitmapDrawable) {
|
||||||
icon = ((BitmapDrawable) drawable).getBitmap();
|
icon = ((BitmapDrawable) drawable).getBitmap();
|
||||||
|
|
@ -89,8 +91,8 @@ public class BaseActivity extends MaterialActivity {
|
||||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||||
drawable.draw(canvas);
|
drawable.draw(canvas);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setTaskDescription(new ActivityManager.TaskDescription(getTitle().toString(), icon));
|
setTaskDescription(new ActivityManager.TaskDescription(getTitle().toString(), icon));
|
||||||
icon.recycle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue