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
treat application/activity names in AndroidManifest.xml as dot-prefixed when they don't contain any dots
This commit is contained in:
@@ -101,9 +101,10 @@ public class Context extends Object {
|
||||
Application application;
|
||||
ResXmlAttribute application_name = manifest.getApplicationElement().searchAttributeByResourceId(AndroidManifestBlock.ID_name);
|
||||
String className = (application_name != null) ? application_name.getValueAsString() : "android.app.Application";
|
||||
if (className.startsWith(".")) {
|
||||
if(className.indexOf('.') == -1)
|
||||
className = "." + className;
|
||||
if (className.startsWith("."))
|
||||
className = manifest.getPackageName() + className;
|
||||
}
|
||||
Class<? extends Application> cls = Class.forName(className).asSubclass(Application.class);
|
||||
Constructor<? extends Application> constructor = cls.getConstructor();
|
||||
application = constructor.newInstance();
|
||||
|
||||
Reference in New Issue
Block a user