You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
main-executable: handle drawable-based app icons by rendering them into SVG
This commit is contained in:
@@ -2,6 +2,7 @@ package android.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.content.res.Configuration;
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.pm.PackageParser;
|
||||
@@ -10,7 +11,22 @@ public class Application extends ContextWrapper {
|
||||
public long native_window;
|
||||
|
||||
private String get_app_icon_path() {
|
||||
return getString(pkg.applicationInfo.icon);
|
||||
String icon_path = null;
|
||||
try {
|
||||
icon_path = getString(pkg.applicationInfo.icon);
|
||||
} catch (android.content.res.Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (icon_path == null) {
|
||||
icon_path = getString(R.mipmap.sym_def_app_icon);
|
||||
} else if (icon_path.endsWith(".xml")) {
|
||||
icon_path = null;
|
||||
}
|
||||
return icon_path;
|
||||
}
|
||||
|
||||
private long get_app_icon_paintable() {
|
||||
return getPackageManager().getApplicationIcon(pkg.applicationInfo).paintable;
|
||||
}
|
||||
|
||||
String get_app_label() {
|
||||
|
||||
@@ -2613,7 +2613,7 @@ public class PackageManager {
|
||||
* @see #getApplicationIcon(String)
|
||||
*/
|
||||
public Drawable getApplicationIcon(ApplicationInfo info) {
|
||||
return null;
|
||||
return Context.this_application.getDrawable(info.icon);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user