GboardOnboardingIntroFragment.java 5.54 KB
package com.bitstrips.imoji.onboarding.gboard;

import android.animation.Animator;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import com.bitstrips.imoji.behaviour.BehaviourHelper;
import com.bitstrips.imoji.firebase.FirebaseUtils;
import com.bitstrips.imoji.identity.AvatarManager;
import com.bitstrips.imoji.identity.AvatarManager.OnAvatarIdUpdateListener;
import com.bitstrips.imoji.persistence.MediaCache;
import com.crashlytics.android.Crashlytics;
import com.squareup.picasso.Callback;
import com.squareup.picasso.RequestCreator;
import javax.inject.Inject;

public class GboardOnboardingIntroFragment
  extends BaseOnboardingFragment
  implements AvatarManager.OnAvatarIdUpdateListener
{
  @Inject
  AvatarManager c;
  @Inject
  BehaviourHelper d;
  @Inject
  MediaCache e;
  private View f;
  private ImageView g;
  
  private void a()
  {
    final String str1 = getImageUrl(getContext(), this.d.getRenderEndpoint(), this.c.getAvatarId());
    String str2 = GboardOnboardingFinishFragment.getImageUrl(getContext(), this.d.getRenderEndpoint(), this.c.getAvatarId());
    this.g.postDelayed(new Runnable()
    {
      public final void run()
      {
        GboardOnboardingIntroFragment.this.e.load(str1).fit().noFade().into(GboardOnboardingIntroFragment.a(GboardOnboardingIntroFragment.this), new Callback()
        {
          public final void onError() {}
          
          public final void onSuccess()
          {
            GboardOnboardingUtils.springInAnimator(GboardOnboardingIntroFragment.b(GboardOnboardingIntroFragment.this)).start();
          }
        });
      }
    }, getResources().getInteger(2131558419));
    this.e.preload(str1);
    this.e.preload(str2);
  }
  
  public static String getImageUrl(Context paramContext, String paramString1, String paramString2)
  {
    return paramContext.getString(2131231239, new Object[] { paramString1, paramString2, paramString2, paramString2, paramString2, paramString2 });
  }
  
  public static GboardOnboardingIntroFragment newInstance(GboardOnboardingSource paramGboardOnboardingSource)
  {
    GboardOnboardingIntroFragment localGboardOnboardingIntroFragment = new GboardOnboardingIntroFragment();
    localGboardOnboardingIntroFragment.setArguments(BaseOnboardingFragment.createArguments(paramGboardOnboardingSource));
    return localGboardOnboardingIntroFragment;
  }
  
  public void onAvatarIdUpdate(String paramString)
  {
    this.g.setImageDrawable(null);
    this.e.cancelRequest(this.g);
    a();
  }
  
  @Nullable
  public View onCreateView(LayoutInflater paramLayoutInflater, @Nullable ViewGroup paramViewGroup, @Nullable final Bundle paramBundle)
  {
    paramLayoutInflater = paramLayoutInflater.inflate(2130903118, paramViewGroup, false);
    paramViewGroup = (Button)paramLayoutInflater.findViewById(2131689703);
    paramBundle = (Button)paramLayoutInflater.findViewById(2131689744);
    this.f = paramLayoutInflater.findViewById(2131689742);
    this.g = ((ImageView)paramLayoutInflater.findViewById(2131689749));
    paramViewGroup.setOnClickListener(new View.OnClickListener()
    {
      public final void onClick(View paramAnonymousView)
      {
        GboardOnboardingIntroFragment.this.skip("intro");
      }
    });
    paramBundle.postDelayed(new Runnable()
    {
      public final void run()
      {
        paramBundle.setOnClickListener(new View.OnClickListener()
        {
          public final void onClick(View paramAnonymous2View)
          {
            if (GboardOnboardingIntroFragment.this.didSaveInstanceState())
            {
              Crashlytics.logException(new IllegalStateException("Performing action after onSaveInstanceState!"));
              return;
            }
            long l = FirebaseUtils.additionalRequiredStorageToIndex(GboardOnboardingIntroFragment.this.getContext()) + GboardOnboardingIntroFragment.this.d.getForcedGboardRequiredStorage();
            if (l > 0L)
            {
              paramAnonymous2View = GboardOnboardingLowStorageFragment.newInstance(l, GboardOnboardingIntroFragment.this.getSource());
              GboardOnboardingIntroFragment.this.sendLowStorageEvent();
            }
            for (;;)
            {
              GboardOnboardingIntroFragment.this.getFragmentManager().beginTransaction().setCustomAnimations(2130968609, 2130968612).replace(2131689651, paramAnonymous2View).addToBackStack(null).commit();
              return;
              paramAnonymous2View = GboardOnboardingInstructionsFragment.newInstance(GboardOnboardingIntroFragment.this.getSource());
            }
          }
        });
        paramBundle.setVisibility(0);
        GboardOnboardingUtils.pulseAnimator(paramBundle).start();
        GboardOnboardingUtils.fadeInAnimator(paramBundle).start();
      }
    }, getResources().getInteger(2131558418));
    return paramLayoutInflater;
  }
  
  public void onStart()
  {
    super.onStart();
    this.c.addOnAvatarIdUpdateListener(this);
    a();
  }
  
  public void onStop()
  {
    super.onStop();
    this.c.removeOnAvatarIdUpdateListner(this);
  }
}


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