From 76cdc1fd558aca2761e0e44ec3ad93b2e0eb44e6 Mon Sep 17 00:00:00 2001 From: spike Date: Wed, 30 Nov 2011 17:48:12 +0100 Subject: [PATCH] Added likes, fixed profile, removed ugly Toasts --- .../res/drawable-hdpi/ic_favorites_tiny.png | Bin 0 -> 3354 bytes LeWebConnect2011/res/layout/profile.xml | 46 ++++++++-- LeWebConnect2011/res/layout/rowlayout.xml | 81 ++++++++---------- .../com/thinkit/lewebconnect/Attendee.java | 20 +++++ .../thinkit/lewebconnect/LeWebAdapter.java | 28 ++---- .../thinkit/lewebconnect/Perticipents.java | 17 +++- .../com/thinkit/lewebconnect/UserProfile.java | 24 ++++-- 7 files changed, 133 insertions(+), 83 deletions(-) create mode 100644 LeWebConnect2011/res/drawable-hdpi/ic_favorites_tiny.png diff --git a/LeWebConnect2011/res/drawable-hdpi/ic_favorites_tiny.png b/LeWebConnect2011/res/drawable-hdpi/ic_favorites_tiny.png new file mode 100644 index 0000000000000000000000000000000000000000..f3bb78312fd4453aa80fe9741f9a57ffe867eafe GIT binary patch literal 3354 zcmV+#4dwEQP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-C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res/layout/profile.xml b/LeWebConnect2011/res/layout/profile.xml index cddc8d9..017ea0f 100644 --- a/LeWebConnect2011/res/layout/profile.xml +++ b/LeWebConnect2011/res/layout/profile.xml @@ -2,13 +2,47 @@ + android:orientation="vertical" > - + android:background="#002531" > + + + + + + + + + + \ No newline at end of file diff --git a/LeWebConnect2011/res/layout/rowlayout.xml b/LeWebConnect2011/res/layout/rowlayout.xml index b564f37..a1eb235 100644 --- a/LeWebConnect2011/res/layout/rowlayout.xml +++ b/LeWebConnect2011/res/layout/rowlayout.xml @@ -21,65 +21,58 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="20" - android:src="@drawable/no_all" /> + android:src="@drawable/no_all" /> + android:layout_weight="4" > - - - - - - - + android:layout_weight="4" + android:orientation="vertical" > - + - + + + + + android:layout_weight="1" + android:text="Medium Text" + android:textAppearance="?android:attr/textAppearanceSmall" android:layout_marginTop="10px" android:layout_marginRight="20px" android:drawableBottom="@drawable/ic_favorites_tiny"/> + \ No newline at end of file diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/Attendee.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/Attendee.java index 4113e04..a0b83b5 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/Attendee.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/Attendee.java @@ -12,6 +12,18 @@ public class Attendee{ private String linkedin; private String facebook; private String country; + private int likes; + + + + public static final String LNAME = "lname"; + public static final String FNAME = "fname"; + public static final String COMPANY = "company"; + public static final String TWITTER = "twitter"; + public static final String LINKEDIN = "linkedin"; + public static final String FACEBOOK = "facebook"; + public static final String COUNTRY = "country"; + public Attendee() { @@ -95,6 +107,14 @@ public class Attendee{ this.country = country; } + public int getLikes() { + return likes; + } + + public void setLikes(int likes) { + this.likes = likes; + } + @Override public String toString() { return new String(getFname() + " " + getLname()); diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java index c02c5e6..8e8437b 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/LeWebAdapter.java @@ -19,7 +19,7 @@ import android.widget.TextView; public class LeWebAdapter extends ArrayAdapter { private final Context context; - private ArrayList users; + public ArrayList users; /** * Lock used to modify the content of {@link #mObjects}. Any write operation @@ -188,12 +188,15 @@ public class LeWebAdapter extends ArrayAdapter { TextView name_text = (TextView) rowview.findViewById(R.id.name_text); TextView company = (TextView) rowview.findViewById(R.id.company_text); TextView country = (TextView) rowview.findViewById(R.id.country_text); + TextView likes = (TextView) rowview.findViewById(R.id.likes); if (name_text != null) name_text.setText(user.getLname() + " " + user.getFname()); if (company != null) company.setText(user.getCompany()); if (country != null) country.setText(user.getCountry()); + if (likes != null) + likes.setText(String.valueOf(user.getLikes())); setSocial(rowview, user); if(enableSections && getSectionForPosition(position) != getSectionForPosition(position - 1)) { @@ -220,58 +223,37 @@ public class LeWebAdapter extends ArrayAdapter { private void setSocial(View rowview, Attendee user) { // TODO Auto-generated method stub - boolean facebook = false; boolean twitter = false; boolean linkedin = false; + boolean facebook = false; ImageView imageView = (ImageView) rowview.findViewById(R.id.icons); - TextView id = (TextView) rowview.findViewById(R.id.id_text); - TextView fb = (TextView) rowview.findViewById(R.id.fb_text); - TextView tw = (TextView) rowview.findViewById(R.id.tw_text); - TextView ld = (TextView) rowview.findViewById(R.id.ld_text); - - id.setText(String.valueOf(user.getId())); facebook = ( user.getFacebook() != null && !user.getFacebook().equals("null") && !user.getFacebook().isEmpty()); linkedin = ( user.getLinkedin() != null && !user.getLinkedin().equals("null") && !user.getLinkedin().isEmpty()); twitter = ( user.getTwitter() != null && !user.getTwitter().equals("null") && !user.getTwitter().isEmpty()); - fb.setText("null"); - ld.setText("null"); - tw.setText("null"); if (facebook && twitter && linkedin){ imageView.setImageResource(R.drawable.social_all); - fb.setText(user.getFacebook()); - tw.setText(user.getTwitter()); - ld.setText(user.getLinkedin()); } else if (facebook && twitter) { imageView.setImageResource(R.drawable.no_linkedin); - fb.setText(user.getFacebook()); - tw.setText(user.getTwitter()); } else if (facebook && linkedin) { imageView.setImageResource(R.drawable.no_twitter); - fb.setText(user.getFacebook()); - ld.setText(user.getLinkedin()); } else if (twitter && linkedin) { imageView.setImageResource(R.drawable.no_fb); - tw.setText(user.getTwitter()); - ld.setText(user.getLinkedin()); } else if (twitter) { imageView.setImageResource(R.drawable.twitter); - tw.setText(user.getTwitter()); } else if (facebook) { imageView.setImageResource(R.drawable.fb); - fb.setText(user.getFacebook()); } else if (linkedin) { imageView.setImageResource(R.drawable.linkedin); - ld.setText(user.getLinkedin()); } else imageView.setImageResource(R.drawable.no_all); diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java index b89c855..65d986e 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/Perticipents.java @@ -140,10 +140,18 @@ public class Perticipents extends ListActivity { try { Intent i = new Intent(this, UserProfile.class); - Attendee user = (Attendee) l.getItemAtPosition(position); - Toast.makeText(this, user.getLname(), Toast.LENGTH_LONG).show(); + LeWebAdapter adapter = (LeWebAdapter) l.getAdapter(); + Attendee user = (Attendee) adapter.users.get(position); + +// Toast.makeText(this, user.getCompany(), Toast.LENGTH_LONG).show(); - i.putExtra("user_name", user.getLinkedin()); + 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()); + i.putExtra(Attendee.LINKEDIN, user.getLinkedin()); startActivity(i); } catch (Exception e) { // TODO Auto-generated catch block @@ -253,6 +261,7 @@ public class Perticipents extends ListActivity { String country = attrs.getNamedItem("country").getTextContent(); String facebook = attrs.getNamedItem("facebook").getTextContent(); String twitter = attrs.getNamedItem("twitter").getTextContent(); + String likes = attrs.getNamedItem("likes").getTextContent(); Attendee user = new Attendee(); user.setFname(fname); @@ -261,6 +270,8 @@ public class Perticipents extends ListActivity { user.setCountry(country); user.setFacebook(facebook); user.setTwitter(twitter); + user.setLikes(Integer.valueOf(likes)); + return user; } } \ No newline at end of file diff --git a/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java b/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java index 1a1a6e4..1a39a77 100644 --- a/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java +++ b/LeWebConnect2011/src/com/thinkit/lewebconnect/UserProfile.java @@ -13,13 +13,23 @@ public class UserProfile extends Activity { // TODO Auto-generated method stub super.onCreate(savedInstanceState); - setContentView(R.layout.profile); - setTitle(R.string.user_profile); - TextView mUserName = (TextView) findViewById(R.id.profile_name); - Bundle extras = getIntent().getExtras(); - if (extras != null) { - String name = extras.getString("user_name"); - mUserName.setText(name); + try { + setContentView(R.layout.profile); + setTitle(R.string.user_profile); + TextView mUserName = (TextView) findViewById(R.id.profile_name); + TextView mCompany = (TextView) findViewById(R.id.profile_company); + TextView mCountry = (TextView) findViewById(R.id.profile_country); + Bundle extras = getIntent().getExtras(); + if (extras != null) { + String fname = extras.getString(Attendee.FNAME); + String lname = extras.getString(Attendee.LNAME); + mUserName.setText(lname + " " + fname); + mCompany.setText(extras.getString(Attendee.COMPANY)); + mCountry.setText(extras.getString(Attendee.COUNTRY)); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); } } }