ADD week 5
This commit is contained in:
		
							
								
								
									
										486
									
								
								02-Easy5/E5/sources/androidx/core/text/BidiFormatter.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										486
									
								
								02-Easy5/E5/sources/androidx/core/text/BidiFormatter.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,486 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.SpannableStringBuilder; | ||||
| import java.util.Locale; | ||||
| import kotlin.text.Typography; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class BidiFormatter { | ||||
|     private static final int DEFAULT_FLAGS = 2; | ||||
|     static final BidiFormatter DEFAULT_LTR_INSTANCE; | ||||
|     static final BidiFormatter DEFAULT_RTL_INSTANCE; | ||||
|     static final TextDirectionHeuristicCompat DEFAULT_TEXT_DIRECTION_HEURISTIC; | ||||
|     private static final int DIR_LTR = -1; | ||||
|     private static final int DIR_RTL = 1; | ||||
|     private static final int DIR_UNKNOWN = 0; | ||||
|     private static final String EMPTY_STRING = ""; | ||||
|     private static final int FLAG_STEREO_RESET = 2; | ||||
|     private static final char LRE = 8234; | ||||
|     private static final char LRM = 8206; | ||||
|     private static final String LRM_STRING; | ||||
|     private static final char PDF = 8236; | ||||
|     private static final char RLE = 8235; | ||||
|     private static final char RLM = 8207; | ||||
|     private static final String RLM_STRING; | ||||
|     private final TextDirectionHeuristicCompat mDefaultTextDirectionHeuristicCompat; | ||||
|     private final int mFlags; | ||||
|     private final boolean mIsRtlContext; | ||||
|  | ||||
|     public boolean getStereoReset() { | ||||
|         return (this.mFlags & 2) != 0; | ||||
|     } | ||||
|  | ||||
|     public boolean isRtlContext() { | ||||
|         return this.mIsRtlContext; | ||||
|     } | ||||
|  | ||||
|     static { | ||||
|         TextDirectionHeuristicCompat textDirectionHeuristicCompat = TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR; | ||||
|         DEFAULT_TEXT_DIRECTION_HEURISTIC = textDirectionHeuristicCompat; | ||||
|         LRM_STRING = Character.toString(LRM); | ||||
|         RLM_STRING = Character.toString(RLM); | ||||
|         DEFAULT_LTR_INSTANCE = new BidiFormatter(false, 2, textDirectionHeuristicCompat); | ||||
|         DEFAULT_RTL_INSTANCE = new BidiFormatter(true, 2, textDirectionHeuristicCompat); | ||||
|     } | ||||
|  | ||||
|     public static final class Builder { | ||||
|         private int mFlags; | ||||
|         private boolean mIsRtlContext; | ||||
|         private TextDirectionHeuristicCompat mTextDirectionHeuristicCompat; | ||||
|  | ||||
|         public Builder setTextDirectionHeuristic(TextDirectionHeuristicCompat textDirectionHeuristicCompat) { | ||||
|             this.mTextDirectionHeuristicCompat = textDirectionHeuristicCompat; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder stereoReset(boolean z) { | ||||
|             if (z) { | ||||
|                 this.mFlags |= 2; | ||||
|             } else { | ||||
|                 this.mFlags &= -3; | ||||
|             } | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder() { | ||||
|             initialize(BidiFormatter.isRtlLocale(Locale.getDefault())); | ||||
|         } | ||||
|  | ||||
|         public Builder(boolean z) { | ||||
|             initialize(z); | ||||
|         } | ||||
|  | ||||
|         public Builder(Locale locale) { | ||||
|             initialize(BidiFormatter.isRtlLocale(locale)); | ||||
|         } | ||||
|  | ||||
|         private void initialize(boolean z) { | ||||
|             this.mIsRtlContext = z; | ||||
|             this.mTextDirectionHeuristicCompat = BidiFormatter.DEFAULT_TEXT_DIRECTION_HEURISTIC; | ||||
|             this.mFlags = 2; | ||||
|         } | ||||
|  | ||||
|         private static BidiFormatter getDefaultInstanceFromContext(boolean z) { | ||||
|             return z ? BidiFormatter.DEFAULT_RTL_INSTANCE : BidiFormatter.DEFAULT_LTR_INSTANCE; | ||||
|         } | ||||
|  | ||||
|         public BidiFormatter build() { | ||||
|             if (this.mFlags == 2 && this.mTextDirectionHeuristicCompat == BidiFormatter.DEFAULT_TEXT_DIRECTION_HEURISTIC) { | ||||
|                 return getDefaultInstanceFromContext(this.mIsRtlContext); | ||||
|             } | ||||
|             return new BidiFormatter(this.mIsRtlContext, this.mFlags, this.mTextDirectionHeuristicCompat); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static BidiFormatter getInstance() { | ||||
|         return new Builder().build(); | ||||
|     } | ||||
|  | ||||
|     public static BidiFormatter getInstance(boolean z) { | ||||
|         return new Builder(z).build(); | ||||
|     } | ||||
|  | ||||
|     public static BidiFormatter getInstance(Locale locale) { | ||||
|         return new Builder(locale).build(); | ||||
|     } | ||||
|  | ||||
|     BidiFormatter(boolean z, int i, TextDirectionHeuristicCompat textDirectionHeuristicCompat) { | ||||
|         this.mIsRtlContext = z; | ||||
|         this.mFlags = i; | ||||
|         this.mDefaultTextDirectionHeuristicCompat = textDirectionHeuristicCompat; | ||||
|     } | ||||
|  | ||||
|     private String markAfter(CharSequence charSequence, TextDirectionHeuristicCompat textDirectionHeuristicCompat) { | ||||
|         boolean isRtl = textDirectionHeuristicCompat.isRtl(charSequence, 0, charSequence.length()); | ||||
|         return (this.mIsRtlContext || !(isRtl || getExitDir(charSequence) == 1)) ? this.mIsRtlContext ? (!isRtl || getExitDir(charSequence) == -1) ? RLM_STRING : EMPTY_STRING : EMPTY_STRING : LRM_STRING; | ||||
|     } | ||||
|  | ||||
|     private String markBefore(CharSequence charSequence, TextDirectionHeuristicCompat textDirectionHeuristicCompat) { | ||||
|         boolean isRtl = textDirectionHeuristicCompat.isRtl(charSequence, 0, charSequence.length()); | ||||
|         return (this.mIsRtlContext || !(isRtl || getEntryDir(charSequence) == 1)) ? this.mIsRtlContext ? (!isRtl || getEntryDir(charSequence) == -1) ? RLM_STRING : EMPTY_STRING : EMPTY_STRING : LRM_STRING; | ||||
|     } | ||||
|  | ||||
|     public boolean isRtl(String str) { | ||||
|         return isRtl((CharSequence) str); | ||||
|     } | ||||
|  | ||||
|     public boolean isRtl(CharSequence charSequence) { | ||||
|         return this.mDefaultTextDirectionHeuristicCompat.isRtl(charSequence, 0, charSequence.length()); | ||||
|     } | ||||
|  | ||||
|     public String unicodeWrap(String str, TextDirectionHeuristicCompat textDirectionHeuristicCompat, boolean z) { | ||||
|         if (str == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return unicodeWrap((CharSequence) str, textDirectionHeuristicCompat, z).toString(); | ||||
|     } | ||||
|  | ||||
|     public CharSequence unicodeWrap(CharSequence charSequence, TextDirectionHeuristicCompat textDirectionHeuristicCompat, boolean z) { | ||||
|         if (charSequence == null) { | ||||
|             return null; | ||||
|         } | ||||
|         boolean isRtl = textDirectionHeuristicCompat.isRtl(charSequence, 0, charSequence.length()); | ||||
|         SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); | ||||
|         if (getStereoReset() && z) { | ||||
|             spannableStringBuilder.append((CharSequence) markBefore(charSequence, isRtl ? TextDirectionHeuristicsCompat.RTL : TextDirectionHeuristicsCompat.LTR)); | ||||
|         } | ||||
|         if (isRtl != this.mIsRtlContext) { | ||||
|             spannableStringBuilder.append(isRtl ? RLE : LRE); | ||||
|             spannableStringBuilder.append(charSequence); | ||||
|             spannableStringBuilder.append(PDF); | ||||
|         } else { | ||||
|             spannableStringBuilder.append(charSequence); | ||||
|         } | ||||
|         if (z) { | ||||
|             spannableStringBuilder.append((CharSequence) markAfter(charSequence, isRtl ? TextDirectionHeuristicsCompat.RTL : TextDirectionHeuristicsCompat.LTR)); | ||||
|         } | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public String unicodeWrap(String str, TextDirectionHeuristicCompat textDirectionHeuristicCompat) { | ||||
|         return unicodeWrap(str, textDirectionHeuristicCompat, true); | ||||
|     } | ||||
|  | ||||
|     public CharSequence unicodeWrap(CharSequence charSequence, TextDirectionHeuristicCompat textDirectionHeuristicCompat) { | ||||
|         return unicodeWrap(charSequence, textDirectionHeuristicCompat, true); | ||||
|     } | ||||
|  | ||||
|     public String unicodeWrap(String str, boolean z) { | ||||
|         return unicodeWrap(str, this.mDefaultTextDirectionHeuristicCompat, z); | ||||
|     } | ||||
|  | ||||
|     public CharSequence unicodeWrap(CharSequence charSequence, boolean z) { | ||||
|         return unicodeWrap(charSequence, this.mDefaultTextDirectionHeuristicCompat, z); | ||||
|     } | ||||
|  | ||||
|     public String unicodeWrap(String str) { | ||||
|         return unicodeWrap(str, this.mDefaultTextDirectionHeuristicCompat, true); | ||||
|     } | ||||
|  | ||||
|     public CharSequence unicodeWrap(CharSequence charSequence) { | ||||
|         return unicodeWrap(charSequence, this.mDefaultTextDirectionHeuristicCompat, true); | ||||
|     } | ||||
|  | ||||
|     static boolean isRtlLocale(Locale locale) { | ||||
|         return TextUtilsCompat.getLayoutDirectionFromLocale(locale) == 1; | ||||
|     } | ||||
|  | ||||
|     private static int getExitDir(CharSequence charSequence) { | ||||
|         return new DirectionalityEstimator(charSequence, false).getExitDir(); | ||||
|     } | ||||
|  | ||||
|     private static int getEntryDir(CharSequence charSequence) { | ||||
|         return new DirectionalityEstimator(charSequence, false).getEntryDir(); | ||||
|     } | ||||
|  | ||||
|     private static class DirectionalityEstimator { | ||||
|         private int charIndex; | ||||
|         private final boolean isHtml; | ||||
|         private char lastChar; | ||||
|         private final int length; | ||||
|         private final CharSequence text; | ||||
|         private static final int DIR_TYPE_CACHE_SIZE = 1792; | ||||
|         private static final byte[] DIR_TYPE_CACHE = new byte[DIR_TYPE_CACHE_SIZE]; | ||||
|  | ||||
|         static { | ||||
|             for (int i = 0; i < DIR_TYPE_CACHE_SIZE; i++) { | ||||
|                 DIR_TYPE_CACHE[i] = Character.getDirectionality(i); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         DirectionalityEstimator(CharSequence charSequence, boolean z) { | ||||
|             this.text = charSequence; | ||||
|             this.isHtml = z; | ||||
|             this.length = charSequence.length(); | ||||
|         } | ||||
|  | ||||
|         int getEntryDir() { | ||||
|             this.charIndex = 0; | ||||
|             int i = 0; | ||||
|             int i2 = 0; | ||||
|             int i3 = 0; | ||||
|             while (this.charIndex < this.length && i == 0) { | ||||
|                 byte dirTypeForward = dirTypeForward(); | ||||
|                 if (dirTypeForward != 0) { | ||||
|                     if (dirTypeForward == 1 || dirTypeForward == 2) { | ||||
|                         if (i3 == 0) { | ||||
|                             return 1; | ||||
|                         } | ||||
|                     } else if (dirTypeForward != 9) { | ||||
|                         switch (dirTypeForward) { | ||||
|                             case 14: | ||||
|                             case 15: | ||||
|                                 i3++; | ||||
|                                 i2 = -1; | ||||
|                                 continue; | ||||
|                             case 16: | ||||
|                             case 17: | ||||
|                                 i3++; | ||||
|                                 i2 = 1; | ||||
|                                 continue; | ||||
|                             case 18: | ||||
|                                 i3--; | ||||
|                                 i2 = 0; | ||||
|                                 continue; | ||||
|                         } | ||||
|                     } | ||||
|                 } else if (i3 == 0) { | ||||
|                     return -1; | ||||
|                 } | ||||
|                 i = i3; | ||||
|             } | ||||
|             if (i == 0) { | ||||
|                 return 0; | ||||
|             } | ||||
|             if (i2 != 0) { | ||||
|                 return i2; | ||||
|             } | ||||
|             while (this.charIndex > 0) { | ||||
|                 switch (dirTypeBackward()) { | ||||
|                     case 14: | ||||
|                     case 15: | ||||
|                         if (i == i3) { | ||||
|                             return -1; | ||||
|                         } | ||||
|                         break; | ||||
|                     case 16: | ||||
|                     case 17: | ||||
|                         if (i == i3) { | ||||
|                             return 1; | ||||
|                         } | ||||
|                         break; | ||||
|                     case 18: | ||||
|                         i3++; | ||||
|                         continue; | ||||
|                 } | ||||
|                 i3--; | ||||
|             } | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         int getExitDir() { | ||||
|             this.charIndex = this.length; | ||||
|             int i = 0; | ||||
|             int i2 = 0; | ||||
|             while (this.charIndex > 0) { | ||||
|                 byte dirTypeBackward = dirTypeBackward(); | ||||
|                 if (dirTypeBackward != 0) { | ||||
|                     if (dirTypeBackward == 1 || dirTypeBackward == 2) { | ||||
|                         if (i == 0) { | ||||
|                             return 1; | ||||
|                         } | ||||
|                         if (i2 == 0) { | ||||
|                             i2 = i; | ||||
|                         } | ||||
|                     } else if (dirTypeBackward != 9) { | ||||
|                         switch (dirTypeBackward) { | ||||
|                             case 14: | ||||
|                             case 15: | ||||
|                                 if (i2 == i) { | ||||
|                                     return -1; | ||||
|                                 } | ||||
|                                 i--; | ||||
|                                 break; | ||||
|                             case 16: | ||||
|                             case 17: | ||||
|                                 if (i2 == i) { | ||||
|                                     return 1; | ||||
|                                 } | ||||
|                                 i--; | ||||
|                                 break; | ||||
|                             case 18: | ||||
|                                 i++; | ||||
|                                 break; | ||||
|                             default: | ||||
|                                 if (i2 != 0) { | ||||
|                                     break; | ||||
|                                 } else { | ||||
|                                     i2 = i; | ||||
|                                     break; | ||||
|                                 } | ||||
|                         } | ||||
|                     } else { | ||||
|                         continue; | ||||
|                     } | ||||
|                 } else { | ||||
|                     if (i == 0) { | ||||
|                         return -1; | ||||
|                     } | ||||
|                     if (i2 == 0) { | ||||
|                         i2 = i; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         private static byte getCachedDirectionality(char c) { | ||||
|             return c < DIR_TYPE_CACHE_SIZE ? DIR_TYPE_CACHE[c] : Character.getDirectionality(c); | ||||
|         } | ||||
|  | ||||
|         byte dirTypeForward() { | ||||
|             char charAt = this.text.charAt(this.charIndex); | ||||
|             this.lastChar = charAt; | ||||
|             if (Character.isHighSurrogate(charAt)) { | ||||
|                 int codePointAt = Character.codePointAt(this.text, this.charIndex); | ||||
|                 this.charIndex += Character.charCount(codePointAt); | ||||
|                 return Character.getDirectionality(codePointAt); | ||||
|             } | ||||
|             this.charIndex++; | ||||
|             byte cachedDirectionality = getCachedDirectionality(this.lastChar); | ||||
|             if (!this.isHtml) { | ||||
|                 return cachedDirectionality; | ||||
|             } | ||||
|             char c = this.lastChar; | ||||
|             if (c == '<') { | ||||
|                 return skipTagForward(); | ||||
|             } | ||||
|             return c == '&' ? skipEntityForward() : cachedDirectionality; | ||||
|         } | ||||
|  | ||||
|         byte dirTypeBackward() { | ||||
|             char charAt = this.text.charAt(this.charIndex - 1); | ||||
|             this.lastChar = charAt; | ||||
|             if (Character.isLowSurrogate(charAt)) { | ||||
|                 int codePointBefore = Character.codePointBefore(this.text, this.charIndex); | ||||
|                 this.charIndex -= Character.charCount(codePointBefore); | ||||
|                 return Character.getDirectionality(codePointBefore); | ||||
|             } | ||||
|             this.charIndex--; | ||||
|             byte cachedDirectionality = getCachedDirectionality(this.lastChar); | ||||
|             if (!this.isHtml) { | ||||
|                 return cachedDirectionality; | ||||
|             } | ||||
|             char c = this.lastChar; | ||||
|             if (c == '>') { | ||||
|                 return skipTagBackward(); | ||||
|             } | ||||
|             return c == ';' ? skipEntityBackward() : cachedDirectionality; | ||||
|         } | ||||
|  | ||||
|         private byte skipTagForward() { | ||||
|             char charAt; | ||||
|             int i = this.charIndex; | ||||
|             while (true) { | ||||
|                 int i2 = this.charIndex; | ||||
|                 if (i2 >= this.length) { | ||||
|                     this.charIndex = i; | ||||
|                     this.lastChar = Typography.less; | ||||
|                     return (byte) 13; | ||||
|                 } | ||||
|                 CharSequence charSequence = this.text; | ||||
|                 this.charIndex = i2 + 1; | ||||
|                 char charAt2 = charSequence.charAt(i2); | ||||
|                 this.lastChar = charAt2; | ||||
|                 if (charAt2 == '>') { | ||||
|                     return (byte) 12; | ||||
|                 } | ||||
|                 if (charAt2 == '\"' || charAt2 == '\'') { | ||||
|                     do { | ||||
|                         int i3 = this.charIndex; | ||||
|                         if (i3 < this.length) { | ||||
|                             CharSequence charSequence2 = this.text; | ||||
|                             this.charIndex = i3 + 1; | ||||
|                             charAt = charSequence2.charAt(i3); | ||||
|                             this.lastChar = charAt; | ||||
|                         } | ||||
|                     } while (charAt != charAt2); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private byte skipTagBackward() { | ||||
|             char charAt; | ||||
|             int i = this.charIndex; | ||||
|             while (true) { | ||||
|                 int i2 = this.charIndex; | ||||
|                 if (i2 <= 0) { | ||||
|                     break; | ||||
|                 } | ||||
|                 CharSequence charSequence = this.text; | ||||
|                 int i3 = i2 - 1; | ||||
|                 this.charIndex = i3; | ||||
|                 char charAt2 = charSequence.charAt(i3); | ||||
|                 this.lastChar = charAt2; | ||||
|                 if (charAt2 == '<') { | ||||
|                     return (byte) 12; | ||||
|                 } | ||||
|                 if (charAt2 == '>') { | ||||
|                     break; | ||||
|                 } | ||||
|                 if (charAt2 == '\"' || charAt2 == '\'') { | ||||
|                     do { | ||||
|                         int i4 = this.charIndex; | ||||
|                         if (i4 > 0) { | ||||
|                             CharSequence charSequence2 = this.text; | ||||
|                             int i5 = i4 - 1; | ||||
|                             this.charIndex = i5; | ||||
|                             charAt = charSequence2.charAt(i5); | ||||
|                             this.lastChar = charAt; | ||||
|                         } | ||||
|                     } while (charAt != charAt2); | ||||
|                 } | ||||
|             } | ||||
|             this.charIndex = i; | ||||
|             this.lastChar = Typography.greater; | ||||
|             return (byte) 13; | ||||
|         } | ||||
|  | ||||
|         private byte skipEntityForward() { | ||||
|             char charAt; | ||||
|             do { | ||||
|                 int i = this.charIndex; | ||||
|                 if (i >= this.length) { | ||||
|                     return (byte) 12; | ||||
|                 } | ||||
|                 CharSequence charSequence = this.text; | ||||
|                 this.charIndex = i + 1; | ||||
|                 charAt = charSequence.charAt(i); | ||||
|                 this.lastChar = charAt; | ||||
|             } while (charAt != ';'); | ||||
|             return (byte) 12; | ||||
|         } | ||||
|  | ||||
|         private byte skipEntityBackward() { | ||||
|             char charAt; | ||||
|             int i = this.charIndex; | ||||
|             do { | ||||
|                 int i2 = this.charIndex; | ||||
|                 if (i2 <= 0) { | ||||
|                     break; | ||||
|                 } | ||||
|                 CharSequence charSequence = this.text; | ||||
|                 int i3 = i2 - 1; | ||||
|                 this.charIndex = i3; | ||||
|                 charAt = charSequence.charAt(i3); | ||||
|                 this.lastChar = charAt; | ||||
|                 if (charAt == '&') { | ||||
|                     return (byte) 12; | ||||
|                 } | ||||
|             } while (charAt != ';'); | ||||
|             this.charIndex = i; | ||||
|             this.lastChar = ';'; | ||||
|             return (byte) 13; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								02-Easy5/E5/sources/androidx/core/text/CharSequenceKt.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								02-Easy5/E5/sources/androidx/core/text/CharSequenceKt.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.TextUtils; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* compiled from: CharSequence.kt */ | ||||
| @Metadata(d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010\u000b\n\u0002\u0010\r\n\u0000\n\u0002\u0010\b\n\u0000\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0086\b\u001a\r\u0010\u0003\u001a\u00020\u0004*\u00020\u0002H\u0086\b¨\u0006\u0005"}, d2 = {"isDigitsOnly", "", "", "trimmedLength", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class CharSequenceKt { | ||||
|     public static final boolean isDigitsOnly(CharSequence charSequence) { | ||||
|         Intrinsics.checkNotNullParameter(charSequence, "<this>"); | ||||
|         return TextUtils.isDigitsOnly(charSequence); | ||||
|     } | ||||
|  | ||||
|     public static final int trimmedLength(CharSequence charSequence) { | ||||
|         Intrinsics.checkNotNullParameter(charSequence, "<this>"); | ||||
|         return TextUtils.getTrimmedLength(charSequence); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										61
									
								
								02-Easy5/E5/sources/androidx/core/text/HtmlCompat.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								02-Easy5/E5/sources/androidx/core/text/HtmlCompat.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.os.Build; | ||||
| import android.text.Html; | ||||
| import android.text.Spanned; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class HtmlCompat { | ||||
|     public static final int FROM_HTML_MODE_COMPACT = 63; | ||||
|     public static final int FROM_HTML_MODE_LEGACY = 0; | ||||
|     public static final int FROM_HTML_OPTION_USE_CSS_COLORS = 256; | ||||
|     public static final int FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE = 32; | ||||
|     public static final int FROM_HTML_SEPARATOR_LINE_BREAK_DIV = 16; | ||||
|     public static final int FROM_HTML_SEPARATOR_LINE_BREAK_HEADING = 2; | ||||
|     public static final int FROM_HTML_SEPARATOR_LINE_BREAK_LIST = 8; | ||||
|     public static final int FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM = 4; | ||||
|     public static final int FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH = 1; | ||||
|     public static final int TO_HTML_PARAGRAPH_LINES_CONSECUTIVE = 0; | ||||
|     public static final int TO_HTML_PARAGRAPH_LINES_INDIVIDUAL = 1; | ||||
|  | ||||
|     public static Spanned fromHtml(String str, int i) { | ||||
|         if (Build.VERSION.SDK_INT >= 24) { | ||||
|             return Api24Impl.fromHtml(str, i); | ||||
|         } | ||||
|         return Html.fromHtml(str); | ||||
|     } | ||||
|  | ||||
|     public static Spanned fromHtml(String str, int i, Html.ImageGetter imageGetter, Html.TagHandler tagHandler) { | ||||
|         if (Build.VERSION.SDK_INT >= 24) { | ||||
|             return Api24Impl.fromHtml(str, i, imageGetter, tagHandler); | ||||
|         } | ||||
|         return Html.fromHtml(str, imageGetter, tagHandler); | ||||
|     } | ||||
|  | ||||
|     public static String toHtml(Spanned spanned, int i) { | ||||
|         if (Build.VERSION.SDK_INT >= 24) { | ||||
|             return Api24Impl.toHtml(spanned, i); | ||||
|         } | ||||
|         return Html.toHtml(spanned); | ||||
|     } | ||||
|  | ||||
|     private HtmlCompat() { | ||||
|     } | ||||
|  | ||||
|     static class Api24Impl { | ||||
|         private Api24Impl() { | ||||
|         } | ||||
|  | ||||
|         static Spanned fromHtml(String str, int i) { | ||||
|             return Html.fromHtml(str, i); | ||||
|         } | ||||
|  | ||||
|         static Spanned fromHtml(String str, int i, Html.ImageGetter imageGetter, Html.TagHandler tagHandler) { | ||||
|             return Html.fromHtml(str, i, imageGetter, tagHandler); | ||||
|         } | ||||
|  | ||||
|         static String toHtml(Spanned spanned, int i) { | ||||
|             return Html.toHtml(spanned, i); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										51
									
								
								02-Easy5/E5/sources/androidx/core/text/HtmlKt.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								02-Easy5/E5/sources/androidx/core/text/HtmlKt.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.Html; | ||||
| import android.text.Spanned; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* compiled from: Html.kt */ | ||||
| @Metadata(d1 = {"\u0000 \n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a/\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u00062\n\b\u0002\u0010\u0007\u001a\u0004\u0018\u00010\bH\u0086\b\u001a\u0017\u0010\t\u001a\u00020\u0002*\u00020\u00012\b\b\u0002\u0010\n\u001a\u00020\u0004H\u0086\b¨\u0006\u000b"}, d2 = {"parseAsHtml", "Landroid/text/Spanned;", "", "flags", "", "imageGetter", "Landroid/text/Html$ImageGetter;", "tagHandler", "Landroid/text/Html$TagHandler;", "toHtml", "option", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class HtmlKt { | ||||
|     public static /* synthetic */ Spanned parseAsHtml$default(String str, int i, Html.ImageGetter imageGetter, Html.TagHandler tagHandler, int i2, Object obj) { | ||||
|         if ((i2 & 1) != 0) { | ||||
|             i = 0; | ||||
|         } | ||||
|         if ((i2 & 2) != 0) { | ||||
|             imageGetter = null; | ||||
|         } | ||||
|         if ((i2 & 4) != 0) { | ||||
|             tagHandler = null; | ||||
|         } | ||||
|         Intrinsics.checkNotNullParameter(str, "<this>"); | ||||
|         Spanned fromHtml = HtmlCompat.fromHtml(str, i, imageGetter, tagHandler); | ||||
|         Intrinsics.checkNotNullExpressionValue(fromHtml, "fromHtml(this, flags, imageGetter, tagHandler)"); | ||||
|         return fromHtml; | ||||
|     } | ||||
|  | ||||
|     public static final Spanned parseAsHtml(String str, int i, Html.ImageGetter imageGetter, Html.TagHandler tagHandler) { | ||||
|         Intrinsics.checkNotNullParameter(str, "<this>"); | ||||
|         Spanned fromHtml = HtmlCompat.fromHtml(str, i, imageGetter, tagHandler); | ||||
|         Intrinsics.checkNotNullExpressionValue(fromHtml, "fromHtml(this, flags, imageGetter, tagHandler)"); | ||||
|         return fromHtml; | ||||
|     } | ||||
|  | ||||
|     public static /* synthetic */ String toHtml$default(Spanned spanned, int i, int i2, Object obj) { | ||||
|         if ((i2 & 1) != 0) { | ||||
|             i = 0; | ||||
|         } | ||||
|         Intrinsics.checkNotNullParameter(spanned, "<this>"); | ||||
|         String html = HtmlCompat.toHtml(spanned, i); | ||||
|         Intrinsics.checkNotNullExpressionValue(html, "toHtml(this, option)"); | ||||
|         return html; | ||||
|     } | ||||
|  | ||||
|     public static final String toHtml(Spanned spanned, int i) { | ||||
|         Intrinsics.checkNotNullParameter(spanned, "<this>"); | ||||
|         String html = HtmlCompat.toHtml(spanned, i); | ||||
|         Intrinsics.checkNotNullExpressionValue(html, "toHtml(this, option)"); | ||||
|         return html; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										98
									
								
								02-Easy5/E5/sources/androidx/core/text/ICUCompat.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								02-Easy5/E5/sources/androidx/core/text/ICUCompat.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,98 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.icu.util.ULocale; | ||||
| import android.os.Build; | ||||
| import android.util.Log; | ||||
| import java.lang.reflect.InvocationTargetException; | ||||
| import java.lang.reflect.Method; | ||||
| import java.util.Locale; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class ICUCompat { | ||||
|     private static final String TAG = "ICUCompat"; | ||||
|     private static Method sAddLikelySubtagsMethod; | ||||
|     private static Method sGetScriptMethod; | ||||
|  | ||||
|     static { | ||||
|         if (Build.VERSION.SDK_INT < 24) { | ||||
|             try { | ||||
|                 sAddLikelySubtagsMethod = Class.forName("libcore.icu.ICU").getMethod("addLikelySubtags", Locale.class); | ||||
|             } catch (Exception e) { | ||||
|                 throw new IllegalStateException(e); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static String maximizeAndGetScript(Locale locale) { | ||||
|         if (Build.VERSION.SDK_INT >= 24) { | ||||
|             return Api24Impl.getScript(Api24Impl.addLikelySubtags(Api24Impl.forLocale(locale))); | ||||
|         } | ||||
|         try { | ||||
|             return Api21Impl.getScript((Locale) sAddLikelySubtagsMethod.invoke(null, locale)); | ||||
|         } catch (IllegalAccessException e) { | ||||
|             Log.w(TAG, e); | ||||
|             return Api21Impl.getScript(locale); | ||||
|         } catch (InvocationTargetException e2) { | ||||
|             Log.w(TAG, e2); | ||||
|             return Api21Impl.getScript(locale); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static String getScriptBelowApi21(String str) { | ||||
|         try { | ||||
|             Method method = sGetScriptMethod; | ||||
|             if (method != null) { | ||||
|                 return (String) method.invoke(null, str); | ||||
|             } | ||||
|         } catch (IllegalAccessException e) { | ||||
|             Log.w(TAG, e); | ||||
|         } catch (InvocationTargetException e2) { | ||||
|             Log.w(TAG, e2); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private static String addLikelySubtagsBelowApi21(Locale locale) { | ||||
|         String locale2 = locale.toString(); | ||||
|         try { | ||||
|             Method method = sAddLikelySubtagsMethod; | ||||
|             if (method != null) { | ||||
|                 return (String) method.invoke(null, locale2); | ||||
|             } | ||||
|         } catch (IllegalAccessException e) { | ||||
|             Log.w(TAG, e); | ||||
|         } catch (InvocationTargetException e2) { | ||||
|             Log.w(TAG, e2); | ||||
|         } | ||||
|         return locale2; | ||||
|     } | ||||
|  | ||||
|     private ICUCompat() { | ||||
|     } | ||||
|  | ||||
|     static class Api24Impl { | ||||
|         private Api24Impl() { | ||||
|         } | ||||
|  | ||||
|         static ULocale forLocale(Locale locale) { | ||||
|             return ULocale.forLocale(locale); | ||||
|         } | ||||
|  | ||||
|         static ULocale addLikelySubtags(Object obj) { | ||||
|             return ULocale.addLikelySubtags((ULocale) obj); | ||||
|         } | ||||
|  | ||||
|         static String getScript(Object obj) { | ||||
|             return ((ULocale) obj).getScript(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class Api21Impl { | ||||
|         private Api21Impl() { | ||||
|         } | ||||
|  | ||||
|         static String getScript(Locale locale) { | ||||
|             return locale.getScript(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										16
									
								
								02-Easy5/E5/sources/androidx/core/text/LocaleKt.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								02-Easy5/E5/sources/androidx/core/text/LocaleKt.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.TextUtils; | ||||
| import java.util.Locale; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* compiled from: Locale.kt */ | ||||
| @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\b\u0003\"\u0016\u0010\u0000\u001a\u00020\u0001*\u00020\u00028Ç\u0002¢\u0006\u0006\u001a\u0004\b\u0003\u0010\u0004¨\u0006\u0005"}, d2 = {"layoutDirection", "", "Ljava/util/Locale;", "getLayoutDirection", "(Ljava/util/Locale;)I", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class LocaleKt { | ||||
|     public static final int getLayoutDirection(Locale locale) { | ||||
|         Intrinsics.checkNotNullParameter(locale, "<this>"); | ||||
|         return TextUtils.getLayoutDirectionFromLocale(locale); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,413 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.os.Build; | ||||
| import android.os.LocaleList; | ||||
| import android.text.Layout; | ||||
| import android.text.PrecomputedText; | ||||
| import android.text.Spannable; | ||||
| import android.text.SpannableString; | ||||
| import android.text.StaticLayout; | ||||
| import android.text.TextDirectionHeuristic; | ||||
| import android.text.TextDirectionHeuristics; | ||||
| import android.text.TextPaint; | ||||
| import android.text.TextUtils; | ||||
| import android.text.style.MetricAffectingSpan; | ||||
| import androidx.core.graphics.ColorKt$$ExternalSyntheticApiModelOutline0; | ||||
| import androidx.core.os.TraceCompat; | ||||
| import androidx.core.util.ObjectsCompat; | ||||
| import androidx.core.util.Preconditions; | ||||
| import java.util.ArrayList; | ||||
| import java.util.concurrent.Callable; | ||||
| import java.util.concurrent.Executor; | ||||
| import java.util.concurrent.Executors; | ||||
| import java.util.concurrent.Future; | ||||
| import java.util.concurrent.FutureTask; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class PrecomputedTextCompat implements Spannable { | ||||
|     private static final char LINE_FEED = '\n'; | ||||
|     private static Executor sExecutor; | ||||
|     private static final Object sLock = new Object(); | ||||
|     private final int[] mParagraphEnds; | ||||
|     private final Params mParams; | ||||
|     private final Spannable mText; | ||||
|     private final PrecomputedText mWrapped; | ||||
|  | ||||
|     public Params getParams() { | ||||
|         return this.mParams; | ||||
|     } | ||||
|  | ||||
|     public static final class Params { | ||||
|         private final int mBreakStrategy; | ||||
|         private final int mHyphenationFrequency; | ||||
|         private final TextPaint mPaint; | ||||
|         private final TextDirectionHeuristic mTextDir; | ||||
|         final PrecomputedText.Params mWrapped; | ||||
|  | ||||
|         public int getBreakStrategy() { | ||||
|             return this.mBreakStrategy; | ||||
|         } | ||||
|  | ||||
|         public int getHyphenationFrequency() { | ||||
|             return this.mHyphenationFrequency; | ||||
|         } | ||||
|  | ||||
|         public TextDirectionHeuristic getTextDirection() { | ||||
|             return this.mTextDir; | ||||
|         } | ||||
|  | ||||
|         public TextPaint getTextPaint() { | ||||
|             return this.mPaint; | ||||
|         } | ||||
|  | ||||
|         public static class Builder { | ||||
|             private int mBreakStrategy; | ||||
|             private int mHyphenationFrequency; | ||||
|             private final TextPaint mPaint; | ||||
|             private TextDirectionHeuristic mTextDir; | ||||
|  | ||||
|             public Builder setBreakStrategy(int i) { | ||||
|                 this.mBreakStrategy = i; | ||||
|                 return this; | ||||
|             } | ||||
|  | ||||
|             public Builder setHyphenationFrequency(int i) { | ||||
|                 this.mHyphenationFrequency = i; | ||||
|                 return this; | ||||
|             } | ||||
|  | ||||
|             public Builder setTextDirection(TextDirectionHeuristic textDirectionHeuristic) { | ||||
|                 this.mTextDir = textDirectionHeuristic; | ||||
|                 return this; | ||||
|             } | ||||
|  | ||||
|             public Builder(TextPaint textPaint) { | ||||
|                 this.mPaint = textPaint; | ||||
|                 if (Build.VERSION.SDK_INT >= 23) { | ||||
|                     this.mBreakStrategy = 1; | ||||
|                     this.mHyphenationFrequency = 1; | ||||
|                 } else { | ||||
|                     this.mHyphenationFrequency = 0; | ||||
|                     this.mBreakStrategy = 0; | ||||
|                 } | ||||
|                 this.mTextDir = TextDirectionHeuristics.FIRSTSTRONG_LTR; | ||||
|             } | ||||
|  | ||||
|             public Params build() { | ||||
|                 return new Params(this.mPaint, this.mTextDir, this.mBreakStrategy, this.mHyphenationFrequency); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         Params(TextPaint textPaint, TextDirectionHeuristic textDirectionHeuristic, int i, int i2) { | ||||
|             PrecomputedText.Params.Builder breakStrategy; | ||||
|             PrecomputedText.Params.Builder hyphenationFrequency; | ||||
|             PrecomputedText.Params.Builder textDirection; | ||||
|             PrecomputedText.Params build; | ||||
|             if (Build.VERSION.SDK_INT >= 29) { | ||||
|                 breakStrategy = ColorKt$$ExternalSyntheticApiModelOutline0.m93m(textPaint).setBreakStrategy(i); | ||||
|                 hyphenationFrequency = breakStrategy.setHyphenationFrequency(i2); | ||||
|                 textDirection = hyphenationFrequency.setTextDirection(textDirectionHeuristic); | ||||
|                 build = textDirection.build(); | ||||
|                 this.mWrapped = build; | ||||
|             } else { | ||||
|                 this.mWrapped = null; | ||||
|             } | ||||
|             this.mPaint = textPaint; | ||||
|             this.mTextDir = textDirectionHeuristic; | ||||
|             this.mBreakStrategy = i; | ||||
|             this.mHyphenationFrequency = i2; | ||||
|         } | ||||
|  | ||||
|         public Params(PrecomputedText.Params params) { | ||||
|             TextPaint textPaint; | ||||
|             TextDirectionHeuristic textDirection; | ||||
|             int breakStrategy; | ||||
|             int hyphenationFrequency; | ||||
|             textPaint = params.getTextPaint(); | ||||
|             this.mPaint = textPaint; | ||||
|             textDirection = params.getTextDirection(); | ||||
|             this.mTextDir = textDirection; | ||||
|             breakStrategy = params.getBreakStrategy(); | ||||
|             this.mBreakStrategy = breakStrategy; | ||||
|             hyphenationFrequency = params.getHyphenationFrequency(); | ||||
|             this.mHyphenationFrequency = hyphenationFrequency; | ||||
|             this.mWrapped = Build.VERSION.SDK_INT < 29 ? null : params; | ||||
|         } | ||||
|  | ||||
|         public boolean equalsWithoutTextDirection(Params params) { | ||||
|             LocaleList textLocales; | ||||
|             LocaleList textLocales2; | ||||
|             boolean equals; | ||||
|             if ((Build.VERSION.SDK_INT >= 23 && (this.mBreakStrategy != params.getBreakStrategy() || this.mHyphenationFrequency != params.getHyphenationFrequency())) || this.mPaint.getTextSize() != params.getTextPaint().getTextSize() || this.mPaint.getTextScaleX() != params.getTextPaint().getTextScaleX() || this.mPaint.getTextSkewX() != params.getTextPaint().getTextSkewX() || this.mPaint.getLetterSpacing() != params.getTextPaint().getLetterSpacing() || !TextUtils.equals(this.mPaint.getFontFeatureSettings(), params.getTextPaint().getFontFeatureSettings()) || this.mPaint.getFlags() != params.getTextPaint().getFlags()) { | ||||
|                 return false; | ||||
|             } | ||||
|             if (Build.VERSION.SDK_INT >= 24) { | ||||
|                 textLocales = this.mPaint.getTextLocales(); | ||||
|                 textLocales2 = params.getTextPaint().getTextLocales(); | ||||
|                 equals = textLocales.equals(textLocales2); | ||||
|                 if (!equals) { | ||||
|                     return false; | ||||
|                 } | ||||
|             } else if (!this.mPaint.getTextLocale().equals(params.getTextPaint().getTextLocale())) { | ||||
|                 return false; | ||||
|             } | ||||
|             return this.mPaint.getTypeface() == null ? params.getTextPaint().getTypeface() == null : this.mPaint.getTypeface().equals(params.getTextPaint().getTypeface()); | ||||
|         } | ||||
|  | ||||
|         public boolean equals(Object obj) { | ||||
|             if (obj == this) { | ||||
|                 return true; | ||||
|             } | ||||
|             if (!(obj instanceof Params)) { | ||||
|                 return false; | ||||
|             } | ||||
|             Params params = (Params) obj; | ||||
|             return equalsWithoutTextDirection(params) && this.mTextDir == params.getTextDirection(); | ||||
|         } | ||||
|  | ||||
|         public int hashCode() { | ||||
|             LocaleList textLocales; | ||||
|             if (Build.VERSION.SDK_INT >= 24) { | ||||
|                 textLocales = this.mPaint.getTextLocales(); | ||||
|                 return ObjectsCompat.hash(Float.valueOf(this.mPaint.getTextSize()), Float.valueOf(this.mPaint.getTextScaleX()), Float.valueOf(this.mPaint.getTextSkewX()), Float.valueOf(this.mPaint.getLetterSpacing()), Integer.valueOf(this.mPaint.getFlags()), textLocales, this.mPaint.getTypeface(), Boolean.valueOf(this.mPaint.isElegantTextHeight()), this.mTextDir, Integer.valueOf(this.mBreakStrategy), Integer.valueOf(this.mHyphenationFrequency)); | ||||
|             } | ||||
|             return ObjectsCompat.hash(Float.valueOf(this.mPaint.getTextSize()), Float.valueOf(this.mPaint.getTextScaleX()), Float.valueOf(this.mPaint.getTextSkewX()), Float.valueOf(this.mPaint.getLetterSpacing()), Integer.valueOf(this.mPaint.getFlags()), this.mPaint.getTextLocale(), this.mPaint.getTypeface(), Boolean.valueOf(this.mPaint.isElegantTextHeight()), this.mTextDir, Integer.valueOf(this.mBreakStrategy), Integer.valueOf(this.mHyphenationFrequency)); | ||||
|         } | ||||
|  | ||||
|         public String toString() { | ||||
|             String fontVariationSettings; | ||||
|             LocaleList textLocales; | ||||
|             StringBuilder sb = new StringBuilder("{"); | ||||
|             sb.append("textSize=" + this.mPaint.getTextSize()); | ||||
|             sb.append(", textScaleX=" + this.mPaint.getTextScaleX()); | ||||
|             sb.append(", textSkewX=" + this.mPaint.getTextSkewX()); | ||||
|             sb.append(", letterSpacing=" + this.mPaint.getLetterSpacing()); | ||||
|             sb.append(", elegantTextHeight=" + this.mPaint.isElegantTextHeight()); | ||||
|             if (Build.VERSION.SDK_INT >= 24) { | ||||
|                 StringBuilder sb2 = new StringBuilder(", textLocale="); | ||||
|                 textLocales = this.mPaint.getTextLocales(); | ||||
|                 sb2.append(textLocales); | ||||
|                 sb.append(sb2.toString()); | ||||
|             } else { | ||||
|                 sb.append(", textLocale=" + this.mPaint.getTextLocale()); | ||||
|             } | ||||
|             sb.append(", typeface=" + this.mPaint.getTypeface()); | ||||
|             if (Build.VERSION.SDK_INT >= 26) { | ||||
|                 StringBuilder sb3 = new StringBuilder(", variationSettings="); | ||||
|                 fontVariationSettings = this.mPaint.getFontVariationSettings(); | ||||
|                 sb3.append(fontVariationSettings); | ||||
|                 sb.append(sb3.toString()); | ||||
|             } | ||||
|             sb.append(", textDir=" + this.mTextDir); | ||||
|             sb.append(", breakStrategy=" + this.mBreakStrategy); | ||||
|             sb.append(", hyphenationFrequency=" + this.mHyphenationFrequency); | ||||
|             sb.append("}"); | ||||
|             return sb.toString(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static PrecomputedTextCompat create(CharSequence charSequence, Params params) { | ||||
|         StaticLayout.Builder obtain; | ||||
|         StaticLayout.Builder breakStrategy; | ||||
|         StaticLayout.Builder hyphenationFrequency; | ||||
|         StaticLayout.Builder textDirection; | ||||
|         PrecomputedText create; | ||||
|         Preconditions.checkNotNull(charSequence); | ||||
|         Preconditions.checkNotNull(params); | ||||
|         try { | ||||
|             TraceCompat.beginSection("PrecomputedText"); | ||||
|             if (Build.VERSION.SDK_INT >= 29 && params.mWrapped != null) { | ||||
|                 create = PrecomputedText.create(charSequence, params.mWrapped); | ||||
|                 return new PrecomputedTextCompat(create, params); | ||||
|             } | ||||
|             ArrayList arrayList = new ArrayList(); | ||||
|             int length = charSequence.length(); | ||||
|             int i = 0; | ||||
|             while (i < length) { | ||||
|                 int indexOf = TextUtils.indexOf(charSequence, LINE_FEED, i, length); | ||||
|                 i = indexOf < 0 ? length : indexOf + 1; | ||||
|                 arrayList.add(Integer.valueOf(i)); | ||||
|             } | ||||
|             int[] iArr = new int[arrayList.size()]; | ||||
|             for (int i2 = 0; i2 < arrayList.size(); i2++) { | ||||
|                 iArr[i2] = ((Integer) arrayList.get(i2)).intValue(); | ||||
|             } | ||||
|             if (Build.VERSION.SDK_INT >= 23) { | ||||
|                 obtain = StaticLayout.Builder.obtain(charSequence, 0, charSequence.length(), params.getTextPaint(), Integer.MAX_VALUE); | ||||
|                 breakStrategy = obtain.setBreakStrategy(params.getBreakStrategy()); | ||||
|                 hyphenationFrequency = breakStrategy.setHyphenationFrequency(params.getHyphenationFrequency()); | ||||
|                 textDirection = hyphenationFrequency.setTextDirection(params.getTextDirection()); | ||||
|                 textDirection.build(); | ||||
|             } else { | ||||
|                 new StaticLayout(charSequence, params.getTextPaint(), Integer.MAX_VALUE, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); | ||||
|             } | ||||
|             return new PrecomputedTextCompat(charSequence, params, iArr); | ||||
|         } finally { | ||||
|             TraceCompat.endSection(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private PrecomputedTextCompat(CharSequence charSequence, Params params, int[] iArr) { | ||||
|         this.mText = new SpannableString(charSequence); | ||||
|         this.mParams = params; | ||||
|         this.mParagraphEnds = iArr; | ||||
|         this.mWrapped = null; | ||||
|     } | ||||
|  | ||||
|     private PrecomputedTextCompat(PrecomputedText precomputedText, Params params) { | ||||
|         this.mText = precomputedText; | ||||
|         this.mParams = params; | ||||
|         this.mParagraphEnds = null; | ||||
|         this.mWrapped = Build.VERSION.SDK_INT < 29 ? null : precomputedText; | ||||
|     } | ||||
|  | ||||
|     public PrecomputedText getPrecomputedText() { | ||||
|         if (ColorKt$$ExternalSyntheticApiModelOutline0.m109m((Object) this.mText)) { | ||||
|             return ColorKt$$ExternalSyntheticApiModelOutline0.m94m((Object) this.mText); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     public int getParagraphCount() { | ||||
|         int paragraphCount; | ||||
|         if (Build.VERSION.SDK_INT >= 29) { | ||||
|             paragraphCount = this.mWrapped.getParagraphCount(); | ||||
|             return paragraphCount; | ||||
|         } | ||||
|         return this.mParagraphEnds.length; | ||||
|     } | ||||
|  | ||||
|     public int getParagraphStart(int i) { | ||||
|         int paragraphStart; | ||||
|         Preconditions.checkArgumentInRange(i, 0, getParagraphCount(), "paraIndex"); | ||||
|         if (Build.VERSION.SDK_INT >= 29) { | ||||
|             paragraphStart = this.mWrapped.getParagraphStart(i); | ||||
|             return paragraphStart; | ||||
|         } | ||||
|         if (i == 0) { | ||||
|             return 0; | ||||
|         } | ||||
|         return this.mParagraphEnds[i - 1]; | ||||
|     } | ||||
|  | ||||
|     public int getParagraphEnd(int i) { | ||||
|         int paragraphEnd; | ||||
|         Preconditions.checkArgumentInRange(i, 0, getParagraphCount(), "paraIndex"); | ||||
|         if (Build.VERSION.SDK_INT >= 29) { | ||||
|             paragraphEnd = this.mWrapped.getParagraphEnd(i); | ||||
|             return paragraphEnd; | ||||
|         } | ||||
|         return this.mParagraphEnds[i]; | ||||
|     } | ||||
|  | ||||
|     private static class PrecomputedTextFutureTask extends FutureTask<PrecomputedTextCompat> { | ||||
|  | ||||
|         private static class PrecomputedTextCallback implements Callable<PrecomputedTextCompat> { | ||||
|             private Params mParams; | ||||
|             private CharSequence mText; | ||||
|  | ||||
|             PrecomputedTextCallback(Params params, CharSequence charSequence) { | ||||
|                 this.mParams = params; | ||||
|                 this.mText = charSequence; | ||||
|             } | ||||
|  | ||||
|             /* JADX WARN: Can't rename method to resolve collision */ | ||||
|             @Override // java.util.concurrent.Callable | ||||
|             public PrecomputedTextCompat call() throws Exception { | ||||
|                 return PrecomputedTextCompat.create(this.mText, this.mParams); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         PrecomputedTextFutureTask(Params params, CharSequence charSequence) { | ||||
|             super(new PrecomputedTextCallback(params, charSequence)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static Future<PrecomputedTextCompat> getTextFuture(CharSequence charSequence, Params params, Executor executor) { | ||||
|         PrecomputedTextFutureTask precomputedTextFutureTask = new PrecomputedTextFutureTask(params, charSequence); | ||||
|         if (executor == null) { | ||||
|             synchronized (sLock) { | ||||
|                 if (sExecutor == null) { | ||||
|                     sExecutor = Executors.newFixedThreadPool(1); | ||||
|                 } | ||||
|                 executor = sExecutor; | ||||
|             } | ||||
|         } | ||||
|         executor.execute(precomputedTextFutureTask); | ||||
|         return precomputedTextFutureTask; | ||||
|     } | ||||
|  | ||||
|     @Override // android.text.Spannable | ||||
|     public void setSpan(Object obj, int i, int i2, int i3) { | ||||
|         if (obj instanceof MetricAffectingSpan) { | ||||
|             throw new IllegalArgumentException("MetricAffectingSpan can not be set to PrecomputedText."); | ||||
|         } | ||||
|         if (Build.VERSION.SDK_INT >= 29) { | ||||
|             this.mWrapped.setSpan(obj, i, i2, i3); | ||||
|         } else { | ||||
|             this.mText.setSpan(obj, i, i2, i3); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.text.Spannable | ||||
|     public void removeSpan(Object obj) { | ||||
|         if (obj instanceof MetricAffectingSpan) { | ||||
|             throw new IllegalArgumentException("MetricAffectingSpan can not be removed from PrecomputedText."); | ||||
|         } | ||||
|         if (Build.VERSION.SDK_INT >= 29) { | ||||
|             this.mWrapped.removeSpan(obj); | ||||
|         } else { | ||||
|             this.mText.removeSpan(obj); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.text.Spanned | ||||
|     public <T> T[] getSpans(int i, int i2, Class<T> cls) { | ||||
|         Object[] spans; | ||||
|         if (Build.VERSION.SDK_INT >= 29) { | ||||
|             spans = this.mWrapped.getSpans(i, i2, cls); | ||||
|             return (T[]) spans; | ||||
|         } | ||||
|         return (T[]) this.mText.getSpans(i, i2, cls); | ||||
|     } | ||||
|  | ||||
|     @Override // android.text.Spanned | ||||
|     public int getSpanStart(Object obj) { | ||||
|         return this.mText.getSpanStart(obj); | ||||
|     } | ||||
|  | ||||
|     @Override // android.text.Spanned | ||||
|     public int getSpanEnd(Object obj) { | ||||
|         return this.mText.getSpanEnd(obj); | ||||
|     } | ||||
|  | ||||
|     @Override // android.text.Spanned | ||||
|     public int getSpanFlags(Object obj) { | ||||
|         return this.mText.getSpanFlags(obj); | ||||
|     } | ||||
|  | ||||
|     @Override // android.text.Spanned | ||||
|     public int nextSpanTransition(int i, int i2, Class cls) { | ||||
|         return this.mText.nextSpanTransition(i, i2, cls); | ||||
|     } | ||||
|  | ||||
|     @Override // java.lang.CharSequence | ||||
|     public int length() { | ||||
|         return this.mText.length(); | ||||
|     } | ||||
|  | ||||
|     @Override // java.lang.CharSequence | ||||
|     public char charAt(int i) { | ||||
|         return this.mText.charAt(i); | ||||
|     } | ||||
|  | ||||
|     @Override // java.lang.CharSequence | ||||
|     public CharSequence subSequence(int i, int i2) { | ||||
|         return this.mText.subSequence(i, i2); | ||||
|     } | ||||
|  | ||||
|     @Override // java.lang.CharSequence | ||||
|     public String toString() { | ||||
|         return this.mText.toString(); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,141 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.SpannableStringBuilder; | ||||
| import android.text.SpannedString; | ||||
| import android.text.style.BackgroundColorSpan; | ||||
| import android.text.style.ForegroundColorSpan; | ||||
| import android.text.style.RelativeSizeSpan; | ||||
| import android.text.style.StrikethroughSpan; | ||||
| import android.text.style.StyleSpan; | ||||
| import android.text.style.SubscriptSpan; | ||||
| import android.text.style.SuperscriptSpan; | ||||
| import android.text.style.UnderlineSpan; | ||||
| import androidx.constraintlayout.core.motion.utils.TypedValues; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.Unit; | ||||
| import kotlin.jvm.functions.Function1; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* compiled from: SpannableStringBuilder.kt */ | ||||
| @Metadata(d1 = {"\u0000:\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0004\n\u0002\u0010\u0007\n\u0002\b\u0005\u001a%\u0010\u0000\u001a\u00020\u00012\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a3\u0010\u0007\u001a\u00020\u0004*\u00020\u00042\b\b\u0001\u0010\b\u001a\u00020\t2\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a)\u0010\n\u001a\u00020\u0004*\u00020\u00042\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a3\u0010\b\u001a\u00020\u0004*\u00020\u00042\b\b\u0001\u0010\b\u001a\u00020\t2\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a1\u0010\u000b\u001a\u00020\u0004*\u00020\u00042\u0006\u0010\f\u001a\u00020\r2\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001aB\u0010\u000b\u001a\u00020\u0004*\u00020\u00042\u0012\u0010\u000e\u001a\n\u0012\u0006\b\u0001\u0012\u00020\r0\u000f\"\u00020\r2\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000¢\u0006\u0002\u0010\u0010\u001a)\u0010\u0011\u001a\u00020\u0004*\u00020\u00042\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a1\u0010\u0012\u001a\u00020\u0004*\u00020\u00042\u0006\u0010\u0013\u001a\u00020\u00142\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a)\u0010\u0015\u001a\u00020\u0004*\u00020\u00042\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a)\u0010\u0016\u001a\u00020\u0004*\u00020\u00042\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a)\u0010\u0017\u001a\u00020\u0004*\u00020\u00042\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u001a)\u0010\u0018\u001a\u00020\u0004*\u00020\u00042\u0017\u0010\u0002\u001a\u0013\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u00050\u0003¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0019"}, d2 = {"buildSpannedString", "Landroid/text/SpannedString;", "builderAction", "Lkotlin/Function1;", "Landroid/text/SpannableStringBuilder;", "", "Lkotlin/ExtensionFunctionType;", "backgroundColor", TypedValues.Custom.S_COLOR, "", "bold", "inSpans", "span", "", "spans", "", "(Landroid/text/SpannableStringBuilder;[Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Landroid/text/SpannableStringBuilder;", "italic", "scale", "proportion", "", "strikeThrough", "subscript", "superscript", "underline", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class SpannableStringBuilderKt { | ||||
|     public static final SpannedString buildSpannedString(Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         return new SpannedString(spannableStringBuilder); | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder inSpans(SpannableStringBuilder spannableStringBuilder, Object[] spans, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(spans, "spans"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         for (Object obj : spans) { | ||||
|             spannableStringBuilder.setSpan(obj, length, spannableStringBuilder.length(), 17); | ||||
|         } | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder inSpans(SpannableStringBuilder spannableStringBuilder, Object span, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(span, "span"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(span, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder bold(SpannableStringBuilder spannableStringBuilder, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         StyleSpan styleSpan = new StyleSpan(1); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(styleSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder italic(SpannableStringBuilder spannableStringBuilder, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         StyleSpan styleSpan = new StyleSpan(2); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(styleSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder underline(SpannableStringBuilder spannableStringBuilder, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         UnderlineSpan underlineSpan = new UnderlineSpan(); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(underlineSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder color(SpannableStringBuilder spannableStringBuilder, int i, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(i); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(foregroundColorSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder backgroundColor(SpannableStringBuilder spannableStringBuilder, int i, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         BackgroundColorSpan backgroundColorSpan = new BackgroundColorSpan(i); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(backgroundColorSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder strikeThrough(SpannableStringBuilder spannableStringBuilder, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         StrikethroughSpan strikethroughSpan = new StrikethroughSpan(); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(strikethroughSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder scale(SpannableStringBuilder spannableStringBuilder, float f, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         RelativeSizeSpan relativeSizeSpan = new RelativeSizeSpan(f); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(relativeSizeSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder superscript(SpannableStringBuilder spannableStringBuilder, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         SuperscriptSpan superscriptSpan = new SuperscriptSpan(); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(superscriptSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
|  | ||||
|     public static final SpannableStringBuilder subscript(SpannableStringBuilder spannableStringBuilder, Function1<? super SpannableStringBuilder, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(spannableStringBuilder, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         SubscriptSpan subscriptSpan = new SubscriptSpan(); | ||||
|         int length = spannableStringBuilder.length(); | ||||
|         builderAction.invoke(spannableStringBuilder); | ||||
|         spannableStringBuilder.setSpan(subscriptSpan, length, spannableStringBuilder.length(), 17); | ||||
|         return spannableStringBuilder; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,42 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.Spannable; | ||||
| import android.text.SpannableString; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
| import kotlin.ranges.IntRange; | ||||
|  | ||||
| /* compiled from: SpannableString.kt */ | ||||
| @Metadata(d1 = {"\u0000(\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\r\n\u0000\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0087\b\u001a%\u0010\u0003\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00052\u0006\u0010\u0007\u001a\u00020\bH\u0086\n\u001a\u001d\u0010\u0003\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u0007\u001a\u00020\bH\u0086\n\u001a\r\u0010\u000b\u001a\u00020\u0002*\u00020\fH\u0086\b¨\u0006\r"}, d2 = {"clearSpans", "", "Landroid/text/Spannable;", "set", "start", "", "end", "span", "", "range", "Lkotlin/ranges/IntRange;", "toSpannable", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class SpannableStringKt { | ||||
|     public static final Spannable toSpannable(CharSequence charSequence) { | ||||
|         Intrinsics.checkNotNullParameter(charSequence, "<this>"); | ||||
|         SpannableString valueOf = SpannableString.valueOf(charSequence); | ||||
|         Intrinsics.checkNotNullExpressionValue(valueOf, "valueOf(this)"); | ||||
|         return valueOf; | ||||
|     } | ||||
|  | ||||
|     public static final void clearSpans(Spannable spannable) { | ||||
|         Intrinsics.checkNotNullParameter(spannable, "<this>"); | ||||
|         Spannable spannable2 = spannable; | ||||
|         Object[] spans = spannable2.getSpans(0, spannable2.length(), Object.class); | ||||
|         Intrinsics.checkNotNullExpressionValue(spans, "getSpans(start, end, T::class.java)"); | ||||
|         for (Object obj : spans) { | ||||
|             spannable.removeSpan(obj); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final void set(Spannable spannable, int i, int i2, Object span) { | ||||
|         Intrinsics.checkNotNullParameter(spannable, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(span, "span"); | ||||
|         spannable.setSpan(span, i, i2, 17); | ||||
|     } | ||||
|  | ||||
|     public static final void set(Spannable spannable, IntRange range, Object span) { | ||||
|         Intrinsics.checkNotNullParameter(spannable, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(range, "range"); | ||||
|         Intrinsics.checkNotNullParameter(span, "span"); | ||||
|         spannable.setSpan(span, range.getStart().intValue(), range.getEndInclusive().intValue(), 17); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										40
									
								
								02-Easy5/E5/sources/androidx/core/text/SpannedStringKt.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								02-Easy5/E5/sources/androidx/core/text/SpannedStringKt.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.Spanned; | ||||
| import android.text.SpannedString; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* compiled from: SpannedString.kt */ | ||||
| @Metadata(d1 = {"\u0000 \n\u0000\n\u0002\u0010\u0011\n\u0000\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\r\n\u0000\u001a:\u0010\u0000\u001a\n\u0012\u0006\b\u0001\u0012\u0002H\u00020\u0001\"\n\b\u0000\u0010\u0002\u0018\u0001*\u00020\u0003*\u00020\u00042\b\b\u0002\u0010\u0005\u001a\u00020\u00062\b\b\u0002\u0010\u0007\u001a\u00020\u0006H\u0086\b¢\u0006\u0002\u0010\b\u001a\r\u0010\t\u001a\u00020\u0004*\u00020\nH\u0086\b¨\u0006\u000b"}, d2 = {"getSpans", "", "T", "", "Landroid/text/Spanned;", "start", "", "end", "(Landroid/text/Spanned;II)[Ljava/lang/Object;", "toSpanned", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class SpannedStringKt { | ||||
|     public static final Spanned toSpanned(CharSequence charSequence) { | ||||
|         Intrinsics.checkNotNullParameter(charSequence, "<this>"); | ||||
|         SpannedString valueOf = SpannedString.valueOf(charSequence); | ||||
|         Intrinsics.checkNotNullExpressionValue(valueOf, "valueOf(this)"); | ||||
|         return valueOf; | ||||
|     } | ||||
|  | ||||
|     public static /* synthetic */ Object[] getSpans$default(Spanned spanned, int i, int i2, int i3, Object obj) { | ||||
|         if ((i3 & 1) != 0) { | ||||
|             i = 0; | ||||
|         } | ||||
|         if ((i3 & 2) != 0) { | ||||
|             i2 = spanned.length(); | ||||
|         } | ||||
|         Intrinsics.checkNotNullParameter(spanned, "<this>"); | ||||
|         Intrinsics.reifiedOperationMarker(4, "T"); | ||||
|         Object[] spans = spanned.getSpans(i, i2, Object.class); | ||||
|         Intrinsics.checkNotNullExpressionValue(spans, "getSpans(start, end, T::class.java)"); | ||||
|         return spans; | ||||
|     } | ||||
|  | ||||
|     public static final /* synthetic */ <T> T[] getSpans(Spanned spanned, int i, int i2) { | ||||
|         Intrinsics.checkNotNullParameter(spanned, "<this>"); | ||||
|         Intrinsics.reifiedOperationMarker(4, "T"); | ||||
|         Object[] spans = spanned.getSpans(i, i2, Object.class); | ||||
|         Intrinsics.checkNotNullExpressionValue(spans, "getSpans(start, end, T::class.java)"); | ||||
|         return (T[]) spans; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										17
									
								
								02-Easy5/E5/sources/androidx/core/text/StringKt.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								02-Easy5/E5/sources/androidx/core/text/StringKt.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.TextUtils; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* compiled from: String.kt */ | ||||
| @Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u000e\n\u0000\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0001H\u0086\b¨\u0006\u0002"}, d2 = {"htmlEncode", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class StringKt { | ||||
|     public static final String htmlEncode(String str) { | ||||
|         Intrinsics.checkNotNullParameter(str, "<this>"); | ||||
|         String htmlEncode = TextUtils.htmlEncode(str); | ||||
|         Intrinsics.checkNotNullExpressionValue(htmlEncode, "htmlEncode(this)"); | ||||
|         return htmlEncode; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public interface TextDirectionHeuristicCompat { | ||||
|     boolean isRtl(CharSequence charSequence, int i, int i2); | ||||
|  | ||||
|     boolean isRtl(char[] cArr, int i, int i2); | ||||
| } | ||||
| @@ -0,0 +1,166 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import java.nio.CharBuffer; | ||||
| import java.util.Locale; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class TextDirectionHeuristicsCompat { | ||||
|     private static final int STATE_FALSE = 1; | ||||
|     private static final int STATE_TRUE = 0; | ||||
|     private static final int STATE_UNKNOWN = 2; | ||||
|     public static final TextDirectionHeuristicCompat LTR = new TextDirectionHeuristicInternal(null, false); | ||||
|     public static final TextDirectionHeuristicCompat RTL = new TextDirectionHeuristicInternal(null, true); | ||||
|     public static final TextDirectionHeuristicCompat FIRSTSTRONG_LTR = new TextDirectionHeuristicInternal(FirstStrong.INSTANCE, false); | ||||
|     public static final TextDirectionHeuristicCompat FIRSTSTRONG_RTL = new TextDirectionHeuristicInternal(FirstStrong.INSTANCE, true); | ||||
|     public static final TextDirectionHeuristicCompat ANYRTL_LTR = new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, false); | ||||
|     public static final TextDirectionHeuristicCompat LOCALE = TextDirectionHeuristicLocale.INSTANCE; | ||||
|  | ||||
|     private interface TextDirectionAlgorithm { | ||||
|         int checkRtl(CharSequence charSequence, int i, int i2); | ||||
|     } | ||||
|  | ||||
|     static int isRtlText(int i) { | ||||
|         if (i != 0) { | ||||
|             return (i == 1 || i == 2) ? 0 : 2; | ||||
|         } | ||||
|         return 1; | ||||
|     } | ||||
|  | ||||
|     static int isRtlTextOrFormat(int i) { | ||||
|         if (i != 0) { | ||||
|             if (i == 1 || i == 2) { | ||||
|                 return 0; | ||||
|             } | ||||
|             switch (i) { | ||||
|                 case 14: | ||||
|                 case 15: | ||||
|                     break; | ||||
|                 case 16: | ||||
|                 case 17: | ||||
|                     return 0; | ||||
|                 default: | ||||
|                     return 2; | ||||
|             } | ||||
|         } | ||||
|         return 1; | ||||
|     } | ||||
|  | ||||
|     private static abstract class TextDirectionHeuristicImpl implements TextDirectionHeuristicCompat { | ||||
|         private final TextDirectionAlgorithm mAlgorithm; | ||||
|  | ||||
|         protected abstract boolean defaultIsRtl(); | ||||
|  | ||||
|         TextDirectionHeuristicImpl(TextDirectionAlgorithm textDirectionAlgorithm) { | ||||
|             this.mAlgorithm = textDirectionAlgorithm; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.core.text.TextDirectionHeuristicCompat | ||||
|         public boolean isRtl(char[] cArr, int i, int i2) { | ||||
|             return isRtl(CharBuffer.wrap(cArr), i, i2); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.core.text.TextDirectionHeuristicCompat | ||||
|         public boolean isRtl(CharSequence charSequence, int i, int i2) { | ||||
|             if (charSequence == null || i < 0 || i2 < 0 || charSequence.length() - i2 < i) { | ||||
|                 throw new IllegalArgumentException(); | ||||
|             } | ||||
|             if (this.mAlgorithm == null) { | ||||
|                 return defaultIsRtl(); | ||||
|             } | ||||
|             return doCheck(charSequence, i, i2); | ||||
|         } | ||||
|  | ||||
|         private boolean doCheck(CharSequence charSequence, int i, int i2) { | ||||
|             int checkRtl = this.mAlgorithm.checkRtl(charSequence, i, i2); | ||||
|             if (checkRtl == 0) { | ||||
|                 return true; | ||||
|             } | ||||
|             if (checkRtl != 1) { | ||||
|                 return defaultIsRtl(); | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class TextDirectionHeuristicInternal extends TextDirectionHeuristicImpl { | ||||
|         private final boolean mDefaultIsRtl; | ||||
|  | ||||
|         @Override // androidx.core.text.TextDirectionHeuristicsCompat.TextDirectionHeuristicImpl | ||||
|         protected boolean defaultIsRtl() { | ||||
|             return this.mDefaultIsRtl; | ||||
|         } | ||||
|  | ||||
|         TextDirectionHeuristicInternal(TextDirectionAlgorithm textDirectionAlgorithm, boolean z) { | ||||
|             super(textDirectionAlgorithm); | ||||
|             this.mDefaultIsRtl = z; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class FirstStrong implements TextDirectionAlgorithm { | ||||
|         static final FirstStrong INSTANCE = new FirstStrong(); | ||||
|  | ||||
|         @Override // androidx.core.text.TextDirectionHeuristicsCompat.TextDirectionAlgorithm | ||||
|         public int checkRtl(CharSequence charSequence, int i, int i2) { | ||||
|             int i3 = i2 + i; | ||||
|             int i4 = 2; | ||||
|             while (i < i3 && i4 == 2) { | ||||
|                 i4 = TextDirectionHeuristicsCompat.isRtlTextOrFormat(Character.getDirectionality(charSequence.charAt(i))); | ||||
|                 i++; | ||||
|             } | ||||
|             return i4; | ||||
|         } | ||||
|  | ||||
|         private FirstStrong() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class AnyStrong implements TextDirectionAlgorithm { | ||||
|         static final AnyStrong INSTANCE_RTL = new AnyStrong(true); | ||||
|         private final boolean mLookForRtl; | ||||
|  | ||||
|         @Override // androidx.core.text.TextDirectionHeuristicsCompat.TextDirectionAlgorithm | ||||
|         public int checkRtl(CharSequence charSequence, int i, int i2) { | ||||
|             int i3 = i2 + i; | ||||
|             boolean z = false; | ||||
|             while (i < i3) { | ||||
|                 int isRtlText = TextDirectionHeuristicsCompat.isRtlText(Character.getDirectionality(charSequence.charAt(i))); | ||||
|                 if (isRtlText != 0) { | ||||
|                     if (isRtlText != 1) { | ||||
|                         continue; | ||||
|                         i++; | ||||
|                     } else if (!this.mLookForRtl) { | ||||
|                         return 1; | ||||
|                     } | ||||
|                 } else if (this.mLookForRtl) { | ||||
|                     return 0; | ||||
|                 } | ||||
|                 z = true; | ||||
|                 i++; | ||||
|             } | ||||
|             if (z) { | ||||
|                 return this.mLookForRtl ? 1 : 0; | ||||
|             } | ||||
|             return 2; | ||||
|         } | ||||
|  | ||||
|         private AnyStrong(boolean z) { | ||||
|             this.mLookForRtl = z; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class TextDirectionHeuristicLocale extends TextDirectionHeuristicImpl { | ||||
|         static final TextDirectionHeuristicLocale INSTANCE = new TextDirectionHeuristicLocale(); | ||||
|  | ||||
|         TextDirectionHeuristicLocale() { | ||||
|             super(null); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.core.text.TextDirectionHeuristicsCompat.TextDirectionHeuristicImpl | ||||
|         protected boolean defaultIsRtl() { | ||||
|             return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == 1; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private TextDirectionHeuristicsCompat() { | ||||
|     } | ||||
| } | ||||
							
								
								
									
										36
									
								
								02-Easy5/E5/sources/androidx/core/text/TextUtilsCompat.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								02-Easy5/E5/sources/androidx/core/text/TextUtilsCompat.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| package androidx.core.text; | ||||
|  | ||||
| import android.text.TextUtils; | ||||
| import java.util.Locale; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class TextUtilsCompat { | ||||
|     private static final String ARAB_SCRIPT_SUBTAG = "Arab"; | ||||
|     private static final String HEBR_SCRIPT_SUBTAG = "Hebr"; | ||||
|     private static final Locale ROOT = new Locale("", ""); | ||||
|  | ||||
|     public static String htmlEncode(String str) { | ||||
|         return TextUtils.htmlEncode(str); | ||||
|     } | ||||
|  | ||||
|     public static int getLayoutDirectionFromLocale(Locale locale) { | ||||
|         return Api17Impl.getLayoutDirectionFromLocale(locale); | ||||
|     } | ||||
|  | ||||
|     private static int getLayoutDirectionFromFirstChar(Locale locale) { | ||||
|         byte directionality = Character.getDirectionality(locale.getDisplayName(locale).charAt(0)); | ||||
|         return (directionality == 1 || directionality == 2) ? 1 : 0; | ||||
|     } | ||||
|  | ||||
|     private TextUtilsCompat() { | ||||
|     } | ||||
|  | ||||
|     static class Api17Impl { | ||||
|         private Api17Impl() { | ||||
|         } | ||||
|  | ||||
|         static int getLayoutDirectionFromLocale(Locale locale) { | ||||
|             return TextUtils.getLayoutDirectionFromLocale(locale); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										292
									
								
								02-Easy5/E5/sources/androidx/core/text/util/FindAddress.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										292
									
								
								02-Easy5/E5/sources/androidx/core/text/util/FindAddress.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,292 @@ | ||||
| package androidx.core.text.util; | ||||
|  | ||||
| import java.util.Locale; | ||||
| import java.util.regex.MatchResult; | ||||
| import java.util.regex.Matcher; | ||||
| import java.util.regex.Pattern; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class FindAddress { | ||||
|     private static final String HOUSE_COMPONENT = "(?:one|[0-9]+([a-z](?=[^a-z]|$)|st|nd|rd|th)?)"; | ||||
|     private static final String HOUSE_END = "(?=[,\"'\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]|$)"; | ||||
|     private static final String HOUSE_POST_DELIM = ",\"'\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029"; | ||||
|     private static final String HOUSE_PRE_DELIM = ":,\"'\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029"; | ||||
|     private static final int MAX_ADDRESS_LINES = 5; | ||||
|     private static final int MAX_ADDRESS_WORDS = 14; | ||||
|     private static final int MAX_LOCATION_NAME_DISTANCE = 5; | ||||
|     private static final int MIN_ADDRESS_WORDS = 4; | ||||
|     private static final String NL = "\n\u000b\f\r\u0085\u2028\u2029"; | ||||
|     private static final String SP = "\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000"; | ||||
|     private static final String WORD_DELIM = ",*•\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029"; | ||||
|     private static final String WORD_END = "(?=[,*•\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]|$)"; | ||||
|     private static final String WS = "\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029"; | ||||
|     private static final int kMaxAddressNameWordLength = 25; | ||||
|     private static final ZipRange[] sStateZipCodeRanges = {new ZipRange(99, 99, -1, -1), new ZipRange(35, 36, -1, -1), new ZipRange(71, 72, -1, -1), new ZipRange(96, 96, -1, -1), new ZipRange(85, 86, -1, -1), new ZipRange(90, 96, -1, -1), new ZipRange(80, 81, -1, -1), new ZipRange(6, 6, -1, -1), new ZipRange(20, 20, -1, -1), new ZipRange(19, 19, -1, -1), new ZipRange(32, 34, -1, -1), new ZipRange(96, 96, -1, -1), new ZipRange(30, 31, -1, -1), new ZipRange(96, 96, -1, -1), new ZipRange(96, 96, -1, -1), new ZipRange(50, 52, -1, -1), new ZipRange(83, 83, -1, -1), new ZipRange(60, 62, -1, -1), new ZipRange(46, 47, -1, -1), new ZipRange(66, 67, 73, -1), new ZipRange(40, 42, -1, -1), new ZipRange(70, 71, -1, -1), new ZipRange(1, 2, -1, -1), new ZipRange(20, 21, -1, -1), new ZipRange(3, 4, -1, -1), new ZipRange(96, 96, -1, -1), new ZipRange(48, 49, -1, -1), new ZipRange(55, 56, -1, -1), new ZipRange(63, 65, -1, -1), new ZipRange(96, 96, -1, -1), new ZipRange(38, 39, -1, -1), new ZipRange(55, 56, -1, -1), new ZipRange(27, 28, -1, -1), new ZipRange(58, 58, -1, -1), new ZipRange(68, 69, -1, -1), new ZipRange(3, 4, -1, -1), new ZipRange(7, 8, -1, -1), new ZipRange(87, 88, 86, -1), new ZipRange(88, 89, 96, -1), new ZipRange(10, 14, 0, 6), new ZipRange(43, 45, -1, -1), new ZipRange(73, 74, -1, -1), new ZipRange(97, 97, -1, -1), new ZipRange(15, 19, -1, -1), new ZipRange(6, 6, 0, 9), new ZipRange(96, 96, -1, -1), new ZipRange(2, 2, -1, -1), new ZipRange(29, 29, -1, -1), new ZipRange(57, 57, -1, -1), new ZipRange(37, 38, -1, -1), new ZipRange(75, 79, 87, 88), new ZipRange(84, 84, -1, -1), new ZipRange(22, 24, 20, -1), new ZipRange(6, 9, -1, -1), new ZipRange(5, 5, -1, -1), new ZipRange(98, 99, -1, -1), new ZipRange(53, 54, -1, -1), new ZipRange(24, 26, -1, -1), new ZipRange(82, 83, -1, -1)}; | ||||
|     private static final Pattern sWordRe = Pattern.compile("[^,*•\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]+(?=[,*•\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]|$)", 2); | ||||
|     private static final Pattern sHouseNumberRe = Pattern.compile("(?:one|[0-9]+([a-z](?=[^a-z]|$)|st|nd|rd|th)?)(?:-(?:one|[0-9]+([a-z](?=[^a-z]|$)|st|nd|rd|th)?))*(?=[,\"'\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]|$)", 2); | ||||
|     private static final Pattern sStateRe = Pattern.compile("(?:(ak|alaska)|(al|alabama)|(ar|arkansas)|(as|american[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+samoa)|(az|arizona)|(ca|california)|(co|colorado)|(ct|connecticut)|(dc|district[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+of[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+columbia)|(de|delaware)|(fl|florida)|(fm|federated[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+states[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+of[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+micronesia)|(ga|georgia)|(gu|guam)|(hi|hawaii)|(ia|iowa)|(id|idaho)|(il|illinois)|(in|indiana)|(ks|kansas)|(ky|kentucky)|(la|louisiana)|(ma|massachusetts)|(md|maryland)|(me|maine)|(mh|marshall[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+islands)|(mi|michigan)|(mn|minnesota)|(mo|missouri)|(mp|northern[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+mariana[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+islands)|(ms|mississippi)|(mt|montana)|(nc|north[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+carolina)|(nd|north[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+dakota)|(ne|nebraska)|(nh|new[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+hampshire)|(nj|new[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+jersey)|(nm|new[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+mexico)|(nv|nevada)|(ny|new[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+york)|(oh|ohio)|(ok|oklahoma)|(or|oregon)|(pa|pennsylvania)|(pr|puerto[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+rico)|(pw|palau)|(ri|rhode[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+island)|(sc|south[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+carolina)|(sd|south[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+dakota)|(tn|tennessee)|(tx|texas)|(ut|utah)|(va|virginia)|(vi|virgin[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+islands)|(vt|vermont)|(wa|washington)|(wi|wisconsin)|(wv|west[\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000]+virginia)|(wy|wyoming))(?=[,*•\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]|$)", 2); | ||||
|     private static final Pattern sLocationNameRe = Pattern.compile("(?:alley|annex|arcade|ave[.]?|avenue|alameda|bayou|beach|bend|bluffs?|bottom|boulevard|branch|bridge|brooks?|burgs?|bypass|broadway|camino|camp|canyon|cape|causeway|centers?|circles?|cliffs?|club|common|corners?|course|courts?|coves?|creek|crescent|crest|crossing|crossroad|curve|circulo|dale|dam|divide|drives?|estates?|expressway|extensions?|falls?|ferry|fields?|flats?|fords?|forest|forges?|forks?|fort|freeway|gardens?|gateway|glens?|greens?|groves?|harbors?|haven|heights|highway|hills?|hollow|inlet|islands?|isle|junctions?|keys?|knolls?|lakes?|land|landing|lane|lights?|loaf|locks?|lodge|loop|mall|manors?|meadows?|mews|mills?|mission|motorway|mount|mountains?|neck|orchard|oval|overpass|parks?|parkways?|pass|passage|path|pike|pines?|plains?|plaza|points?|ports?|prairie|privada|radial|ramp|ranch|rapids?|rd[.]?|rest|ridges?|river|roads?|route|row|rue|run|shoals?|shores?|skyway|springs?|spurs?|squares?|station|stravenue|stream|st[.]?|streets?|summit|speedway|terrace|throughway|trace|track|trafficway|trail|tunnel|turnpike|underpass|unions?|valleys?|viaduct|views?|villages?|ville|vista|walks?|wall|ways?|wells?|xing|xrd)(?=[,*•\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]|$)", 2); | ||||
|     private static final Pattern sSuffixedNumberRe = Pattern.compile("([0-9]+)(st|nd|rd|th)", 2); | ||||
|     private static final Pattern sZipCodeRe = Pattern.compile("(?:[0-9]{5}(?:-[0-9]{4})?)(?=[,*•\t  \u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006 \u2008\u2009\u200a \u205f\u3000\n\u000b\f\r\u0085\u2028\u2029]|$)", 2); | ||||
|  | ||||
|     private static class ZipRange { | ||||
|         int mException1; | ||||
|         int mException2; | ||||
|         int mHigh; | ||||
|         int mLow; | ||||
|  | ||||
|         ZipRange(int i, int i2, int i3, int i4) { | ||||
|             this.mLow = i; | ||||
|             this.mHigh = i2; | ||||
|             this.mException1 = i3; | ||||
|             this.mException2 = i4; | ||||
|         } | ||||
|  | ||||
|         boolean matches(String str) { | ||||
|             int parseInt = Integer.parseInt(str.substring(0, 2)); | ||||
|             return (this.mLow <= parseInt && parseInt <= this.mHigh) || parseInt == this.mException1 || parseInt == this.mException2; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static boolean checkHouseNumber(String str) { | ||||
|         int i = 0; | ||||
|         for (int i2 = 0; i2 < str.length(); i2++) { | ||||
|             if (Character.isDigit(str.charAt(i2))) { | ||||
|                 i++; | ||||
|             } | ||||
|         } | ||||
|         if (i > 5) { | ||||
|             return false; | ||||
|         } | ||||
|         Matcher matcher = sSuffixedNumberRe.matcher(str); | ||||
|         if (!matcher.find()) { | ||||
|             return true; | ||||
|         } | ||||
|         int parseInt = Integer.parseInt(matcher.group(1)); | ||||
|         if (parseInt == 0) { | ||||
|             return false; | ||||
|         } | ||||
|         String lowerCase = matcher.group(2).toLowerCase(Locale.getDefault()); | ||||
|         int i3 = parseInt % 10; | ||||
|         if (i3 == 1) { | ||||
|             return lowerCase.equals(parseInt % 100 != 11 ? "st" : "th"); | ||||
|         } | ||||
|         if (i3 == 2) { | ||||
|             return lowerCase.equals(parseInt % 100 != 12 ? "nd" : "th"); | ||||
|         } | ||||
|         if (i3 != 3) { | ||||
|             return lowerCase.equals("th"); | ||||
|         } | ||||
|         return lowerCase.equals(parseInt % 100 != 13 ? "rd" : "th"); | ||||
|     } | ||||
|  | ||||
|     public static MatchResult matchHouseNumber(String str, int i) { | ||||
|         if (i > 0 && HOUSE_PRE_DELIM.indexOf(str.charAt(i - 1)) == -1) { | ||||
|             return null; | ||||
|         } | ||||
|         Matcher region = sHouseNumberRe.matcher(str).region(i, str.length()); | ||||
|         if (region.lookingAt()) { | ||||
|             MatchResult matchResult = region.toMatchResult(); | ||||
|             if (checkHouseNumber(matchResult.group(0))) { | ||||
|                 return matchResult; | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     public static MatchResult matchState(String str, int i) { | ||||
|         if (i > 0 && WORD_DELIM.indexOf(str.charAt(i - 1)) == -1) { | ||||
|             return null; | ||||
|         } | ||||
|         Matcher region = sStateRe.matcher(str).region(i, str.length()); | ||||
|         if (region.lookingAt()) { | ||||
|             return region.toMatchResult(); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private static boolean isValidZipCode(String str, MatchResult matchResult) { | ||||
|         if (matchResult == null) { | ||||
|             return false; | ||||
|         } | ||||
|         int groupCount = matchResult.groupCount(); | ||||
|         while (true) { | ||||
|             if (groupCount <= 0) { | ||||
|                 break; | ||||
|             } | ||||
|             int i = groupCount - 1; | ||||
|             if (matchResult.group(groupCount) != null) { | ||||
|                 groupCount = i; | ||||
|                 break; | ||||
|             } | ||||
|             groupCount = i; | ||||
|         } | ||||
|         return sZipCodeRe.matcher(str).matches() && sStateZipCodeRanges[groupCount].matches(str); | ||||
|     } | ||||
|  | ||||
|     public static boolean isValidZipCode(String str, String str2) { | ||||
|         return isValidZipCode(str, matchState(str2, 0)); | ||||
|     } | ||||
|  | ||||
|     public static boolean isValidZipCode(String str) { | ||||
|         return sZipCodeRe.matcher(str).matches(); | ||||
|     } | ||||
|  | ||||
|     public static boolean isValidLocationName(String str) { | ||||
|         return sLocationNameRe.matcher(str).matches(); | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Code restructure failed: missing block: B:74:0x0026, code lost: | ||||
|      | ||||
|         return -r13; | ||||
|      */ | ||||
|     /* | ||||
|         Code decompiled incorrectly, please refer to instructions dump. | ||||
|         To view partially-correct add '--show-bad-code' argument | ||||
|     */ | ||||
|     private static int attemptMatch(java.lang.String r13, java.util.regex.MatchResult r14) { | ||||
|         /* | ||||
|             int r14 = r14.end() | ||||
|             java.util.regex.Pattern r0 = androidx.core.text.util.FindAddress.sWordRe | ||||
|             java.util.regex.Matcher r0 = r0.matcher(r13) | ||||
|             r1 = -1 | ||||
|             r2 = 1 | ||||
|             r3 = 0 | ||||
|             java.lang.String r4 = "" | ||||
|             r5 = 1 | ||||
|             r6 = 1 | ||||
|             r7 = 1 | ||||
|             r8 = 0 | ||||
|             r9 = -1 | ||||
|             r10 = -1 | ||||
|         L15: | ||||
|             int r11 = r13.length() | ||||
|             if (r14 >= r11) goto Ld5 | ||||
|             boolean r11 = r0.find(r14) | ||||
|             if (r11 != 0) goto L27 | ||||
|             int r13 = r13.length() | ||||
|         L25: | ||||
|             int r13 = -r13 | ||||
|             return r13 | ||||
|         L27: | ||||
|             int r11 = r0.end() | ||||
|             int r12 = r0.start() | ||||
|             int r11 = r11 - r12 | ||||
|             r12 = 25 | ||||
|             if (r11 <= r12) goto L39 | ||||
|             int r13 = r0.end() | ||||
|             goto L25 | ||||
|         L39: | ||||
|             int r11 = r0.start() | ||||
|             if (r14 >= r11) goto L51 | ||||
|             int r11 = r14 + 1 | ||||
|             char r14 = r13.charAt(r14) | ||||
|             java.lang.String r12 = "\n\u000b\f\r\u0085\u2028\u2029" | ||||
|             int r14 = r12.indexOf(r14) | ||||
|             if (r14 == r1) goto L4f | ||||
|             int r5 = r5 + 1 | ||||
|         L4f: | ||||
|             r14 = r11 | ||||
|             goto L39 | ||||
|         L51: | ||||
|             r11 = 5 | ||||
|             if (r5 <= r11) goto L56 | ||||
|             goto Ld5 | ||||
|         L56: | ||||
|             int r6 = r6 + r2 | ||||
|             r12 = 14 | ||||
|             if (r6 <= r12) goto L5d | ||||
|             goto Ld5 | ||||
|         L5d: | ||||
|             java.util.regex.MatchResult r12 = matchHouseNumber(r13, r14) | ||||
|             if (r12 == 0) goto L6d | ||||
|             if (r7 == 0) goto L69 | ||||
|             if (r5 <= r2) goto L69 | ||||
|             int r13 = -r14 | ||||
|             return r13 | ||||
|         L69: | ||||
|             if (r9 != r1) goto Lcb | ||||
|             r9 = r14 | ||||
|             goto Lcb | ||||
|         L6d: | ||||
|             java.lang.String r7 = r0.group(r3) | ||||
|             boolean r7 = isValidLocationName(r7) | ||||
|             if (r7 == 0) goto L7a | ||||
|             r7 = 0 | ||||
|             r8 = 1 | ||||
|             goto Lcb | ||||
|         L7a: | ||||
|             if (r6 != r11) goto L83 | ||||
|             if (r8 != 0) goto L83 | ||||
|             int r14 = r0.end() | ||||
|             goto Ld5 | ||||
|         L83: | ||||
|             if (r8 == 0) goto Lca | ||||
|             r7 = 4 | ||||
|             if (r6 <= r7) goto Lca | ||||
|             java.util.regex.MatchResult r14 = matchState(r13, r14) | ||||
|             if (r14 == 0) goto Lca | ||||
|             java.lang.String r7 = "et" | ||||
|             boolean r4 = r4.equals(r7) | ||||
|             if (r4 == 0) goto La7 | ||||
|             java.lang.String r4 = r14.group(r3) | ||||
|             java.lang.String r7 = "al" | ||||
|             boolean r4 = r4.equals(r7) | ||||
|             if (r4 == 0) goto La7 | ||||
|             int r14 = r14.end() | ||||
|             goto Ld5 | ||||
|         La7: | ||||
|             java.util.regex.Pattern r4 = androidx.core.text.util.FindAddress.sWordRe | ||||
|             java.util.regex.Matcher r4 = r4.matcher(r13) | ||||
|             int r7 = r14.end() | ||||
|             boolean r7 = r4.find(r7) | ||||
|             if (r7 == 0) goto Lc6 | ||||
|             java.lang.String r7 = r4.group(r3) | ||||
|             boolean r14 = isValidZipCode(r7, r14) | ||||
|             if (r14 == 0) goto Lca | ||||
|             int r13 = r4.end() | ||||
|             return r13 | ||||
|         Lc6: | ||||
|             int r10 = r14.end() | ||||
|         Lca: | ||||
|             r7 = 0 | ||||
|         Lcb: | ||||
|             java.lang.String r4 = r0.group(r3) | ||||
|             int r14 = r0.end() | ||||
|             goto L15 | ||||
|         Ld5: | ||||
|             if (r10 <= 0) goto Ld8 | ||||
|             return r10 | ||||
|         Ld8: | ||||
|             if (r9 <= 0) goto Ldb | ||||
|             goto Ldc | ||||
|         Ldb: | ||||
|             r9 = r14 | ||||
|         Ldc: | ||||
|             int r13 = -r9 | ||||
|             return r13 | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: androidx.core.text.util.FindAddress.attemptMatch(java.lang.String, java.util.regex.MatchResult):int"); | ||||
|     } | ||||
|  | ||||
|     static String findAddress(String str) { | ||||
|         Matcher matcher = sHouseNumberRe.matcher(str); | ||||
|         int i = 0; | ||||
|         while (matcher.find(i)) { | ||||
|             if (checkHouseNumber(matcher.group(0))) { | ||||
|                 int start = matcher.start(); | ||||
|                 int attemptMatch = attemptMatch(str, matcher); | ||||
|                 if (attemptMatch > 0) { | ||||
|                     return str.substring(start, attemptMatch); | ||||
|                 } | ||||
|                 i = -attemptMatch; | ||||
|             } else { | ||||
|                 i = matcher.end(); | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private FindAddress() { | ||||
|     } | ||||
| } | ||||
							
								
								
									
										344
									
								
								02-Easy5/E5/sources/androidx/core/text/util/LinkifyCompat.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										344
									
								
								02-Easy5/E5/sources/androidx/core/text/util/LinkifyCompat.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,344 @@ | ||||
| package androidx.core.text.util; | ||||
|  | ||||
| import android.os.Build; | ||||
| import android.text.Spannable; | ||||
| import android.text.SpannableString; | ||||
| import android.text.method.LinkMovementMethod; | ||||
| import android.text.style.URLSpan; | ||||
| import android.text.util.Linkify; | ||||
| import android.webkit.WebView; | ||||
| import android.widget.TextView; | ||||
| import androidx.core.net.MailTo; | ||||
| import androidx.core.text.util.LinkifyCompat; | ||||
| import androidx.core.util.PatternsCompat; | ||||
| import java.io.UnsupportedEncodingException; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
| import java.net.URLEncoder; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collections; | ||||
| import java.util.Comparator; | ||||
| import java.util.Iterator; | ||||
| import java.util.Locale; | ||||
| import java.util.regex.Matcher; | ||||
| import java.util.regex.Pattern; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class LinkifyCompat { | ||||
|     private static final String[] EMPTY_STRING = new String[0]; | ||||
|     private static final Comparator<LinkSpec> COMPARATOR = new Comparator() { // from class: androidx.core.text.util.LinkifyCompat$$ExternalSyntheticLambda0 | ||||
|         @Override // java.util.Comparator | ||||
|         public final int compare(Object obj, Object obj2) { | ||||
|             return LinkifyCompat.lambda$static$0((LinkifyCompat.LinkSpec) obj, (LinkifyCompat.LinkSpec) obj2); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface LinkifyMask { | ||||
|     } | ||||
|  | ||||
|     private static boolean shouldAddLinksFallbackToFramework() { | ||||
|         return Build.VERSION.SDK_INT >= 28; | ||||
|     } | ||||
|  | ||||
|     static /* synthetic */ int lambda$static$0(LinkSpec linkSpec, LinkSpec linkSpec2) { | ||||
|         if (linkSpec.start < linkSpec2.start) { | ||||
|             return -1; | ||||
|         } | ||||
|         if (linkSpec.start > linkSpec2.start) { | ||||
|             return 1; | ||||
|         } | ||||
|         return Integer.compare(linkSpec2.end, linkSpec.end); | ||||
|     } | ||||
|  | ||||
|     public static boolean addLinks(Spannable spannable, int i) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             return Linkify.addLinks(spannable, i); | ||||
|         } | ||||
|         if (i == 0) { | ||||
|             return false; | ||||
|         } | ||||
|         URLSpan[] uRLSpanArr = (URLSpan[]) spannable.getSpans(0, spannable.length(), URLSpan.class); | ||||
|         for (int length = uRLSpanArr.length - 1; length >= 0; length--) { | ||||
|             spannable.removeSpan(uRLSpanArr[length]); | ||||
|         } | ||||
|         if ((i & 4) != 0) { | ||||
|             Linkify.addLinks(spannable, 4); | ||||
|         } | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         if ((i & 1) != 0) { | ||||
|             gatherLinks(arrayList, spannable, PatternsCompat.AUTOLINK_WEB_URL, new String[]{"http://", "https://", "rtsp://"}, Linkify.sUrlMatchFilter, null); | ||||
|         } | ||||
|         if ((i & 2) != 0) { | ||||
|             gatherLinks(arrayList, spannable, PatternsCompat.AUTOLINK_EMAIL_ADDRESS, new String[]{MailTo.MAILTO_SCHEME}, null, null); | ||||
|         } | ||||
|         if ((i & 8) != 0) { | ||||
|             gatherMapLinks(arrayList, spannable); | ||||
|         } | ||||
|         pruneOverlaps(arrayList, spannable); | ||||
|         if (arrayList.size() == 0) { | ||||
|             return false; | ||||
|         } | ||||
|         Iterator it = arrayList.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             LinkSpec linkSpec = (LinkSpec) it.next(); | ||||
|             if (linkSpec.frameworkAddedSpan == null) { | ||||
|                 applyLink(linkSpec.url, linkSpec.start, linkSpec.end, spannable); | ||||
|             } | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public static boolean addLinks(TextView textView, int i) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             return Linkify.addLinks(textView, i); | ||||
|         } | ||||
|         if (i == 0) { | ||||
|             return false; | ||||
|         } | ||||
|         CharSequence text = textView.getText(); | ||||
|         if (text instanceof Spannable) { | ||||
|             if (addLinks((Spannable) text, i)) { | ||||
|                 addLinkMovementMethod(textView); | ||||
|                 return true; | ||||
|             } | ||||
|         } else { | ||||
|             SpannableString valueOf = SpannableString.valueOf(text); | ||||
|             if (addLinks(valueOf, i)) { | ||||
|                 addLinkMovementMethod(textView); | ||||
|                 textView.setText(valueOf); | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     public static void addLinks(TextView textView, Pattern pattern, String str) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             Linkify.addLinks(textView, pattern, str); | ||||
|         } else { | ||||
|             addLinks(textView, pattern, str, (String[]) null, (Linkify.MatchFilter) null, (Linkify.TransformFilter) null); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static void addLinks(TextView textView, Pattern pattern, String str, Linkify.MatchFilter matchFilter, Linkify.TransformFilter transformFilter) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             Linkify.addLinks(textView, pattern, str, matchFilter, transformFilter); | ||||
|         } else { | ||||
|             addLinks(textView, pattern, str, (String[]) null, matchFilter, transformFilter); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static void addLinks(TextView textView, Pattern pattern, String str, String[] strArr, Linkify.MatchFilter matchFilter, Linkify.TransformFilter transformFilter) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             Api24Impl.addLinks(textView, pattern, str, strArr, matchFilter, transformFilter); | ||||
|             return; | ||||
|         } | ||||
|         SpannableString valueOf = SpannableString.valueOf(textView.getText()); | ||||
|         if (addLinks(valueOf, pattern, str, strArr, matchFilter, transformFilter)) { | ||||
|             textView.setText(valueOf); | ||||
|             addLinkMovementMethod(textView); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static boolean addLinks(Spannable spannable, Pattern pattern, String str) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             return Linkify.addLinks(spannable, pattern, str); | ||||
|         } | ||||
|         return addLinks(spannable, pattern, str, (String[]) null, (Linkify.MatchFilter) null, (Linkify.TransformFilter) null); | ||||
|     } | ||||
|  | ||||
|     public static boolean addLinks(Spannable spannable, Pattern pattern, String str, Linkify.MatchFilter matchFilter, Linkify.TransformFilter transformFilter) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             return Linkify.addLinks(spannable, pattern, str, matchFilter, transformFilter); | ||||
|         } | ||||
|         return addLinks(spannable, pattern, str, (String[]) null, matchFilter, transformFilter); | ||||
|     } | ||||
|  | ||||
|     public static boolean addLinks(Spannable spannable, Pattern pattern, String str, String[] strArr, Linkify.MatchFilter matchFilter, Linkify.TransformFilter transformFilter) { | ||||
|         if (shouldAddLinksFallbackToFramework()) { | ||||
|             return Api24Impl.addLinks(spannable, pattern, str, strArr, matchFilter, transformFilter); | ||||
|         } | ||||
|         if (str == null) { | ||||
|             str = ""; | ||||
|         } | ||||
|         if (strArr == null || strArr.length < 1) { | ||||
|             strArr = EMPTY_STRING; | ||||
|         } | ||||
|         String[] strArr2 = new String[strArr.length + 1]; | ||||
|         strArr2[0] = str.toLowerCase(Locale.ROOT); | ||||
|         int i = 0; | ||||
|         while (i < strArr.length) { | ||||
|             String str2 = strArr[i]; | ||||
|             i++; | ||||
|             strArr2[i] = str2 == null ? "" : str2.toLowerCase(Locale.ROOT); | ||||
|         } | ||||
|         Matcher matcher = pattern.matcher(spannable); | ||||
|         boolean z = false; | ||||
|         while (matcher.find()) { | ||||
|             int start = matcher.start(); | ||||
|             int end = matcher.end(); | ||||
|             String group = matcher.group(0); | ||||
|             if (matchFilter == null || matchFilter.acceptMatch(spannable, start, end)) { | ||||
|                 if (group != null) { | ||||
|                     applyLink(makeUrl(group, strArr2, matcher, transformFilter), start, end, spannable); | ||||
|                     z = true; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return z; | ||||
|     } | ||||
|  | ||||
|     private static void addLinkMovementMethod(TextView textView) { | ||||
|         if ((textView.getMovementMethod() instanceof LinkMovementMethod) || !textView.getLinksClickable()) { | ||||
|             return; | ||||
|         } | ||||
|         textView.setMovementMethod(LinkMovementMethod.getInstance()); | ||||
|     } | ||||
|  | ||||
|     private static String makeUrl(String str, String[] strArr, Matcher matcher, Linkify.TransformFilter transformFilter) { | ||||
|         boolean z; | ||||
|         if (transformFilter != null) { | ||||
|             str = transformFilter.transformUrl(matcher, str); | ||||
|         } | ||||
|         int length = strArr.length; | ||||
|         int i = 0; | ||||
|         while (true) { | ||||
|             if (i >= length) { | ||||
|                 z = false; | ||||
|                 break; | ||||
|             } | ||||
|             String str2 = strArr[i]; | ||||
|             if (str.regionMatches(true, 0, str2, 0, str2.length())) { | ||||
|                 z = true; | ||||
|                 if (!str.regionMatches(false, 0, str2, 0, str2.length())) { | ||||
|                     str = str2 + str.substring(str2.length()); | ||||
|                 } | ||||
|             } else { | ||||
|                 i++; | ||||
|             } | ||||
|         } | ||||
|         if (z || strArr.length <= 0) { | ||||
|             return str; | ||||
|         } | ||||
|         return strArr[0] + str; | ||||
|     } | ||||
|  | ||||
|     private static void gatherLinks(ArrayList<LinkSpec> arrayList, Spannable spannable, Pattern pattern, String[] strArr, Linkify.MatchFilter matchFilter, Linkify.TransformFilter transformFilter) { | ||||
|         Matcher matcher = pattern.matcher(spannable); | ||||
|         while (matcher.find()) { | ||||
|             int start = matcher.start(); | ||||
|             int end = matcher.end(); | ||||
|             String group = matcher.group(0); | ||||
|             if (matchFilter == null || matchFilter.acceptMatch(spannable, start, end)) { | ||||
|                 if (group != null) { | ||||
|                     LinkSpec linkSpec = new LinkSpec(); | ||||
|                     linkSpec.url = makeUrl(group, strArr, matcher, transformFilter); | ||||
|                     linkSpec.start = start; | ||||
|                     linkSpec.end = end; | ||||
|                     arrayList.add(linkSpec); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static void applyLink(String str, int i, int i2, Spannable spannable) { | ||||
|         spannable.setSpan(new URLSpan(str), i, i2, 33); | ||||
|     } | ||||
|  | ||||
|     private static void gatherMapLinks(ArrayList<LinkSpec> arrayList, Spannable spannable) { | ||||
|         int indexOf; | ||||
|         String obj = spannable.toString(); | ||||
|         int i = 0; | ||||
|         while (true) { | ||||
|             try { | ||||
|                 String findAddress = findAddress(obj); | ||||
|                 if (findAddress != null && (indexOf = obj.indexOf(findAddress)) >= 0) { | ||||
|                     LinkSpec linkSpec = new LinkSpec(); | ||||
|                     int length = findAddress.length() + indexOf; | ||||
|                     linkSpec.start = indexOf + i; | ||||
|                     i += length; | ||||
|                     linkSpec.end = i; | ||||
|                     obj = obj.substring(length); | ||||
|                     try { | ||||
|                         linkSpec.url = "geo:0,0?q=" + URLEncoder.encode(findAddress, "UTF-8"); | ||||
|                         arrayList.add(linkSpec); | ||||
|                     } catch (UnsupportedEncodingException unused) { | ||||
|                     } | ||||
|                 } | ||||
|                 return; | ||||
|             } catch (UnsupportedOperationException unused2) { | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static String findAddress(String str) { | ||||
|         if (Build.VERSION.SDK_INT >= 28) { | ||||
|             return WebView.findAddress(str); | ||||
|         } | ||||
|         return FindAddress.findAddress(str); | ||||
|     } | ||||
|  | ||||
|     private static void pruneOverlaps(ArrayList<LinkSpec> arrayList, Spannable spannable) { | ||||
|         int i; | ||||
|         int i2 = 0; | ||||
|         for (URLSpan uRLSpan : (URLSpan[]) spannable.getSpans(0, spannable.length(), URLSpan.class)) { | ||||
|             LinkSpec linkSpec = new LinkSpec(); | ||||
|             linkSpec.frameworkAddedSpan = uRLSpan; | ||||
|             linkSpec.start = spannable.getSpanStart(uRLSpan); | ||||
|             linkSpec.end = spannable.getSpanEnd(uRLSpan); | ||||
|             arrayList.add(linkSpec); | ||||
|         } | ||||
|         Collections.sort(arrayList, COMPARATOR); | ||||
|         int size = arrayList.size(); | ||||
|         while (i2 < size - 1) { | ||||
|             LinkSpec linkSpec2 = arrayList.get(i2); | ||||
|             int i3 = i2 + 1; | ||||
|             LinkSpec linkSpec3 = arrayList.get(i3); | ||||
|             if (linkSpec2.start <= linkSpec3.start && linkSpec2.end > linkSpec3.start) { | ||||
|                 if (linkSpec3.end > linkSpec2.end && linkSpec2.end - linkSpec2.start <= linkSpec3.end - linkSpec3.start) { | ||||
|                     i = linkSpec2.end - linkSpec2.start < linkSpec3.end - linkSpec3.start ? i2 : -1; | ||||
|                 } else { | ||||
|                     i = i3; | ||||
|                 } | ||||
|                 if (i != -1) { | ||||
|                     Object obj = arrayList.get(i).frameworkAddedSpan; | ||||
|                     if (obj != null) { | ||||
|                         spannable.removeSpan(obj); | ||||
|                     } | ||||
|                     arrayList.remove(i); | ||||
|                     size--; | ||||
|                 } | ||||
|             } | ||||
|             i2 = i3; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private LinkifyCompat() { | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     static class LinkSpec { | ||||
|         int end; | ||||
|         URLSpan frameworkAddedSpan; | ||||
|         int start; | ||||
|         String url; | ||||
|  | ||||
|         LinkSpec() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class Api24Impl { | ||||
|         private Api24Impl() { | ||||
|         } | ||||
|  | ||||
|         static void addLinks(TextView textView, Pattern pattern, String str, String[] strArr, Linkify.MatchFilter matchFilter, Linkify.TransformFilter transformFilter) { | ||||
|             Linkify.addLinks(textView, pattern, str, strArr, matchFilter, transformFilter); | ||||
|         } | ||||
|  | ||||
|         static boolean addLinks(Spannable spannable, Pattern pattern, String str, String[] strArr, Linkify.MatchFilter matchFilter, Linkify.TransformFilter transformFilter) { | ||||
|             return Linkify.addLinks(spannable, pattern, str, strArr, matchFilter, transformFilter); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user