1 /* 2 * Copyright 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.compose.ui.text 18 19 /** 20 * An annotation that contains the metadata intended for text-to-speech engine. If the text is being 21 * processed by a text-to-speech engine, the engine may use the data in this annotation in addition 22 * to or instead of its associated text. 23 */ 24 sealed class TtsAnnotation : AnnotatedString.Annotation 25 26 /** 27 * The text associated with this annotation is a series of characters that have to be read verbatim. 28 * 29 * @param verbatim a string where the characters are read verbatim except whitespace. 30 */ 31 class VerbatimTtsAnnotation(val verbatim: String) : TtsAnnotation() { equalsnull32 override fun equals(other: Any?): Boolean { 33 if (this === other) return true 34 if (other !is VerbatimTtsAnnotation) return false 35 if (verbatim != other.verbatim) return false 36 return true 37 } 38 hashCodenull39 override fun hashCode(): Int { 40 return verbatim.hashCode() 41 } 42 toStringnull43 override fun toString(): String { 44 return "VerbatimTtsAnnotation(verbatim=$verbatim)" 45 } 46 } 47