Beispiel #1
0
 @Override
 protected void onPostExecute(Message result) {
   SessionManager manager = new SessionManager(LoginFb.this);
   int success = result.arg1;
   if (success == 0) {
     Toast.makeText(LoginFb.this, "Ocurrio un Error", Toast.LENGTH_LONG).show();
   } else {
     Toast.makeText(LoginFb.this, "Entrando a PREXIOS APP", Toast.LENGTH_LONG).show();
     manager.crearSessionOn(result.obj.toString());
     LoginFb.this.finish();
     startActivity(new Intent(LoginFb.this, Map.class));
     LoginFb.this.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
   }
   pDialog.dismiss();
 }
Beispiel #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_loginfb);

    Button btnLogin = (Button) findViewById(R.id.btnLoginFb);
    mFacebook = new Facebook(APP_ID);

    context = LoginFb.this;
    manager = new SessionManager(context);

    btnLogin.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            boolean internet = new InternetUtil(LoginFb.this).isConnectingToInternet();
            if (internet) {
              AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(mFacebook);
              mFacebook.authorize(LoginFb.this, APP_PERMISIONS, new LoginDialogListener());
            } else {
              Toast.makeText(LoginFb.this, "Necesita Conectarse a Internet.", Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });

    // nos salteamos el logueo
    if (manager.getEstadoSession()) {
      ((SherlockActivity) context).finish();
      context.startActivity(new Intent(context, Map.class));
      ((SherlockActivity) context).overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    }

    ActionBar ab = getSupportActionBar();
    ab.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
    ab.setTitle(getString(R.string.register_user));
  }