You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
api-impl: add stubs / simple stuff for OsmAnd
without native libs present, launches and renders white square in map view; with native libs present, segfaults in bundled skia
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
package android.text;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class TextUtils {
|
||||
public static int getLayoutDirectionFromLocale(Locale locale) {
|
||||
return 0 /*LTR*/; // FIXME
|
||||
}
|
||||
|
||||
// unchanged from android source
|
||||
|
||||
/* split */
|
||||
@@ -66,28 +71,30 @@ public class TextUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a and b are equal, including if they are both null.
|
||||
* <p><i>Note: In platform versions 1.1 and earlier, this method only worked well if
|
||||
* both the arguments were instances of String.</i></p>
|
||||
* @param a first CharSequence to check
|
||||
* @param b second CharSequence to check
|
||||
* @return true if a and b are equal
|
||||
*/
|
||||
public static boolean equals(CharSequence a, CharSequence b) {
|
||||
if (a == b) return true;
|
||||
int length;
|
||||
if (a != null && b != null && (length = a.length()) == b.length()) {
|
||||
if (a instanceof String && b instanceof String) {
|
||||
return a.equals(b);
|
||||
} else {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (a.charAt(i) != b.charAt(i)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
* Returns true if a and b are equal, including if they are both null.
|
||||
* <p><i>Note: In platform versions 1.1 and earlier, this method only worked well if
|
||||
* both the arguments were instances of String.</i></p>
|
||||
* @param a first CharSequence to check
|
||||
* @param b second CharSequence to check
|
||||
* @return true if a and b are equal
|
||||
*/
|
||||
public static boolean equals(CharSequence a, CharSequence b) {
|
||||
if (a == b)
|
||||
return true;
|
||||
int length;
|
||||
if (a != null && b != null && (length = a.length()) == b.length()) {
|
||||
if (a instanceof String && b instanceof String) {
|
||||
return a.equals(b);
|
||||
} else {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (a.charAt(i) != b.charAt(i))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public enum TruncateAt {
|
||||
START,
|
||||
@@ -103,22 +110,20 @@ public class TextUtils {
|
||||
* or, if it does not fit, a truncated
|
||||
* copy with ellipsis character added at the specified edge or center.
|
||||
*/
|
||||
public static CharSequence ellipsize(CharSequence text,
|
||||
TextPaint p,
|
||||
float avail, TruncateAt where) {
|
||||
public static CharSequence ellipsize(CharSequence text, TextPaint p, float avail, TruncateAt where) {
|
||||
return text;
|
||||
}
|
||||
|
||||
public static void getChars(CharSequence s, int start, int end, char[] dest, int destoff) {
|
||||
Class<? extends CharSequence> c = s.getClass();
|
||||
if (c == String.class)
|
||||
((String) s).getChars(start, end, dest, destoff);
|
||||
((String)s).getChars(start, end, dest, destoff);
|
||||
else if (c == StringBuffer.class)
|
||||
((StringBuffer) s).getChars(start, end, dest, destoff);
|
||||
((StringBuffer)s).getChars(start, end, dest, destoff);
|
||||
else if (c == StringBuilder.class)
|
||||
((StringBuilder) s).getChars(start, end, dest, destoff);
|
||||
((StringBuilder)s).getChars(start, end, dest, destoff);
|
||||
else if (s instanceof GetChars)
|
||||
((GetChars) s).getChars(start, end, dest, destoff);
|
||||
((GetChars)s).getChars(start, end, dest, destoff);
|
||||
else {
|
||||
for (int i = start; i < end; i++)
|
||||
dest[destoff++] = s.charAt(i);
|
||||
|
||||
Reference in New Issue
Block a user