mirror of
https://github.com/bspeice/itcs4180
synced 2024-11-13 19:08:20 -05:00
Now have a working TweetsListActivity
Needs a bit of tweaking, but functionality is mostly there.
This commit is contained in:
parent
e23b4bd798
commit
8d4d50c4a9
@ -1,57 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/RelativeLayout1"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent"
|
||||
android:columnCount="2"
|
||||
android:orientation="vertical" >
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgProfileImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:id="@+id/txtTweetText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imageView1"
|
||||
android:layout_toRightOf="@+id/imgProfileImage"
|
||||
android:layout_alignParentTop="true"
|
||||
android:orientation="vertical" >
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTweetText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView" />
|
||||
<TextView
|
||||
android:id="@+id/txtTweetInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/txtTweetText"
|
||||
android:layout_below="@+id/txtTweetText"
|
||||
android:layout_toLeftOf="@+id/imgIsRetweet"
|
||||
android:text="TextView" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<ImageButton
|
||||
android:id="@+id/ibtnSaveTweet"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/txtTweetText"
|
||||
android:onClick="onSaveTweet"
|
||||
android:src="@drawable/add_bookmark" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTweetInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgIsRetweet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/not_retweeted" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibtnSaveTweet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onSaveTweet"
|
||||
android:src="@drawable/add_bookmark" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/imgIsRetweet"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignTop="@+id/ibtnSaveTweet"
|
||||
android:layout_toLeftOf="@+id/ibtnSaveTweet"
|
||||
android:src="@drawable/not_retweeted" />
|
||||
|
||||
</RelativeLayout>
|
5
HW5/res/values/ids.xml
Normal file
5
HW5/res/values/ids.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="TWEET_TAG_KEY" type="id"/>
|
||||
|
||||
</resources>
|
@ -27,6 +27,8 @@ public class TweetListAdapter extends ArrayAdapter<Tweet> {
|
||||
|
||||
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<Tweet> {
|
||||
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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user