Android Open Source - twittah Tweet Detail 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 a v a  2  s.  com*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.codepath.wangela.apps.twittah.R;
import com.codepath.wangela.apps.twittah.models.Tweet;
import com.nostra13.universalimageloader.core.ImageLoader;

public class TweetDetailActivity extends Activity {
    private ImageView ivTweeterPic;
    private TextView tvTweeterFullName;
    private TextView tvTweeterHandle;
    private TextView tvTweeterTweet;
    private TextView tvTimestamp;
    private Tweet tweet;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tweet_detail);
        getActionBar().setDisplayHomeAsUpEnabled(true);
        setupViews();
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
            case android.R.id.home:
                this.finish();
        }
        return super.onOptionsItemSelected(item);
    }
    
    public void setupViews() {
        ivTweeterPic = (ImageView) findViewById(R.id.ivTweeterPic);
        tvTweeterFullName = (TextView) findViewById(R.id.tvTweeterFullName);
        tvTweeterHandle = (TextView) findViewById(R.id.tvTweeterHandle);
        tvTweeterTweet = (TextView) findViewById(R.id.tvTweeterTweet);
        tvTimestamp = (TextView) findViewById(R.id.tvTimestamp);

        // Populate tweet
        tweet = (Tweet) getIntent().getSerializableExtra("tweet");
        ImageLoader imageLoader = ImageLoader.getInstance();
        imageLoader.displayImage(tweet.getUser().getProfileImageUrl(), ivTweeterPic);
        tvTweeterFullName.setText(tweet.getUser().getName());
        tvTweeterHandle.setText("@" + tweet.getUser().getScreenname());
        tvTweeterTweet.setText(tweet.getBody());
        tvTimestamp.setText(tweet.getCreatedAgo());
        
    }
    
    public void onReply(View v) {
        Intent i = new Intent(this, ComposeActivity.class);
        i.putExtra("replyTo", tweet);
        startActivity(i);
    }
}




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