Android Open Source - twittah Login Activity






From Project

Back to project page twittah.

License

The source code is released under:

MIT License

If you think the Android project twittah 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.wangela.apps.twittah.activities;
/* w w  w .j  ava2  s . c o  m*/
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.codepath.oauth.OAuthLoginActivity;
import com.codepath.wangela.apps.twittah.R;
import com.codepath.wangela.apps.twittah.helpers.TwitterClient;

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, "Logged in with OAuth", 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) {
      ProgressBar pb = (ProgressBar) findViewById(R.id.pbLogin);
      pb.setVisibility(ProgressBar.VISIBLE);
        getClient().connect();
    }

}




Java Source Code List

com.codepath.wangela.apps.twittah.activities.ComposeActivity.java
com.codepath.wangela.apps.twittah.activities.LoginActivity.java
com.codepath.wangela.apps.twittah.activities.ProfileActivity.java
com.codepath.wangela.apps.twittah.activities.TimelineActivity.java
com.codepath.wangela.apps.twittah.activities.TweetDetailActivity.java
com.codepath.wangela.apps.twittah.activities.TwitterApplication.java
com.codepath.wangela.apps.twittah.adapters.TweetArrayAdapter.java
com.codepath.wangela.apps.twittah.fragments.HomeTimelineFragment.java
com.codepath.wangela.apps.twittah.fragments.MentionsTimelineFragment.java
com.codepath.wangela.apps.twittah.fragments.TweetsListFragment.java
com.codepath.wangela.apps.twittah.fragments.UserTimelineFragment.java
com.codepath.wangela.apps.twittah.helpers.TwitterClient.java
com.codepath.wangela.apps.twittah.listeners.EndlessScrollListener.java
com.codepath.wangela.apps.twittah.listeners.SupportFragmentTabListener.java
com.codepath.wangela.apps.twittah.models.Category.java
com.codepath.wangela.apps.twittah.models.Item.java
com.codepath.wangela.apps.twittah.models.SampleModel.java
com.codepath.wangela.apps.twittah.models.Tweet.java
com.codepath.wangela.apps.twittah.models.User.java