# HG changeset patch # User nikita@nikita-laptop # Date 1266164738 -3600 # Node ID 532fdf132146e972b456caafbcdddc8151910a3f # Parent ea02c5b80cc0e5287c6a76a103c71114508283ce# Parent 9fb7971592360efee167c8ca73163877368970ac merge diff -r ea02c5b80cc0 -r 532fdf132146 .classpath diff -r ea02c5b80cc0 -r 532fdf132146 AndroidManifest.xml --- a/AndroidManifest.xml Sun Jan 24 04:57:37 2010 +0100 +++ b/AndroidManifest.xml Sun Feb 14 17:25:38 2010 +0100 @@ -98,4 +98,6 @@ + diff -r ea02c5b80cc0 -r 532fdf132146 default.properties --- a/default.properties Sun Jan 24 04:57:37 2010 +0100 +++ b/default.properties Sun Feb 14 17:25:38 2010 +0100 @@ -10,5 +10,5 @@ # Indicates whether an apk should be generated for each density. split.density=false # Project target. -target=android-4 +target=android-7 apk-configurations= diff -r ea02c5b80cc0 -r 532fdf132146 res/layout/chat_msg_row.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/res/layout/chat_msg_row.xml Sun Feb 14 17:25:38 2010 +0100 @@ -0,0 +1,22 @@ + + + + + + + diff -r ea02c5b80cc0 -r 532fdf132146 res/layout/contactlist.xml --- a/res/layout/contactlist.xml Sun Jan 24 04:57:37 2010 +0100 +++ b/res/layout/contactlist.xml Sun Feb 14 17:25:38 2010 +0100 @@ -2,19 +2,12 @@ - - + - - + - diff -r ea02c5b80cc0 -r 532fdf132146 res/layout/contactlist_groupstub.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/res/layout/contactlist_groupstub.xml Sun Feb 14 17:25:38 2010 +0100 @@ -0,0 +1,11 @@ + + + + + diff -r ea02c5b80cc0 -r 532fdf132146 res/layout/preferences.xml --- a/res/layout/preferences.xml Sun Jan 24 04:57:37 2010 +0100 +++ b/res/layout/preferences.xml Sun Feb 14 17:25:38 2010 +0100 @@ -7,6 +7,9 @@ + @@ -30,9 +33,6 @@ android:summary="@string/SettingsPrioritySummary" android:numeric="signed" android:defaultValue="0" /> - diff -r ea02c5b80cc0 -r 532fdf132146 res/values-fr/strings.xml --- a/res/values-fr/strings.xml Sun Jan 24 04:57:37 2010 +0100 +++ b/res/values-fr/strings.xml Sun Feb 14 17:25:38 2010 +0100 @@ -162,7 +162,7 @@ Créer un compte Paramètres A propos - A propos + Beem %s - A propos Beem est un EPITECH Innovative Project. Rencontrez nous sur http://www.beem-project.com ! @@ -204,8 +204,11 @@ Liste d\'ami(e)s Une série d\'options d\'affichage de votre liste d\'ami(e)s - Caché(e)s - Cochez cette option pour cacher les ami(e)s déconnecté(e)s + + Cachez les groupes + Cochez cette option pour cacher les groupes + Cachez les contacts + Cochez cette option pour cacher les contacts déconnectés Nom d\'utilisateur @@ -275,6 +278,7 @@ Saisissez votre message Beem - Chat Moi + Erreur Envoyer Liste de contacts Changer de conversation @@ -303,4 +307,33 @@ Non Mettre à jour + + + + Erreur lors de l\'authenfitication, mauvais login ou password + + Erreur survenu sur le serveur + bad-request + forbidden + item-not-found + conflict + feature-not-implemented + gone + jid-malformed + no-acceptable + not-allowed + not-authorized + payment-required + recipient-unavailable + redirect + registration-required + Serveur non trouvé + Pas de réponse du serveur + Erreur survenu sur le serveur + resource-constraint + service-unavailable + subscription-required + undefined-condition + unexpected-condition + request-timeout diff -r ea02c5b80cc0 -r 532fdf132146 res/values/strings.xml --- a/res/values/strings.xml Sun Jan 24 04:57:37 2010 +0100 +++ b/res/values/strings.xml Sun Feb 14 17:25:38 2010 +0100 @@ -151,7 +151,7 @@ Create an account Settings About - About + Beem %s - About Beem is an EPITECH Innovative Project. Visit us at http://www.beem-project.com ! @@ -194,7 +194,10 @@ Buddy list A set of display options for your buddy list - Hidden + + Hide groups + Check this option to hide groups + Hide buddies Check this option to hide unconnected buddies @@ -259,6 +262,7 @@ Beem - Chat Type your message Me + Error Send Contacts list Switch chat @@ -287,4 +291,33 @@ No Update + + + + Error during authentication, bad login or password. + + Remote server error + bad-request + forbidden + item-not-found + conflict + feature-not-implemented + gone + jid-malformed + no-acceptable + not-allowed + not-authorized + payment-required + recipient-unavailable + redirect + registration-required + Remote server not found + No server response + Remote server error + resource-constraint + service-unavailable + subscription-required + undefined-condition + unexpected-condition + request-timeout diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/BeemService.java --- a/src/com/beem/project/beem/BeemService.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/BeemService.java Sun Feb 14 17:25:38 2010 +0100 @@ -53,30 +53,6 @@ import org.jivesoftware.smack.proxy.ProxyInfo; import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType; import org.jivesoftware.smack.util.StringUtils; -import org.jivesoftware.smackx.GroupChatInvitation; -import org.jivesoftware.smackx.PrivateDataManager; -import org.jivesoftware.smackx.packet.ChatStateExtension; -import org.jivesoftware.smackx.packet.LastActivity; -import org.jivesoftware.smackx.packet.OfflineMessageInfo; -import org.jivesoftware.smackx.packet.OfflineMessageRequest; -import org.jivesoftware.smackx.packet.SharedGroupsInfo; -import org.jivesoftware.smackx.provider.AdHocCommandDataProvider; -import org.jivesoftware.smackx.provider.BytestreamsProvider; -import org.jivesoftware.smackx.provider.DataFormProvider; -import org.jivesoftware.smackx.provider.DelayInformationProvider; -import org.jivesoftware.smackx.provider.DiscoverInfoProvider; -import org.jivesoftware.smackx.provider.DiscoverItemsProvider; -import org.jivesoftware.smackx.provider.IBBProviders; -import org.jivesoftware.smackx.provider.MUCAdminProvider; -import org.jivesoftware.smackx.provider.MUCOwnerProvider; -import org.jivesoftware.smackx.provider.MUCUserProvider; -import org.jivesoftware.smackx.provider.MessageEventProvider; -import org.jivesoftware.smackx.provider.MultipleAddressesProvider; -import org.jivesoftware.smackx.provider.RosterExchangeProvider; -import org.jivesoftware.smackx.provider.StreamInitiationProvider; -import org.jivesoftware.smackx.provider.VCardProvider; -import org.jivesoftware.smackx.provider.XHTMLExtensionProvider; -import org.jivesoftware.smackx.search.UserSearch; import android.app.Notification; import android.app.NotificationManager; @@ -138,7 +114,7 @@ * Initialise la configuration de la connexion. */ private void initConnectionConfig() { - java.security.Security.addProvider(new com.sun.security.sasl.Provider()); + //java.security.Security.addProvider(new com.sun.security.sasl.Provider()); mUseProxy = mSettings.getBoolean("settings_key_proxy_use", false); if (mUseProxy) { String stype = mSettings.getString("settings_key_proxy_type", "HTTP"); @@ -148,17 +124,14 @@ int pport = Integer.parseInt(mSettings.getString("settings_key_proxy_port", "1080")); ProxyInfo.ProxyType type = ProxyType.valueOf(stype); mProxyInfo = new ProxyInfo(type, phost, pport, puser, ppass); - Log.d("Proxy", "type " + type); - if (mService != null) - mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService, mProxyInfo); - else - mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mProxyInfo); } else { - if (mService != null) - mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService); - else - mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort); + mProxyInfo = ProxyInfo.forNoProxy(); } + if (mSettings.getBoolean("settings_key_specific_server", false)) + mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService, mProxyInfo); + else + mConnectionConfiguration = new ConnectionConfiguration(mService, mProxyInfo); + if (mSettings.getBoolean("settings_key_xmpp_tls_use", false) || mSettings.getBoolean("settings_key_gmail", false)) { mConnectionConfiguration.setSecurityMode(SecurityMode.required); @@ -206,10 +179,12 @@ if (mSettings.getBoolean("settings_key_specific_server", false)) { mHost = mSettings.getString("settings_key_xmpp_server", ""); - mPort = Integer.parseInt(mSettings.getString("settings_key_xmpp_port", "5222")); + if ("".equals(mHost)) + mHost = StringUtils.parseServer(tmpJid); + String tmpPort = mSettings.getString("settings_key_xmpp_port", "5222"); + mPort = ("".equals(tmpPort)) ? DEFAULT_XMPP_PORT : Integer.parseInt(tmpPort) ; } - if (mSettings.getBoolean("settings_key_gmail", false)) { - mHost = "talk.google.com"; + if ("gmail.com".equals(mService) || "googlemail.com".equals(mService)) { mLogin = tmpJid; } @@ -309,6 +284,10 @@ * @param pm The ProviderManager. */ private void configure(ProviderManager pm) { + // Privacy + pm.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider()); + + /* // Private Data Storage pm.addIQProvider("query", "jabber:iq:private", new PrivateDataManager.PrivateDataIQProvider()); // Time @@ -375,8 +354,7 @@ pm.addIQProvider("open", "http://jabber.org/protocol/ibb", new IBBProviders.Open()); pm.addIQProvider("close", "http://jabber.org/protocol/ibb", new IBBProviders.Close()); pm.addExtensionProvider("data", "http://jabber.org/protocol/ibb", new IBBProviders.Data()); - // Privacy - pm.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider()); + pm.addIQProvider("command", COMMAND_NAMESPACE, new AdHocCommandDataProvider()); pm.addExtensionProvider("malformed-action", COMMAND_NAMESPACE, new AdHocCommandDataProvider.MalformedActionError()); @@ -388,6 +366,7 @@ new AdHocCommandDataProvider.BadSessionIDError()); pm.addExtensionProvider("session-expired", COMMAND_NAMESPACE, new AdHocCommandDataProvider.SessionExpiredError()); + */ } } diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/service/BeemChatManager.java --- a/src/com/beem/project/beem/service/BeemChatManager.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/service/BeemChatManager.java Sun Feb 14 17:25:38 2010 +0100 @@ -222,9 +222,10 @@ return result; } Chat c = mAdaptee.createChat(key, null); - result = new ChatAdapter(c); + // maybe a little probleme of thread synchronization + // if so use an HashTable instead of a HashMap for mChats + result = getChat(c); result.addMessageListener(listener); - mChats.put(key, result); return result; } diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/service/Message.java --- a/src/com/beem/project/beem/service/Message.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/service/Message.java Sun Feb 14 17:25:38 2010 +0100 @@ -47,7 +47,6 @@ import android.os.Parcel; import android.os.Parcelable; -import android.util.Log; /** * This class represents a instant message. @@ -135,7 +134,7 @@ mType = MSG_TYPE_ERROR; break; default: - Log.w("BEEM_MESSAGE", "type de message non gerer" + smackMsg.getType()); + mType = MSG_TYPE_NORMAL; break; } this.mFrom = smackMsg.getFrom(); diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/service/XmppConnectionAdapter.java --- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Sun Feb 14 17:25:38 2010 +0100 @@ -171,10 +171,18 @@ return true; } catch (XMPPException e) { Log.e(TAG, "Error while connecting", e); - if (!"".equals(e.getMessage())) - mErrorMsg = e.getMessage(); - else - mErrorMsg = e.toString(); + try { + //TODO NIKITA DOES SOME SHIT !!! Fix this monstruosity + String str = mService.getResources().getString( + mService.getResources().getIdentifier( + e.getXMPPError().getCondition().replace("-", "_"), "string", "com.beem.project.beem")); + mErrorMsg = str; + } catch(NullPointerException e2) { + if (!"".equals(e.getMessage())) + mErrorMsg = e.getMessage(); + else + mErrorMsg = e.toString(); + } } return false; } @@ -211,15 +219,12 @@ mService.resetStatus(); mService.initJingle(mAdaptee); - // triggerAsynchronousConnectEvent(); + // triggerAsynchronousConnectEvent(); changeStatus(Status.CONTACT_STATUS_AVAILABLE, mService.getServicePreference().getString("status_text", "")); return true; } catch (XMPPException e) { Log.e(TAG, "Error while connecting", e); - if (!"".equals(e.getMessage())) - mErrorMsg = e.getMessage(); - else - mErrorMsg = e.toString(); + mErrorMsg = mService.getString(R.string.error_login_authentication); return false; } } diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/ui/ChangeStatus.java --- a/src/com/beem/project/beem/ui/ChangeStatus.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/ui/ChangeStatus.java Sun Feb 14 17:25:38 2010 +0100 @@ -180,7 +180,7 @@ * @return the status index from status the settings. */ private int getPreferenceStatusIndex() { - return mSettings.getInt("PreferenceStatus", 0); + return mSettings.getInt(getString(R.string.PreferenceStatus), AVAILABLE_IDX); } /** @@ -276,24 +276,26 @@ int status = getStatusForService((String) mSpinner.getSelectedItem()); Editor edit = mSettings.edit(); edit.putString(getString(R.string.PreferenceStatusText), msg); - edit.putInt(getString(R.string.PreferenceStatus), mSpinner.getSelectedItemPosition()); - edit.commit(); if (status == Status.CONTACT_STATUS_DISCONNECT) { stopService(new Intent(ChangeStatus.this, BeemService.class)); + edit.putInt(getString(R.string.PreferenceStatus), AVAILABLE_IDX); } else { try { mXmppFacade.changeStatus(status, msg.toString()); + edit.putInt(getString(R.string.PreferenceStatus), mSpinner.getSelectedItemPosition()); } catch (RemoteException e) { e.printStackTrace(); } mToast.show(); } + edit.commit(); } ChangeStatus.this.finish(); } else if (v == mClear) { mStatusMessageEditText.setText(null); } else if (v == mContact) { startActivity(new Intent(ChangeStatus.this, ContactList.class)); + ChangeStatus.this.finish(); } } } diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/ui/Chat.java --- a/src/com/beem/project/beem/ui/Chat.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/ui/Chat.java Sun Feb 14 17:25:38 2010 +0100 @@ -53,7 +53,6 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.ComponentName; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; @@ -61,7 +60,6 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; -import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -69,6 +67,7 @@ import android.text.util.Linkify; import android.util.Log; import android.view.KeyEvent; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -80,7 +79,6 @@ import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; @@ -344,30 +342,47 @@ * @throws RemoteException If a Binder remote-invocation error occurred. */ private void playRegisteredTranscript() throws RemoteException { - String fromBareJid = null; - String fromName = null; - List chatMessages = mChat.getMessages(); mListMessages.clear(); + List msgList = convertMessagesList(mChat.getMessages()); + mListMessages.addAll(msgList); mMessagesListAdapter.notifyDataSetChanged(); + } + + /** + * Convert a list of Mesage coming from the service to a list of MessageText that can be displayed in UI. + * @param chatMessages the list of Message + * @return a list of message that can be displayed. + */ + private List convertMessagesList(List chatMessages) { + List result = new ArrayList(chatMessages.size()); + String remoteName = mContact.getName(); + String localName = getString(R.string.chat_self); MessageText lastMessage = null; for (Message m : chatMessages) { - fromBareJid = StringUtils.parseBareAddress(m.getFrom()); - fromName = mContact.getName(); - if (fromBareJid == null) { - fromBareJid = getString(R.string.chat_self); - fromName = getString(R.string.chat_self); - } - if (m.getBody() != null) { - if (lastMessage == null || !lastMessage.getBareJid().equals(fromBareJid)) { - lastMessage = new MessageText(fromBareJid, fromName, m.getBody()); - mListMessages.add(lastMessage); - } else { - lastMessage.setMessage(lastMessage.getMessage().concat("\n" + m.getBody())); + String name = remoteName; + String fromBareJid = StringUtils.parseBareAddress(m.getFrom()); + if (m.getType() == Message.MSG_TYPE_ERROR) { + lastMessage = null; + result.add(new MessageText(fromBareJid, name, m.getBody(), true)); + continue; + } else if (m.getType() == Message.MSG_TYPE_CHAT) { + if (fromBareJid == null) { //nofrom or from == yours + name = localName; + fromBareJid = ""; + } + + if (m.getBody() != null) { + if (lastMessage == null || ! fromBareJid.equals(lastMessage.getBareJid())) { + lastMessage = new MessageText(fromBareJid, name, m.getBody()); + result.add(lastMessage); + } else { + lastMessage.setMessage(lastMessage.getMessage().concat("\n" + m.getBody())); + } } } } - mMessagesListAdapter.notifyDataSetChanged(); + return result; } /** @@ -387,7 +402,7 @@ public void onServiceConnected(ComponentName name, IBinder service) { mXmppFacade = IXmppFacade.Stub.asInterface(service); try { - if ((mRoster = mXmppFacade.getRoster()) != null ) + if ((mRoster = mXmppFacade.getRoster()) != null) mRoster.addRosterListener(mBeemRosterListener); mContact = new Contact(getIntent().getData()); if ((mChatManager = mXmppFacade.getChatManager()) != null) @@ -485,8 +500,10 @@ @Override public void run() { - //TODO gerer les messages de types error - if (msg.getBody() != null && msg.getType() != Message.MSG_TYPE_ERROR) { + if (msg.getType() == Message.MSG_TYPE_ERROR) { + mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(), true)); + mMessagesListAdapter.notifyDataSetChanged(); + } else if (msg.getBody() != null ) { MessageText lastMessage = mListMessages.size() != 0 ? mListMessages.get(mListMessages .size() - 1) : null; @@ -521,7 +538,6 @@ // Check for a contact status message update if (!(mContactStatusMsgTextView.getText().toString().equals(mContact.getMsgState()))) { - Log.d(TAG, "Setting status message - " + mContact.getMsgState()); mContactStatusMsgTextView.setText(mContact.getMsgState()); Linkify.addLinks(mContactStatusMsgTextView, Linkify.WEB_URLS); } @@ -567,6 +583,7 @@ * Returns the number of messages contained in the messages list. * @return The number of messages contained in the messages list. */ + @Override public int getCount() { return mListMessages.size(); } @@ -576,8 +593,9 @@ * @param position The position of the requested item. * @return The item from the messages list at the requested position. */ + @Override public Object getItem(int position) { - return position; + return mListMessages.get(position); } /** @@ -585,6 +603,7 @@ * @param position The position of the requested item. * @return The id of an item from the messages list at the requested position. */ + @Override public long getItemId(int position) { return position; } @@ -597,27 +616,26 @@ * @return A View corresponding to the data at the specified position. */ public View getView(int position, View convertView, ViewGroup parent) { - MessageView sv; + View sv; if (convertView == null) { - sv = new MessageView(Chat.this, mListMessages.get(position).getName(), mListMessages.get(position) - .getMessage()); + LayoutInflater inflater = Chat.this.getLayoutInflater(); + sv = inflater.inflate(R.layout.chat_msg_row, null); } else { - sv = (MessageView) convertView; - sv.setName(mListMessages.get(position).getName()); - sv.setMessage(mListMessages.get(position).getMessage()); + sv = convertView; } - - //TODO Put this in the xml layout - sv.setPadding(2, 2, 2, 4); - - sv.mName.setTextSize(16); - sv.mName.setTextColor(Color.WHITE); - sv.mName.setTypeface(Typeface.DEFAULT_BOLD); - - sv.mMessage.setLinkTextColor(Color.WHITE); - sv.mMessage.setPadding(0, 4, 0, 4); - Linkify.addLinks(sv.mMessage, Linkify.WEB_URLS); - + 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()); + if (msg.isError()) { + String err = getString(R.string.chat_error); + msgName.setText(err); + msgName.setTextColor(Color.RED); + msgName.setError(err); + } return sv; } } @@ -630,6 +648,7 @@ private String mBareJid; private String mName; private String mMessage; + private boolean mIsError; /** * Constructor. @@ -641,6 +660,21 @@ mBareJid = bareJid; mName = name; mMessage = message; + mIsError = false; + } + + /** + * Constructor. + * @param bareJid A String containing the bare JID of the message's author. + * @param name A String containing the name of the message's author. + * @param message A String containing the message. + * @param isError if the message is an error message. + */ + public MessageText(final String bareJid, final String name, final String message, final boolean isError) { + mBareJid = bareJid; + mName = name; + mMessage = message; + mIsError = isError; } /** @@ -692,54 +726,13 @@ public void setMessage(String message) { mMessage = message; } - } - - /** - * We will use a MessageView to display each message. - * TODO : put this in an xml file - */ - private class MessageView extends LinearLayout { - private final TextView mName; - private final TextView mMessage; /** - * Constructor. - * @param context The context of the MessageView - * @param name A String containing the message's author. - * @param message A String containing the message. + * Get the message type. + * @return true if the message is an error message. */ - public MessageView(final Context context, final String name, final String message) { - super(context); - - this.setOrientation(VERTICAL); - - mName = new TextView(context); - mName.setText(name); - addView(mName, - new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, - android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); - - mMessage = new TextView(context); - mMessage.setText(message); - addView(mMessage, - new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, - android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); - } - - /** - * Convenience method to set the title of a MessageView. - * @param name A String containing the message's author. - */ - public void setName(String name) { - mName.setText(name); - } - - /** - * Convenience method to set the dialogue of a MessageView. - * @param message A String containing the message. - */ - public void setMessage(String message) { - mMessage.setText(message); + public boolean isError() { + return mIsError; } } @@ -781,16 +774,10 @@ if (lastMessage != null && lastMessage.getName().equals(self)) { lastMessage.setMessage(lastMessage.getMessage().concat("\n" + inputContent)); - mListMessages.set(mListMessages.size() - 1, lastMessage); } else mListMessages.add(new MessageText(self, self, inputContent)); mMessagesListAdapter.notifyDataSetChanged(); mInputField.setText(null); } } - - @Override - protected void finalize() { - Log.e("CHATFIN", "FINALIZE"); - } } diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/ui/ContactList.java Sun Feb 14 17:25:38 2010 +0100 @@ -59,6 +59,7 @@ import android.content.ServiceConnection; import android.content.SharedPreferences; import android.graphics.BitmapFactory; +import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -72,14 +73,15 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.ViewStub; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Gallery; +import android.widget.LinearLayout; +import android.widget.ListView; import android.widget.TextView; -import android.widget.ListView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; -import android.graphics.drawable.BitmapDrawable; import com.beem.project.beem.R; import com.beem.project.beem.service.Contact; @@ -243,7 +245,7 @@ break; default: result = super.onContextItemSelected(item); - break; + break; } return result; } @@ -290,8 +292,11 @@ if (mXmppFacade == null) bindService(SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); else { + if (!mSettings.getBoolean("settings_key_hide_groups", false)) + buildBanner(); + else + hideGroups(); buildContactList(); - buildBanner(); } } @@ -386,6 +391,12 @@ * buildBanner. */ private void buildBanner() { + + ViewStub stub = (ViewStub) findViewById(R.id.contactlist_stub); + if (stub != null) + stub.inflate(); + else + ((LinearLayout) findViewById(R.id.contactlist_groupstub)).setVisibility(View.VISIBLE); Gallery g = (Gallery) findViewById(R.id.contactlist_banner); g.setOnItemClickListener(new OnItemClickGroupName()); g.setAdapter(mAdapterBanner); @@ -793,7 +804,10 @@ } mContactOnGroup.put(getString(R.string.contact_list_all_contact), tmpContactList); mCurGroup = getString(R.string.contact_list_all_contact); - buildBanner(); + if (!mSettings.getBoolean("settings_key_hide_groups", false)) + buildBanner(); + else + hideGroups(); buildContactList(); } } catch (RemoteException e) { @@ -821,4 +835,10 @@ protected void finalize() { Log.e(TAG, "FINALIZE"); } + + private void hideGroups() { + ViewStub stub = (ViewStub) findViewById(R.id.contactlist_stub); + if (stub == null) + ((LinearLayout) findViewById(R.id.contactlist_groupstub)).setVisibility(View.GONE); + } } diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/ui/Login.java --- a/src/com/beem/project/beem/ui/Login.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/ui/Login.java Sun Feb 14 17:25:38 2010 +0100 @@ -47,6 +47,8 @@ import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.PackageInfo; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; @@ -169,7 +171,16 @@ */ private void createAboutDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(R.string.login_about_title).setMessage(R.string.login_about_msg).setCancelable(false); + String versionname; + try { + PackageManager pm = getPackageManager(); + PackageInfo pi = pm.getPackageInfo("com.beem.project.beem", 0); + versionname = pi.versionName; + } catch (PackageManager.NameNotFoundException e) { + versionname = ""; + } + String title = getString(R.string.login_about_title, versionname); + builder.setTitle(title).setMessage(R.string.login_about_msg).setCancelable(false); builder.setNeutralButton(R.string.login_about_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { diff -r ea02c5b80cc0 -r 532fdf132146 src/com/beem/project/beem/ui/LoginAnim.java --- a/src/com/beem/project/beem/ui/LoginAnim.java Sun Jan 24 04:57:37 2010 +0100 +++ b/src/com/beem/project/beem/ui/LoginAnim.java Sun Feb 14 17:25:38 2010 +0100 @@ -209,7 +209,6 @@ @Override protected void onProgressUpdate(Integer ... values) { - Log.d(TAG, "onProgress " + values[0]); mLoginState.setText(getResources().getStringArray(R.array.loganim_state)[values[0]]); }