mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Consistent behaviour independent on build host
This is required since Telegram starts a new contest to improve UI for calls, so guys with MacOS or Linux wouldn't be distracted by this.
This commit is contained in:
parent
9bc4ddd546
commit
002eb8c87c
1 changed files with 3 additions and 26 deletions
|
@ -140,32 +140,9 @@ public class Utilities {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (BuildConfig.BUILD_HOST_IS_WINDOWS) {
|
Matcher matcher = pattern.matcher(value);
|
||||||
Matcher matcher = pattern.matcher(value);
|
if (matcher.find()) {
|
||||||
if (matcher.find()) {
|
return Integer.valueOf(matcher.group());
|
||||||
return Integer.valueOf(matcher.group());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int val = 0;
|
|
||||||
try {
|
|
||||||
int start = -1, end;
|
|
||||||
for (end = 0; end < value.length(); ++end) {
|
|
||||||
char character = value.charAt(end);
|
|
||||||
boolean allowedChar = character == '-' || character >= '0' && character <= '9';
|
|
||||||
if (allowedChar && start < 0) {
|
|
||||||
start = end;
|
|
||||||
} else if (!allowedChar && start >= 0) {
|
|
||||||
end++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (start >= 0) {
|
|
||||||
String str = value.subSequence(start, end).toString();
|
|
||||||
// val = parseInt(str);
|
|
||||||
val = Integer.parseInt(str);
|
|
||||||
}
|
|
||||||
} catch (Exception ignore) {}
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue