IndexableSticker.java 5.57 KB
package com.bitstrips.imoji.firebase.models;

import com.bitstrips.imoji.firebase.AppIndexablesFactory;
import com.bitstrips.imoji.models.Sticker;
import com.google.firebase.appindexing.FirebaseAppIndexingException;
import com.google.firebase.appindexing.Indexable;
import com.google.firebase.appindexing.Indexable.Builder;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang3.builder.EqualsBuilder;

public class IndexableSticker
  implements Serializable
{
  private static final String INDEXABLE_TYPE = "Sticker";
  private static final String KEYWORDS_KEY = "keywords";
  private static final String STICKER_PACKS_KEY = "partOf";
  @SerializedName("capabilities")
  List<String> mCapabilities;
  @SerializedName("comic_id")
  String mComicId;
  @SerializedName("generated_url")
  String mGeneratedUrl;
  @SerializedName("url")
  String mImageUrl;
  @SerializedName("sticker_pack_names")
  List<String> mStickerPackNames;
  @SerializedName("tags")
  List<String> mTags;
  @SerializedName("template_id")
  String mTemplateId;
  
  private IndexableSticker(String paramString1, String paramString2, String paramString3, String paramString4, List<String> paramList1, List<String> paramList2, List<String> paramList3)
  {
    this.mTemplateId = paramString1;
    this.mComicId = paramString2;
    this.mGeneratedUrl = paramString3;
    this.mImageUrl = paramString4;
    this.mTags = paramList1;
    this.mCapabilities = paramList2;
    this.mStickerPackNames = paramList3;
  }
  
  public boolean equals(Object paramObject)
  {
    if (paramObject == this) {
      return true;
    }
    if (!(paramObject instanceof IndexableSticker)) {
      return false;
    }
    paramObject = (IndexableSticker)paramObject;
    return new EqualsBuilder().append(this.mComicId, ((IndexableSticker)paramObject).getComicId()).append(this.mGeneratedUrl, ((IndexableSticker)paramObject).getGeneratedUrl()).append(this.mImageUrl, ((IndexableSticker)paramObject).getImageUrl()).append(this.mTags, ((IndexableSticker)paramObject).getTags()).append(this.mStickerPackNames, ((IndexableSticker)paramObject).getStickerPackNames()).isEquals();
  }
  
  public String getComicId()
  {
    return this.mComicId;
  }
  
  public String getGeneratedUrl()
  {
    return this.mGeneratedUrl;
  }
  
  public String getImageUrl()
  {
    return this.mImageUrl;
  }
  
  public List<String> getStickerPackNames()
  {
    return this.mStickerPackNames;
  }
  
  public List<String> getTags()
  {
    return this.mTags;
  }
  
  public String getTemplateId()
  {
    return this.mTemplateId;
  }
  
  public int hashCode()
  {
    if (this.mImageUrl == null) {
      return 0;
    }
    return this.mImageUrl.hashCode();
  }
  
  public Indexable toIndexable()
    throws FirebaseAppIndexingException
  {
    Indexable.Builder localBuilder = (Indexable.Builder)((Indexable.Builder)new Indexable.Builder("Sticker").setName(this.mComicId)).setImage(this.mImageUrl);
    if (this.mGeneratedUrl != null) {
      localBuilder.setUrl(this.mGeneratedUrl);
    }
    if ((this.mTags != null) && (!this.mTags.isEmpty())) {
      localBuilder.put("keywords", (String[])this.mTags.toArray(new String[this.mTags.size()]));
    }
    if ((this.mStickerPackNames != null) && (!this.mStickerPackNames.isEmpty()))
    {
      Indexable[] arrayOfIndexable = new Indexable[this.mStickerPackNames.size()];
      int i = 0;
      while (i < this.mStickerPackNames.size())
      {
        String str = (String)this.mStickerPackNames.get(i);
        arrayOfIndexable[i] = new IndexableStickerPack.Builder().setUrl(AppIndexablesFactory.getStickerPackIndexableUrl(str)).setTitle(str).build().toIndexable();
        i += 1;
      }
      localBuilder.put("partOf", arrayOfIndexable);
    }
    return localBuilder.build();
  }
  
  public Indexable toStickerPackStickerIndexable()
    throws FirebaseAppIndexingException
  {
    return ((Indexable.Builder)((Indexable.Builder)((Indexable.Builder)new Indexable.Builder("Sticker").setUrl(this.mGeneratedUrl)).setName(this.mComicId)).setImage(this.mImageUrl)).build();
  }
  
  public static class Builder
  {
    private List<String> mCapabilities;
    private String mComicId;
    private String mGeneratedUrl;
    private String mImageUrl;
    private List<String> mStickerPackNames;
    private List<String> mTags;
    private String mTemplateId;
    
    public IndexableSticker build()
    {
      return new IndexableSticker(this.mTemplateId, this.mComicId, this.mGeneratedUrl, this.mImageUrl, this.mTags, this.mCapabilities, this.mStickerPackNames, null);
    }
    
    public Builder fromSticker(Sticker paramSticker)
    {
      this.mTemplateId = paramSticker.getTemplateId();
      this.mComicId = paramSticker.getComicId();
      this.mImageUrl = paramSticker.getImageUrl();
      this.mTags = paramSticker.getTags();
      this.mCapabilities = paramSticker.getCapabilities();
      return this;
    }
    
    public Builder setGeneratedUrl(String paramString)
    {
      this.mGeneratedUrl = paramString;
      return this;
    }
    
    public Builder setImageUrl(String paramString)
    {
      this.mImageUrl = paramString;
      return this;
    }
    
    public Builder setStickerPackNames(List<String> paramList)
    {
      this.mStickerPackNames = paramList;
      return this;
    }
    
    public Builder setTags(List<String> paramList)
    {
      this.mTags = paramList;
      return this;
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/firebase/models/IndexableSticker.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */