# HG changeset patch
# User "Vincent Veronis"
# Date 1293497771 -3600
# Node ID 117ea85f0fe6e3b481b1f80db3f9673b16a2c5d5
# Parent 0d5d1d7735ca594b14d02a47b1315b1fb3ef60d3# Parent f179ba8098f1a39d51437317b4cbabb2d41bf221
Merge
diff -r f179ba8098f1 -r 117ea85f0fe6 AndroidManifest.xml
--- a/AndroidManifest.xml Mon Dec 27 21:50:48 2010 +0100
+++ b/AndroidManifest.xml Tue Dec 28 01:56:11 2010 +0100
@@ -87,11 +87,12 @@
-
-
-
-
+ android:name="com.beem.project.beem.BEEM_SERVICE"/>
+
+
+
+
+
diff -r f179ba8098f1 -r 117ea85f0fe6 build.xml
--- a/build.xml Mon Dec 27 21:50:48 2010 +0100
+++ b/build.xml Tue Dec 28 01:56:11 2010 +0100
@@ -73,6 +73,8 @@
+
+
diff -r f179ba8098f1 -r 117ea85f0fe6 res/drawable/avatar_status.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/drawable/avatar_status.xml Tue Dec 28 01:56:11 2010 +0100
@@ -0,0 +1,16 @@
+
+
+
+ -
+
+
+
+
diff -r f179ba8098f1 -r 117ea85f0fe6 res/layout/chat.xml
--- a/res/layout/chat.xml Mon Dec 27 21:50:48 2010 +0100
+++ b/res/layout/chat.xml Tue Dec 28 01:56:11 2010 +0100
@@ -7,9 +7,10 @@
android:orientation="horizontal" android:gravity="center_vertical"
android:background="#222222" android:padding="4px">
+ android:src="@drawable/avatar_status"
+ android:layout_width="48dip"
+ android:layout_height="48dip"
+ />
diff -r f179ba8098f1 -r 117ea85f0fe6 src/com/beem/project/beem/BeemService.java
--- a/src/com/beem/project/beem/BeemService.java Mon Dec 27 21:50:48 2010 +0100
+++ b/src/com/beem/project/beem/BeemService.java Tue Dec 28 01:56:11 2010 +0100
@@ -154,7 +154,7 @@
|| mSettings.getBoolean("settings_key_gmail", false)) {
mConnectionConfiguration.setSecurityMode(SecurityMode.required);
}
- mConnectionConfiguration.setDebuggerEnabled(true);
+ mConnectionConfiguration.setDebuggerEnabled(false);
mConnectionConfiguration.setSendPresence(true);
// maybe not the universal path, but it works on most devices (Samsung Galaxy, Google Nexus One)
mConnectionConfiguration.setTruststoreType("BKS");
diff -r f179ba8098f1 -r 117ea85f0fe6 src/com/beem/project/beem/service/BeemChatManager.java
--- a/src/com/beem/project/beem/service/BeemChatManager.java Mon Dec 27 21:50:48 2010 +0100
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Tue Dec 28 01:56:11 2010 +0100
@@ -62,7 +62,6 @@
import android.util.Log;
import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IChat;
import com.beem.project.beem.service.aidl.IChatManager;
import com.beem.project.beem.service.aidl.IChatManagerListener;
@@ -270,8 +269,9 @@
/**
* Set a notification of a new chat.
* @param chat The chat to access by the notification
+ * @param msgBody the body of the new message
*/
- private void notifyNewChat(IChat chat) {
+ private void notifyNewChat(IChat chat, String msgBody) {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mService);
try {
CharSequence tickerText = mService.getBind().getRoster().getContact(chat.getParticipant().getJID())
@@ -279,8 +279,7 @@
Notification notification = new Notification(android.R.drawable.stat_notify_chat, tickerText, System
.currentTimeMillis());
notification.flags = Notification.FLAG_AUTO_CANCEL;
- notification.setLatestEventInfo(mService, tickerText, mService
- .getString(R.string.BeemChatManagerNewMessage), makeChatIntent(chat));
+ notification.setLatestEventInfo(mService, tickerText, msgBody, makeChatIntent(chat));
mService.sendNotification(chat.getParticipant().getJID().hashCode(), notification);
} catch (RemoteException e) {
Log.e(TAG, e.getMessage());
@@ -293,11 +292,12 @@
@Override
public void processMessage(final IChat chat, Message message) {
try {
- if (!chat.isOpen() && message.getBody() != null) {
+ String body = message.getBody();
+ if (!chat.isOpen() && body != null) {
if (chat instanceof ChatAdapter) {
mChats.put(chat.getParticipant().getJID(), (ChatAdapter) chat);
}
- notifyNewChat(chat);
+ notifyNewChat(chat, body);
}
} catch (RemoteException e) {
Log.e(TAG, e.getMessage());
diff -r f179ba8098f1 -r 117ea85f0fe6 src/com/beem/project/beem/ui/Chat.java
diff -r f179ba8098f1 -r 117ea85f0fe6 src/com/beem/project/beem/ui/ContactList.java
--- a/src/com/beem/project/beem/ui/ContactList.java Mon Dec 27 21:50:48 2010 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java Tue Dec 28 01:56:11 2010 +0100
@@ -60,7 +60,6 @@
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
-import android.graphics.drawable.LevelListDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -87,6 +86,7 @@
import android.widget.ListView;
import android.widget.TextView;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
import com.beem.project.beem.R;
import com.beem.project.beem.service.Contact;
@@ -656,30 +656,41 @@
private void bindView(View view, Contact curContact) {
if (curContact != null) {
TextView v = (TextView) view.findViewById(R.id.contactlistpseudo);
- LevelListDrawable mStatusDrawable = (LevelListDrawable) getResources()
- .getDrawable(R.drawable.status_icon);
- mStatusDrawable.setLevel(curContact.getStatus());
- v.setCompoundDrawablesWithIntrinsicBounds(mStatusDrawable, null, null, null);
v.setText(curContact.getName());
v = (TextView) view.findViewById(R.id.contactlistmsgperso);
v.setText(curContact.getMsgState());
- Drawable d = null;
- try {
- String avatarId = curContact.getAvatarId();
- byte[] avatar = mXmppFacade.getAvatar(avatarId);
- if (avatar != null) {
- ByteArrayInputStream in = new ByteArrayInputStream(avatar);
- d = Drawable.createFromStream(in, avatarId);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Error while setting the avatar", e);
+ ImageView img = (ImageView) view.findViewById(R.id.avatar);
+ String avatarId = curContact.getAvatarId();
+ int contactStatus = curContact.getStatus();
+ Drawable avatar = getAvatarStatusDrawable(curContact.getAvatarId());
+ img.setImageDrawable(avatar);
+ img.setImageLevel(contactStatus);
+ }
+ }
+
+ /**
+ * Get a LayerDrawable containing the avatar and the status icon.
+ * The status icon will change with the level of the drawable.
+ * @param avatarId the avatar id to retrieve or null to get default
+ * @return a LayerDrawable
+ */
+ private Drawable getAvatarStatusDrawable(String avatarId) {
+ Drawable avatarDrawable = null;
+ try {
+ byte[] avatar = mXmppFacade.getAvatar(avatarId);
+ if (avatar != null) {
+ ByteArrayInputStream in = new ByteArrayInputStream(avatar);
+ avatarDrawable = Drawable.createFromStream(in, avatarId);
}
- ImageView img = (ImageView) view.findViewById(R.id.avatar);
- if (d != null)
- img.setImageDrawable(d);
- else
- img.setImageResource(R.drawable.beem_launcher_icon_silver);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error while setting the avatar", e);
}
+ if (avatarDrawable == null)
+ avatarDrawable = getResources().getDrawable(R.drawable.beem_launcher_icon_silver);
+ LayerDrawable ld = (LayerDrawable) getResources().getDrawable(R.drawable.avatar_status);
+ ld.setLayerInset(1, 36, 36, 0, 0);
+ ld.setDrawableByLayerId(R.id.avatar, avatarDrawable);
+ return ld;
}
/**
diff -r f179ba8098f1 -r 117ea85f0fe6 tools/checkstyle.xml
--- a/tools/checkstyle.xml Mon Dec 27 21:50:48 2010 +0100
+++ b/tools/checkstyle.xml Tue Dec 28 01:56:11 2010 +0100
@@ -1,208 +1,341 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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