content: package androidx.emoji2.text;
  
  import android.graphics.Canvas;
  import android.graphics.Paint;
  import android.graphics.Typeface;
  import androidx.emoji2.text.flatbuffer.MetadataItem;
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  import mt.Log1F380D;
  
  /* compiled from: 006E */
  public class EmojiMetadata {
      public static final int HAS_GLYPH_ABSENT = 1;
      public static final int HAS_GLYPH_EXISTS = 2;
      public static final int HAS_GLYPH_UNKNOWN = 0;
      private static final ThreadLocal<MetadataItem> sMetadataItem = new ThreadLocal<>();
      private volatile int mHasGlyph = 0;
      private final int mIndex;
      private final MetadataRepo mMetadataRepo;
  
      @Retention(RetentionPolicy.SOURCE)
      public @interface HasGlyph {
      }
  
      EmojiMetadata(MetadataRepo metadataRepo, int index) {
          this.mMetadataRepo = metadataRepo;
          this.mIndex = index;
      }
  
      private MetadataItem getMetadataItem() {
          ThreadLocal<MetadataItem> threadLocal = sMetadataItem;
          MetadataItem metadataItem = threadLocal.get();
          if (metadataItem == null) {
              metadataItem = new MetadataItem();
              threadLocal.set(metadataItem);
          }
          this.mMetadataRepo.getMetadataList().list(metadataItem, this.mIndex);
          return metadataItem;
      }
  
      public void draw(Canvas canvas, float x, float y, Paint paint) {
          Typeface typeface = this.mMetadataRepo.getTypeface();
          Typeface typeface2 = paint.getTypeface();
          paint.setTypeface(typeface);
          canvas.drawText(this.mMetadataRepo.getEmojiCharArray(), this.mIndex * 2, 2, x, y, paint);
          paint.setTypeface(typeface2);
      }
  
      public int getCodepointAt(int index) {
          return getMetadataItem().codepoints(index);
      }
  
      public int getCodepointsLength() {
          return getMetadataItem().codepointsLength();
      }
  
      public short getCompatAdded() {
          return getMetadataItem().compatAdded();
      }
  
      public int getHasGlyph() {
          return this.mHasGlyph;
      }
  
      public short getHeight() {
          return getMetadataItem().height();
      }
  
      public int getId() {
          return getMetadataItem().id();
      }
  
      public short getSdkAdded() {
          return getMetadataItem().sdkAdded();
      }
  
      public Typeface getTypeface() {
          return this.mMetadataRepo.getTypeface();
      }
  
      public short getWidth() {
          return getMetadataItem().width();
      }
  
      public boolean isDefaultEmoji() {
          return getMetadataItem().emojiStyle();
      }
  
      public void resetHasGlyphCache() {
          this.mHasGlyph = 0;
      }
  
      public void setHasGlyph(boolean hasGlyph) {
          this.mHasGlyph = hasGlyph ? 2 : 1;
      }
  
      public String toString() {
          StringBuilder sb = new StringBuilder();
          sb.append(super.toString());
          sb.append(", id:");
          String hexString = Integer.toHexString(getId());
          Log1F380D.a((Object) hexString);
          sb.append(hexString);
          sb.append(", codepoints:");
          int codepointsLength = getCodepointsLength();
          for (int i = 0; i < codepointsLength; i++) {
              String hexString2 = Integer.toHexString(getCodepointAt(i));
              Log1F380D.a((Object) hexString2);
              sb.append(hexString2);
              sb.append(" ");
          }
          return sb.toString();
      }
  }
  