--- a/src/com/beem/project/beem/ui/Chat.java Tue Oct 25 13:17:23 2011 +0200
+++ b/src/com/beem/project/beem/ui/Chat.java Fri Oct 28 19:12:38 2011 +0200
@@ -60,63 +60,59 @@
/**
* The chat activity for communication with 1 contact.
- *
* @author Vincent V. <marseille@beem-project.com>
*/
public class Chat extends Activity implements OnKeyListener {
- private static final String TAG = "Chat";
- private String mjid;
+ private static final String TAG = "Chat";
+ private String mjid;
+
+ /**
+ * Constructor.
+ */
+ public Chat() {
+ super();
+ }
- /**
- * Constructor.
- */
- public Chat() {
- super();
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onCreate(Bundle savedBundle) {
+ super.onCreate(savedBundle);
+ // TODO : get account from jid. if multi account propose select
+ // Intent { act=android.intent.action.SENDTO dat=imto://jabber/jid
+ // cmp=com.beem.project.beem/.ui.Chat }
+ Uri contactURI = getIntent().getData();
+ mjid = contactURI.getPathSegments().get(0);
+
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean isCompact = settings.getBoolean("settings_chat_compact_key", false);
+ // UI
+ if (!isCompact) {
+ setNormalView();
+ } else {
+ setContentView(R.layout.chat_compact);
}
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onCreate(Bundle savedBundle) {
- super.onCreate(savedBundle);
- // TODO : get account from jid. if multi account propose select
- // Intent { act=android.intent.action.SENDTO dat=imto://jabber/jid
- // cmp=com.beem.project.beem/.ui.Chat }
- Uri contactURI = getIntent().getData();
- mjid = contactURI.getPathSegments().get(0);
-
- SharedPreferences settings = PreferenceManager
- .getDefaultSharedPreferences(this);
- boolean isCompact = settings.getBoolean("settings_chat_compact_key",
- false);
- // UI
- if (!isCompact) {
- setNormalView();
- } else {
- setContentView(R.layout.chat_compact);
- }
+ }
- }
+ private void setNormalView() {
+ Log.d(TAG, "Jid : " + mjid);
+ setContentView(R.layout.chat);
+ TextView ContactNameTextView = (TextView) findViewById(R.id.chat_contact_name);
+ ContactNameTextView.setText(mjid);
+ TextView ContactStatusMsgTextView = (TextView) findViewById(R.id.chat_contact_status_msg);
+ TextView ContactChatStateTextView = (TextView) findViewById(R.id.chat_contact_chat_state);
+ ImageView ContactStatusIcon = (ImageView) findViewById(R.id.chat_contact_status_icon);
+ LayerDrawable AvatarStatusDrawable = (LayerDrawable) ContactStatusIcon.getDrawable();
+ AvatarStatusDrawable.setLayerInset(1, 36, 36, 0, 0);
- private void setNormalView() {
- Log.d(TAG, "Jid : " + mjid);
- setContentView(R.layout.chat);
- TextView ContactNameTextView = (TextView) findViewById(R.id.chat_contact_name);
- ContactNameTextView.setText(mjid);
- TextView ContactStatusMsgTextView = (TextView) findViewById(R.id.chat_contact_status_msg);
- TextView ContactChatStateTextView = (TextView) findViewById(R.id.chat_contact_chat_state);
- ImageView ContactStatusIcon = (ImageView) findViewById(R.id.chat_contact_status_icon);
- LayerDrawable AvatarStatusDrawable = (LayerDrawable) ContactStatusIcon
- .getDrawable();
- AvatarStatusDrawable.setLayerInset(1, 36, 36, 0, 0);
+ }
- }
-
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- return false;
- }
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ return false;
+ }
}
--- a/src/com/beem/project/beem/ui/ContactList.java Tue Oct 25 13:17:23 2011 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Fri Oct 28 19:12:38 2011 +0200
@@ -25,20 +25,6 @@
Please send bug reports with examples or suggestions to
contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
-
*/
package com.beem.project.beem.ui;
@@ -71,7 +57,6 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Filterable;
import android.widget.Gallery;
-import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
@@ -141,7 +126,7 @@
new String[] { ContactsContract.Groups.TITLE }, new int[] { R.id.contactlist_group });
// Get Contacts list
- // TODO: Get contact list by account
+ // TODO: Get contact list by account -> Create Sqlite View or join
final Cursor cursorContact = getContentResolver().query(ContactsContract.RawContacts.CONTENT_URI,
new String[] { ContactsContract.RawContacts._ID, ContactsContract.RawContacts.SOURCE_ID },
ContactsContract.RawContacts.ACCOUNT_NAME + "=?", new String[] { mAccountName }, null);
@@ -154,7 +139,6 @@
listView.setOnItemClickListener(mOnContactClick);
registerForContextMenu(listView);
listView.setAdapter(mAdapterContactList);
- Log.e(TAG, "ONCREATE");
}
@Override
@@ -200,8 +184,6 @@
}
return true;
case R.id.contact_list_menu_sync:
- //TODO: Manual Sync operation
- Log.i(TAG, "performSync: " + mAccountName);
Intent intent = new Intent(BeemIntent.ACTION_SYNC);
intent.putExtra(BeemIntent.EXTRA_ACCOUNT, mAccountName);
startService(intent);
@@ -296,14 +278,6 @@
}
/**
- * Build and display the contact list.
- * @param group name of the contact list.
- */
- private void buildContactList(String group) {
-
- }
-
- /**
* Show the groups view.
*/
private void showGroups() {
@@ -314,10 +288,6 @@
Gallery g = (Gallery) v.findViewById(R.id.contactlist_banner);
g.setOnItemClickListener(new OnItemClickGroupName());
g.setAdapter(mAdapterBanner);
- } else {
- ((LinearLayout) findViewById(R.id.contactlist_groupstub)).setVisibility(View.VISIBLE);
- Gallery g = (Gallery) findViewById(R.id.contactlist_banner);
- //g.setSelection(0);
}
}
@@ -352,31 +322,29 @@
@Override
public void bindView(View view, Context context, Cursor cursor) {
- if (cursor.getCount() > 0) {
- String name = cursor.getString(cursor.getColumnIndex(ContactsContract.RawContacts.SOURCE_ID));
- String jid = cursor.getString(cursor.getColumnIndex(ContactsContract.RawContacts.SOURCE_ID));
- TextView nameText = (TextView) view.findViewById(R.id.contactlistpseudo);
- if (nameText != null) {
- nameText.setText(name);
- }
+ String name = cursor.getString(cursor.getColumnIndex(ContactsContract.RawContacts.SOURCE_ID));
+ String jid = cursor.getString(cursor.getColumnIndex(ContactsContract.RawContacts.SOURCE_ID));
+ TextView nameText = (TextView) view.findViewById(R.id.contactlistpseudo);
+ if (nameText != null) {
+ nameText.setText(name);
+ }
- // String msgStatus = cursor.getString(cursor
- // .getColumnIndex(ContactsContract.Contacts.CONTACT_STATUS));
- // TextView msgStatusText = (TextView) view
- // .findViewById(R.id.contactlistmsgperso);
- // if (msgStatusText != null) {
- // msgStatusText.setText(msgStatus);
- // }
+ // String msgStatus = cursor.getString(cursor
+ // .getColumnIndex(ContactsContract.Contacts.CONTACT_STATUS));
+ // TextView msgStatusText = (TextView) view
+ // .findViewById(R.id.contactlistmsgperso);
+ // if (msgStatusText != null) {
+ // msgStatusText.setText(msgStatus);
+ // }
- view.setTag(jid);
+ view.setTag(jid);
- // ImageView img = (ImageView) view.findViewById(R.id.avatar);
- // String avatarId = curContact.getAvatarId();
- // int contactStatus = curContact.getStatus();
- // Drawable avatar = getAvatarStatusDrawable(avatarId);
- // img.setImageDrawable(avatar);
- // img.setImageLevel(contactStatus);
- }
+ // ImageView img = (ImageView) view.findViewById(R.id.avatar);
+ // String avatarId = curContact.getAvatarId();
+ // int contactStatus = curContact.getStatus();
+ // Drawable avatar = getAvatarStatusDrawable(avatarId);
+ // img.setImageDrawable(avatar);
+ // img.setImageLevel(contactStatus);
}
// @Override
@@ -480,12 +448,10 @@
@Override
public void bindView(View view, Context context, Cursor cursor) {
- if (cursor.getCount() > 0) {
- String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Groups.TITLE));
- TextView nameText = (TextView) view.findViewById(R.id.contactlist_group);
- if (nameText != null) {
- nameText.setText(name);
- }
+ String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Groups.TITLE));
+ TextView nameText = (TextView) view.findViewById(R.id.contactlist_group);
+ if (nameText != null) {
+ nameText.setText(name);
}
}
}
--- a/src/com/beem/project/beem/ui/Login.java Tue Oct 25 13:17:23 2011 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Fri Oct 28 19:12:38 2011 +0200
@@ -97,16 +97,29 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ AccountManager am = AccountManager.get(Login.this);
+ Account allAccount[] = am.getAccountsByType("com.beem.project.com");
+ for (Account account : allAccount) {
+ mListAccount.add(account.name);
+ }
+
setContentView(R.layout.login);
-
+
Intent intent = new Intent(this, BeemService.class);
startService(intent);
+ IntentFilter filter = new IntentFilter(BeemIntent.ACTION_CONNECTED);
+ filter.addAction(BeemIntent.ACTION_DISCONNECTED);
+ registerReceiver(mOnBroadcastReceiver, filter);
+
ListView listView = (ListView) findViewById(R.id.accountlist);
mAdapterAccountList = new BeemAccountList(getLayoutInflater());
listView.setClickable(true);
listView.setOnItemClickListener(mOnAccountClick);
listView.setAdapter(mAdapterAccountList);
+
+
}
@Override
@@ -116,7 +129,14 @@
inflater.inflate(R.menu.login, menu);
return true;
}
-
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ //TODO: Option autostart connect account
+ //TODO: Check if already connected : BindService ? Database ?
+ }
+
@Override
public void onDestroy() {
super.onDestroy();
@@ -176,11 +196,6 @@
public BeemAccountList(LayoutInflater layoutInflater) {
mInflater = layoutInflater;
- AccountManager am = AccountManager.get(Login.this);
- Account allAccount[] = am.getAccountsByType("com.beem.project.com");
- for (Account account : allAccount) {
- mListAccount.add(account.name);
- }
}
@Override
@@ -244,9 +259,6 @@
TextView accountName = (TextView) mView.findViewById(R.id.accountname);
Intent intent = new Intent(BeemIntent.ACTION_CONNECT);
intent.putExtra(BeemIntent.EXTRA_ACCOUNT, accountName.getText());
- IntentFilter filter = new IntentFilter(BeemIntent.ACTION_CONNECTED);
- filter.addAction(BeemIntent.ACTION_DISCONNECTED);
- registerReceiver(mOnBroadcastReceiver, filter);
startService(intent);
}
}
--- a/src/com/beem/project/beem/ui/wizard/AccountConfigure.java Tue Oct 25 13:17:23 2011 +0200
+++ b/src/com/beem/project/beem/ui/wizard/AccountConfigure.java Fri Oct 28 19:12:38 2011 +0200
@@ -152,7 +152,7 @@
*/
private void configureAccount() {
final String jid = mAccountJID.getText().toString();
- Log.e("ACCOUNT CONFIGURE", "ACCOUNT NAME PREFERENCES : " + jid);
+ Log.e("ACCOUNT CONFIGURE", "ACCOUNT NAME PREFERENCES : " + jid);
SharedPreferences settings = getSharedPreferences(jid, MODE_PRIVATE); //PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = settings.edit();
edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY, jid);