Mise en place nouvelle activite user info.
authorVincent Veronis <veroni_v@epitech.net>
Sun, 27 Sep 2009 19:09:18 +0200
changeset 415 164c96b9e98b
parent 410 60e54a934da2
child 416 ca334bc39396
Mise en place nouvelle activite user info.
AndroidManifest.xml
res/layout/contactlist.xml
res/layout/userinfo.xml
res/values-en/strings.xml
res/values-fr/strings.xml
src/com/beem/project/beem/ui/ContactDialog.java
src/com/beem/project/beem/ui/UserInfo.java
--- a/AndroidManifest.xml	Sun Sep 27 17:59:13 2009 +0200
+++ b/AndroidManifest.xml	Sun Sep 27 19:09:18 2009 +0200
@@ -55,6 +55,12 @@
 					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
 			</intent-filter>
 		</activity>
+		<activity android:name=".ui.UserInfo" android:label="@string/user_info_name">
+			<intent-filter android:label="Beem Connection">
+				<action
+					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
+			</intent-filter>
+		</activity>
 		<activity android:name=".jingle.demo.JingleCallActivity"
 			android:label="JingleDemoCall">
 			<intent-filter>
--- a/res/layout/contactlist.xml	Sun Sep 27 17:59:13 2009 +0200
+++ b/res/layout/contactlist.xml	Sun Sep 27 19:09:18 2009 +0200
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout android:id="@+id/linlayoutBase"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 	android:layout_width="fill_parent" android:layout_height="fill_parent"
-	android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
+	android:orientation="vertical">
 
 	<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
 		android:id="@+id/gallery" android:layout_width="fill_parent"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/userinfo.xml	Sun Sep 27 19:09:18 2009 +0200
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:orientation="vertical" android:layout_width="fill_parent"
+	android:layout_height="fill_parent">
+	<ListView android:id="@+id/userinfo" android:layout_width="fill_parent"
+		android:layout_height="fill_parent" />
+	<LinearLayout android:id="@+id/userinfo_alias"
+		android:orientation="horizontal" android:layout_width="fill_parent"
+		android:layout_height="wrap_content" android:paddingLeft="10px"
+		android:paddingRight="10px" android:gravity="center_vertical">
+
+		<ImageView android:id="@+id/contactliststatus"
+			android:adjustViewBounds="true" android:maxWidth="15dip"
+			android:maxHeight="15dip" android:layout_width="wrap_content"
+			android:layout_height="wrap_content" android:gravity="center_vertical" />
+
+		<LinearLayout android:orientation="vertical"
+			android:layout_weight="1" android:layout_width="fill_parent"
+			android:layout_height="wrap_content">
+			<TextView android:id="@+id/contactlistpseudo"
+				android:layout_width="fill_parent" android:layout_height="wrap_content"
+				android:paddingLeft="20sp" android:singleLine="true"
+				android:maxLines="1" />
+			<TextView android:id="@+id/contactlistmsgperso"
+				android:layout_width="fill_parent" android:layout_height="wrap_content"
+				android:paddingLeft="20sp" android:singleLine="true"
+				android:maxLines="1" android:autoLink="all" />
+		</LinearLayout>
+
+		<ImageView android:id="@+id/contactlistavatar"
+			android:adjustViewBounds="true" android:maxWidth="50dip"
+			android:maxHeight="50dip" android:padding="1dip"
+			android:layout_width="wrap_content" android:layout_height="wrap_content"
+			android:gravity="center_vertical" />
+
+	</LinearLayout>
+</LinearLayout>
\ No newline at end of file
--- a/res/values-en/strings.xml	Sun Sep 27 17:59:13 2009 +0200
+++ b/res/values-en/strings.xml	Sun Sep 27 19:09:18 2009 +0200
@@ -20,7 +20,8 @@
 	<!--  Preferences informations -->
 	<string name="PreferenceStatus">status</string>
 	<string name="PreferenceStatusText">status_text</string>
-	<string name="PreferenceIsConfigured">preference_is_configured</string>
+	<string name="PreferenceIsConfigured">preference_is_configured
+	</string>
 
 	<!-- ContactListSettings class -->
 	<string name="CLSServerConnection">Server connection</string>
@@ -44,7 +45,7 @@
 	</string>
 	<string name="CDSure2DeleteYes">Yes</string>
 	<string name="CDSure2DeleteNo">No</string>
-	
+
 
 	<!-- AddContact class -->
 	<string name="AddCActTitle">Beem - Add contact</string>
@@ -107,15 +108,13 @@
     	Activities
     -->
     <string name="login_tag">BEEM - Login Activity</string>
-    
     <string name="edit_settings_name">BEEM - Settings</string>
-	<string name="edit_settings_tag">BEEM - EditSettings Activity</string>
-	
+	<string name="edit_settings_tag">BEEM - EditSettings Activity</string>	
     <string name="create_account_name">BEEM - Create an account</string>
     <string name="create_account_tag">BEEM - CreateAccount Activity</string>
-    
     <string name="contact_list_name">BEEM - Contacts</string>
     <string name="contact_list_tag">BEEM - ContactList Activity</string>
+    <string name="user_info_name">BEEM - User Info</string>
 
     
     <!--
--- a/res/values-fr/strings.xml	Sun Sep 27 17:59:13 2009 +0200
+++ b/res/values-fr/strings.xml	Sun Sep 27 19:09:18 2009 +0200
@@ -111,6 +111,7 @@
     <string name="create_account_tag">BEEM - CreateAccount Activity</string>
     <string name="contact_list_name">BEEM - Contacts</string>
     <string name="contact_list_tag">BEEM - ContactList Activity</string>
+    <string name="user_info_name">BEEM - Informations</string>
     
     <!--
     	Buttons
--- a/src/com/beem/project/beem/ui/ContactDialog.java	Sun Sep 27 17:59:13 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactDialog.java	Sun Sep 27 19:09:18 2009 +0200
@@ -49,10 +49,10 @@
 	button.setOnClickListener(new deleteListener());
 	button = (Button) findViewById(R.id.CDResend);
 	button.setOnClickListener(new resendListener());
+	button = (Button) findViewById(R.id.CDBlock);
+	button.setOnClickListener(new blockListener());
 	button = (Button) findViewById(R.id.CDInfos);
 	button.setOnClickListener(new infosListener());
-	button = (Button) findViewById(R.id.CDBlock);
-	button.setOnClickListener(new blockListener());
 	button = (Button) findViewById(R.id.CDCall);
 	button.setOnClickListener(new CallListener());
 
@@ -149,7 +149,11 @@
     class infosListener implements View.OnClickListener {
 
 	@Override
-	public void onClick(View v) {	    
+	public void onClick(View v) {
+	    Activity a = ContactDialog.this.getOwnerActivity();
+	    Intent i = new Intent(mContext, UserInfo.class);
+	    i.setData(mContact.toUri());
+	    a.startActivity(i);
 	    dismiss();
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/UserInfo.java	Sun Sep 27 19:09:18 2009 +0200
@@ -0,0 +1,95 @@
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+
+/**
+ * This activity class provides the view for user infos after long click on a correspondant.
+ * @author marseille
+ */
+public class UserInfo extends Activity {
+
+    private Contact mContact;
+
+    /**
+     * Constructor.
+     */
+    public UserInfo() {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+	super.onCreate(savedInstanceState);
+	setContentView(R.layout.userinfo);
+	mContact = new Contact(getIntent().getData());
+	setTitle(mContact.getName());
+	ListView listview = (ListView) findViewById(R.id.userinfo);
+	listview.setAdapter(new BeemUserInfo(this));
+    }
+
+    /**
+     * Adapter banner list.
+     */
+    public class BeemUserInfo extends BaseAdapter {
+	private LayoutInflater mInflater;
+
+	/**
+	 * Constructor.
+	 * @param c context activity.
+	 */
+	public BeemUserInfo(final Context c) {
+	    mInflater = LayoutInflater.from(c);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public int getCount() {
+	    return 1;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public Object getItem(int position) {
+	    return position;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public long getItemId(int position) {
+	    return position;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public View getView(int position, View convertView, ViewGroup parent) {
+	    View v = convertView;
+	    if (convertView == null) {
+		v = mInflater.inflate(R.id.userinfo_alias, null);
+	    }
+	    return v;
+	}
+
+    }
+
+}