# HG changeset patch
# User "Vincent Veronis"
# Date 1293409224 -3600
# Node ID ac719bcb0f251b3de7cbaf3a442679e128eb676e
# Parent 27a5b676b9f36a6946e8c58b98ac5519967e0125
Compact Chat window support + options in settings
diff -r 27a5b676b9f3 -r ac719bcb0f25 default.properties
--- a/default.properties Fri Dec 10 11:18:45 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-7
diff -r 27a5b676b9f3 -r ac719bcb0f25 res/layout/chat_compact.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/chat_compact.xml Mon Dec 27 01:20:24 2010 +0100
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
diff -r 27a5b676b9f3 -r ac719bcb0f25 res/layout/chat_msg_row_compact.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/chat_msg_row_compact.xml Mon Dec 27 01:20:24 2010 +0100
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
diff -r 27a5b676b9f3 -r ac719bcb0f25 res/layout/preferences.xml
--- a/res/layout/preferences.xml Fri Dec 10 11:18:45 2010 +0100
+++ b/res/layout/preferences.xml Mon Dec 27 01:20:24 2010 +0100
@@ -23,6 +23,9 @@
android:singleLine="true" android:summary="@string/away_message_sum"
android:title="@string/away_message_title" android:key="settings_away_message"
android:hint="@string/away_message_hint" />
+
Activer le vibreur pour les messages entrants
Sonnerie des messages
Configurer la sonnerie des messages entrants
+ Chat compact
+ Activer la fenetre Chat compact
Inscription acceptée
diff -r 27a5b676b9f3 -r ac719bcb0f25 res/values/strings.xml
--- a/res/values/strings.xml Fri Dec 10 11:18:45 2010 +0100
+++ b/res/values/strings.xml Mon Dec 27 01:20:24 2010 +0100
@@ -117,7 +117,8 @@
Enable vibrate on incoming messages
Message ringtone
Set your incoming message ringtone
-
+ Chat compact
+ Set the chat windows compact
Subscription accepted
diff -r 27a5b676b9f3 -r ac719bcb0f25 src/com/beem/project/beem/ui/Chat.java
--- a/src/com/beem/project/beem/ui/Chat.java Fri Dec 10 11:18:45 2010 +0100
+++ b/src/com/beem/project/beem/ui/Chat.java Mon Dec 27 01:20:24 2010 +0100
@@ -50,7 +50,9 @@
import java.util.List;
import java.util.Map;
+import org.jivesoftware.smack.packet.Presence.Mode;
import org.jivesoftware.smack.util.StringUtils;
+import org.w3c.dom.Entity;
import android.app.Activity;
import android.app.Dialog;
@@ -58,6 +60,8 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
@@ -65,6 +69,9 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
+import android.preference.PreferenceManager;
+import android.text.Html;
+import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.Log;
import android.view.KeyEvent;
@@ -96,6 +103,7 @@
import com.beem.project.beem.service.aidl.IXmppFacade;
import com.beem.project.beem.ui.dialogs.builders.ChatList;
import com.beem.project.beem.utils.BeemBroadcastReceiver;
+import com.beem.project.beem.utils.PresenceType;
import com.beem.project.beem.utils.Status;
/**
@@ -136,6 +144,7 @@
private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
private IXmppFacade mXmppFacade;
private boolean mBinded;
+ private boolean mCompact;
/**
* Constructor.
@@ -150,14 +159,19 @@
@Override
protected void onCreate(Bundle savedBundle) {
super.onCreate(savedBundle);
- setContentView(R.layout.chat);
this.registerReceiver(mBroadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
-
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
+ mCompact = settings.getBoolean("settings_chat_compact_key", false);
// UI
- mContactNameTextView = (TextView) findViewById(R.id.chat_contact_name);
- mContactStatusMsgTextView = (TextView) findViewById(R.id.chat_contact_status_msg);
- mContactChatState = (TextView) findViewById(R.id.chat_contact_chat_state);
- mContactStatusIcon = (ImageView) findViewById(R.id.chat_contact_status_icon);
+ if (!mCompact) {
+ setContentView(R.layout.chat);
+ mContactNameTextView = (TextView) findViewById(R.id.chat_contact_name);
+ mContactStatusMsgTextView = (TextView) findViewById(R.id.chat_contact_status_msg);
+ mContactChatState = (TextView) findViewById(R.id.chat_contact_chat_state);
+ mContactStatusIcon = (ImageView) findViewById(R.id.chat_contact_status_icon);
+ } else {
+ setContentView(R.layout.chat_compact);
+ }
mMessagesListView = (ListView) findViewById(R.id.chat_messages);
mMessagesListView.setAdapter(mMessagesListAdapter);
mInputField = (EditText) findViewById(R.id.chat_input);
@@ -532,7 +546,8 @@
} else if ("paused".equals(state)) {
text = Chat.this.getString(R.string.chat_state_active);
}
- mContactChatState.setText(text);
+ if (!mCompact)
+ mContactChatState.setText(text);
}
});
@@ -548,13 +563,17 @@
String res = mContact.getSelectedRes();
if (!"".equals(res))
name += "(" + res + ")";
- if (!(mContactNameTextView.getText().toString().equals(name)))
- mContactNameTextView.setText(name);
-
- // Check for a contact status message update
- if (!(mContactStatusMsgTextView.getText().toString().equals(mContact.getMsgState()))) {
- mContactStatusMsgTextView.setText(mContact.getMsgState());
- Linkify.addLinks(mContactStatusMsgTextView, Linkify.WEB_URLS);
+ if (!mCompact) {
+ if (!(mContactNameTextView.getText().toString().equals(name)))
+ mContactNameTextView.setText(name);
+ //Check for a contact status message update
+ if (!(mContactStatusMsgTextView.getText().toString().equals(mContact.getMsgState()))) {
+ mContactStatusMsgTextView.setText(mContact.getMsgState());
+ Linkify.addLinks(mContactStatusMsgTextView, Linkify.WEB_URLS);
+ }
+ } else {
+ Mode m = Status.getPresenceModeFromStatus(mContact.getStatus());
+ setTitle(getString(R.string.chat_name) + " " + mContact.getName() + " (" + m.name() + ")");
}
}
@@ -562,7 +581,8 @@
* Update the contact status icon.
*/
private void updateContactStatusIcon() {
- mContactStatusIcon.setImageLevel(mContact.getStatus());
+ if (!mCompact)
+ mContactStatusIcon.setImageLevel(mContact.getStatus());
}
/**
@@ -634,26 +654,35 @@
View sv;
if (convertView == null) {
LayoutInflater inflater = Chat.this.getLayoutInflater();
- sv = inflater.inflate(R.layout.chat_msg_row, null);
+ if (!mCompact)
+ sv = inflater.inflate(R.layout.chat_msg_row, null);
+ else
+ sv = inflater.inflate(R.layout.chat_msg_row_compact, null);
} else {
sv = convertView;
}
+ DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
MessageText msg = mListMessages.get(position);
- TextView msgName = (TextView) sv.findViewById(R.id.chatmessagename);
- msgName.setText(msg.getName());
- msgName.setTextColor(Color.WHITE);
- msgName.setError(null);
- TextView msgText = (TextView) sv.findViewById(R.id.chatmessagetext);
- msgText.setText(msg.getMessage());
- TextView msgDate = (TextView) sv.findViewById(R.id.chatmessagedate);
- DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
- String date = df.format(msg.getTimestamp());
- msgDate.setText(date);
- if (msg.isError()) {
- String err = getString(R.string.chat_error);
- msgName.setText(err);
- msgName.setTextColor(Color.RED);
- msgName.setError(err);
+ if (!mCompact) {
+ TextView msgName = (TextView) sv.findViewById(R.id.chatmessagename);
+ msgName.setText(msg.getName());
+ msgName.setTextColor(Color.WHITE);
+ msgName.setError(null);
+ TextView msgText = (TextView) sv.findViewById(R.id.chatmessagetext);
+ msgText.setText(msg.getMessage());
+ TextView msgDate = (TextView) sv.findViewById(R.id.chatmessagedate);
+ String date = df.format(msg.getTimestamp());
+ msgDate.setText(date);
+ if (msg.isError()) {
+ String err = getString(R.string.chat_error);
+ msgName.setText(err);
+ msgName.setTextColor(Color.RED);
+ msgName.setError(err);
+ }
+ } else {
+ String str = "(" + df.format(msg.getTimestamp()) + ") " + msg.getName() + " : " + msg.getMessage();
+ TextView msgText = (TextView) sv.findViewById(R.id.chatmessagetext);
+ msgText.setText(str);
}
return sv;
}