Merge.
--- a/res/layout/contactlistcontact.xml Sun Sep 27 20:16:32 2009 +0200
+++ b/res/layout/contactlistcontact.xml Sun Sep 27 20:16:58 2009 +0200
@@ -19,7 +19,7 @@
<TextView android:id="@+id/contactlistmsgperso"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingLeft="20sp" android:singleLine="true"
- android:maxLines="1" android:autoLink="all" />
+ android:maxLines="1" android:linksClickable="false" android:autoLink="all" />
</LinearLayout>
<ImageView android:id="@+id/contactlistavatar"
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Sun Sep 27 20:16:32 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Sun Sep 27 20:16:58 2009 +0200
@@ -39,7 +39,7 @@
/**
* Beem connection closed Intent name.
*/
-
+
private static final String TAG = "XMPPConnectionAdapter";
private XMPPConnection mAdaptee;
private IChatManager mChatManager;
--- a/src/com/beem/project/beem/ui/Login.java Sun Sep 27 20:16:32 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Sun Sep 27 20:16:58 2009 +0200
@@ -81,7 +81,7 @@
setContentView(R.layout.login);
mProgressDialog = new ProgressDialog(this);
}
-
+
/**
* {@inheritDoc}
*/
--- a/src/com/beem/project/beem/ui/SendIM.java Sun Sep 27 20:16:32 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java Sun Sep 27 20:16:58 2009 +0200
@@ -217,7 +217,7 @@
mSmyDialog.show();
return true;
case R.id.sendim_call:
- // TODO start the jingle call
+ // TODO start the jingle call
// Bug a besoin du jid complet (resource compris)
try {
mXmppFacade.call(mContact.getJID());
@@ -332,8 +332,6 @@
Message msg = new Message(mContact.getJID(), Message.MSG_TYPE_CHAT);
msg.setBody(text);
try {
- // TODO: PAs connecter au serveur BING grosse Error !
- // INTERDICTION !
mChat.sendMessage(msg);
if (mSpeak != 1)
mText.append(getString(R.string.SendIMYouSay, text));
@@ -344,7 +342,6 @@
mToSend.requestFocus();
mSpeak = 1;
} catch (RemoteException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
--- a/src/com/beem/project/beem/ui/Subscription.java Sun Sep 27 20:16:32 2009 +0200
+++ b/src/com/beem/project/beem/ui/Subscription.java Sun Sep 27 20:16:58 2009 +0200
@@ -1,19 +1,12 @@
-/**
- *
- */
package com.beem.project.beem.ui;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Presence.Type;
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.PresenceAdapter;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
@@ -23,22 +16,40 @@
import android.widget.TextView;
import android.widget.Toast;
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
/**
+ * This activity is used to accept a subscription request.
* @author nikita
- *
*/
public class Subscription extends Activity {
- public static final String TAG = "Subscription";
+ private static final Intent SERVICE_INTENT = new Intent();
private IXmppFacade mService;
private String mContact;
private ServiceConnection mServConn = new BeemServiceConnection();
+ private BeemBroadcastReceiver mReceiver;
+ private MyOnClickListener mClickListener = new MyOnClickListener();
+
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ /**
+ * Constructor.
+ */
+ public Subscription() {
+ }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.subscription);
- bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ mReceiver = new BeemBroadcastReceiver(mServConn);
findViewById(R.id.SubscriptionAccept).setOnClickListener(mClickListener);
findViewById(R.id.SubscriptionRefuse).setOnClickListener(mClickListener);
mContact = getIntent().getStringExtra("from");
@@ -48,12 +59,31 @@
}
@Override
- protected void onDestroy() {
- super.onDestroy();
- unbindService(mServConn);
+ protected void onResume() {
+ super.onResume();
+ this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ mReceiver.setBinded();
}
- private OnClickListener mClickListener = new OnClickListener() {
+ @Override
+ protected void onPause() {
+ super.onPause();
+ this.unregisterReceiver(mReceiver);
+ if (mReceiver.isBinded())
+ unbindService(mServConn);
+ }
+
+ /**
+ * Event simple click on buttons.
+ */
+ private class MyOnClickListener implements OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public MyOnClickListener() {
+ }
@Override
public void onClick(View v) {
@@ -72,24 +102,33 @@
Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
- break ;
+ break;
case R.id.SubscriptionRefuse:
Toast.makeText(Subscription.this, getString(R.string.SubscriptRefused),
Toast.LENGTH_SHORT).show();
- break ;
+ break;
default:
Toast.makeText(Subscription.this, getString(R.string.SubscriptError),
Toast.LENGTH_SHORT).show();
- };
+ }
}
};
+ /**
+ * The ServiceConnection used to connect to the Beem service.
+ */
private class BeemServiceConnection implements ServiceConnection {
+ /**
+ * Constructor.
+ */
+ public BeemServiceConnection() {
+ }
+
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
- mService = IXmppFacade.Stub.asInterface(service);
+ mService = IXmppFacade.Stub.asInterface(service);
}
@Override
--- a/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java Sun Sep 27 20:16:32 2009 +0200
+++ b/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java Sun Sep 27 20:16:58 2009 +0200
@@ -14,14 +14,18 @@
*/
public class BeemBroadcastReceiver extends BroadcastReceiver {
+ /**
+ * Broadcast intent type.
+ */
public static final String BEEM_CONNECTION_CLOSED = "BeemConnectionClosed";
private ServiceConnection mService;
private boolean mIsBinded;
-
+
/**
* constructor.
+ * @param service service observed
*/
- public BeemBroadcastReceiver(ServiceConnection service) {
+ public BeemBroadcastReceiver(final ServiceConnection service) {
mService = service;
mIsBinded = false;
}
@@ -34,14 +38,21 @@
context.unbindService(mService);
mIsBinded = false;
context.startActivity(new Intent(context, Login.class));
- CharSequence message = intent.getCharSequenceExtra("message");
+ CharSequence message = intent.getCharSequenceExtra("message");
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
-
+
+ /**
+ * service is binded.
+ */
public void setBinded() {
mIsBinded = true;
}
+ /**
+ * return service bind status.
+ * @return service bind status.
+ */
public boolean isBinded() {
return mIsBinded;
}