mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
149 lines
11 KiB
Java
149 lines
11 KiB
Java
package androidx.compose.ui.text.android;
|
|
|
|
import android.graphics.Paint;
|
|
import android.graphics.Rect;
|
|
import android.text.Layout;
|
|
import android.text.SpannableString;
|
|
import android.text.Spanned;
|
|
import android.text.StaticLayout;
|
|
import android.text.TextDirectionHeuristic;
|
|
import android.text.TextDirectionHeuristics;
|
|
import android.text.TextPaint;
|
|
import androidx.compose.ui.text.android.style.LineHeightStyleSpan;
|
|
import io.flutter.embedding.android.KeyboardMap;
|
|
import kotlin.Metadata;
|
|
import kotlin.collections.ArraysKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* compiled from: TextLayout.kt */
|
|
@Metadata(d1 = {"\u0000J\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a \u0010\u0005\u001a\u00020\u00032\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\u0007H\u0000ø\u0001\u0000¢\u0006\u0002\u0010\t\u001a\u0010\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u0007H\u0000\u001a1\u0010\r\u001a\u0004\u0018\u00010\u000e*\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u000b2\f\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00150\u0014H\u0002¢\u0006\u0002\u0010\u0016\u001a\"\u0010\u0017\u001a\u00020\u0003*\u00020\u000f2\f\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00150\u0014H\u0002ø\u0001\u0000¢\u0006\u0002\u0010\u0018\u001a\u0017\u0010\u0019\u001a\b\u0012\u0004\u0012\u00020\u00150\u0014*\u00020\u000fH\u0002¢\u0006\u0002\u0010\u001a\u001a\u0014\u0010\u001b\u001a\u00020\u0003*\u00020\u000fH\u0002ø\u0001\u0000¢\u0006\u0002\u0010\u001c\u001a\u0014\u0010\u001d\u001a\u00020\u001e*\u00020\u001f2\u0006\u0010 \u001a\u00020\u0007H\u0000\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u0013\u0010\u0002\u001a\u00020\u0003X\u0082\u0004ø\u0001\u0000¢\u0006\u0004\n\u0002\u0010\u0004\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006!"}, d2 = {"SharedTextAndroidCanvas", "Landroidx/compose/ui/text/android/TextAndroidCanvas;", "ZeroVerticalPadding", "Landroidx/compose/ui/text/android/VerticalPaddings;", "J", "VerticalPaddings", "topPadding", "", "bottomPadding", "(II)J", "getTextDirectionHeuristic", "Landroid/text/TextDirectionHeuristic;", "textDirectionHeuristic", "getLastLineMetrics", "Landroid/graphics/Paint$FontMetricsInt;", "Landroidx/compose/ui/text/android/TextLayout;", "textPaint", "Landroid/text/TextPaint;", "frameworkTextDir", "lineHeightSpans", "", "Landroidx/compose/ui/text/android/style/LineHeightStyleSpan;", "(Landroidx/compose/ui/text/android/TextLayout;Landroid/text/TextPaint;Landroid/text/TextDirectionHeuristic;[Landroidx/compose/ui/text/android/style/LineHeightStyleSpan;)Landroid/graphics/Paint$FontMetricsInt;", "getLineHeightPaddings", "(Landroidx/compose/ui/text/android/TextLayout;[Landroidx/compose/ui/text/android/style/LineHeightStyleSpan;)J", "getLineHeightSpans", "(Landroidx/compose/ui/text/android/TextLayout;)[Landroidx/compose/ui/text/android/style/LineHeightStyleSpan;", "getVerticalPaddings", "(Landroidx/compose/ui/text/android/TextLayout;)J", "isLineEllipsized", "", "Landroid/text/Layout;", "lineIndex", "ui-text_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes.dex */
|
|
public final class TextLayoutKt {
|
|
private static final TextAndroidCanvas SharedTextAndroidCanvas = new TextAndroidCanvas();
|
|
private static final long ZeroVerticalPadding = VerticalPaddings(0, 0);
|
|
|
|
public static final TextDirectionHeuristic getTextDirectionHeuristic(int i) {
|
|
if (i == 0) {
|
|
TextDirectionHeuristic LTR = TextDirectionHeuristics.LTR;
|
|
Intrinsics.checkNotNullExpressionValue(LTR, "LTR");
|
|
return LTR;
|
|
}
|
|
if (i == 1) {
|
|
TextDirectionHeuristic RTL = TextDirectionHeuristics.RTL;
|
|
Intrinsics.checkNotNullExpressionValue(RTL, "RTL");
|
|
return RTL;
|
|
}
|
|
if (i == 2) {
|
|
TextDirectionHeuristic FIRSTSTRONG_LTR = TextDirectionHeuristics.FIRSTSTRONG_LTR;
|
|
Intrinsics.checkNotNullExpressionValue(FIRSTSTRONG_LTR, "FIRSTSTRONG_LTR");
|
|
return FIRSTSTRONG_LTR;
|
|
}
|
|
if (i == 3) {
|
|
TextDirectionHeuristic FIRSTSTRONG_RTL = TextDirectionHeuristics.FIRSTSTRONG_RTL;
|
|
Intrinsics.checkNotNullExpressionValue(FIRSTSTRONG_RTL, "FIRSTSTRONG_RTL");
|
|
return FIRSTSTRONG_RTL;
|
|
}
|
|
if (i == 4) {
|
|
TextDirectionHeuristic ANYRTL_LTR = TextDirectionHeuristics.ANYRTL_LTR;
|
|
Intrinsics.checkNotNullExpressionValue(ANYRTL_LTR, "ANYRTL_LTR");
|
|
return ANYRTL_LTR;
|
|
}
|
|
if (i == 5) {
|
|
TextDirectionHeuristic LOCALE = TextDirectionHeuristics.LOCALE;
|
|
Intrinsics.checkNotNullExpressionValue(LOCALE, "LOCALE");
|
|
return LOCALE;
|
|
}
|
|
TextDirectionHeuristic FIRSTSTRONG_LTR2 = TextDirectionHeuristics.FIRSTSTRONG_LTR;
|
|
Intrinsics.checkNotNullExpressionValue(FIRSTSTRONG_LTR2, "FIRSTSTRONG_LTR");
|
|
return FIRSTSTRONG_LTR2;
|
|
}
|
|
|
|
public static final long VerticalPaddings(int i, int i2) {
|
|
return VerticalPaddings.m4449constructorimpl((i2 & KeyboardMap.kValueMask) | (i << 32));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final long getVerticalPaddings(TextLayout textLayout) {
|
|
int topPadding;
|
|
int bottomPadding;
|
|
if (textLayout.getIncludePadding() || textLayout.isFallbackLinespacingApplied$ui_text_release()) {
|
|
return ZeroVerticalPadding;
|
|
}
|
|
TextPaint paint = textLayout.getLayout().getPaint();
|
|
CharSequence text = textLayout.getLayout().getText();
|
|
Intrinsics.checkNotNullExpressionValue(paint, "paint");
|
|
Intrinsics.checkNotNullExpressionValue(text, "text");
|
|
Rect charSequenceBounds = PaintExtensionsKt.getCharSequenceBounds(paint, text, textLayout.getLayout().getLineStart(0), textLayout.getLayout().getLineEnd(0));
|
|
int lineAscent = textLayout.getLayout().getLineAscent(0);
|
|
if (charSequenceBounds.top < lineAscent) {
|
|
topPadding = lineAscent - charSequenceBounds.top;
|
|
} else {
|
|
topPadding = textLayout.getLayout().getTopPadding();
|
|
}
|
|
if (textLayout.getLineCount() != 1) {
|
|
int lineCount = textLayout.getLineCount() - 1;
|
|
charSequenceBounds = PaintExtensionsKt.getCharSequenceBounds(paint, text, textLayout.getLayout().getLineStart(lineCount), textLayout.getLayout().getLineEnd(lineCount));
|
|
}
|
|
int lineDescent = textLayout.getLayout().getLineDescent(textLayout.getLineCount() - 1);
|
|
if (charSequenceBounds.bottom > lineDescent) {
|
|
bottomPadding = charSequenceBounds.bottom - lineDescent;
|
|
} else {
|
|
bottomPadding = textLayout.getLayout().getBottomPadding();
|
|
}
|
|
return (topPadding == 0 && bottomPadding == 0) ? ZeroVerticalPadding : VerticalPaddings(topPadding, bottomPadding);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final long getLineHeightPaddings(TextLayout textLayout, LineHeightStyleSpan[] lineHeightStyleSpanArr) {
|
|
int i = 0;
|
|
int i2 = 0;
|
|
for (LineHeightStyleSpan lineHeightStyleSpan : lineHeightStyleSpanArr) {
|
|
if (lineHeightStyleSpan.getFirstAscentDiff() < 0) {
|
|
i = Math.max(i, Math.abs(lineHeightStyleSpan.getFirstAscentDiff()));
|
|
}
|
|
if (lineHeightStyleSpan.getLastDescentDiff() < 0) {
|
|
i2 = Math.max(i, Math.abs(lineHeightStyleSpan.getLastDescentDiff()));
|
|
}
|
|
}
|
|
return (i == 0 && i2 == 0) ? ZeroVerticalPadding : VerticalPaddings(i, i2);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final Paint.FontMetricsInt getLastLineMetrics(TextLayout textLayout, TextPaint textPaint, TextDirectionHeuristic textDirectionHeuristic, LineHeightStyleSpan[] lineHeightStyleSpanArr) {
|
|
StaticLayout create;
|
|
int lineCount = textLayout.getLineCount() - 1;
|
|
if (textLayout.getLayout().getLineStart(lineCount) != textLayout.getLayout().getLineEnd(lineCount)) {
|
|
return null;
|
|
}
|
|
if (!(true ^ (lineHeightStyleSpanArr.length == 0))) {
|
|
return null;
|
|
}
|
|
SpannableString spannableString = new SpannableString("\u200b");
|
|
LineHeightStyleSpan lineHeightStyleSpan = (LineHeightStyleSpan) ArraysKt.first(lineHeightStyleSpanArr);
|
|
spannableString.setSpan(lineHeightStyleSpan.copy$ui_text_release(0, spannableString.length(), (lineCount == 0 || !lineHeightStyleSpan.getTrimLastLineBottom()) ? lineHeightStyleSpan.getTrimLastLineBottom() : false), 0, spannableString.length(), 33);
|
|
create = StaticLayoutFactory.INSTANCE.create(r6, (r47 & 2) != 0 ? 0 : 0, (r47 & 4) != 0 ? spannableString.length() : spannableString.length(), textPaint, Integer.MAX_VALUE, (r47 & 32) != 0 ? LayoutCompat.INSTANCE.getDEFAULT_TEXT_DIRECTION_HEURISTIC$ui_text_release() : textDirectionHeuristic, (r47 & 64) != 0 ? LayoutCompat.INSTANCE.getDEFAULT_LAYOUT_ALIGNMENT$ui_text_release() : null, (r47 & 128) != 0 ? Integer.MAX_VALUE : 0, (r47 & 256) != 0 ? null : null, (r47 & 512) != 0 ? Integer.MAX_VALUE : 0, (r47 & 1024) != 0 ? 1.0f : 0.0f, (r47 & 2048) != 0 ? 0.0f : 0.0f, (r47 & 4096) != 0 ? 0 : 0, (r47 & 8192) != 0 ? false : textLayout.getIncludePadding(), (r47 & 16384) != 0 ? true : textLayout.getFallbackLineSpacing(), (32768 & r47) != 0 ? 0 : 0, (65536 & r47) != 0 ? 0 : 0, (131072 & r47) != 0 ? 0 : 0, (262144 & r47) != 0 ? 0 : 0, (524288 & r47) != 0 ? null : null, (r47 & 1048576) != 0 ? null : null);
|
|
Paint.FontMetricsInt fontMetricsInt = new Paint.FontMetricsInt();
|
|
fontMetricsInt.ascent = create.getLineAscent(0);
|
|
fontMetricsInt.descent = create.getLineDescent(0);
|
|
fontMetricsInt.top = create.getLineTop(0);
|
|
fontMetricsInt.bottom = create.getLineBottom(0);
|
|
return fontMetricsInt;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final LineHeightStyleSpan[] getLineHeightSpans(TextLayout textLayout) {
|
|
if (!(textLayout.getText() instanceof Spanned)) {
|
|
return new LineHeightStyleSpan[0];
|
|
}
|
|
CharSequence text = textLayout.getText();
|
|
Intrinsics.checkNotNull(text, "null cannot be cast to non-null type android.text.Spanned");
|
|
LineHeightStyleSpan[] lineHeightStyleSpans = (LineHeightStyleSpan[]) ((Spanned) text).getSpans(0, textLayout.getText().length(), LineHeightStyleSpan.class);
|
|
Intrinsics.checkNotNullExpressionValue(lineHeightStyleSpans, "lineHeightStyleSpans");
|
|
return lineHeightStyleSpans.length == 0 ? new LineHeightStyleSpan[0] : lineHeightStyleSpans;
|
|
}
|
|
|
|
public static final boolean isLineEllipsized(Layout layout, int i) {
|
|
Intrinsics.checkNotNullParameter(layout, "<this>");
|
|
return layout.getEllipsisCount(i) > 0;
|
|
}
|
|
}
|