--- a/src/com/beem/project/beem/BeemService.java Sun Mar 20 02:55:29 2011 +0100
+++ b/src/com/beem/project/beem/BeemService.java Sun Mar 20 04:57:15 2011 +0100
@@ -103,7 +103,7 @@
private Map<String, BeemConnection> mBeemConnection = new HashMap<String, BeemConnection>();
//TODO: MAp maybe instead of LIST
- private Map<String, XmppFacade> mBind = new HashMap<String, XmppFacade>();
+ private Map<String, IXmppFacade.Stub> mBind = new HashMap<String, IXmppFacade.Stub>();
private boolean mOnOffReceiverIsRegistered;
@@ -123,8 +123,8 @@
@Override
public IBinder onBind(Intent intent) {
Log.d(TAG, "ONBIND()");
- //TODO: Prendre le bon mbind dans le tableau
- return mBind.get(intent.getExtras().getString("account_name"));
+ Log.e(TAG, intent.getStringExtra("account_name"));
+ return (IBinder) mBind.get(intent.getStringExtra("account_name"));
}
@Override
@@ -253,6 +253,7 @@
*/
public IXmppFacade getBind() {
//TODO: Prendre le bon mbind dans le tableau
+ Log.e(TAG, "GETBIND");
return mBind.get(0);
}
--- a/src/com/beem/project/beem/ui/ContactList.java Sun Mar 20 02:55:29 2011 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java Sun Mar 20 04:57:15 2011 +0100
@@ -39,7 +39,7 @@
Flavien Astraud, November 26, 2009
-*/
+ */
package com.beem.project.beem.ui;
import java.util.ArrayList;
@@ -121,16 +121,16 @@
private final BeemContactList mAdapterContactList = new BeemContactList();
private final List<String> mListGroup = new ArrayList<String>();
- /** Map containing a list of the different contacts of a given group.
- * Each list is a @{link SortedList} so there is no need to sort it again.
- * */
+ /**
+ * Map containing a list of the different contacts of a given group. Each list is a @{link SortedList} so there is
+ * no need to sort it again.
+ */
private final Map<String, List<Contact>> mContactOnGroup = new HashMap<String, List<Contact>>();
private final BeemContactListOnClick mOnContactClick = new BeemContactListOnClick();
private final Handler mHandler = new Handler();
private final ServiceConnection mServConn = new BeemServiceConnection();
private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private final ComparatorContactListByStatusAndName<Contact> mComparator =
- new ComparatorContactListByStatusAndName<Contact>();
+ private final ComparatorContactListByStatusAndName<Contact> mComparator = new ComparatorContactListByStatusAndName<Contact>();
private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
private List<Contact> mListContact;
private String mSelectedGroup;
@@ -143,6 +143,8 @@
private BeemBanner mAdapterBanner;
private boolean mBinded;
+ private String mAccountName;
+
/**
* Constructor.
*/
@@ -166,7 +168,9 @@
public final boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.contact_list_menu_settings:
- startActivity(new Intent(this, Settings.class));
+ Intent i = new Intent(this, Settings.class);
+ i.putExtra("account_name", mAccountName);
+ startActivity(i);
return true;
case R.id.contact_list_menu_add_contact:
startActivity(new Intent(ContactList.this, AddContact.class));
@@ -252,8 +256,8 @@
result = true;
break;
case R.id.contact_list_context_menu_userinfo_subscription:
- Dialog subscription = new ResendSubscription(ContactList.this,
- mXmppFacade, mSelectedContact).create();
+ Dialog subscription = new ResendSubscription(ContactList.this, mXmppFacade, mSelectedContact)
+ .create();
subscription.show();
result = true;
break;
@@ -280,6 +284,8 @@
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
setContentView(R.layout.contactlist);
+ mAccountName = getIntent().getStringExtra("account_name");
+
this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
mInflater = getLayoutInflater();
@@ -289,13 +295,19 @@
listView.setOnItemClickListener(mOnContactClick);
registerForContextMenu(listView);
listView.setAdapter(mAdapterContactList);
+ Log.e(TAG, "ONCREATE");
}
@Override
protected void onResume() {
super.onResume();
- if (!mBinded)
- mBinded = bindService(SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+ if (!mBinded) {
+ Log.e(TAG, "ON RESUME");
+ Intent i = new Intent(SERVICE_INTENT);
+ i.putExtras(getIntent());
+ Log.e(TAG, i.getStringExtra("account_name"));
+ mBinded = bindService(i, mServConn, BIND_AUTO_CREATE);
+ }
}
/**
@@ -376,12 +388,10 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesAdded event.
- * if contact has to be shown :
+ * {@inheritDoc} Simple stategy to handle the onEntriesAdded event. if contact has to be shown :
* <ul>
- * <li> add him to his groups</li>
- * <li> add him to the specials groups</>
+ * <li>add him to his groups</li>
+ * <li>add him to the specials groups</>
* </ul>
*/
@Override
@@ -413,10 +423,9 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesDeleted event.
+ * {@inheritDoc} Simple stategy to handle the onEntriesDeleted event.
* <ul>
- * <li> Remove the contact from all groups</li>
+ * <li>Remove the contact from all groups</li>
* </ul>
*/
@Override
@@ -447,12 +456,11 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesUpdated event.
+ * {@inheritDoc} Simple stategy to handle the onEntriesUpdated event.
* <ul>
- * <li> Remove the contact from all groups</li>
- * <li> if contact has to be shown add it to his groups</li>
- * <li> if contact has to be shown add it to the specials groups</li>
+ * <li>Remove the contact from all groups</li>
+ * <li>if contact has to be shown add it to his groups</li>
+ * <li>if contact has to be shown add it to the specials groups</li>
* </ul>
*/
@Override
@@ -473,8 +481,7 @@
for (String group : groups) {
if (!mListGroup.contains(group)) {
mListGroup.add(mListGroup.size() - 1, group);
- List<Contact> tmplist = new SortedList<Contact>(
- new LinkedList<Contact>(), mComparator);
+ List<Contact> tmplist = new SortedList<Contact>(new LinkedList<Contact>(), mComparator);
mContactOnGroup.put(group, tmplist);
}
mContactOnGroup.get(group).remove(contact);
@@ -492,12 +499,11 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onPresenceChanged event.
+ * {@inheritDoc} Simple stategy to handle the onPresenceChanged event.
* <ul>
- * <li> Remove the contact from all groups</li>
- * <li> if contact has to be shown add it to his groups</li>
- * <li> if contact has to be shown add it to the specials groups</li>
+ * <li>Remove the contact from all groups</li>
+ * <li>if contact has to be shown add it to his groups</li>
+ * <li>if contact has to be shown add it to the specials groups</li>
* </ul>
*/
@Override
@@ -527,10 +533,8 @@
}
/**
- * Add a contact to the special list No Group and All contacts.
- * The contact will be added if the list is not the current list otherwise
- * the list must be modified in a Handler.
- *
+ * Add a contact to the special list No Group and All contacts. The contact will be added if the list is not the
+ * current list otherwise the list must be modified in a Handler.
* @param contact the contact to add.
*/
private void addToSpecialList(Contact contact) {
@@ -547,7 +551,6 @@
/**
* Update the current list with the status of contact.
- *
* @param listName name of the current list
* @param contact contact to update
*/
@@ -556,12 +559,11 @@
final List<String> groups = contact.getGroups();
String noGroup = getString(R.string.contact_list_no_group);
String allGroup = getString(R.string.contact_list_all_contact);
- final boolean add = ((!hideDisconnected || Status.statusOnline(contact.getStatus())) && // must show and
- (
- (listName.equals(noGroup) && groups.isEmpty()) || // in no group
- groups.contains(listName) || // or in current
- listName.equals(allGroup) // or in all
- ));
+ final boolean add = ((!hideDisconnected || Status.statusOnline(contact.getStatus())) && // must show and
+ ((listName.equals(noGroup) && groups.isEmpty()) || // in no group
+ groups.contains(listName) || // or in current
+ listName.equals(allGroup) // or in all
+ ));
mHandler.post(new Runnable() {
public void run() {
mListContact.remove(contact);
@@ -624,7 +626,6 @@
return mListContact.get(position).hashCode();
}
-
/**
* {@inheritDoc}
*/
@@ -672,8 +673,8 @@
}
/**
- * Get a LayerDrawable containing the avatar and the status icon.
- * The status icon will change with the level of the drawable.
+ * 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
*/
@@ -710,7 +711,8 @@
/**
* Create a ContactFilter.
*/
- public ContactFilter() { }
+ public ContactFilter() {
+ }
@Override
protected Filter.FilterResults performFiltering(CharSequence constraint) {
@@ -730,7 +732,7 @@
}
@Override
- protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
+ protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
Log.d(TAG, "publishResults");
List<Contact> contacts = (List<Contact>) results.values;
mListContact = contacts;
@@ -799,7 +801,12 @@
try {
mRoster = mXmppFacade.getRoster();
if (mRoster != null) {
+ Log.e(TAG, "ROSTER");
+
List<String> tmpGroupList = mRoster.getGroupsNames();
+ for (String string : tmpGroupList) {
+ Log.e(TAG, string);
+ }
Collections.sort(tmpGroupList);
mListGroup.clear();
mListGroup.add(getString(R.string.contact_list_all_contact));
@@ -824,6 +831,7 @@
@Override
public void onServiceDisconnected(ComponentName name) {
+ Log.e(TAG, "SERVICE DISCO");
try {
mRoster.removeRosterListener(mBeemRosterListener);
} catch (RemoteException e) {
@@ -839,9 +847,7 @@
}
/**
- * Assign the differents contact to their groups.
- * This methods will fill the mContactOnGroup map.
- *
+ * Assign the differents contact to their groups. This methods will fill the mContactOnGroup map.
* @param contacts list of contacts
* @param groupNames list of existing groups
*/
@@ -874,7 +880,6 @@
/**
* Make the List of the map became Insertion sorted list.
- *
* @param map the map to convert.
*/
private void makeSortedList(Map<String, List<Contact>> map) {
@@ -885,9 +890,6 @@
}
}
-
-
-
/**
* Comparator Contact by status and name.
*/
--- a/src/com/beem/project/beem/ui/Login.java Sun Mar 20 02:55:29 2011 +0100
+++ b/src/com/beem/project/beem/ui/Login.java Sun Mar 20 04:57:15 2011 +0100
@@ -56,6 +56,7 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -81,6 +82,7 @@
private static final int LOGIN_REQUEST_CODE = 1;
private TextView mTextView;
private BeemApplication mBeemApplication;
+ private String mAccountName;
List<String> mListAccount = new ArrayList<String>();
private BeemAccountList mAdapterAccountList;
@@ -95,17 +97,17 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Application app = getApplication();
- if (app instanceof BeemApplication) {
- mBeemApplication = (BeemApplication) app;
- if (mBeemApplication.isConnected()) {
- startActivity(new Intent(this, ContactList.class));
- finish();
- } else if (!mBeemApplication.isAccountConfigured()) {
- startActivity(new Intent(this, Account.class));
- finish();
- }
- }
+// Application app = getApplication();
+// if (app instanceof BeemApplication) {
+// mBeemApplication = (BeemApplication) app;
+// if (mBeemApplication.isConnected()) {
+// startActivity(new Intent(this, ContactList.class));
+// finish();
+// } else if (!mBeemApplication.isAccountConfigured()) {
+// startActivity(new Intent(this, Account.class));
+// finish();
+// }
+// }
setContentView(R.layout.login);
mTextView = (TextView) findViewById(R.id.log_as_msg);
ListView listView = (ListView) findViewById(R.id.accountlist);
@@ -123,8 +125,11 @@
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == LOGIN_REQUEST_CODE) {
- if (resultCode == Activity.RESULT_OK) {
- startActivity(new Intent(this, ContactList.class));
+ if (resultCode == Activity.RESULT_OK) {
+ Intent i = new Intent(this, ContactList.class);
+ Log.e("LOGIN", "ACCOUNT NAME : " + mAccountName);
+ i.putExtra("account_name", mAccountName);
+ startActivity(i);
finish();
} else if (resultCode == Activity.RESULT_CANCELED) {
if (data != null) {
@@ -254,7 +259,8 @@
@Override
public void onItemClick(AdapterView<?> arg0, View v, int pos, long lpos) {
Intent i = new Intent(Login.this, LoginAnim.class);
- i.putExtra("account_name", mListAccount.get(pos));
+ mAccountName = mListAccount.get(pos);
+ i.putExtra("account_name", mAccountName);
startActivityForResult(i, LOGIN_REQUEST_CODE);
}
}
--- a/src/com/beem/project/beem/ui/LoginAnim.java Sun Mar 20 02:55:29 2011 +0100
+++ b/src/com/beem/project/beem/ui/LoginAnim.java Sun Mar 20 04:57:15 2011 +0100
@@ -122,7 +122,7 @@
mTask = new LoginTask();
if (mXmppFacade == null) {
Intent i = new Intent(LoginAnim.SERVICE_INTENT);
- i.putExtra("account_name", getIntent().getExtras().getString("account_name"));
+ i.putExtras(getIntent());
bindService(i, mServConn, BIND_AUTO_CREATE);
}
}
--- a/src/com/beem/project/beem/ui/Settings.java Sun Mar 20 02:55:29 2011 +0100
+++ b/src/com/beem/project/beem/ui/Settings.java Sun Mar 20 04:57:15 2011 +0100
@@ -73,6 +73,7 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getSharedPreferences(getIntent().getExtras().getString("account_name"), MODE_PRIVATE);
addPreferencesFromResource(R.layout.preferences);
}