1 /* 2 * Copyright 2022 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 * Note: this is now deprecated. In order to display a link in the text, add a [LinkAnnotation] to 25 * the AnnotatedString and pass it to the Text composable function 26 */ 27 @ExperimentalTextApi 28 @Deprecated("Use LinkAnnotatation.Url(url) instead", ReplaceWith("LinkAnnotation.Url(url)")) 29 @Suppress("Deprecation") 30 class UrlAnnotation(val url: String) : AnnotatedString.Annotation { equalsnull31 override fun equals(other: Any?): Boolean { 32 if (this === other) return true 33 if (other !is UrlAnnotation) return false 34 if (url != other.url) return false 35 return true 36 } 37 hashCodenull38 override fun hashCode(): Int { 39 return url.hashCode() 40 } 41 toStringnull42 override fun toString(): String { 43 return "UrlAnnotation(url=$url)" 44 } 45 } 46