Skip to content

Commit

Permalink
Refactor: Use AndroidManifest constants
Browse files Browse the repository at this point in the history
  • Loading branch information
REAndroid committed Jan 8, 2024
1 parent c1ef559 commit 06916e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/reandroid/apkeditor/info/Info.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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]));
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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){
Expand All @@ -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){
Expand All @@ -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){
Expand Down

0 comments on commit 06916e4

Please sign in to comment.