diff --git a/.gitignore b/.gitignore
index c142e61..7e438d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,16 @@
+# Skip application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
bin/
gen/
+# Local configuration file (sdk path, etc)
+local.properties
diff --git a/res/layout/activity_myday_list.xml b/res/layout/activity_myday_list.xml
index 5b2222a..d05f1f3 100755
--- a/res/layout/activity_myday_list.xml
+++ b/res/layout/activity_myday_list.xml
@@ -2,45 +2,48 @@
-
-
-
-
+ android:orientation="horizontal" >
+ android:gravity="left" />
-
+ android:orientation="vertical" >
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/activity_tweet_list.xml b/res/layout/activity_tweet_list.xml
index a212ba2..2fe3055 100755
--- a/res/layout/activity_tweet_list.xml
+++ b/res/layout/activity_tweet_list.xml
@@ -2,29 +2,40 @@
-
+
-
+ android:orientation="vertical" >
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/se/hv/dindag/MyDay.java b/src/se/hv/dindag/MyDay.java
index 910418a..a67975b 100755
--- a/src/se/hv/dindag/MyDay.java
+++ b/src/se/hv/dindag/MyDay.java
@@ -6,8 +6,11 @@ import java.util.concurrent.ExecutionException;
import android.app.AlertDialog;
import android.app.ListActivity;
+import android.content.ClipData.Item;
import android.content.Intent;
+import android.graphics.Color;
import android.os.Bundle;
+import android.util.Log;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
@@ -32,6 +35,7 @@ public class MyDay extends ListActivity {
static final String KEY_TITLE = "title";
static final String KEY_DESC = "description";
static final String KEY_DATE = "pubDate";
+ static final String KEY_TAG = "tag";
/*
* Fires up the activity_myday and waits for the Login-button to be pressed.
@@ -66,18 +70,31 @@ public class MyDay extends ListActivity {
// Add the menuItems to our ListView
ListAdapter adapter = new SimpleAdapter(this, myDayItems,
R.layout.activity_myday_list, new String[] { KEY_TITLE,
- KEY_LINK, KEY_DESC, KEY_DATE }, new int[] {
+ KEY_LINK, KEY_DESC, KEY_DATE, KEY_TAG }, new int[] {
R.id.mydayTitle, R.id.mydayLink,
- R.id.mydayDescription, R.id.mydayDate });
-
+ R.id.mydayDescription, R.id.mydayDate,
+ R.id.mydayTag });
setListAdapter(adapter);
ListView lv = (ListView) findViewById(R.id.myDayList);
-
+ for (int i = 0; i <= myDayItems.size(); i++) {
+ String theTag = myDayItems.get(i).get(KEY_TAG);
+ if (theTag.contains("schema")) {
+ Log.i("TAG", "Schema hittad");
+ // TextView tv = (TextView) myDayItems.get(i);
+ }
+ else if (theTag.contains("kronox"))
+ Log.i("TAG", "Kronox hittad");
+ else if (theTag.contains("ladok"))
+ Log.i("TAG", "Ladok hittad");
+ else if (theTag.contains("disco"))
+ Log.i("TAG", "Disco hittad");
+ else
+ Log.i("TAG ANNAT", theTag);
+ }
// Wait for an item in the list to be clicked
lv.setOnItemClickListener(new OnItemClickListener() {
-
public void onItemClick(AdapterView> parent, View view,
int position, long id) {
// getting values from selected ListItem
diff --git a/src/se/hv/dindag/MyDayHandler.java b/src/se/hv/dindag/MyDayHandler.java
index b8cc0e6..aac65f3 100755
--- a/src/se/hv/dindag/MyDayHandler.java
+++ b/src/se/hv/dindag/MyDayHandler.java
@@ -14,6 +14,7 @@ import android.os.AsyncTask;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
+import android.widget.TextView;
/**
* This class manages the loading of external data. It uses the ASynkTask class
diff --git a/src/se/hv/dindag/Tweet.java b/src/se/hv/dindag/Tweet.java
index 72f0fb4..e304f76 100755
--- a/src/se/hv/dindag/Tweet.java
+++ b/src/se/hv/dindag/Tweet.java
@@ -4,4 +4,5 @@ public class Tweet {
String from;
String text;
String date;
+ String pic;
}
diff --git a/src/se/hv/dindag/TwitterFeed.java b/src/se/hv/dindag/TwitterFeed.java
index 24260bb..4d581f5 100755
--- a/src/se/hv/dindag/TwitterFeed.java
+++ b/src/se/hv/dindag/TwitterFeed.java
@@ -1,5 +1,6 @@
package se.hv.dindag;
+import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -17,6 +18,8 @@ import org.json.JSONObject;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
@@ -24,6 +27,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
+import android.widget.ImageView;
import android.widget.TextView;
public class TwitterFeed extends ListActivity {
@@ -62,6 +66,7 @@ public class TwitterFeed extends ListActivity {
tweet.from = session.getString("from_user");
tweet.date = prettyfyDate(session
.getString("created_at"));
+ tweet.pic = session.getString("profile_image_url");
tweets.add(tweet);
}
}
@@ -101,6 +106,43 @@ public class TwitterFeed extends ListActivity {
return theDate;
}
+ /**
+ * Laddar hem Twitter-bilden
+ *
+ * @author imcoh
+ *
+ */
+ private class DownloadImageTask extends AsyncTask {
+ ImageView bmImage = (ImageView) findViewById(R.id.twitterPic);
+
+ public DownloadImageTask(ImageView bmImage) {
+ this.bmImage = bmImage;
+ }
+
+ protected Bitmap doInBackground(String... urls) {
+ String urldisplay = urls[0];
+ Bitmap mIcon11 = null;
+ try {
+ InputStream in = new java.net.URL(urldisplay).openStream();
+ mIcon11 = BitmapFactory.decodeStream(in);
+ } catch (Exception e) {
+ Log.e("Error", e.getMessage());
+ e.printStackTrace();
+ }
+ return mIcon11;
+ }
+
+ protected void onPostExecute(Bitmap result) {
+ bmImage.setImageBitmap(result);
+ }
+ }
+
+ /**
+ * Stoppar in alla funna resultat i listan
+ *
+ * @author imcoh
+ *
+ */
private class TweetListAdaptor extends ArrayAdapter {
private ArrayList tweets;
@@ -121,6 +163,9 @@ public class TwitterFeed extends ListActivity {
TextView tvText = (TextView) v.findViewById(R.id.tweet_text);
TextView tvDate = (TextView) v.findViewById(R.id.tweet_date);
TextView tvFrom = (TextView) v.findViewById(R.id.tweet_from);
+
+ // new DownloadImageTask((ImageView)
+ // findViewById(R.id.twitterPic)).execute(o.pic);
tvFrom.setText("@" + o.from);
tvDate.setText(o.date);
tvText.setText(o.text);