From 06916e4d285e90cdd9f391366214ceb7425bfe32 Mon Sep 17 00:00:00 2001 From: REAndroid Date: Mon, 8 Jan 2024 14:03:32 +0100 Subject: [PATCH] Refactor: Use AndroidManifest constants --- src/main/java/com/reandroid/apkeditor/info/Info.java | 9 +++++---- .../reandroid/apkeditor/refactor/TypeNameRefactor.java | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/reandroid/apkeditor/info/Info.java b/src/main/java/com/reandroid/apkeditor/info/Info.java index 4d59076..34aa18e 100644 --- a/src/main/java/com/reandroid/apkeditor/info/Info.java +++ b/src/main/java/com/reandroid/apkeditor/info/Info.java @@ -18,6 +18,7 @@ import com.reandroid.apk.ApkModule; import com.reandroid.apkeditor.BaseCommand; import com.reandroid.apkeditor.Util; +import com.reandroid.app.AndroidManifest; import com.reandroid.arsc.chunk.PackageBlock; import com.reandroid.arsc.chunk.TableBlock; import com.reandroid.arsc.chunk.xml.AndroidManifestBlock; @@ -218,7 +219,7 @@ private void printAppName(ApkModule apkModule) throws IOException { AndroidManifestBlock manifest = apkModule.getAndroidManifest(); ResXmlElement application = manifest.getApplicationElement(); ResXmlAttribute attributeLabel = application - .searchAttributeByResourceId(AndroidManifestBlock.ID_label); + .searchAttributeByResourceId(AndroidManifest.ID_label); if(attributeLabel == null){ return; } @@ -237,7 +238,7 @@ private void printAppIcon(ApkModule apkModule) throws IOException { AndroidManifestBlock manifest = apkModule.getAndroidManifest(); ResXmlElement application = manifest.getApplicationElement(); ResXmlAttribute attribute = application - .searchAttributeByResourceId(AndroidManifestBlock.ID_icon); + .searchAttributeByResourceId(AndroidManifest.ID_icon); if(attribute == null){ return; } @@ -282,7 +283,7 @@ private void printUsesPermissions(ApkModule apkModule) throws IOException { return; } //printLine("Uses permission (" + usesPermissions.size() + ")"); - String tag = AndroidManifestBlock.TAG_uses_permission; + String tag = AndroidManifest.TAG_uses_permission; InfoWriter infoWriter = getInfoWriter(); infoWriter.writeArray(tag, usesPermissions.toArray(new String[0])); } @@ -335,7 +336,7 @@ private void printAppClass(ApkModule apkModule) throws IOException { } private String getValueOfName(ResXmlElement element){ ResXmlAttribute attribute = element - .searchAttributeByResourceId(AndroidManifestBlock.ID_name); + .searchAttributeByResourceId(AndroidManifest.ID_name); if(attribute == null){ return null; } diff --git a/src/main/java/com/reandroid/apkeditor/refactor/TypeNameRefactor.java b/src/main/java/com/reandroid/apkeditor/refactor/TypeNameRefactor.java index 5ec9612..da07aa2 100644 --- a/src/main/java/com/reandroid/apkeditor/refactor/TypeNameRefactor.java +++ b/src/main/java/com/reandroid/apkeditor/refactor/TypeNameRefactor.java @@ -16,6 +16,7 @@ package com.reandroid.apkeditor.refactor; import com.reandroid.apk.*; +import com.reandroid.app.AndroidManifest; import com.reandroid.arsc.chunk.PackageBlock; import com.reandroid.arsc.chunk.TableBlock; import com.reandroid.arsc.chunk.xml.AndroidManifestBlock; @@ -463,7 +464,7 @@ private boolean checkId(ResXmlAttribute attribute){ if(hasRefactoredName(name)){ return false; } - if(attribute.getNameId()!=AndroidManifestBlock.ID_id){ + if(attribute.getNameId()!=AndroidManifest.ID_id){ return false; } if(attribute.getValueType() != ValueType.REFERENCE){ @@ -477,7 +478,7 @@ private boolean checkStyle(ResXmlAttribute attribute){ if(hasRefactoredName(name)){ return false; } - if(attribute.getNameId()!=AndroidManifestBlock.ID_theme){ + if(attribute.getNameId() != AndroidManifest.ID_theme){ return false; } if(attribute.getValueType() != ValueType.REFERENCE){ @@ -491,7 +492,7 @@ private boolean checkString(ResXmlAttribute attribute){ if(hasRefactoredName(name)){ return false; } - if(attribute.getNameId()!=AndroidManifestBlock.ID_label){ + if(attribute.getNameId() != AndroidManifest.ID_label){ return false; } if(attribute.getValueType() != ValueType.REFERENCE){