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:
Mis012
2024-04-12 18:32:30 +02:00
parent fefd2f108b
commit 2802aaa28d
42 changed files with 2171 additions and 77 deletions

View File

@@ -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);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
package android.text.style;
public class ForegroundColorSpan {
public ForegroundColorSpan(int dummy) {}
}

View File

@@ -0,0 +1,5 @@
package android.text.style;
public class MetricAffectingSpan {
}