ImojiBrowserFragment.java 3.37 KB
package com.bitstrips.imoji.browser.fragments;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import com.bitstrips.imoji.analytics.AnalyticsWrapper;
import com.bitstrips.imoji.analytics.LegacyAnalyticsService;
import com.bitstrips.imoji.browser.BitmojiClickListener;
import com.bitstrips.imoji.browser.ImojiCategoriesViewController;
import com.bitstrips.imoji.browser.models.StickerCategory;
import com.bitstrips.imoji.browser.models.StickerCategory.EmptyStateType;
import com.bitstrips.imoji.browser.views.StickerViewHolder.OnStickerSelectedListener;
import com.bitstrips.imoji.models.Sticker;
import com.bitstrips.imoji.persistence.MediaCache;
import com.bitstrips.imoji.search.SearchIndex;
import com.bitstrips.imoji.ui.fragments.BitmojiBaseFragment;
import com.crashlytics.android.Crashlytics;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;

public class ImojiBrowserFragment
  extends BitmojiBaseFragment
  implements StickerViewHolder.OnStickerSelectedListener
{
  public static final String SUPERTAG = "supertag";
  @Inject
  @Named("avatarId")
  Provider<String> a;
  @Inject
  SearchIndex b;
  @Inject
  MediaCache c;
  @Inject
  LegacyAnalyticsService d;
  private String e;
  private ImojiCategoriesViewController f;
  private BitmojiClickListener g;
  
  public static ImojiBrowserFragment newInstance(String paramString)
  {
    Bundle localBundle = new Bundle();
    localBundle.putString("supertag", paramString);
    paramString = new ImojiBrowserFragment();
    paramString.setArguments(localBundle);
    return paramString;
  }
  
  public String getFragmentSuperTag()
  {
    return this.e;
  }
  
  protected int getLayout()
  {
    return 2130903129;
  }
  
  protected void initSubViews(View paramView)
  {
    if (!isActivityValid()) {
      return;
    }
    String str = (String)this.a.get();
    if (TextUtils.isEmpty(str))
    {
      Crashlytics.logException(new IllegalStateException("Trying to show Imoji grid with null avatar id!"));
      return;
    }
    StickerCategory localStickerCategory = new StickerCategory(this.e, this.b.getStickersForSupertag(this.e), null, StickerCategory.EmptyStateType.IGNORE);
    this.f = new ImojiCategoriesViewController((RecyclerView)paramView.findViewById(2131689790), localStickerCategory, this, this.c, this.d);
    this.f.init(getContext(), str);
  }
  
  public void onAttach(Context paramContext)
  {
    super.onAttach(paramContext);
    if (!(paramContext instanceof BitmojiClickListener)) {
      throw new RuntimeException("the activity must implement BitmojiClickListener");
    }
    this.g = ((BitmojiClickListener)paramContext);
  }
  
  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.e = getArguments().getString("supertag");
  }
  
  public void onDetach()
  {
    super.onDetach();
    this.g = null;
  }
  
  public void onStickerSelected(Sticker paramSticker, String paramString)
  {
    if (this.g != null)
    {
      paramString = new AnalyticsWrapper().labelForImojiShare(paramSticker, paramString);
      this.g.onClick(paramSticker, paramString);
    }
  }
}


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