IndexableStickerPack.java 4 KB
package com.bitstrips.imoji.firebase.models;

import com.bitstrips.imoji.models.Sticker;
import com.bitstrips.imoji.models.StickerPack;
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.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.builder.EqualsBuilder;

public class IndexableStickerPack
  implements Serializable
{
  private static final String INDEXABLE_TYPE = "StickerPack";
  private static final String KEYWORDS_KEY = "keywords";
  private static final String STICKERS_KEY = "hasSticker";
  @SerializedName("stickers")
  List<IndexableSticker> mStickers;
  @SerializedName("title")
  String mTitle;
  @SerializedName("url")
  String mUrl;
  
  private IndexableStickerPack(String paramString1, String paramString2, List<IndexableSticker> paramList)
  {
    this.mTitle = paramString1;
    this.mUrl = paramString2;
    this.mStickers = paramList;
  }
  
  public boolean equals(Object paramObject)
  {
    if (paramObject == this) {
      return true;
    }
    if (!(paramObject instanceof IndexableStickerPack)) {
      return false;
    }
    paramObject = (IndexableStickerPack)paramObject;
    return new EqualsBuilder().append(this.mTitle, ((IndexableStickerPack)paramObject).getTitle()).append(this.mUrl, ((IndexableStickerPack)paramObject).getUrl()).append(this.mStickers, ((IndexableStickerPack)paramObject).getStickers()).isEquals();
  }
  
  public List<IndexableSticker> getStickers()
  {
    return this.mStickers;
  }
  
  public String getTitle()
  {
    return this.mTitle;
  }
  
  public String getUrl()
  {
    return this.mUrl;
  }
  
  public int hashCode()
  {
    return this.mTitle.hashCode();
  }
  
  public Indexable toIndexable()
    throws FirebaseAppIndexingException
  {
    Indexable.Builder localBuilder = (Indexable.Builder)((Indexable.Builder)new Indexable.Builder("StickerPack").setName(this.mTitle)).put("keywords", new String[] { this.mTitle });
    if (this.mUrl != null) {
      localBuilder.setUrl(this.mUrl);
    }
    if ((this.mStickers != null) && (!this.mStickers.isEmpty()))
    {
      Indexable[] arrayOfIndexable = new Indexable[this.mStickers.size()];
      int i = 0;
      while (i < this.mStickers.size())
      {
        arrayOfIndexable[i] = ((IndexableSticker)this.mStickers.get(i)).toStickerPackStickerIndexable();
        i += 1;
      }
      localBuilder.put("hasSticker", arrayOfIndexable);
    }
    return localBuilder.build();
  }
  
  public static class Builder
  {
    private List<IndexableSticker> mStickers;
    private String mTitle;
    private String mUrl;
    
    public IndexableStickerPack build()
    {
      return new IndexableStickerPack(this.mTitle, this.mUrl, this.mStickers, null);
    }
    
    public Builder fromStickerPack(StickerPack paramStickerPack)
    {
      this.mTitle = paramStickerPack.getTitle();
      this.mUrl = paramStickerPack.getUrl();
      ArrayList localArrayList = new ArrayList();
      paramStickerPack = paramStickerPack.getStickers().iterator();
      while (paramStickerPack.hasNext())
      {
        Sticker localSticker = (Sticker)paramStickerPack.next();
        localArrayList.add(new IndexableSticker.Builder().fromSticker(localSticker).build());
      }
      this.mStickers = localArrayList;
      return this;
    }
    
    public Builder setStickers(List<IndexableSticker> paramList)
    {
      this.mStickers = paramList;
      return this;
    }
    
    public Builder setTitle(String paramString)
    {
      this.mTitle = paramString;
      return this;
    }
    
    public Builder setUrl(String paramString)
    {
      this.mUrl = paramString;
      return this;
    }
  }
}


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