# HG changeset patch # User nikita@nikita-lab # Date 1242999811 -7200 # Node ID 088857b09c7ddbb5211c887d61dcb6e54a1d6218 # Parent fb0591e482d8c8aaa18a2dc2a0bb7e6d7af3ee9a# Parent 73b3c7576722a52e694e86bf6a8c481f82bd458c merged diff -r 73b3c7576722 -r 088857b09c7d src/com/beem/project/beem/ui/ContactDialog.java --- a/src/com/beem/project/beem/ui/ContactDialog.java Fri May 22 15:07:35 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactDialog.java Fri May 22 15:43:31 2009 +0200 @@ -6,6 +6,7 @@ import android.content.Intent; import android.view.View; import android.widget.Button; +import android.widget.TextView; import com.beem.project.beem.R; import com.beem.project.beem.service.Contact; @@ -16,22 +17,23 @@ private Contact mContact; private Context mContext; - public ContactDialog(final Context context, Contact c) { + public ContactDialog(final Context context, Contact curContact, Intent curIntent) { super(context); mContext = context; setContentView(R.layout.contactdialog); - mContact = c; - setTitle(c.getJID()); + mContact = curContact; + setTitle(curContact.getJID()); Button chat = (Button) findViewById(R.id.chat); chat.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - Activity a = ContactDialog.this.getOwnerActivity(); + /*Activity a = ContactDialog.this.getOwnerActivity(); Intent i = new Intent(mContext, SendIM.class); i.putExtra("contact", mContact); - a.startActivity(i); + a.startActivity(i);*/ + String type = ((TextView) v).getText(); dismiss(); } diff -r 73b3c7576722 -r 088857b09c7d src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Fri May 22 15:07:35 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactList.java Fri May 22 15:43:31 2009 +0200 @@ -65,6 +65,18 @@ mRosterListener = new BeemRosterListener(); mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE); mBeemApplication = BeemApplication.getApplication(this); +<<<<<<< local + groupMap = new HashMap>(); + groupName = new ArrayList(); + mBeemApplication.callWhenConnectedToServer(mHandler, new Runnable() { + @Override + public void run() { + mService = mBeemApplication.getXmppFacade(); + try { + mRoster = mService.getRoster(); + } catch (RemoteException e1) { + Log.e(TAG, "Get roster failed", e1); +======= //TODO: a refaire /*if (mSettings.getString(getString(R.string.PreferenceHostKey), "").equals("")) @@ -75,6 +87,7 @@ protected void onResume() { super.onResume(); +>>>>>>> other } @Override @@ -82,14 +95,31 @@ mBeemApplication.unbindBeemService(); super.onDestroy(); } +<<<<<<< local + callbackShowContactList(); + } + }); + //TODO: a refaire + if (mSettings.getString(getString(R.string.PreferenceHostKey), "").equals("")) + startActivityForResult(new Intent(ContactList.this, ContactListSettings.class), PREFERENCECHANGED); + } + + @Override + protected void onDestroy() { + mBeemApplication.unbindBeemService(); + super.onDestroy(); + } +======= +>>>>>>> other private void callbackShowContactList() { - if (mRoster != null) + if (mRoster != null) { try { buildContactList(mRoster.getContactList()); } catch (RemoteException e) { e.printStackTrace(); } + } } /** @@ -143,12 +173,26 @@ mBeemApplication.stopBeemService(); } } +<<<<<<< local + } + + @Override + public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { + Intent i = new Intent(ContactList.this, SendIM.class); + try { + i.putExtra("contact", groupMap.get(groupName.get(groupPosition)).get(childPosition)); + startActivity(i); + return true; + } catch (NullPointerException e) { + Log.e(TAG, "Child not found", e); + return false; + } +======= +>>>>>>> other } private void buildContactList(List listContact) { - mListContact = listContact; - groupMap = new HashMap>(); - groupName = new ArrayList(); + mListContact = listContact; for (Contact contact : listContact) { for (String group : contact.getGroups()) { if (!groupMap.containsKey(group)) { @@ -156,7 +200,8 @@ groupName.add(group); } try { - groupMap.get(group).add(contact); + if (!groupMap.get(group).contains(contact)) + groupMap.get(group).add(contact); } catch (NullPointerException e) { Log.e(TAG, "Failed to find group in groupMap", e); }