Package icyllis.modernui.text.style

# Class LocaleSpan

java.lang.Object
icyllis.modernui.text.style.CharacterStyle
icyllis.modernui.text.style.MetricAffectingSpan
icyllis.modernui.text.style.LocaleSpan

All Implemented Interfaces:
  `ParcelableSpan`, `UpdateAppearance`, `UpdateLayout`, `Parcelable`

public class LocaleSpan extends MetricAffectingSpan implements ParcelableSpan
Changes the `Locale` of the text to which the span is attached.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable

  `Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LocaleSpan(Parcel source)`
  `LocaleSpan(Locale locale)`
  Creates a `LocaleSpan` from a well-formed `Locale`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Locale`
  `getLocale()`
  `int`
  `getSpanTypeId()`
  Return a special type identifier for this span class.
  `void`
  `updateMeasureState(TextPaint paint)`
  Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.
  `void`
  `writeToParcel(Parcel dest, int flags)`
  The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.

  ### Methods inherited from class icyllis.modernui.text.style.MetricAffectingSpan

  `getUnderlying, updateDrawState`

  ### Methods inherited from class icyllis.modernui.text.style.CharacterStyle

  `wrap`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LocaleSpan

    public LocaleSpan(@Nullable Locale locale)
    Creates a `LocaleSpan` from a well-formed `Locale`. Note that only `Locale` objects that can be created by `Locale.forLanguageTag(String)` are supported.

    Caveat: Do not specify any `Locale` object that cannot be created by `Locale.forLanguageTag(String)`. `new Locale(" a ", " b c", " d")` is an example of such a malformed `Locale` object.

    Parameters:
      `locale` - The `Locale` of the text to which the span is attached.

  - ### LocaleSpan

    public LocaleSpan(@NonNull Parcel source)

- ## Method Details

  - ### getSpanTypeId

    public int getSpanTypeId()
    Description copied from interface: `ParcelableSpan`
    Return a special type identifier for this span class.
    Specified by:
      `getSpanTypeId` in interface `ParcelableSpan`

  - ### writeToParcel

    public void writeToParcel(Parcel dest, int flags)
    Description copied from interface: `Parcelable`
    The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.
    Specified by:
      `writeToParcel` in interface `Parcelable`
    Parameters:
      `dest` - the parcel to write the object's data to
      `flags` - the flags about how the object should be written

  - ### updateMeasureState

    public void updateMeasureState(@NonNull TextPaint paint)
    Description copied from class: `MetricAffectingSpan`
    Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.
    Specified by:
      `updateMeasureState` in class `MetricAffectingSpan`
    Parameters:
      `paint` - the paint used for measuring the text

  - ### getLocale

    @Nullable public Locale getLocale()
    Returns:
      The `Locale` for this span. If multiple locales are associated with this span, only the first locale is returned. `null` if no `Locale` is specified.