AvatarManager.java 2.97 KB
package com.bitstrips.imoji.identity;

import android.content.Context;
import android.content.res.Resources;
import com.bitstrips.imoji.abv3.AvatarBuilderGender;
import com.bitstrips.imoji.abv3.model.AvatarGetV3;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.injection.ForApplication;
import com.bitstrips.imoji.models.AvatarInfo;
import com.bitstrips.imoji.util.PreferenceUtils;
import java.util.Collections;
import java.util.Set;
import java.util.WeakHashMap;
import javax.inject.Inject;
import javax.inject.Singleton;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

@Singleton
public class AvatarManager
{
  private static final String a = AvatarManager.class.getSimpleName();
  private final BitmojiApi b;
  private final PreferenceUtils c;
  private final Set<OnAvatarIdUpdateListener> d = Collections.newSetFromMap(new WeakHashMap());
  private int e;
  
  @Inject
  public AvatarManager(@ForApplication Context paramContext, BitmojiApi paramBitmojiApi, PreferenceUtils paramPreferenceUtils)
  {
    this.b = paramBitmojiApi;
    this.c = paramPreferenceUtils;
    this.e = paramContext.getResources().getInteger(2131558411);
  }
  
  public void addOnAvatarIdUpdateListener(OnAvatarIdUpdateListener paramOnAvatarIdUpdateListener)
  {
    this.d.add(paramOnAvatarIdUpdateListener);
  }
  
  public String getAvatarId()
  {
    return this.c.getString(2131231175, null);
  }
  
  @Deprecated
  public AvatarBuilderGender getGender()
  {
    return AvatarBuilderGender.fromValue(this.c.getInt(2131231172, -1).intValue());
  }
  
  @Deprecated
  public String getLegacyAvatarId()
  {
    return this.c.getString(2131231270, null);
  }
  
  public void removeOnAvatarIdUpdateListner(OnAvatarIdUpdateListener paramOnAvatarIdUpdateListener)
  {
    this.d.remove(paramOnAvatarIdUpdateListener);
  }
  
  public void updateAvatarInfo(final int paramInt, final UpdateAvatarInfoCallback paramUpdateAvatarInfoCallback)
  {
    this.b.getAvatarV3(new Callback()
    {
      public final void failure(RetrofitError paramAnonymousRetrofitError)
      {
        if (paramUpdateAvatarInfoCallback != null) {
          paramUpdateAvatarInfoCallback.onFailure();
        }
      }
    });
  }
  
  public void updateAvatarInfo(UpdateAvatarInfoCallback paramUpdateAvatarInfoCallback)
  {
    updateAvatarInfo(this.e, paramUpdateAvatarInfoCallback);
  }
  
  public Response updateAvatarInfoBackgroundSynchronous()
  {
    return this.b.getAvatarInfo(this.e, 1);
  }
  
  public static abstract interface OnAvatarIdUpdateListener
  {
    public abstract void onAvatarIdUpdate(String paramString);
  }
  
  public static abstract interface UpdateAvatarInfoCallback
  {
    public abstract void onFailure();
    
    public abstract void onSuccess(String paramString1, String paramString2);
  }
}


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