BSLoginActivity.java 5.14 KB
package com.bitstrips.imoji.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import com.bitstrips.imoji.InjectorApplication;
import com.bitstrips.imoji.analytics.LegacyAnalyticsService;
import com.bitstrips.imoji.analytics.PageViewReporter;
import com.bitstrips.imoji.api.BSAuthResponse;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.experiments.Experiments;
import com.bitstrips.imoji.identity.AvatarManager;
import com.bitstrips.imoji.identity.AvatarManager.UpdateAvatarInfoCallback;
import com.bitstrips.imoji.ui.views.Form;
import com.bitstrips.imoji.ui.views.Form.EmailValidator;
import com.bitstrips.imoji.ui.views.Form.PasswordValidator;
import com.bitstrips.imoji.ui.views.FormField;
import com.bitstrips.imoji.util.PreferenceUtils;
import javax.inject.Inject;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

public class BSLoginActivity
  extends OnboardingFormBaseActivity
{
  public static final String KEY_EXTRA_LINKING = "com.bitstrips.imoji.login.linking";
  @Inject
  LegacyAnalyticsService n;
  @Inject
  AvatarManager o;
  @Inject
  BitmojiApi p;
  @Inject
  PreferenceUtils q;
  @Inject
  PageViewReporter r;
  @Inject
  Experiments s;
  private FormField t;
  private FormField u;
  
  private boolean a()
  {
    if (getIntent() == null) {
      return false;
    }
    return getIntent().getBooleanExtra("com.bitstrips.imoji.login.linking", false);
  }
  
  private void b()
  {
    disableButtons();
    String str1 = this.t.getText().toString();
    String str2 = this.u.getText().toString();
    this.p.getToken("imoji", str2, "password", str1, str2, new Callback()
    {
      public final void failure(RetrofitError paramAnonymousRetrofitError)
      {
        paramAnonymousRetrofitError = paramAnonymousRetrofitError.getResponse();
        if ((paramAnonymousRetrofitError != null) && (paramAnonymousRetrofitError.getStatus() == 400)) {
          BSLoginActivity.b(BSLoginActivity.this);
        }
        for (;;)
        {
          BSLoginActivity.this.enableButtons();
          return;
          BSLoginActivity.c(BSLoginActivity.this);
        }
      }
    });
  }
  
  public Menu getOptionsMenu()
  {
    return this.mOptionsMenu;
  }
  
  public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
  }
  
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    ((InjectorApplication)getApplication()).inject(this);
    setContentView(2130903079);
    setSupportActionBar((Toolbar)findViewById(2131689623));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTitle(2131230987);
    this.t = ((FormField)findViewById(2131689539));
    this.u = ((FormField)findViewById(2131689656));
    paramBundle = (Button)findViewById(2131689657);
    TextView localTextView = (TextView)findViewById(2131689658);
    setMainButton(paramBundle);
    if (a()) {
      this.r.loginScreenFromWelcomeScreenInSnapchatAppContext();
    }
    for (;;)
    {
      paramBundle.setOnClickListener(new View.OnClickListener()
      {
        public final void onClick(View paramAnonymousView)
        {
          BSLoginActivity.this.onLoginClicked(paramAnonymousView);
        }
      });
      localTextView.setOnClickListener(new View.OnClickListener()
      {
        public final void onClick(View paramAnonymousView)
        {
          BSLoginActivity.this.onForgotPasswordClicked(paramAnonymousView);
        }
      });
      paramBundle = new Form(this);
      paramBundle.addField(this.t, new Form.EmailValidator(this.t, paramBundle));
      paramBundle.addField(this.u, new Form.PasswordValidator(this.u, paramBundle));
      return;
      this.r.loginScreenFromWelcomeScreenInBitmojiAppContext();
    }
  }
  
  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131755008, paramMenu);
    return super.onCreateOptionsMenu(paramMenu);
  }
  
  public void onForgotPasswordClicked(View paramView)
  {
    paramView = new Intent(getApplicationContext(), BSPasswordRecoveryActivity.class);
    if (a()) {
      paramView.putExtra("com.bitstrips.imoji.login.linking", true);
    }
    startActivity(paramView);
  }
  
  public void onLoginClicked(View paramView)
  {
    b();
  }
  
  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    int i = paramMenuItem.getItemId();
    if (i == 2131689972)
    {
      b();
      return true;
    }
    if (i == 16908332)
    {
      finish();
      return true;
    }
    return super.onOptionsItemSelected(paramMenuItem);
  }
  
  protected void onPause()
  {
    super.onPause();
  }
  
  public void onResume()
  {
    super.onResume();
  }
}


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