diff --git a/LeWebConnect2011/AndroidManifest.xml b/LeWebConnect2011/AndroidManifest.xml index b401540..85d557c 100644 --- a/LeWebConnect2011/AndroidManifest.xml +++ b/LeWebConnect2011/AndroidManifest.xml @@ -26,7 +26,7 @@ diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_dark.png b/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_dark.png index 5064df4..b173d83 100644 Binary files a/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_dark.png and b/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_dark.png differ diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_light.png b/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_light.png index eda45eb..2b295ce 100644 Binary files a/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_light.png and b/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites_light.png differ diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_dark.png b/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_dark.png index b4addca..f537090 100644 Binary files a/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_dark.png and b/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_dark.png differ diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_light.png b/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_light.png index 4c71404..41c58ee 100644 Binary files a/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_light.png and b/LeWebConnect2011/res/drawable-hdpi/ic_tab_perticipents_light.png differ diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites.xml b/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit.xml similarity index 62% rename from LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites.xml rename to LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit.xml index f674a98..26cb77f 100644 --- a/LeWebConnect2011/res/drawable-hdpi/ic_tab_favorites.xml +++ b/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit.xml @@ -1,8 +1,8 @@ - - + \ No newline at end of file diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit_dark.png b/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit_dark.png new file mode 100644 index 0000000..c498472 Binary files /dev/null and b/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit_dark.png differ diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit_light.png b/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit_light.png new file mode 100644 index 0000000..a9448bc Binary files /dev/null and b/LeWebConnect2011/res/drawable-hdpi/ic_tab_thinkit_light.png differ diff --git a/LeWebConnect2011/res/drawable-hdpi/logo_thinkit.png b/LeWebConnect2011/res/drawable-hdpi/logo_thinkit.png new file mode 100644 index 0000000..c716f05 Binary files /dev/null and b/LeWebConnect2011/res/drawable-hdpi/logo_thinkit.png differ diff --git a/LeWebConnect2011/res/layout/main.xml b/LeWebConnect2011/res/layout/main.xml index 1dc6912..1933b26 100644 --- a/LeWebConnect2011/res/layout/main.xml +++ b/LeWebConnect2011/res/layout/main.xml @@ -11,7 +11,7 @@ + android:layout_height="60px" /> + android:orientation="vertical" android:layout_gravity="center"> - + + + + + + + \ No newline at end of file diff --git a/LeWebConnect2011/res/layout/thinkit.xml b/LeWebConnect2011/res/layout/thinkit.xml new file mode 100644 index 0000000..9fb7c10 --- /dev/null +++ b/LeWebConnect2011/res/layout/thinkit.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/LeWebConnect2011/res/layout/tweet_row.xml b/LeWebConnect2011/res/layout/tweet_row.xml new file mode 100644 index 0000000..5d74b2e --- /dev/null +++ b/LeWebConnect2011/res/layout/tweet_row.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java index f837063..1ed661e 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java @@ -48,7 +48,7 @@ public class LeWebAdapter extends ArrayAdapter { boolean enableSections, boolean companySections, boolean countrySections) { super(context, R.layout.rowlayout, users); - Log.d("LeWebAdapter", "LeWebAdapter constructor"); +// Log.d("LeWebAdapter", "LeWebAdapter constructor"); this.context = context; this.users = users; this.filter = new LeWebFilter(); @@ -148,7 +148,7 @@ public class LeWebAdapter extends ArrayAdapter { public void notifyDataSetChanged(){ if (enableSections) { - Log.d("notifyDataSetChanged", "..."); +// Log.d("notifyDataSetChanged", "..."); buildHashIndexer(); buildSections(); } @@ -161,7 +161,7 @@ public class LeWebAdapter extends ArrayAdapter { { if(enableSections) { - Log.d("notifyDataSetInvalidated", "..."); +// Log.d("notifyDataSetInvalidated", "..."); buildHashIndexer(); buildSections(); @@ -276,10 +276,10 @@ public class LeWebAdapter extends ArrayAdapter { return alphaIndexer.get(letter); } catch (Exception e) { // TODO: handle exception - Log.d("getPositionForSection", String.valueOf(section)); - Log.d("getPositionForSection", "alphaindexer: " + alphaIndexer.toString()); - Log.d("getPositionForSection", "sections: " + getSections()); - //e.printStackTrace(); +// Log.d("getPositionForSection", String.valueOf(section)); +// Log.d("getPositionForSection", "alphaindexer: " + alphaIndexer.toString()); +// Log.d("getPositionForSection", "sections: " + getSections()); + e.printStackTrace(); } return 0; } @@ -338,7 +338,7 @@ public class LeWebAdapter extends ArrayAdapter { protected FilterResults performFiltering(CharSequence constraint) { // NOTE: this function is *always* called from a background thread, and // not the UI thread. - Log.d("Filter", "Filter ....."); +// Log.d("Filter", "Filter ....."); FilterResults results = new FilterResults(); diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebConnect.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebConnect.java index 9a859c1..ed66433 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebConnect.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebConnect.java @@ -30,17 +30,17 @@ public class LeWebConnect extends TabActivity{ .setContent(intent); tabHost.addTab(spec); // Do the same for the other tabs - intent = new Intent().setClass(this, Likes.class); + intent = new Intent().setClass(this, ThinkIT.class); spec = tabHost - .newTabSpec("likes") + .newTabSpec("thinkit") .setIndicator("", - res.getDrawable(R.drawable.ic_tab_favorites)) + res.getDrawable(R.drawable.ic_tab_thinkit)) .setContent(intent); tabHost.addTab(spec); tabHost.setCurrentTab(0); } catch (Exception e) { // TODO: handle exception - Log.d("Error", e.toString()); +// Log.d("Error", e.toString()); e.printStackTrace(); } } diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/Likes.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/Likes.java deleted file mode 100644 index 1cabe0f..0000000 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/Likes.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.thinkit.lewebconnect; - -import android.app.Activity; -import android.os.Bundle; - -public class Likes extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - } -} \ No newline at end of file diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java index 6d79436..ebbe8cf 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java @@ -119,11 +119,11 @@ public class Perticipents extends ListActivity { public void onTextChanged(CharSequence s, int start, int before, int count) { ListView lv = getListView(); - Log.d("onTextChanged", s.toString()); - Log.d("getCount", String.valueOf(lv.getAdapter().getCount())); +// Log.d("onTextChanged", s.toString()); +// Log.d("getCount", String.valueOf(lv.getAdapter().getCount())); adapter = (ArrayAdapter) lv.getAdapter(); adapter.getFilter().filter(s); - Log.d("getCount", String.valueOf(lv.getAdapter().getCount())); +// Log.d("getCount", String.valueOf(lv.getAdapter().getCount())); } }; @@ -147,14 +147,15 @@ public class Perticipents extends ListActivity { LeWebAdapter adapter = (LeWebAdapter) l.getAdapter(); Attendee user = (Attendee) adapter.users.get(position); -// Toast.makeText(this, user.getCompany(), Toast.LENGTH_LONG).show(); - i.putExtra(Attendee.LNAME, user.getLname()); i.putExtra(Attendee.FNAME, user.getFname()); i.putExtra(Attendee.COUNTRY, user.getCountry()); i.putExtra(Attendee.COMPANY, user.getCompany()); i.putExtra(Attendee.FACEBOOK, user.getFacebook()); - i.putExtra(Attendee.TWITTER, user.getTwitter()); + if (user.isHas_twitter()) + { + i.putExtra(Attendee.TWITTER, user.getTwitter()); + } i.putExtra(Attendee.LINKEDIN, user.getLinkedin()); i.putExtra(Attendee.LIKES, user.getLikes()); i.putExtra(Attendee.ID, user.getId()); diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/ThinkIT.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/ThinkIT.java new file mode 100644 index 0000000..acdf231 --- /dev/null +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/ThinkIT.java @@ -0,0 +1,55 @@ +package com.thinkit.lewebconnect; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class ThinkIT extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + // TODO Auto-generated method stub + super.onCreate(savedInstanceState); + + setContentView(R.layout.thinkit); + + try { + View button = findViewById(R.id.thinkit_button); + button.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + String url = "http://i-think-it.com/"; + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + startActivity(i); + } + }); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + View button = findViewById(R.id.email); + button.setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + // TODO Auto-generated method stub + final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); + emailIntent.setType("plain/text"); + emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"contact@i-think-it.com"}); + emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Feedback"); + emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hello guys, your app is great ... "); + startActivity(Intent.createChooser(emailIntent, "Send mail...")); + } + }); + + + + } + + + +} diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/Tweet.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/Tweet.java new file mode 100644 index 0000000..dfabe63 --- /dev/null +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/Tweet.java @@ -0,0 +1,102 @@ +package com.thinkit.lewebconnect; + +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.ResponseHandler; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.BasicResponseHandler; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; + +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.widget.Toast; + +public class Tweet { + public static final String TWEETS_URL = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name="; + public String message; + public String date_created; + public String tweet_id; + public String profile_image_url; + + public Tweet(String tweet_id, String message, String date_created, String profile_image_url) { + this.message = message; + this.date_created = date_created; + this.tweet_id = tweet_id; + this.profile_image_url = profile_image_url; + } + + public static ArrayList getTweets(String username) { + + ArrayList tweets = new ArrayList(); + + HttpClient client = new DefaultHttpClient(); + HttpGet get = new HttpGet(TWEETS_URL + username + "&count=10"); + + + HttpResponse httpResponse = null; + +// ResponseHandler responseHandler = new BasicResponseHandler(); + String responseBody = null; + + try { +// responseBody = client.execute(get, responseHandler); + httpResponse = client.execute(get); + HttpEntity httpEntity = httpResponse.getEntity(); + responseBody = EntityUtils.toString(httpEntity, "UTF-8"); + } catch (ClientProtocolException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + try { +// JSONObject stats = (JSONObject) new JSONTokener(responseBody).nextValue(); + JSONTokener tokener = new JSONTokener(responseBody); + JSONArray stats = new JSONArray(tokener); + + for (int i =0; i < stats.length(); i++) { + JSONObject stat = stats.getJSONObject(i); + String tweet_id = stat.getString("id_str"); + String tweet_msg = stat.getString("text"); + String tweet_date = stat.getString("created_at"); + tweet_date = tweet_date.substring(0, 16); + JSONObject user = stat.getJSONObject("user"); + String profile_image = user.getString("profile_image_url"); + Tweet tweet = new Tweet(tweet_id, tweet_msg, tweet_date, profile_image); + tweets.add(tweet); + } + + } catch (JSONException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return tweets; + + } + + public Bitmap getBitmap(String bitmapUrl) { + try { + URL url = new URL(bitmapUrl); + return BitmapFactory.decodeStream(url.openConnection().getInputStream()); + } catch (Exception e) { + // TODO: handle exception + return null; + } + } + +} diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/TweetsAdapter.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/TweetsAdapter.java new file mode 100644 index 0000000..271bf29 --- /dev/null +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/TweetsAdapter.java @@ -0,0 +1,51 @@ +package com.thinkit.lewebconnect; + +import java.util.ArrayList; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +public class TweetsAdapter extends ArrayAdapter { + private ArrayList tweets; + private Context context; + + public TweetsAdapter(Context context, int textViewResouceID, ArrayList tweets) { + super(context, textViewResouceID, tweets); + this.tweets = tweets; + this.context = context; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View v = convertView; + if (v == null) { + LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + v = vi.inflate(R.layout.tweet_row, null); + } + + Tweet tweet = tweets.get(position); + if (tweet != null) { + TextView tweet_msg = (TextView) v.findViewById(R.id.tweet_text); + TextView tweet_date = (TextView) v.findViewById(R.id.tweet_date); +// ImageView image = (ImageView) v.findViewById(R.id.avatar); +// + if (tweet_date != null) { + tweet_date.setText(tweet.date_created); + } + + if(tweet_msg != null) { + tweet_msg.setText(tweet.message); + } + +// if(image != null) { +// image.setImageBitmap(getBitmap(tweet.image_url)); +// } + } + return v; + + } +} diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java index fea6e35..a17e192 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java @@ -2,6 +2,7 @@ package com.thinkit.lewebconnect; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; +import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; @@ -15,6 +16,7 @@ import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; +import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; @@ -51,6 +53,17 @@ public class UserProfile extends Activity { } }); + String twitter_name = extras.getString(Attendee.TWITTER); + if (twitter_name != null) + { + + ArrayList tweets = Tweet.getTweets(twitter_name); + ListView lv = (ListView) findViewById(R.id.tweets_list); + lv.setAdapter(new TweetsAdapter(this, R.layout.tweet_row, tweets)); + } + + + } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -71,4 +84,6 @@ public class UserProfile extends Activity { } + + } \ No newline at end of file