GboardOnboardingLowStorageFragment.java 5.53 KB
package com.bitstrips.imoji.onboarding.gboard;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
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 android.widget.TextView;
import com.bitstrips.imoji.behaviour.BehaviourHelper;
import com.bitstrips.imoji.identity.AvatarManager;
import com.bitstrips.imoji.identity.AvatarManager.OnAvatarIdUpdateListener;
import com.bitstrips.imoji.persistence.MediaCache;
import com.squareup.picasso.Callback;
import com.squareup.picasso.RequestCreator;
import javax.inject.Inject;

public class GboardOnboardingLowStorageFragment
  extends BaseOnboardingFragment
  implements AvatarManager.OnAvatarIdUpdateListener
{
  @Inject
  AvatarManager c;
  @Inject
  BehaviourHelper d;
  @Inject
  MediaCache e;
  private ImageView f;
  private View g;
  
  private void a()
  {
    final String str = getImageUrl(getContext(), this.d.getRenderEndpoint(), this.c.getAvatarId());
    this.f.postDelayed(new Runnable()
    {
      public final void run()
      {
        GboardOnboardingLowStorageFragment.this.e.load(str).fit().noFade().into(GboardOnboardingLowStorageFragment.a(GboardOnboardingLowStorageFragment.this), new Callback()
        {
          public final void onError() {}
          
          public final void onSuccess()
          {
            GboardOnboardingLowStorageFragment.b(GboardOnboardingLowStorageFragment.this).setVisibility(0);
            AnimatorSet localAnimatorSet = new AnimatorSet();
            localAnimatorSet.playTogether(new Animator[] { GboardOnboardingUtils.slideInAnimator(GboardOnboardingLowStorageFragment.a(GboardOnboardingLowStorageFragment.this)), GboardOnboardingUtils.springInAnimator(GboardOnboardingLowStorageFragment.b(GboardOnboardingLowStorageFragment.this)) });
            localAnimatorSet.start();
          }
        });
      }
    }, getResources().getInteger(2131558419));
    this.e.preload(str);
  }
  
  public static String getImageUrl(Context paramContext, String paramString1, String paramString2)
  {
    return paramContext.getString(2131231241, new Object[] { paramString1, paramString2 });
  }
  
  public static GboardOnboardingLowStorageFragment newInstance(long paramLong, GboardOnboardingSource paramGboardOnboardingSource)
  {
    GboardOnboardingLowStorageFragment localGboardOnboardingLowStorageFragment = new GboardOnboardingLowStorageFragment();
    paramGboardOnboardingSource = BaseOnboardingFragment.createArguments(paramGboardOnboardingSource);
    paramGboardOnboardingSource.putLong("STORAGE_REQUIRED", paramLong);
    localGboardOnboardingLowStorageFragment.setArguments(paramGboardOnboardingSource);
    return localGboardOnboardingLowStorageFragment;
  }
  
  public void onAvatarIdUpdate(String paramString)
  {
    this.f.setImageDrawable(null);
    this.e.cancelRequest(this.f);
    this.g.setVisibility(8);
    a();
  }
  
  @Nullable
  public View onCreateView(LayoutInflater paramLayoutInflater, @Nullable ViewGroup paramViewGroup, @Nullable Bundle paramBundle)
  {
    paramViewGroup = paramLayoutInflater.inflate(2130903119, paramViewGroup, false);
    paramBundle = (Button)paramViewGroup.findViewById(2131689703);
    final Button localButton = (Button)paramViewGroup.findViewById(2131689744);
    TextView localTextView = (TextView)paramViewGroup.findViewById(2131689752);
    this.f = ((ImageView)paramViewGroup.findViewById(2131689751));
    this.g = paramViewGroup.findViewById(2131689750);
    long l = getArguments().getLong("STORAGE_REQUIRED");
    if (l > 1048576L) {
      paramLayoutInflater = getString(2131230926, new Object[] { Long.valueOf(l / 1048576L) });
    }
    for (;;)
    {
      localTextView.setText(paramLayoutInflater);
      paramBundle.setOnClickListener(new View.OnClickListener()
      {
        public final void onClick(View paramAnonymousView)
        {
          GboardOnboardingLowStorageFragment.this.skip("low_storage");
        }
      });
      localButton.postDelayed(new Runnable()
      {
        public final void run()
        {
          localButton.setOnClickListener(new View.OnClickListener()
          {
            public final void onClick(View paramAnonymous2View)
            {
              GboardOnboardingLowStorageFragment.this.startActivity(new Intent("android.settings.MEMORY_CARD_SETTINGS"));
              GboardOnboardingLowStorageFragment.this.dismiss();
            }
          });
          localButton.setVisibility(0);
          GboardOnboardingUtils.pulseAnimator(localButton).start();
          GboardOnboardingUtils.fadeInAnimator(localButton).start();
        }
      }, getResources().getInteger(2131558418));
      return paramViewGroup;
      if (l > 1024L) {
        paramLayoutInflater = getString(2131230925, new Object[] { Long.valueOf(l / 1024L) });
      } else {
        paramLayoutInflater = getString(2131230924, new Object[] { Long.valueOf(l) });
      }
    }
  }
  
  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/GboardOnboardingLowStorageFragment.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */