mirror of
https://github.com/revanced/Apktool.git
synced 2024-09-01 20:15:14 +02:00
remove duplicate code in favor of function
This commit is contained in:
parent
657a44f593
commit
1c23bb3962
@ -101,13 +101,7 @@ public final class ResXmlPatcher {
|
|||||||
Node provider = attrs.getNamedItem("android:authorities");
|
Node provider = attrs.getNamedItem("android:authorities");
|
||||||
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
String reference = provider.getNodeValue();
|
saved = isSaved(file, saved, provider);
|
||||||
String replacement = pullValueFromStrings(file.getParentFile(), reference);
|
|
||||||
|
|
||||||
if (replacement != null) {
|
|
||||||
provider.setNodeValue(replacement);
|
|
||||||
saved = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,13 +121,7 @@ public final class ResXmlPatcher {
|
|||||||
Node provider = attrs.getNamedItem("android:scheme");
|
Node provider = attrs.getNamedItem("android:scheme");
|
||||||
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
String reference = provider.getNodeValue();
|
saved = isSaved(file, saved, provider);
|
||||||
String replacement = pullValueFromStrings(file.getParentFile(), reference);
|
|
||||||
|
|
||||||
if (replacement != null) {
|
|
||||||
provider.setNodeValue(replacement);
|
|
||||||
saved = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,6 +136,26 @@ public final class ResXmlPatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the replacement was properly made to a node.
|
||||||
|
*
|
||||||
|
* @param file File we are searching for value
|
||||||
|
* @param saved boolean on whether we need to save
|
||||||
|
* @param provider Node we are attempign to replace
|
||||||
|
* @return boolean
|
||||||
|
* @throws AndrolibException setting node value failed
|
||||||
|
*/
|
||||||
|
private static boolean isSaved(File file, boolean saved, Node provider) throws AndrolibException {
|
||||||
|
String reference = provider.getNodeValue();
|
||||||
|
String replacement = pullValueFromStrings(file.getParentFile(), reference);
|
||||||
|
|
||||||
|
if (replacement != null) {
|
||||||
|
provider.setNodeValue(replacement);
|
||||||
|
saved = true;
|
||||||
|
}
|
||||||
|
return saved;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds key in strings.xml file and returns text value
|
* Finds key in strings.xml file and returns text value
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user