From 8d4d50c4a973c3e1723d2d4bd8b6ced845e1ef03 Mon Sep 17 00:00:00 2001 From: DjBushido Date: Sat, 12 Apr 2014 13:35:08 -0400 Subject: [PATCH] Now have a working TweetsListActivity Needs a bit of tweaking, but functionality is mostly there. --- HW5/res/layout/tweet_list.xml | 70 ++++++++----------- HW5/res/values/ids.xml | 5 ++ .../uncc/itcs4180/hw5/TweetListAdapter.java | 4 +- .../uncc/itcs4180/hw5/TweetsListActivity.java | 7 +- 4 files changed, 45 insertions(+), 41 deletions(-) create mode 100644 HW5/res/values/ids.xml diff --git a/HW5/res/layout/tweet_list.xml b/HW5/res/layout/tweet_list.xml index 666eb7e..f59ecdb 100644 --- a/HW5/res/layout/tweet_list.xml +++ b/HW5/res/layout/tweet_list.xml @@ -1,57 +1,49 @@ + android:layout_width="fill_parent" + android:layout_height="fill_parent" > - + android:text="TextView" /> - + - + - - - - - - - - - + \ No newline at end of file diff --git a/HW5/res/values/ids.xml b/HW5/res/values/ids.xml new file mode 100644 index 0000000..24e30c8 --- /dev/null +++ b/HW5/res/values/ids.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/HW5/src/edu/uncc/itcs4180/hw5/TweetListAdapter.java b/HW5/src/edu/uncc/itcs4180/hw5/TweetListAdapter.java index ab1369e..a3dbfaf 100644 --- a/HW5/src/edu/uncc/itcs4180/hw5/TweetListAdapter.java +++ b/HW5/src/edu/uncc/itcs4180/hw5/TweetListAdapter.java @@ -27,6 +27,8 @@ public class TweetListAdapter extends ArrayAdapter { public TweetListAdapter(Activity activity, Tweet[] tweets) { super(activity, R.layout.tweet_list, tweets); + this.tweets = tweets; + this.activity = activity; } @Override @@ -47,7 +49,7 @@ public class TweetListAdapter extends ArrayAdapter { tv.ibtnSaveTweet = (ImageButton) rowView.findViewById(R.id.ibtnSaveTweet); rowView.setTag(tv); - rowView.setTag(TWEET_TAG_KEY, tweet); + rowView.setTag(R.id.TWEET_TAG_KEY, tweet); } else { tv = (TweetView) rowView.getTag(); } diff --git a/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java b/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java index 5f5a1c2..1003a60 100644 --- a/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java +++ b/HW5/src/edu/uncc/itcs4180/hw5/TweetsListActivity.java @@ -1,5 +1,6 @@ package edu.uncc.itcs4180.hw5; +import edu.uncc.itcs4180.hw5.twitter.Tweet; import edu.uncc.itcs4180.hw5.twitter.TweetList; import edu.uncc.itcs4180.hw5.twitter.TwitterClient; import android.os.AsyncTask; @@ -8,6 +9,8 @@ import android.app.Activity; import android.app.ProgressDialog; import android.util.Log; import android.view.Menu; +import android.widget.ListAdapter; +import android.widget.ListView; public class TweetsListActivity extends Activity { @@ -47,7 +50,9 @@ public class TweetsListActivity extends Activity { } private void displayTweets(TweetList list) { - + ListView lv = (ListView)findViewById(R.id.listTweetList); + ListAdapter la = new TweetListAdapter(this, list.toArray(new Tweet[list.size()])); + lv.setAdapter(la); } }