- Added like button

- Filter by Lname and Fname
- go to browser social networks

TODO:
location, dynamic context menu, thinkit tab, smaller tabs, tweeter feeds
master
unknown 13 years ago
parent 7ddf5ecfe6
commit 436f26acb7

@ -8,7 +8,8 @@
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#002531" >
android:background="#002531"
android:baselineAligned="false" >
<LinearLayout
android:id="@+id/linearLayout2"
@ -23,7 +24,7 @@
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="60px" android:paddingBottom="20px"/>
android:textSize="40px" android:paddingBottom="20px"/>
<TextView
android:id="@+id/profile_company"
@ -32,7 +33,7 @@
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="35px" android:paddingBottom="20px"/>
android:textSize="25px" android:paddingBottom="20px"/>
<TextView
android:id="@+id/profile_country"
@ -41,8 +42,31 @@
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="30px" />
android:textSize="25px" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:layout_weight="10">
<TextView
android:id="@+id/profile_likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="20px" android:drawingCacheQuality="auto" android:layout_marginTop="20px" android:layout_marginLeft="30px" android:drawableRight="@drawable/ic_favorites_tiny" android:drawablePadding="10px"/>
<Button
android:id="@+id/like_button"
android:layout_width="42dp"
android:layout_height="30dp"
android:text="Like" android:layout_marginTop="10px" android:layout_marginLeft="15px" android:textSize="14px" android:background="#3299bb" android:layout_weight="0"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -2,6 +2,8 @@ package com.thinkit.lewebconnect;
import java.util.Comparator;
import android.R.bool;
public class Attendee{
private int id;
private String fname;
@ -13,6 +15,9 @@ public class Attendee{
private String facebook;
private String country;
private int likes;
private boolean has_facebook = false;
private boolean has_twitter = false;
private boolean has_linkedin = false;
@ -23,6 +28,9 @@ public class Attendee{
public static final String LINKEDIN = "linkedin";
public static final String FACEBOOK = "facebook";
public static final String COUNTRY = "country";
public static final String LIKES = "likes";
public static final String ID = "user_id";
public Attendee()
@ -73,6 +81,8 @@ public class Attendee{
public void setTwitter(String twitter) {
this.twitter = twitter;
if ( twitter != null && !twitter.equals("null") && !twitter.isEmpty())
setHas_twitter(true);
}
public String getUrl() {
@ -89,6 +99,8 @@ public class Attendee{
public void setLinkedin(String linkedin) {
this.linkedin = linkedin;
if ( linkedin != null && !linkedin.equals("null") && !linkedin.isEmpty())
setHas_linkedin(true);
}
public String getFacebook() {
@ -97,6 +109,8 @@ public class Attendee{
public void setFacebook(String facebook) {
this.facebook = facebook;
if ( facebook != null && !facebook.equals("null") && !facebook.isEmpty())
setHas_facebook(true);
}
public String getCountry() {
@ -115,6 +129,30 @@ public class Attendee{
this.likes = likes;
}
public boolean isHas_facebook() {
return has_facebook;
}
public void setHas_facebook(boolean has_facebook) {
this.has_facebook = has_facebook;
}
public boolean isHas_twitter() {
return has_twitter;
}
public void setHas_twitter(boolean has_twitter) {
this.has_twitter = has_twitter;
}
public boolean isHas_linkedin() {
return has_linkedin;
}
public void setHas_linkedin(boolean has_linkedin) {
this.has_linkedin = has_linkedin;
}
@Override public String toString() {
return new String(getFname() + " " + getLname());

@ -223,15 +223,15 @@ public class LeWebAdapter extends ArrayAdapter<Attendee> {
private void setSocial(View rowview, Attendee user) {
// TODO Auto-generated method stub
boolean twitter = false;
boolean linkedin = false;
boolean facebook = false;
boolean twitter;
boolean linkedin;
boolean facebook;
ImageView imageView = (ImageView) rowview.findViewById(R.id.icons);
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());
facebook = user.isHas_facebook();
linkedin = user.isHas_linkedin();
twitter = user.isHas_twitter();
if (facebook && twitter && linkedin){
@ -373,7 +373,8 @@ public class LeWebAdapter extends ArrayAdapter<Attendee> {
valueText = value.getCountry().toLowerCase();
}
else {
valueText = value.getLname().toLowerCase();
valueText = value.getLname().toLowerCase() +
" " + value.getFname().toLowerCase();
}
// First match against the whole, non-splitted value

@ -16,6 +16,7 @@ import com.thinkit.lewebconnect.Attendee.LeWebByLnameComparator;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.sax.Element;
import android.text.Editable;
@ -29,6 +30,7 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Filterable;
import android.widget.ListView;
@ -96,6 +98,8 @@ public class Perticipents extends ListActivity {
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
@ -152,6 +156,8 @@ public class Perticipents extends ListActivity {
i.putExtra(Attendee.FACEBOOK, user.getFacebook());
i.putExtra(Attendee.TWITTER, user.getTwitter());
i.putExtra(Attendee.LINKEDIN, user.getLinkedin());
i.putExtra(Attendee.LIKES, user.getLikes());
i.putExtra(Attendee.ID, user.getId());
startActivity(i);
} catch (Exception e) {
// TODO Auto-generated catch block
@ -236,19 +242,50 @@ public class Perticipents extends ListActivity {
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
LeWebAdapter adapter = (LeWebAdapter) getListAdapter();
Attendee user = (Attendee) adapter.users.get(info.position);
switch(item.getItemId()) {
case FACEBOOK:
{
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
int id = (int) info.position;
Toast.makeText(this, String.valueOf(id), Toast.LENGTH_LONG).show();
if (user.isHas_facebook())
{
String url = user.getFacebook();
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
else
Toast.makeText(this, "user do not have facebook", Toast.LENGTH_LONG).show();
return true;
}
case TWITTER:
{
if (user.isHas_twitter()){
String url = "http://twitter.com/" + user.getTwitter();
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
else
Toast.makeText(this, "user do not have twitter", Toast.LENGTH_LONG).show();
return true;
}
case LINKEDIN:
{
if (user.isHas_linkedin())
{
String url = user.getLinkedin();
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
else
Toast.makeText(this, "user do not have linkedin", Toast.LENGTH_LONG).show();
return true;
}
}
return super.onContextItemSelected(item);
}
@ -261,7 +298,9 @@ public class Perticipents extends ListActivity {
String country = attrs.getNamedItem("country").getTextContent();
String facebook = attrs.getNamedItem("facebook").getTextContent();
String twitter = attrs.getNamedItem("twitter").getTextContent();
String linkedin = attrs.getNamedItem("linkedin").getTextContent();
String likes = attrs.getNamedItem("likes").getTextContent();
String id = attrs.getNamedItem("id").getTextContent();
Attendee user = new Attendee();
user.setFname(fname);
@ -270,7 +309,9 @@ public class Perticipents extends ListActivity {
user.setCountry(country);
user.setFacebook(facebook);
user.setTwitter(twitter);
user.setLinkedin(linkedin);
user.setLikes(Integer.valueOf(likes));
user.setId(Integer.valueOf(id));
return user;
}

@ -1,9 +1,22 @@
package com.thinkit.lewebconnect;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import com.thinkit.lewebconnect.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class UserProfile extends Activity {
@ -19,17 +32,43 @@ public class UserProfile extends Activity {
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();
final TextView mLikes = (TextView) findViewById(R.id.profile_likes);
final 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));
mLikes.setText(String.valueOf(extras.getInt(Attendee.LIKES)));
}
final Button button = (Button) findViewById(R.id.like_button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
incrementUser(extras.getInt(Attendee.ID));
mLikes.setText(String.valueOf(extras.getInt(Attendee.LIKES) + 1));
}
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void incrementUser(int id) {
// TODO Auto-generated method stub
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet get = new HttpGet(WebService.INCREMENT_USER + String.valueOf(id));
HttpResponse httpResponse = httpClient.execute(get);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -10,6 +10,7 @@ import android.util.Log;
public class WebService {
static String XML_DB_URL = "http://leweb.i-think-it.com/get/";
static String INCREMENT_USER = "http://leweb.i-think-it.com/inc/?id=";
static private String FILENAME = "leweb.xml";
private int bufsize = 1024;
private Context context;

@ -84,7 +84,7 @@ public class XMLfunctions {
HttpResponse httpResponse = httpClient.execute(get);
HttpEntity httpEntity = httpResponse.getEntity();
line = EntityUtils.toString(httpEntity);
line = EntityUtils.toString(httpEntity, "UTF-8");
} catch (UnsupportedEncodingException e) {
line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";

Loading…
Cancel
Save