Added likes, fixed profile, removed ugly Toasts

master
spike 13 years ago
parent 989493fe04
commit 76cdc1fd55

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -2,13 +2,47 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:orientation="vertical" >
<TextView
android:id="@+id/profile_name"
android:layout_width="match_parent"
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"/>
android:background="#002531" >
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical" android:paddingLeft="20px">
<TextView
android:id="@+id/profile_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="60px" android:paddingBottom="20px"/>
<TextView
android:id="@+id/profile_company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="35px" android:paddingBottom="20px"/>
<TextView
android:id="@+id/profile_country"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="30px" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -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" />
<LinearLayout
android:id="@+id/linearLayout2"
android:id="@+id/linearLayout3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" android:layout_weight="4">
android:layout_weight="4" >
<TextView
android:id="@+id/name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="40px"/>
<TextView
android:id="@+id/company_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25px" />
<TextView
android:id="@+id/country_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25px" />
<TextView
android:id="@+id/fb_text"
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TextView" android:visibility="gone"/>
android:layout_weight="4"
android:orientation="vertical" >
<TextView
android:id="@+id/id_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TextView" android:visibility="gone"/>
<TextView
android:id="@+id/name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="40px" />
<TextView
android:id="@+id/tw_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" android:visibility="gone"/>
<TextView
android:id="@+id/company_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25px" />
<TextView
android:id="@+id/country_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25px" />
</LinearLayout>
<TextView
android:id="@+id/ld_text"
android:id="@+id/likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" android:visibility="gone"/>
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"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -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());

@ -19,7 +19,7 @@ import android.widget.TextView;
public class LeWebAdapter extends ArrayAdapter<Attendee> {
private final Context context;
private ArrayList<Attendee> users;
public ArrayList<Attendee> users;
/**
* Lock used to modify the content of {@link #mObjects}. Any write operation
@ -188,12 +188,15 @@ public class LeWebAdapter extends ArrayAdapter<Attendee> {
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<Attendee> {
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);

@ -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;
}
}

@ -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();
}
}
}

Loading…
Cancel
Save