FavouriteFragment.java 3.4 KB
package com.bitstrips.imoji.ui.fragments;

import android.content.Context;
import android.content.res.Resources;
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.Header;
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.manager.RecentStickersManager;
import com.bitstrips.imoji.models.Sticker;
import com.bitstrips.imoji.persistence.MediaCache;
import com.bitstrips.imoji.search.SearchIndex;
import com.crashlytics.android.Crashlytics;
import java.util.Arrays;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;

public class FavouriteFragment
  extends BitmojiBaseFragment
  implements StickerViewHolder.OnStickerSelectedListener
{
  @Inject
  RecentStickersManager a;
  @Inject
  SearchIndex b;
  @Inject
  MediaCache c;
  @Inject
  LegacyAnalyticsService d;
  @Inject
  @Named("avatarId")
  Provider<String> e;
  private BitmojiClickListener f;
  
  public static FavouriteFragment newInstance()
  {
    return new FavouriteFragment();
  }
  
  public String getFragmentSuperTag()
  {
    return "popular";
  }
  
  protected int getLayout()
  {
    return 2130903111;
  }
  
  protected void initSubViews(View paramView)
  {
    if (!isActivityValid()) {
      return;
    }
    String str = (String)this.e.get();
    if (TextUtils.isEmpty(str))
    {
      Crashlytics.logException(new IllegalStateException("Trying to show Imoji grid with null avatar id!"));
      return;
    }
    StickerCategory localStickerCategory1 = new StickerCategory("#recent", this.a.getRecentStickers(), new Header(getString(2131231016), getContext().getResources().getColor(2131624107)), StickerCategory.EmptyStateType.RECENTS);
    StickerCategory localStickerCategory2 = new StickerCategory("popular", this.b.getStickersForSupertag("popular"), new Header(getString(2131231005), getContext().getResources().getColor(2131624096)), StickerCategory.EmptyStateType.IGNORE);
    new ImojiCategoriesViewController((RecyclerView)paramView.findViewById(2131689730), Arrays.asList(new StickerCategory[] { localStickerCategory1, localStickerCategory2 }), this, this.c, this.d).init(getContext(), str);
  }
  
  public void onAttach(Context paramContext)
  {
    super.onAttach(paramContext);
    if (!(paramContext instanceof BitmojiClickListener)) {
      throw new RuntimeException("the activity must implement BitmojiClickListener");
    }
    this.f = ((BitmojiClickListener)paramContext);
  }
  
  public void onDetach()
  {
    super.onDetach();
    this.f = null;
  }
  
  public void onStickerSelected(Sticker paramSticker, String paramString)
  {
    if (this.f != null)
    {
      paramString = new AnalyticsWrapper().labelForImojiShare(paramSticker, paramString);
      this.f.onClick(paramSticker, paramString);
    }
  }
}


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