Added user profile page, implementing user data passing

master
spike 13 years ago
parent 094c798011
commit 989493fe04

@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="14"/>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
<application
android:icon="@drawable/ic_launcher"
@ -29,13 +29,8 @@
android:name=".Likes"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<activity
android:label="@string/app_name"
android:name=".Search"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
</activity>
<activity android:name=".UserProfile"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
</FrameLayout>
</LinearLayout>
</TabHost>

@ -11,7 +11,7 @@
android:id="@+building_list/search_box"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="type to filter"
android:hint="type to filter or use menu"
android:maxLines="1" />
<ListView

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/profile_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</LinearLayout>

@ -53,7 +53,32 @@
android:layout_marginTop="2px"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25px" />
android:textSize="25px" />
<TextView
android:id="@+id/fb_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TextView" android:visibility="gone"/>
<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/tw_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" android:visibility="gone"/>
<TextView
android:id="@+id/ld_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" android:visibility="gone"/>
</LinearLayout>
</LinearLayout>

@ -2,9 +2,17 @@
<resources>
<string name="hello">Hello World, LeWebConnectActivity!</string>
<string name="app_name">LeWebConnect</string>
<string name="search_hint">Type in a persone or a company name </string>
<string name="search_hint">type to filter or use menu</string>
<string name="filter_name">By Name</string>
<string name="filter_company">By Company</string>
<string name="filter_country">By Country</string>
<string name="filter_country">By Country</string>
<string name="facebook_menu">Facebook</string>
<string name="linkedin_menu">Linkedin</string>
<string name="twitter_menu">Twitter</string>
<string name="user_profile">User Profile</string>
<string name="id_text">id_text</string>
<string name="fb_text">fb_text</string>
<string name="ld_text">ld_text</string>
<string name="tw_text">tw_text</string>
</resources>

@ -194,10 +194,7 @@ public class LeWebAdapter extends ArrayAdapter<Attendee> {
company.setText(user.getCompany());
if (country != null)
country.setText(user.getCountry());
ImageView imageView = (ImageView) rowview.findViewById(R.id.icons);
setImage(imageView, user);
// imageView.setVisibility(View.GONE);
setSocial(rowview, user);
if(enableSections && getSectionForPosition(position) != getSectionForPosition(position - 1))
{
// Log.d("getView", "Setting Header ........ " + String.valueOf(position));
@ -221,30 +218,62 @@ public class LeWebAdapter extends ArrayAdapter<Attendee> {
}
private void setImage(ImageView imageView, Attendee user) {
private void setSocial(View rowview, Attendee user) {
// TODO Auto-generated method stub
boolean facebook = false;
boolean twitter = false;
boolean linkedin = 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());
if (facebook && twitter && linkedin)
fb.setText("null");
ld.setText("null");
tw.setText("null");
if (facebook && twitter && linkedin){
imageView.setImageResource(R.drawable.social_all);
else if (facebook && twitter)
fb.setText(user.getFacebook());
tw.setText(user.getTwitter());
ld.setText(user.getLinkedin());
}
else if (facebook && twitter) {
imageView.setImageResource(R.drawable.no_linkedin);
else if (facebook && linkedin)
fb.setText(user.getFacebook());
tw.setText(user.getTwitter());
}
else if (facebook && linkedin) {
imageView.setImageResource(R.drawable.no_twitter);
else if (twitter && linkedin)
fb.setText(user.getFacebook());
ld.setText(user.getLinkedin());
}
else if (twitter && linkedin) {
imageView.setImageResource(R.drawable.no_fb);
else if (twitter)
tw.setText(user.getTwitter());
ld.setText(user.getLinkedin());
}
else if (twitter) {
imageView.setImageResource(R.drawable.twitter);
else if (facebook)
tw.setText(user.getTwitter());
}
else if (facebook) {
imageView.setImageResource(R.drawable.fb);
else if (linkedin)
fb.setText(user.getFacebook());
}
else if (linkedin) {
imageView.setImageResource(R.drawable.linkedin);
else
ld.setText(user.getLinkedin());
}
else
imageView.setImageResource(R.drawable.no_all);
}

@ -30,12 +30,6 @@ public class LeWebConnect extends TabActivity{
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, Search.class);
spec = tabHost
.newTabSpec("search")
.setIndicator("", res.getDrawable(R.drawable.ic_tab_search))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, Likes.class);
spec = tabHost
.newTabSpec("likes")

@ -15,6 +15,7 @@ import com.thinkit.lewebconnect.Attendee.LeWebByLnameComparator;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.sax.Element;
import android.text.Editable;
@ -31,13 +32,19 @@ import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Filterable;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
public class Perticipents extends ListActivity {
/** Called when the activity is first created. */
private static final int FACEBOOK = Menu.FIRST;
private static final int TWITTER = Menu.FIRST + 1;
private static final int LINKEDIN = Menu.FIRST + 2;
private static String TAG = "Perticipents";
private ArrayList<Attendee> users;
private EditText filterText = null;
@ -71,7 +78,6 @@ public class Perticipents extends ListActivity {
Collections.sort(users, new LeWebByLnameComparator());
setContentView(R.layout.perticipents);
filterText= (EditText) findViewById(R.building_list.search_box);
filterText.addTextChangedListener(filterTextWatcher);
@ -80,12 +86,13 @@ public class Perticipents extends ListActivity {
ListView lv = getListView();
lv.setFastScrollEnabled(true);
lv.setTextFilterEnabled(false);
registerForContextMenu(lv);
adapter = new LeWebAdapter(this, users, true, false, false);
setListAdapter(adapter);
registerForContextMenu(getListView());
@ -96,7 +103,7 @@ public class Perticipents extends ListActivity {
}
private TextWatcher filterTextWatcher = new TextWatcher() {
private TextWatcher filterTextWatcher = new TextWatcher() {
public void afterTextChanged(Editable s) {
}
@ -124,7 +131,27 @@ public class Perticipents extends ListActivity {
filterText.removeTextChangedListener(filterTextWatcher);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
try {
Intent i = new Intent(this, UserProfile.class);
Attendee user = (Attendee) l.getItemAtPosition(position);
Toast.makeText(this, user.getLname(), Toast.LENGTH_LONG).show();
i.putExtra("user_name", user.getLinkedin());
startActivity(i);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
@ -191,7 +218,32 @@ public class Perticipents extends ListActivity {
return super.onOptionsItemSelected(item);
}
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu((ContextMenu) menu, v, menuInfo);
menu.add(0, FACEBOOK, 0, R.string.facebook_menu);
menu.add(0, TWITTER, 0, R.string.twitter_menu);
menu.add(0, LINKEDIN, 0, R.string.linkedin_menu);
}
public boolean onContextItemSelected(MenuItem item) {
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();
return true;
}
case TWITTER:
return true;
case LINKEDIN:
return true;
}
return super.onContextItemSelected(item);
}
public Attendee NodeToAttendee(Node userNode)
{
NamedNodeMap attrs = userNode.getAttributes();

@ -1,15 +0,0 @@
package com.thinkit.lewebconnect;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Search extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
textview.setText("search view");
setContentView(textview); }
}

@ -0,0 +1,25 @@
package com.thinkit.lewebconnect;
import com.thinkit.lewebconnect.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class UserProfile extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// 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);
}
}
}
Loading…
Cancel
Save