Android Open Source - twittah Profile 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;
//from   www .  j  a v  a  2s  .co m
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;

import com.codepath.wangela.apps.twittah.R;
import com.codepath.wangela.apps.twittah.fragments.UserTimelineFragment;
import com.codepath.wangela.apps.twittah.models.User;
import com.nostra13.universalimageloader.core.ImageLoader;

public class ProfileActivity extends FragmentActivity {
  private ImageView ivProfile;
  private TextView tvProfileName;
  private TextView tvDescription;
  private TextView tvLocation;
  private TextView tvFollowing;
  private TextView tvFollowers;
  private User user;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.activity_profile);
    loadProfileInfo();

  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
      NavUtils.navigateUpFromSameTask(this);
      return true;
    }
    return super.onOptionsItemSelected(item);
  }

  public void loadProfileInfo() {
    user = (User) getIntent().getSerializableExtra("User");
    populateProfileHeader(user);
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    UserTimelineFragment myTimeline = UserTimelineFragment.newInstance(user.getScreenname());
    ft.replace(R.id.flUserTimeline, myTimeline);
    ft.commit();
  }

  private void populateProfileHeader(User user) {
    ivProfile = (ImageView) findViewById(R.id.ivProfile);
    tvProfileName = (TextView) findViewById(R.id.tvProfileName);
    tvDescription = (TextView) findViewById(R.id.tvDescription);
    tvLocation = (TextView) findViewById(R.id.tvLocation);
    tvFollowing = (TextView) findViewById(R.id.tvFollowing);
    tvFollowers = (TextView) findViewById(R.id.tvFollowers);
    
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.displayImage(user.getProfileImageUrl(),
        ivProfile);
    tvProfileName.setText(user.getName());
    tvDescription.setText(user.getDescription());
    tvLocation.setText(user.getLocation());
    tvFollowing.setText(user.getFollowingCount() + " following");
    tvFollowers.setText(user.getFollowersCount() + " followers");
    getActionBar().setTitle("@" + user.getScreenname());
  }
}




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