Android Open Source - SimpleTwitterClient Login Activity






From Project

Back to project page SimpleTwitterClient.

License

The source code is released under:

Copyright (c) 2014 Keithen Hayenga Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the So...

If you think the Android project SimpleTwitterClient listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codepath.apps.basictwitter;
/*from  w  w w .  j a v a  2  s.  c  om*/
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;

import com.codepath.oauth.OAuthLoginActivity;

public class LoginActivity extends OAuthLoginActivity<TwitterClient> {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
  }

  // Inflate the menu; this adds items to the action bar if it is present.
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.login, menu);
    return true;
  }
  
  // OAuth authenticated successfully, launch primary authenticated activity
  // i.e Display application "homepage"
    @Override
    public void onLoginSuccess() {
      Intent i = new Intent(this, TimelineActivity.class);
      startActivity(i);
      //Toast.makeText(this, "Success", Toast.LENGTH_SHORT).show();
    }
    
    // OAuth authentication flow failed, handle the error
    // i.e Display an error dialog or toast
    @Override
    public void onLoginFailure(Exception e) {
        e.printStackTrace();
    }
    
    // Click handler method for the button used to start OAuth flow
    // Uses the client to initiate OAuth authorization
    // This should be tied to a button used to login
    public void loginToRest(View view) {
        getClient().connect();
    }

}




Java Source Code List

com.codepath.apps.basictwitter.ComposeActivity.java
com.codepath.apps.basictwitter.LoginActivity.java
com.codepath.apps.basictwitter.TimelineActivity.java
com.codepath.apps.basictwitter.TweetArrayAdapter.java
com.codepath.apps.basictwitter.TwitterApplication.java
com.codepath.apps.basictwitter.TwitterClient.java
com.codepath.apps.basictwitter.models.SampleModel.java
com.codepath.apps.basictwitter.models.Tweet.java
com.codepath.apps.basictwitter.models.User.java