diff --git a/HW5/AndroidManifest.xml b/HW5/AndroidManifest.xml
index d8f05a2..de2d868 100644
--- a/HW5/AndroidManifest.xml
+++ b/HW5/AndroidManifest.xml
@@ -28,6 +28,10 @@
android:name="edu.uncc.itcs4180.hw5.TweetsListActivity"
android:label="@string/title_activity_tweets_list" >
+
+
diff --git a/HW5/res/layout/activity_detailed_tweet.xml b/HW5/res/layout/activity_detailed_tweet.xml
new file mode 100644
index 0000000..437563f
--- /dev/null
+++ b/HW5/res/layout/activity_detailed_tweet.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HW5/res/layout/tweet_list.xml b/HW5/res/layout/tweet_list.xml
index 32cace8..39d8853 100644
--- a/HW5/res/layout/tweet_list.xml
+++ b/HW5/res/layout/tweet_list.xml
@@ -3,6 +3,7 @@
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
+ android:descendantFocusability="blocksDescendants"
android:padding="2dp" >
+
+
+
+
diff --git a/HW5/res/values/strings.xml b/HW5/res/values/strings.xml
index 2418083..9d3c2dc 100644
--- a/HW5/res/values/strings.xml
+++ b/HW5/res/values/strings.xml
@@ -5,5 +5,6 @@
Settings
Hello world!
TweetsListActivity
+ DetailedTweetActivity
diff --git a/HW5/src/edu/uncc/itcs4180/hw5/DetailedTweetActivity.java b/HW5/src/edu/uncc/itcs4180/hw5/DetailedTweetActivity.java
new file mode 100644
index 0000000..8139bee
--- /dev/null
+++ b/HW5/src/edu/uncc/itcs4180/hw5/DetailedTweetActivity.java
@@ -0,0 +1,47 @@
+package edu.uncc.itcs4180.hw5;
+
+import edu.uncc.itcs4180.hw5.twitter.Tweet;
+import android.os.Bundle;
+import android.app.Activity;
+import android.view.Menu;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class DetailedTweetActivity extends Activity {
+
+ private Tweet tweet;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_detailed_tweet);
+
+ tweet = (Tweet)getIntent().getExtras().getSerializable("tweet");
+
+ TextView userName = (TextView)findViewById(R.id.txtDetailUsername);
+ TextView tweetText = (TextView)findViewById(R.id.txtDetailTweet);
+ TextView favoritesCount = (TextView)findViewById(R.id.txtFavoritesCount);
+ TextView retweetCount = (TextView)findViewById(R.id.txtRetweetCount);
+ ImageView profileBackground = (ImageView)findViewById(R.id.imgDetailBackground);
+
+ userName.setText(tweet.getUser().getName());
+ tweetText.setText(tweet.getText());
+ favoritesCount.setText("Favorites Count: " + tweet.getFavoriteCount());
+ retweetCount.setText("ReTweets Count: " + tweet.getRetweetCount());
+
+ new BitmapDownloader(profileBackground).execute(tweet.getUser().getProfileBackgroundImageUrl());
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.detailed_tweet, menu);
+ return true;
+ }
+
+ public void onClickBack(View v) {
+ finish();
+ }
+
+}
diff --git a/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java b/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java
index 1003a60..3eadb42 100644
--- a/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java
+++ b/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java
@@ -7,14 +7,19 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
+import android.content.Intent;
import android.util.Log;
import android.view.Menu;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
public class TweetsListActivity extends Activity {
- ProgressDialog dialog;
+ private ProgressDialog dialog;
+ private TweetList list;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -49,10 +54,27 @@ public class TweetsListActivity extends Activity {
return true;
}
+ public TweetList getTweetList() {
+ return list;
+ }
+
private void displayTweets(TweetList list) {
+ this.list = list;
ListView lv = (ListView)findViewById(R.id.listTweetList);
ListAdapter la = new TweetListAdapter(this, list.toArray(new Tweet[list.size()]));
lv.setAdapter(la);
+ Log.d("ClickListener", "Setting click listener!");
+ lv.setOnItemClickListener(new OnItemClickListener() {
+
+ @Override
+ public void onItemClick(AdapterView> adapterView, View view, int pos,
+ long l) {
+ Log.d("ClickListener", "You clicked me!");
+ Intent i = new Intent(TweetsListActivity.this, DetailedTweetActivity.class);
+ i.putExtra("tweet", getTweetList().get(pos));
+ startActivity(i);
+ }
+ });
}
}
diff --git a/HW5/src/edu/uncc/itcs4180/hw5/twitter/Tweet.java b/HW5/src/edu/uncc/itcs4180/hw5/twitter/Tweet.java
index a60bae7..df06d1d 100644
--- a/HW5/src/edu/uncc/itcs4180/hw5/twitter/Tweet.java
+++ b/HW5/src/edu/uncc/itcs4180/hw5/twitter/Tweet.java
@@ -5,9 +5,11 @@ package edu.uncc.itcs4180.hw5.twitter;
//
// We changed the field names to conform to Java standards
+import java.io.Serializable;
+
import com.google.gson.annotations.SerializedName;
-public class Tweet {
+public class Tweet implements Serializable {
@SerializedName("created_at")
private String dateCreated;
@@ -32,6 +34,28 @@ public class Tweet {
@SerializedName("retweeted")
private boolean retweeted;
+
+ @SerializedName("favorite_count")
+ private int favoriteCount;
+
+ @SerializedName("retweet_count")
+ private int retweetCount;
+
+ public int getFavoriteCount() {
+ return favoriteCount;
+ }
+
+ public void setFavoriteCount(int favoriteCount) {
+ this.favoriteCount = favoriteCount;
+ }
+
+ public int getRetweetCount() {
+ return retweetCount;
+ }
+
+ public void setRetweetCount(int retweetCount) {
+ this.retweetCount = retweetCount;
+ }
public String getDateCreated() {
return dateCreated;
diff --git a/HW5/src/edu/uncc/itcs4180/hw5/twitter/TwitterUser.java b/HW5/src/edu/uncc/itcs4180/hw5/twitter/TwitterUser.java
index d9fce86..665e9bb 100644
--- a/HW5/src/edu/uncc/itcs4180/hw5/twitter/TwitterUser.java
+++ b/HW5/src/edu/uncc/itcs4180/hw5/twitter/TwitterUser.java
@@ -3,9 +3,11 @@ package edu.uncc.itcs4180.hw5.twitter;
// Code copied from:
// https://github.com/Rockncoder/TwitterTutorial/blob/master/src/com/example/TwitterTutorial/TwitterUser.java
+import java.io.Serializable;
+
import com.google.gson.annotations.SerializedName;
-public class TwitterUser {
+public class TwitterUser implements Serializable {
@SerializedName("screen_name")
private String screenName;