Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7004c440 authored by Raph Levien's avatar Raph Levien Committed by Android (Google) Code Review
Browse files

Merge "Allow null string to BidiFormatter#unicodeWrap" into nyc-dev

parents c2ba2907 b68d147b
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.text;
package android.text;


import android.annotation.Nullable;
import android.view.View;
import android.view.View;


import static android.text.TextDirectionHeuristics.FIRSTSTRONG_LTR;
import static android.text.TextDirectionHeuristics.FIRSTSTRONG_LTR;
@@ -390,14 +391,17 @@ public final class BidiFormatter {
     * @return Input string after applying the above processing. {@code null} if {@code str} is
     * @return Input string after applying the above processing. {@code null} if {@code str} is
     *     {@code null}.
     *     {@code null}.
     */
     */
    public String unicodeWrap(String str, TextDirectionHeuristic heuristic, boolean isolate) {
    public @Nullable String unicodeWrap(@Nullable String str, TextDirectionHeuristic heuristic,
            boolean isolate) {
        if (str == null) return null;
        return unicodeWrap((CharSequence) str, heuristic, isolate).toString();
        return unicodeWrap((CharSequence) str, heuristic, isolate).toString();
    }
    }


    /**
    /**
     * @hide
     * @hide
     */
     */
    public CharSequence unicodeWrap(CharSequence str, TextDirectionHeuristic heuristic, boolean isolate) {
    public @Nullable CharSequence unicodeWrap(@Nullable CharSequence str,
            TextDirectionHeuristic heuristic, boolean isolate) {
        if (str == null) return null;
        if (str == null) return null;
        final boolean isRtl = heuristic.isRtl(str, 0, str.length());
        final boolean isRtl = heuristic.isRtl(str, 0, str.length());
        SpannableStringBuilder result = new SpannableStringBuilder();
        SpannableStringBuilder result = new SpannableStringBuilder();