mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-30 06:14:25 +02:00
fix ResConfig parse three digit region
This commit is contained in:
parent
f6ad9d1ba8
commit
ff57e605ae
@ -2126,13 +2126,14 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Matcher matcher = PATTERN_REGION.matcher(qualifier);
|
Matcher matcher = PATTERN_REGION.matcher(qualifier);
|
||||||
if(!matcher.matches()){
|
if(!matcher.matches() && !isRegionNumber(qualifier)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.mConfig.setRegion(qualifier);
|
this.mConfig.setRegion(qualifier);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isEmpty(){
|
private boolean isEmpty(){
|
||||||
if(!mEmpty){
|
if(!mEmpty){
|
||||||
mEmpty = isEmpty(mQualifiers);
|
mEmpty = isEmpty(mQualifiers);
|
||||||
@ -2172,6 +2173,25 @@
|
|||||||
}
|
}
|
||||||
return qualifier.split("-");
|
return qualifier.split("-");
|
||||||
}
|
}
|
||||||
|
private static boolean isRegionNumber(String qualifier){
|
||||||
|
if(qualifier==null || qualifier.length()==0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return qualifier.length() == 3 && isAllDigit(qualifier);
|
||||||
|
}
|
||||||
|
private static boolean isAllDigit(String qualifier){
|
||||||
|
if(qualifier == null || qualifier.length()==0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
char[] chars = qualifier.toCharArray();
|
||||||
|
for(int i = 0; i < chars.length; i++){
|
||||||
|
char ch = chars[i];
|
||||||
|
if(ch > '9' || ch < '0'){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern PATTERN_PREFIX_NUMBER = Pattern.compile("^([mcnv]+)([0-9]+)$");
|
private static final Pattern PATTERN_PREFIX_NUMBER = Pattern.compile("^([mcnv]+)([0-9]+)$");
|
||||||
private static final Pattern PATTERN_DP = Pattern.compile("^([swh]+)([0-9]+)dp$");
|
private static final Pattern PATTERN_DP = Pattern.compile("^([swh]+)([0-9]+)dp$");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user