ConnectSnapchatActivity.java 5.98 KB
package com.bitstrips.imoji.ui.activities;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.bitstrips.imoji.InjectorApplication;
import com.bitstrips.imoji.analytics.PageViewReporter;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.behaviour.BehaviourHelper;
import com.bitstrips.imoji.browser.ImojiBrowserActivity;
import com.bitstrips.imoji.persistence.MediaCache;
import com.bitstrips.imoji.ui.BitmojiBaseActivity;
import com.bitstrips.imoji.ui.IntentCreatorService;
import com.bitstrips.imoji.util.PreferenceUtils;
import com.squareup.picasso.RequestCreator;
import javax.inject.Inject;
import retrofit.Callback;
import retrofit.RetrofitError;

public class ConnectSnapchatActivity
  extends BitmojiBaseActivity
{
  public static final String KEY_INTENT_LINKED = "is_linked";
  public static final String LOGOUT_ON_EXIT = "logout_on_exit";
  public static final int SC_REQUEST_CODE = 55;
  public static final String SC_REQUEST_TOKEN_EXTRA = "request_token";
  @Inject
  IntentCreatorService n;
  @Inject
  PreferenceUtils o;
  @Inject
  BitmojiApi p;
  @Inject
  PageViewReporter q;
  @Inject
  BehaviourHelper r;
  @Inject
  MediaCache s;
  TextView t;
  ImageView u;
  ImageView v;
  Button w;
  private String x;
  
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    ((InjectorApplication)getApplication()).inject(this);
    setContentView(2130903069);
    this.t = ((TextView)findViewById(2131689634));
    this.u = ((ImageView)findViewById(2131689631));
    this.v = ((ImageView)findViewById(2131689632));
    this.w = ((Button)findViewById(2131689635));
    String str = getString(2131230872).replace("%%1$", "%1$").replace("%%2$", "%2$");
    paramBundle = getString(2131231043);
    Object localObject = str.replace("%1$", paramBundle);
    int i = ((String)localObject).indexOf(paramBundle);
    if (i != -1)
    {
      str = getString(2131231008);
      localObject = ((String)localObject).replace("%2$", str);
      int j = ((String)localObject).indexOf(str);
      if (j != -1)
      {
        localObject = new SpannableStringBuilder((CharSequence)localObject);
        ((SpannableStringBuilder)localObject).setSpan(new ClickableSpan()
        {
          public final void onClick(View paramAnonymousView)
          {
            ConnectSnapchatActivity.this.n.goToTermsOfService(jdField_this);
          }
          
          public final void updateDrawState(TextPaint paramAnonymousTextPaint)
          {
            paramAnonymousTextPaint.setColor(ContextCompat.getColor(jdField_this, 2131624039));
            paramAnonymousTextPaint.setFakeBoldText(true);
          }
        }, i, paramBundle.length() + i, 0);
        ((SpannableStringBuilder)localObject).setSpan(new ClickableSpan()
        {
          public final void onClick(View paramAnonymousView)
          {
            ConnectSnapchatActivity.this.n.goToPrivacyPolicy(jdField_this);
          }
          
          public final void updateDrawState(TextPaint paramAnonymousTextPaint)
          {
            paramAnonymousTextPaint.setColor(ContextCompat.getColor(jdField_this, 2131624039));
            paramAnonymousTextPaint.setFakeBoldText(true);
          }
        }, j, str.length() + j, 0);
        this.t.setText((CharSequence)localObject);
        this.t.setMovementMethod(LinkMovementMethod.getInstance());
      }
    }
    paramBundle = this.r.getRenderEndpoint();
    str = this.o.getString(2131231175, "");
    paramBundle = String.format(getString(2131231322), new Object[] { paramBundle, str });
    this.s.load(paramBundle).into(this.u);
    paramBundle = getIntent();
    if (paramBundle != null)
    {
      this.x = paramBundle.getStringExtra("request_token");
      this.q.connectToSnapchatScreenFromSnapchatApp();
    }
    this.w.setOnClickListener(new View.OnClickListener()
    {
      public final void onClick(View paramAnonymousView)
      {
        if (ConnectSnapchatActivity.a(ConnectSnapchatActivity.this) == null)
        {
          ConnectSnapchatActivity.b(ConnectSnapchatActivity.this);
          return;
        }
        ConnectSnapchatActivity.this.p.linkToSnapchat(ConnectSnapchatActivity.a(ConnectSnapchatActivity.this), new Callback()
        {
          public final void failure(RetrofitError paramAnonymous2RetrofitError)
          {
            paramAnonymous2RetrofitError = ConnectSnapchatActivity.this.getString(2131230887);
            String str = ConnectSnapchatActivity.this.getString(2131230902);
            ConnectSnapchatActivity.this.showAlertDialog(paramAnonymous2RetrofitError, str, new Runnable()
            {
              public final void run() {}
            }, null);
          }
        });
      }
    });
    this.v.setOnClickListener(new View.OnClickListener()
    {
      public final void onClick(View paramAnonymousView)
      {
        if ((ConnectSnapchatActivity.d(ConnectSnapchatActivity.this)) || (ConnectSnapchatActivity.e(ConnectSnapchatActivity.this)))
        {
          paramAnonymousView = ConnectSnapchatActivity.this;
          Intent localIntent = new Intent(paramAnonymousView, ImojiBrowserActivity.class);
          localIntent.addFlags(131072);
          localIntent.setData(Uri.parse(paramAnonymousView.getString(2131231276)));
          paramAnonymousView.startActivity(localIntent);
          paramAnonymousView.finish();
          return;
        }
        ConnectSnapchatActivity.this.finish();
      }
    });
  }
}


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