# HG changeset patch # User marseille # Date 1240498785 -7200 # Node ID 70b67bdac4fcae86ac4ae3ee601d5874b7655d0f # Parent 3dd605c7c71f93865b6d7ecb0c72c1d938de70c1 Qqls modification. Mise en anglais... diff -r 3dd605c7c71f -r 70b67bdac4fc AndroidManifest.xml --- a/AndroidManifest.xml Thu Apr 23 14:32:45 2009 +0200 +++ b/AndroidManifest.xml Thu Apr 23 16:59:45 2009 +0200 @@ -2,7 +2,7 @@ - + diff -r 3dd605c7c71f -r 70b67bdac4fc res/layout/contactlistsettings.xml --- a/res/layout/contactlistsettings.xml Thu Apr 23 14:32:45 2009 +0200 +++ b/res/layout/contactlistsettings.xml Thu Apr 23 16:59:45 2009 +0200 @@ -106,6 +106,11 @@ android:text="OK"> + \ No newline at end of file diff -r 3dd605c7c71f -r 70b67bdac4fc res/menu/contactlistmenu.xml --- a/res/menu/contactlistmenu.xml Thu Apr 23 14:32:45 2009 +0200 +++ b/res/menu/contactlistmenu.xml Thu Apr 23 16:59:45 2009 +0200 @@ -1,6 +1,6 @@ - + - - + + diff -r 3dd605c7c71f -r 70b67bdac4fc res/values/strings.xml --- a/res/values/strings.xml Thu Apr 23 14:32:45 2009 +0200 +++ b/res/values/strings.xml Thu Apr 23 16:59:45 2009 +0200 @@ -55,6 +55,9 @@ Type here your status message : Add new contact + Beem Project + Create account + Edit account Updating status Nothing to change diff -r 3dd605c7c71f -r 70b67bdac4fc src/com/beem/project/beem/BeemService.java --- a/src/com/beem/project/beem/BeemService.java Thu Apr 23 14:32:45 2009 +0200 +++ b/src/com/beem/project/beem/BeemService.java Thu Apr 23 16:59:45 2009 +0200 @@ -79,7 +79,7 @@ mPassword = mSettings.getString(getString(R.string.PreferencePasswordKey), ""); mHost = mSettings.getString(getString(R.string.PreferenceHostKey), ""); // TODO penser a commenter - mHost = "10.0.2.2"; + //mHost = "10.0.2.2"; initConnectionConfig(); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, mPassword, this); diff -r 3dd605c7c71f -r 70b67bdac4fc src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Thu Apr 23 14:32:45 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactList.java Thu Apr 23 16:59:45 2009 +0200 @@ -8,7 +8,6 @@ import android.app.ExpandableListActivity; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; @@ -38,22 +37,20 @@ private static final String TAG = "CONTACTLIST_ACT"; private static final int PREFERENCECHANGED = 0; - private static final int CREATEACCOUNT = 1; + private static final String CHILD = "CHILD"; + private static final String GROUP = "GROUP"; private IXmppFacade mService = null; - private SharedPreferences mSettings; private BeemApplication mBeemApplication; private BeemRosterListener mRosterListener; private IRoster mRoster; @SuppressWarnings("unchecked") @Override - public boolean onChildClick(ExpandableListView parent, View v, - int groupPosition, int childPosition, long id) { + public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { + Map child = (HashMap) parent.getExpandableListAdapter().getChild( + groupPosition, childPosition); Intent i = new Intent(this, SendIM.class); - Map child = (HashMap) parent - .getExpandableListAdapter().getChild(groupPosition, - childPosition); - i.putExtra("contact", child.get("CHILD")); + i.putExtra("contact", child.get(CHILD)); startActivity(i); return true; } @@ -62,8 +59,6 @@ protected void onCreate(Bundle saveBundle) { super.onCreate(saveBundle); mBeemApplication = BeemApplication.getApplication(this); - mSettings = getSharedPreferences( - getString(R.string.PreferenceFileName), MODE_PRIVATE); mRosterListener = new BeemRosterListener(); mBeemApplication.startBeemService(); mBeemApplication.callWhenConnectedToServer(new Handler(), new Runnable() { @@ -89,9 +84,9 @@ @Override protected void onDestroy() { - // TODO Auto-generated method stub - super.onDestroy(); - mBeemApplication.unbindBeemService(); + // TODO Auto-generated method stub + super.onDestroy(); + mBeemApplication.unbindBeemService(); } private void callbackShowContactList() { @@ -100,8 +95,7 @@ */ if (mRoster != null) try { - showContactList(mRoster.getGroupsNames(), mRoster - .getContactList()); + showContactList(mRoster.getGroupsNames(), mRoster.getContactList()); } catch (RemoteException e) { e.printStackTrace(); } @@ -109,9 +103,7 @@ /** * Callback for menu creation. - * - * @param menu - * the menu created + * @param menu the menu created * @return true on success, false otherwise */ @Override @@ -124,9 +116,7 @@ /** * Callback for menu item selected. - * - * @param item - * the item selected + * @param item the item selected * @return true on success, false otherwise */ @Override @@ -148,19 +138,23 @@ } } - protected void onActivityResult(int requestCode, int resultCode, - Intent data) { + protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PREFERENCECHANGED) { if (resultCode == RESULT_OK) { mBeemApplication.stopBeemService(); mBeemApplication.startBeemService(); - } + } } } + private boolean isStatusOK(int status) { + if (status == Status.CONTACT_STATUS_AVAILABLE || status == Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT + || status == Status.CONTACT_STATUS_AWAY || status == Status.CONTACT_STATUS_BUSY) + return true; + return false; + } - private void showContactList(List listGroup, - List listContact) { + private void showContactList(List listGroup, List listContact) { ExpandableListAdapter Adapter; List> groupData = new ArrayList>(); List>> childData = new ArrayList>>(); @@ -175,43 +169,36 @@ List> children = new ArrayList>(); for (int j = 0; j < listContact.size(); ++j) { + Contact c = listContact.get(j); + Log.i(TAG, c.getID() + " " + c.getJID()); Map curChildMap = new HashMap(); children.add(curChildMap); - Contact c = listContact.get(j); - Log.i(TAG, c.getID() + " " + c.getJID()); - curChildMap.put("CHILD", c); + curChildMap.put(CHILD, c); } childData.add(children); } - Adapter = new ContactExpandableListAdapter(this, groupData, - R.layout.contactlistgroup, new String[] { "GROUP" }, - new int[] { R.id.textgroup }, childData, - R.layout.contactlistcontact, new String[] { "CHILD" }, - new int[] { R.id.contactliststatus, R.id.contactlistpseudo, - R.id.contactlistmsgperso, R.id.contactlistavatar }); + Adapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup, + new String[] { GROUP }, new int[] { R.id.textgroup }, childData, R.layout.contactlistcontact, + new String[] { CHILD }, new int[] { R.id.contactliststatus, R.id.contactlistpseudo, + R.id.contactlistmsgperso, R.id.contactlistavatar }); setListAdapter(Adapter); } /** - * A simple adapter which allows you to bind data to specific Views defined - * within the layout of an Expandable Lists children (Implement - * getGroupView() to define the layout of parents) + * A simple adapter which allows you to bind data to specific Views defined within the layout of an Expandable Lists + * children (Implement getGroupView() to define the layout of parents) */ - private class ContactExpandableListAdapter extends - SimpleExpandableListAdapter { + private class ContactExpandableListAdapter extends SimpleExpandableListAdapter { private List>> mChildData; private String[] mChildFrom; private int[] mChildTo; - public ContactExpandableListAdapter(Context context, - List> groupData, int groupLayout, - String[] groupFrom, int[] groupTo, - List>> childData, - int childLayout, String[] childFrom, int[] childTo) { - super(context, groupData, groupLayout, groupFrom, groupTo, - childData, childLayout, childFrom, childTo); + public ContactExpandableListAdapter(Context context, List> groupData, int groupLayout, + String[] groupFrom, int[] groupTo, List>> childData, + int childLayout, String[] childFrom, int[] childTo) { + super(context, groupData, groupLayout, groupFrom, groupTo, childData, childLayout, childFrom, childTo); mChildData = childData; mChildFrom = childFrom; @@ -220,8 +207,8 @@ } @Override - public View getChildView(int groupPosition, int childPosition, - boolean isLastChild, View convertView, ViewGroup parent) { + public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, + ViewGroup parent) { View v; if (convertView == null) { @@ -229,13 +216,13 @@ } else { v = convertView; } - bindView(v, mChildData.get(groupPosition).get(childPosition), - mChildFrom, mChildTo, groupPosition, childPosition); + bindView(v, mChildData.get(groupPosition).get(childPosition), mChildFrom, mChildTo, groupPosition, + childPosition); return v; } - private void bindView(View view, Map data, String[] from, - int[] to, int groupPosition, int childPosition) { + private void bindView(View view, Map data, String[] from, int[] to, int groupPosition, + int childPosition) { Contact c = (Contact) data.get(from[0]); if (c != null) { @@ -244,33 +231,26 @@ Drawable imageDrawable = null; switch (c.getStatus()) { case Status.CONTACT_STATUS_AVAILABLE: - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.online); + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.online); break; case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT: - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.chat); + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.chat); break; case Status.CONTACT_STATUS_AWAY: - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.away); + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.away); break; case Status.CONTACT_STATUS_BUSY: - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.dnd); + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.dnd); break; case Status.CONTACT_STATUS_DISCONNECT: - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.offline); + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.offline); break; case Status.CONTACT_STATUS_UNAVAILABLE: - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.requested); + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.requested); break; default: - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.error); - break; + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.error); + break; } imgV.setImageDrawable(imageDrawable); @@ -285,13 +265,11 @@ } /* - * TODO: Rajouter l'avatar du contact getAvatar() dans la - * classe + * TODO: Rajouter l'avatar du contact getAvatar() dans la classe */ imgV = (ImageView) view.findViewById(to[3]); if (imgV != null) { - imageDrawable = (Drawable) getResources().getDrawable( - R.drawable.avatar); + imageDrawable = (Drawable) getResources().getDrawable(R.drawable.avatar); imgV.setImageDrawable(imageDrawable); } } @@ -301,29 +279,25 @@ private class BeemRosterListener extends IBeemRosterListener.Stub { @Override - public void onEntriesAdded(List addresses) - throws RemoteException { + public void onEntriesAdded(List addresses) throws RemoteException { Log.i(TAG, "ENTRIES ADDED"); } @Override - public void onEntriesDeleted(List addresses) - throws RemoteException { + public void onEntriesDeleted(List addresses) throws RemoteException { Log.i(TAG, "ENTRIES DEL"); } @Override - public void onEntriesUpdated(List addresses) - throws RemoteException { + public void onEntriesUpdated(List addresses) throws RemoteException { Log.i(TAG, "ENTRIES UPD"); } @Override - public void onPresenceChanged(PresenceAdapter presence) - throws RemoteException { + public void onPresenceChanged(PresenceAdapter presence) throws RemoteException { Log.i(TAG, "PRESENCE CHANGED"); } diff -r 3dd605c7c71f -r 70b67bdac4fc src/com/beem/project/beem/ui/ContactListSettings.java --- a/src/com/beem/project/beem/ui/ContactListSettings.java Thu Apr 23 14:32:45 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactListSettings.java Thu Apr 23 16:59:45 2009 +0200 @@ -51,6 +51,17 @@ showSettings(); Button ok = (Button) findViewById(R.id.ok); ok.setOnClickListener(mOkListener); + + Button reco = (Button) findViewById(R.id.reconnect); + reco.setOnClickListener(new OnClickListener () { + + @Override + public void onClick(View v) { + setResult(RESULT_OK); + finish(); + } + + }); } private OnItemSelectedListener mProxyType = new OnItemSelectedListener() { diff -r 3dd605c7c71f -r 70b67bdac4fc src/com/beem/project/beem/ui/SendIM.java --- a/src/com/beem/project/beem/ui/SendIM.java Thu Apr 23 14:32:45 2009 +0200 +++ b/src/com/beem/project/beem/ui/SendIM.java Thu Apr 23 16:59:45 2009 +0200 @@ -64,7 +64,6 @@ @Override public void onCreate(Bundle saveBundle) { super.onCreate(saveBundle); - setTheme(R.style.customtheme_contactList); mHandler = new Handler(); mChatManagerListener = new OnChatListener(); mMessageListener = new OnMessageListener();