Toujours de la mise en place du user infos dans le longclick.
Menage.
--- a/AndroidManifest.xml Sun Sep 27 19:08:01 2009 +0200
+++ b/AndroidManifest.xml Sun Sep 27 20:02:15 2009 +0200
@@ -54,6 +54,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 19:08:01 2009 +0200
+++ b/res/layout/contactlist.xml Sun Sep 27 20:02:15 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"
--- a/res/layout/contactlistgroup.xml Sun Sep 27 19:08:01 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="50sp"
- android:paddingTop="5sp"
- android:gravity="center_vertical">
-
- <TextView android:id="@+id/textgroup"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:minHeight="30sp"
- android:paddingLeft="40sp" />
-
-</LinearLayout>
\ No newline at end of file
--- a/res/layout/contactlistsettings.xml Sun Sep 27 19:08:01 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <LinearLayout android:orientation="vertical"
- android:layout_width="fill_parent" android:layout_height="fill_parent">
-
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/CLSServerConnection"
- android:textSize="18sp" />
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="@string/CLSUserid"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/userid" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:scrollHorizontally="true" />
- </LinearLayout>
-
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="@string/CLSHostPort"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/host" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:layout_weight="2" android:scrollHorizontally="true" />
- <EditText android:id="@+id/port" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:layout_weight="3" android:scrollHorizontally="true" />
- </LinearLayout>
-
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="@string/CLSPassword"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/password" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:password="true" android:textSize="14sp" android:autoText="false"
- android:capitalize="none" android:scrollHorizontally="true" />
- </LinearLayout>
-
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text=""
- android:textSize="18sp" />
-
- <Spinner android:id="@+id/proxy_type" android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
-
- <LinearLayout android:id="@+id/proxy_layout"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="0sp">
-
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/CLSProxyInfo"
- android:textSize="18sp" />
-
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="@string/CLSHostPort"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/proxy_host"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:singleLine="true" android:textSize="14sp" android:autoText="false"
- android:capitalize="none" android:layout_weight="2"
- android:scrollHorizontally="true" />
- <EditText android:id="@+id/proxy_port"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:singleLine="true" android:textSize="14sp" android:autoText="false"
- android:capitalize="none" android:layout_weight="3"
- android:scrollHorizontally="true" />
- </LinearLayout>
-
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="@string/CLSLogin"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/proxy_login"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:singleLine="true" android:textSize="14sp" android:autoText="false"
- android:capitalize="none" android:scrollHorizontally="true" />
- </LinearLayout>
-
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="@string/CLSPassword"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/proxy_pwd" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:password="true" android:textSize="14sp" android:autoText="false"
- android:capitalize="none" android:scrollHorizontally="true" />
- </LinearLayout>
- </LinearLayout>
- <Button android:id="@+id/ok" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:layout_gravity="center_horizontal"
- android:text="@string/CLSOkButton">
- <requestFocus />
- </Button>
- </LinearLayout>
-</ScrollView>
\ No newline at end of file
--- a/res/layout/edit_settings.xml Sun Sep 27 19:08:01 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TabHost android:id="@+id/settings_tab_host" xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <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">
-
- <!--
- Account Tab
- -->
- <ScrollView
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <RelativeLayout android:id="@+id/settings_account"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:padding="10dip">
- <TextView android:id="@+id/settings_account_label_username"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/settings_account_username"
- style="@style/Label" />
- <EditText android:id="@+id/settings_account_username"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/settings_account_label_username"
- android:singleLine="true" />
- <TextView android:id="@+id/settings_account_label_password"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/settings_account_username"
- android:text="@string/settings_account_password"
- style="@style/Label" />
- <EditText android:id="@+id/settings_account_password"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/settings_account_label_password"
- android:password="true"
- android:singleLine="true" />
- <Button android:id="@+id/settings_account_button_save"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/settings_account_password"
- android:layout_alignParentRight="true"
- android:text="@string/button_save" />
- </RelativeLayout>
- </ScrollView>
-
- <!--
- XMPP Tab
- -->
- <ScrollView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical">
- <RelativeLayout android:id="@+id/settings_xmpp"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:padding="10dip">
- <TableLayout android:id="@+id/settings_xmpp_table_sp"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:stretchColumns="1">
- <TableRow>
- <TextView android:id="@+id/settings_xmpp_label_server"
- android:layout_column="1"
- android:layout_width="223dp"
- android:layout_height="wrap_content"
- android:text="@string/settings_xmpp_server"
- style="@style/Label" />
- <TextView android:id="@+id/settings_xmpp_label_port"
- android:layout_column="2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/settings_xmpp_port"
- style="@style/Label" />
- </TableRow>
- <TableRow>
- <EditText android:id="@+id/settings_xmpp_server"
- android:layout_column="1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:maxWidth="223dp"
- android:singleLine="true" />
- <EditText android:id="@+id/settings_xmpp_port"
- android:layout_column="2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:minWidth="77dp"
- android:numeric="integer"
- android:maxLength="5"
- android:singleLine="true" />
- </TableRow>
- </TableLayout>
- <CheckBox android:id="@+id/settings_xmpp_use_tls"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/settings_xmpp_use_tls"
- android:layout_below="@id/settings_xmpp_table_sp"
- android:focusable="true"
- style="@style/CheckBoxLabel" />
- <Button android:id="@+id/settings_xmpp_button_save"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_below="@id/settings_xmpp_use_tls"
- android:text="@string/button_save" />
- </RelativeLayout>
- </ScrollView>
-
- <!--
- Proxy Tab
- -->
- <ScrollView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical">
- <RelativeLayout android:id="@+id/settings_proxy"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:padding="10dip">
- <CheckBox android:id="@+id/settings_proxy_use"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/settings_proxy_use"
- android:focusable="true"
- style="@style/CheckBoxLabel" />
- <LinearLayout android:id="@+id/settings_proxy_parameters"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_below="@id/settings_proxy_use"
- android:orientation="vertical">
- <Spinner android:id="@+id/settings_proxy_type"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
- <TableLayout android:id="@+id/settings_proxy_table_sp"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:stretchColumns="1">
- <TableRow>
- <TextView android:id="@+id/settings_proxy_label_server"
- android:layout_column="1"
- android:layout_width="223dp"
- android:layout_height="wrap_content"
- android:text="@string/settings_proxy_server"
- style="@style/Label" />
- <TextView android:id="@+id/settings_proxy_label_port"
- android:layout_column="2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/settings_proxy_port"
- style="@style/Label" />
- </TableRow>
- <TableRow>
- <EditText android:id="@+id/settings_proxy_server"
- android:layout_column="1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:maxWidth="223dp"
- android:singleLine="true" />
- <EditText android:id="@+id/settings_proxy_port"
- android:layout_column="2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:minWidth="77dp"
- android:numeric="integer"
- android:maxLength="5"
- android:singleLine="true" />
- </TableRow>
- </TableLayout>
- <TextView android:id="@+id/settings_proxy_label_username"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/settings_proxy_username"
- style="@style/Label" />
- <EditText android:id="@+id/settings_proxy_username"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:singleLine="true" />
- <TextView android:id="@+id/settings_proxy_label_password"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/settings_proxy_password"
- style="@style/Label" />
- <EditText android:id="@+id/settings_proxy_password"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:password="true"
- android:singleLine="true" />
- </LinearLayout>
- <Button android:id="@+id/settings_proxy_button_save"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:text="@string/button_save" />
- </RelativeLayout>
- </ScrollView>
- </FrameLayout>
- </LinearLayout>
-</TabHost>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/userinfo.xml Sun Sep 27 20:02:15 2009 +0200
@@ -0,0 +1,7 @@
+<?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>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/userinfo_alias.xml Sun Sep 27 20:02:15 2009 +0200
@@ -0,0 +1,13 @@
+<?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="wrap_content">
+ <TextView android:id="@+id/userinfo_alias_label"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:paddingLeft="20sp" android:singleLine="true" android:maxLines="1"
+ android:textSize="30px" android:text="Alias" />
+ <TextView android:id="@+id/userinfo_alias_def"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:paddingLeft="20sp" android:singleLine="true" android:textSize="10px"
+ android:text="Modifier le nom affiche de votre contact" />
+</LinearLayout>
\ No newline at end of file
--- a/res/values-en/strings.xml Sun Sep 27 19:08:01 2009 +0200
+++ b/res/values-en/strings.xml Sun Sep 27 20:02:15 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 19:08:01 2009 +0200
+++ b/res/values-fr/strings.xml Sun Sep 27 20:02:15 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 19:08:01 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactDialog.java Sun Sep 27 20:02:15 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();
}
--- a/src/com/beem/project/beem/ui/EditSettings.java Sun Sep 27 19:08:01 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,558 +0,0 @@
-package com.beem.project.beem.ui;
-
-import java.util.ArrayList;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.Spinner;
-import android.widget.TabHost;
-import android.widget.Toast;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.XmppConnectionAdapter;
-
-/**
- * This class represents an activity which allows the user to change his account or proxy parameters.
- * @author dasilvj
- */
-public class EditSettings extends Activity {
-
- private static final String LOG_MSG_SETTINGS_SAVED = "Settings saved successfully.";
- private static final String LOG_MSG_XMPP_SETTINGS_REGISTERED = "XMPP Settings has been registered.";
- private static final String LOG_MSG_ACCOUNT_SETTINGS_REGISTERED = "Account Settings has been registered.";
- private static final String LOG_MSG_PROXY_SETTINGS_REGISTERED = "Proxy Settings has been registered.";
-
- private static final boolean DEFAULT_BOOLEAN_VALUE = false;
- private static final String DEFAULT_STRING_VALUE = "";
- private static final int DEFAULT_INT_VALUE = 0;
-
- private static final String DEFAULT_XMPP_PORT = "5222";
-
- private static final int NOTIFICATION_DURATION = Toast.LENGTH_SHORT;
-
- private SharedPreferences mSettings;
-
- private EditText mAccUsernameField;
- private EditText mAccPasswordField;
-
- private EditText mXmppServerField;
- private EditText mXmppPortField;
- private CheckBox mXmppUseTlsCheckBox;
-
- private CheckBox mProxyUseCheckBox;
- private Spinner mProxyTypeSpinner;
- private EditText mProxyServerField;
- private EditText mProxyPortField;
- private EditText mProxyUsernameField;
- private EditText mProxyPasswordField;
- private BroadcastReceiver mReceiver;
-
- private static final Intent SERVICE_INTENT = new Intent();
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- /**
- * Constructor.
- */
- public EditSettings() { }
-
- /**
- * Add a labeled "Account" tab on the tabbed window view passed by parameter.
- * @param tHost a tabbed window view
- */
- private void addAccountTab(TabHost tHost) {
- TabHost.TabSpec accountTab = tHost.newTabSpec(getString(R.string.settings_tab_tag_account));
- accountTab.setIndicator(getString(R.string.settings_tab_label_account));
- accountTab.setContent(R.id.settings_account);
- tHost.addTab(accountTab);
- }
-
- /**
- * Add a labeled "Proxy" tab on the tabbed window view passed by parameter.
- * @param tHost a tabbed window view
- */
- private void addProxyTab(TabHost tHost) {
- TabHost.TabSpec proxyTab = tHost.newTabSpec(getString(R.string.settings_tab_tag_proxy));
- proxyTab.setIndicator(getString(R.string.settings_tab_label_proxy));
- proxyTab.setContent(R.id.settings_proxy);
- tHost.addTab(proxyTab);
- }
-
- /**
- * Add a labeled "XMPP" tab on the tabbed window view passed by parameter.
- * @param tHost a tabbed window view
- */
- private void addXMPPTab(TabHost tHost) {
- TabHost.TabSpec personalTab = tHost.newTabSpec(getString(R.string.settings_tab_tag_xmpp));
- personalTab.setIndicator(getString(R.string.settings_tab_label_xmpp));
- personalTab.setContent(R.id.settings_xmpp);
- tHost.addTab(personalTab);
- }
-
- /**
- * Disable proxy parameters fields.
- */
- private void disableProxyParameters() {
- mProxyTypeSpinner.setEnabled(false);
- mProxyServerField.setEnabled(false);
- mProxyPortField.setEnabled(false);
- mProxyUsernameField.setEnabled(false);
- mProxyPasswordField.setEnabled(false);
- mProxyTypeSpinner.setFocusable(false);
- mProxyServerField.setFocusable(false);
- mProxyPortField.setFocusable(false);
- mProxyUsernameField.setFocusable(false);
- mProxyPasswordField.setFocusable(false);
- mProxyTypeSpinner.setFocusableInTouchMode(false);
- mProxyServerField.setFocusableInTouchMode(false);
- mProxyPortField.setFocusableInTouchMode(false);
- mProxyUsernameField.setFocusableInTouchMode(false);
- mProxyPasswordField.setFocusableInTouchMode(false);
- }
-
- /**
- * Display a brief notification.
- * @param msg the message to display.
- */
- private void displayNotification(CharSequence msg) {
- Toast toast = Toast.makeText(getApplicationContext(), msg, NOTIFICATION_DURATION);
- toast.show();
- }
-
- /**
- * Enable proxy parameters fields.
- */
- private void enableProxyParameters() {
- mProxyTypeSpinner.setEnabled(true);
- mProxyServerField.setEnabled(true);
- mProxyPortField.setEnabled(true);
- mProxyUsernameField.setEnabled(true);
- mProxyPasswordField.setEnabled(true);
- mProxyTypeSpinner.setFocusable(true);
- mProxyServerField.setFocusable(true);
- mProxyPortField.setFocusable(true);
- mProxyUsernameField.setFocusable(true);
- mProxyPasswordField.setFocusable(true);
- mProxyTypeSpinner.setFocusableInTouchMode(true);
- mProxyServerField.setFocusableInTouchMode(true);
- mProxyPortField.setFocusableInTouchMode(true);
- mProxyUsernameField.setFocusableInTouchMode(true);
- mProxyPasswordField.setFocusableInTouchMode(true);
- }
-
- /**
- * Retrieve the value of a CheckBox.
- * @param viewId identifier of the checkbox
- * @return true if the CheckBox is checked, else false
- */
- private boolean getCheckBoxValue(int viewId) {
- final CheckBox checkBox = (CheckBox) findViewById(viewId);
- if (checkBox.isChecked())
- return true;
- return false;
- }
-
- /**
- * Retrieve account password from the preferences.
- * @return Registered account password
- */
- private String getRegisteredAccountPassword() {
- return mSettings.getString(getString(R.string.settings_key_account_password), DEFAULT_STRING_VALUE);
- }
-
- /**
- * Retrieve account username from the preferences.
- * @return Registered account username
- */
- private String getRegisteredAccountUsername() {
- return mSettings.getString(getString(R.string.settings_key_account_username), DEFAULT_STRING_VALUE);
- }
-
- /**
- * Retrieve proxy password from the preferences.
- * @return Registered proxy password
- */
- private String getRegisteredProxyPassword() {
- return mSettings.getString(getString(R.string.settings_key_proxy_password), DEFAULT_STRING_VALUE);
- }
-
- /**
- * Retrieve proxy port from the preferences.
- * @return Registered proxy port
- */
- private String getRegisteredProxyPort() {
- return mSettings.getString(getString(R.string.settings_key_proxy_port), DEFAULT_STRING_VALUE);
- }
-
- /**
- * Retrieve proxy server from the preferences.
- * @return Registered proxy server
- */
- private String getRegisteredProxyServer() {
- return mSettings.getString(getString(R.string.settings_key_proxy_server), DEFAULT_STRING_VALUE);
- }
-
- /**
- * Retrieve proxy type from the preferences.
- * @return Registered proxy type
- */
- private int getRegisteredProxyType() {
- return mSettings.getInt(getString(R.string.settings_key_proxy_type), DEFAULT_INT_VALUE);
- }
-
- /**
- * Retrieve proxy use from the preferences.
- * @return Registered proxy use
- */
- private boolean getRegisteredProxyUse() {
- return mSettings.getBoolean(getString(R.string.settings_key_proxy_use), DEFAULT_BOOLEAN_VALUE);
- }
-
- /**
- * Retrieve proxy username from the preferences.
- * @return Registered proxy username
- */
- private String getRegisteredProxyUsername() {
- return mSettings.getString(getString(R.string.settings_key_proxy_username), DEFAULT_STRING_VALUE);
- }
-
- /**
- * Retrieve xmpp port from the preferences.
- * @return Registered xmpp port
- */
- private String getRegisteredXMPPPort() {
- return mSettings.getString(getString(R.string.settings_key_xmpp_port), DEFAULT_XMPP_PORT);
- }
-
- /**
- * Retrieve xmpp server from the preferences.
- * @return Registered xmpp server
- */
- private String getRegisteredXMPPServer() {
- return mSettings.getString(getString(R.string.settings_key_xmpp_server), DEFAULT_STRING_VALUE);
- }
-
- /**
- * Retrieve TLS use from the preferences.
- * @return Registered TLS use
- */
- private boolean getRegisteredXMPPTLSUse() {
- return mSettings.getBoolean(getString(R.string.settings_key_xmpp_tls_use), DEFAULT_BOOLEAN_VALUE);
- }
-
- /**
- * Initialize Account tab fields.
- */
- private void initAccountFields() {
- mAccUsernameField = (EditText) findViewById(R.id.settings_account_username);
- mAccPasswordField = (EditText) findViewById(R.id.settings_account_password);
- }
-
- /**
- * Initialize all of the components displayed in tabs (EditText fields, CheckBoxes, Spinners...).
- */
- private void initFields() {
- initAccountFields();
- initXMPPFields();
- initProxyFields();
- }
-
- /**
- * Initialize Proxy tab fields.
- */
- private void initProxyFields() {
- mProxyUseCheckBox = (CheckBox) findViewById(R.id.settings_proxy_use);
- mProxyTypeSpinner = (Spinner) findViewById(R.id.settings_proxy_type);
- mProxyServerField = (EditText) findViewById(R.id.settings_proxy_server);
- mProxyPortField = (EditText) findViewById(R.id.settings_proxy_port);
- mProxyUsernameField = (EditText) findViewById(R.id.settings_proxy_username);
- mProxyPasswordField = (EditText) findViewById(R.id.settings_proxy_password);
- }
-
- /**
- * Initialize proxy's types spinner of the proxy tab.
- */
- private void initProxyTypesSpinner() {
- ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.proxy_types,
- android.R.layout.simple_spinner_item);
- adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- mProxyTypeSpinner.setAdapter(adapter);
- }
-
- /**
- * Initialize the checkbox allowing user to use a proxy.
- */
- private void initProxyUseCheckBox() {
- mProxyUseCheckBox.setOnClickListener(new OnClickListener() {
-
- public void onClick(View v) {
- if (mProxyUseCheckBox.isChecked()) {
- enableProxyParameters();
- } else {
- disableProxyParameters();
- }
- }
- });
- }
-
- /**
- * Initialize "save" buttons allowing user to save settings.
- */
- private void initSaveButtons() {
- final ArrayList<Integer> views = new ArrayList<Integer>();
- Button saveButton = null;
-
- views.add(R.id.settings_account_button_save);
- views.add(R.id.settings_proxy_button_save);
- views.add(R.id.settings_xmpp_button_save);
-
- for (int i = 0; i < views.size(); i++) {
- saveButton = (Button) findViewById(views.get(i));
- saveButton.setFocusable(true);
- saveButton.setOnClickListener(new View.OnClickListener() {
-
- public void onClick(View v) {
- saveSettings();
- setResult(69);
- }
- });
- }
- }
-
- /**
- * Initialize tabbed window view by adding tabs and setting the default tab.
- */
- private void initTabbedWindow() {
- TabHost tHost = (TabHost) this.findViewById(R.id.settings_tab_host);
- tHost.setup();
- addAccountTab(tHost);
- addXMPPTab(tHost);
- addProxyTab(tHost);
- tHost.setCurrentTab(0);
- }
-
- /**
- * Initialize XMPP tab fields.
- */
- private void initXMPPFields() {
- mXmppServerField = (EditText) findViewById(R.id.settings_xmpp_server);
- mXmppPortField = (EditText) findViewById(R.id.settings_xmpp_port);
- mXmppUseTlsCheckBox = (CheckBox) findViewById(R.id.settings_xmpp_use_tls);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.edit_settings);
- initTabbedWindow();
- initFields();
- mSettings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE);
- mReceiver = new BeemBroadcastReceiver();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater mInflater = getMenuInflater();
- mInflater.inflate(R.menu.edit_settings, menu);
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- Intent i = null;
- switch (item.getItemId()) {
- case R.id.settings_menu_create_account:
- i = new Intent(this, CreateAccount.class);
- startActivity(i);
- return true;
- case R.id.settings_menu_login:
- setResult(69);
- this.stopService(SERVICE_INTENT);
- finish();
- return true;
- default:
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onResume() {
- super.onResume();
- this.registerReceiver(mReceiver, new IntentFilter(XmppConnectionAdapter.BEEM_CONNECTION_CLOSED));
- refreshAccountTabFields();
- refreshXMPPTabFields();
- refreshProxyTabFields();
-
- if (!mProxyUseCheckBox.isChecked())
- disableProxyParameters();
- }
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onPause() {
- super.onPause();
- this.unregisterReceiver(mReceiver);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onStart() {
- super.onStart();
- initProxyTypesSpinner();
- initProxyUseCheckBox();
- initSaveButtons();
- }
-
- /**
- * Refresh values of "Account" tab fields.
- */
- private void refreshAccountTabFields() {
- mAccUsernameField.setText(getRegisteredAccountUsername());
- mAccPasswordField.setText(getRegisteredAccountPassword());
- }
-
- /**
- * Refresh values of "Account" tab fields.
- */
- private void refreshProxyTabFields() {
- mProxyUseCheckBox.setChecked(getRegisteredProxyUse());
- mProxyTypeSpinner.setSelection(getRegisteredProxyType());
- mProxyServerField.setText(getRegisteredProxyServer());
- mProxyPortField.setText(getRegisteredProxyPort());
- mProxyUsernameField.setText(getRegisteredProxyUsername());
- mProxyPasswordField.setText(getRegisteredProxyPassword());
- }
-
- /**
- * Refresh values of "Account" tab fields.
- */
- private void refreshXMPPTabFields() {
- mXmppServerField.setText(getRegisteredXMPPServer());
- mXmppPortField.setText(getRegisteredXMPPPort());
- mXmppUseTlsCheckBox.setChecked(getRegisteredXMPPTLSUse());
- }
-
- /**
- * Register account settings changes in SharedPreferences.Editor object passed by parameter.
- * @param settingsEditor the editor to use.
- */
- private void registerAccountSettingsChanges(SharedPreferences.Editor settingsEditor) {
- final String usernameFieldValue = mAccUsernameField.getText().toString();
- final String passwordFieldValue = mAccPasswordField.getText().toString();
-
- if (!getRegisteredAccountUsername().equals(usernameFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_account_username), usernameFieldValue);
- if (!getRegisteredAccountPassword().equals(passwordFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_account_password), passwordFieldValue);
- Log.i(getString(R.string.edit_settings_tag), LOG_MSG_ACCOUNT_SETTINGS_REGISTERED);
- }
-
- /**
- * Register proxy settings changes in SharedPreferences.Editor object passed by parameter.
- * @param settingsEditor the editor to use.
- */
- private void registerProxySettingsChanges(SharedPreferences.Editor settingsEditor) {
- final int proxyTypeFieldValue = mProxyTypeSpinner.getSelectedItemPosition();
- final String serverFieldValue = mProxyServerField.getText().toString();
- final String portFieldValue = mProxyPortField.getText().toString();
- final String usernameFieldValue = mProxyUsernameField.getText().toString();
- final String passwordFieldValue = mProxyPasswordField.getText().toString();
-
- if (getRegisteredProxyType() != proxyTypeFieldValue)
- settingsEditor.putInt(getString(R.string.settings_key_proxy_type), proxyTypeFieldValue);
- if (!getRegisteredProxyServer().equals(serverFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_proxy_server), serverFieldValue);
- if (!getRegisteredProxyPort().equals(portFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_proxy_port), portFieldValue);
- if (!getRegisteredProxyUsername().equals(usernameFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_proxy_username), usernameFieldValue);
- if (!getRegisteredProxyPassword().equals(passwordFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_proxy_password), passwordFieldValue);
- Log.i(getString(R.string.edit_settings_tag), LOG_MSG_PROXY_SETTINGS_REGISTERED);
- }
-
- /**
- * Register XMPP settings changes in SharedPreferences.Editor object passed by parameter.
- * @param settingsEditor the editor to use.
- */
- private void registerXMPPSettingsChanges(SharedPreferences.Editor settingsEditor) {
- final boolean tlsUseCheckBoxValue = getCheckBoxValue(R.id.settings_xmpp_use_tls);
- final String serverFieldValue = mXmppServerField.getText().toString();
- final String portFieldValue = mXmppPortField.getText().toString();
-
- if (getRegisteredXMPPTLSUse() != tlsUseCheckBoxValue)
- settingsEditor.putBoolean(getString(R.string.settings_key_xmpp_tls_use), tlsUseCheckBoxValue);
- if (!getRegisteredXMPPServer().equals(serverFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_xmpp_server), serverFieldValue);
- if (!getRegisteredXMPPPort().equals(portFieldValue))
- settingsEditor.putString(getString(R.string.settings_key_xmpp_port), portFieldValue);
- Log.i(getString(R.string.edit_settings_tag), LOG_MSG_XMPP_SETTINGS_REGISTERED);
- }
-
- /**
- * Save settings in shared preferences.
- */
- private void saveSettings() {
- final SharedPreferences.Editor settingsEditor = mSettings.edit();
- final boolean proxyUseCheckBoxValue = getCheckBoxValue(R.id.settings_proxy_use);
-
- if (getRegisteredProxyUse() != proxyUseCheckBoxValue)
- settingsEditor.putBoolean(getString(R.string.settings_key_proxy_use), proxyUseCheckBoxValue);
- if (proxyUseCheckBoxValue)
- registerProxySettingsChanges(settingsEditor);
- registerAccountSettingsChanges(settingsEditor);
- registerXMPPSettingsChanges(settingsEditor);
- String password = mAccPasswordField.getText().toString();
- String username = mAccUsernameField.getText().toString();
- String port = mXmppPortField.getText().toString();
- if ("".equals(password) || "".equals(username)
- || "".equals(port))
- settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), false);
- else
- settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), true);
-
- if (settingsEditor.commit()) {
- displayNotification(getText(R.string.settings_saved_ok));
- Log.i(getString(R.string.edit_settings_tag), LOG_MSG_SETTINGS_SAVED);
- }
- }
-
- private class BeemBroadcastReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- EditSettings.this.setResult(69);
- }
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/UserInfo.java Sun Sep 27 20:02:15 2009 +0200
@@ -0,0 +1,113 @@
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.AdapterView.OnItemClickListener;
+
+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;
+ private static final List<String> mInfo = new ArrayList<String>();
+
+ static {
+ mInfo.add("alias");
+ }
+
+ /**
+ * 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));
+ listview.setOnItemClickListener(new BeemUserInfoClick());
+ }
+
+ public class BeemUserInfoClick implements OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
+ Log.i("OOO", mInfo.get(arg2));
+ }
+ }
+
+ /**
+ * Adapter user info 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 mInfo.size();
+ }
+
+ /**
+ * {@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) {
+ if (position == 0)
+ v = mInflater.inflate(R.layout.userinfo_alias, null);
+ }
+ return v;
+ }
+ }
+
+}