Android Open Source - android_twitter_client Profile Activity






From Project

Back to project page android_twitter_client.

License

The source code is released under:

GNU General Public License

If you think the Android project android_twitter_client 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.github.snambi.twitterclient.activities;
/*ww w  .ja  v  a  2s .  co m*/
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;

import com.github.snambi.twitterclient.R;
import com.github.snambi.twitterclient.TwitterApplication;
import com.github.snambi.twitterclient.clients.TwitterRestClient;
import com.github.snambi.twitterclient.fragemets.ProfileHeaderFragment;
import com.github.snambi.twitterclient.fragemets.UserTimelineFragment;

public class ProfileActivity extends FragmentActivity {
  
  protected TwitterRestClient restClient;
  
  /**
   * profile activity is made up of two fragments
   * one frgament is statically loaded
   * other fragment is dynamically loaded
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);
      
    String screenName = getIntent().getStringExtra("screenname");
    
    restClient = TwitterApplication.getRestClient();
    
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.replace(R.id.flProfileHeader, new ProfileHeaderFragment( restClient, screenName ) , "profile-fragment");
    ft.commit();
    
    FragmentTransaction ft2 = getSupportFragmentManager().beginTransaction();
    ft2.replace(R.id.flProfileTweets, UserTimelineFragment.newInstance(screenName), "tweets-fragment");
    ft2.commit();
    
    if( screenName !=null ){
      getActionBar().setTitle( "@" + screenName );
    }else{
      SharedPreferences prefs = getSharedPreferences("com.github.snambi.twitterclient", Context.MODE_PRIVATE);
      String userName = prefs.getString("screen_name", null);
      getActionBar().setTitle("@" + userName);
    }
    
  }
  
}




Java Source Code List

com.github.snambi.twitterclient.TwitterApplication.java
com.github.snambi.twitterclient.activities.ComposeActivity.java
com.github.snambi.twitterclient.activities.LoginActivity.java
com.github.snambi.twitterclient.activities.ProfileActivity.java
com.github.snambi.twitterclient.activities.TimelineActivity.java
com.github.snambi.twitterclient.adapters.TwitterArrayAdapter.java
com.github.snambi.twitterclient.clients.TwitterRestClient.java
com.github.snambi.twitterclient.db.TweetDbHelper.java
com.github.snambi.twitterclient.fragemets.HomeTimelineFragment.java
com.github.snambi.twitterclient.fragemets.MentionsTimelineFragment.java
com.github.snambi.twitterclient.fragemets.ProfileHeaderFragment.java
com.github.snambi.twitterclient.fragemets.TwitterListFragment.java
com.github.snambi.twitterclient.fragemets.UserTimelineFragment.java
com.github.snambi.twitterclient.listeners.EndlessScrollListener.java
com.github.snambi.twitterclient.listeners.FragmentTabListener.java
com.github.snambi.twitterclient.models.SampleModel.java
com.github.snambi.twitterclient.models.Tweet.java
com.github.snambi.twitterclient.models.User.java
com.github.snambi.twitterclient.utils.TwitterTimeUtils.java