--- a/default.properties Wed May 25 00:57:00 2011 +0200
+++ b/default.properties Wed May 25 01:31:07 2011 +0200
@@ -10,4 +10,4 @@
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
-target=android-8
+target=android-10
--- a/src/com/beem/project/beem/otr/BeemOtrManager.java Wed May 25 00:57:00 2011 +0200
+++ b/src/com/beem/project/beem/otr/BeemOtrManager.java Wed May 25 01:31:07 2011 +0200
@@ -41,7 +41,6 @@
import net.java.otr4j.OtrPolicyImpl;
import net.java.otr4j.session.SessionID;
import net.java.otr4j.session.SessionStatus;
-import android.os.RemoteException;
import android.util.Log;
import com.beem.project.beem.service.ChatAdapter;
--- a/src/com/beem/project/beem/service/ChatAdapter.java Wed May 25 00:57:00 2011 +0200
+++ b/src/com/beem/project/beem/service/ChatAdapter.java Wed May 25 01:31:07 2011 +0200
@@ -471,5 +471,12 @@
return BeemOtrManager.getInstance().getRemoteFingerprint(mOtrSessionId);
}
+
+ @Override
+ public String getOtrStatus() throws RemoteException {
+ if (mOtrSessionId == null)
+ return null;
+ return BeemOtrManager.getInstance().getOtrManager().getSessionStatus(mOtrSessionId).toString();
+ }
}
--- a/src/com/beem/project/beem/service/aidl/IChat.aidl Wed May 25 00:57:00 2011 +0200
+++ b/src/com/beem/project/beem/service/aidl/IChat.aidl Wed May 25 01:31:07 2011 +0200
@@ -112,5 +112,10 @@
*/
String getRemoteOtrFingerprint();
+ /**
+ * get current OTR status.
+ */
+ String getOtrStatus();
+
}
--- a/src/com/beem/project/beem/ui/Chat.java Wed May 25 00:57:00 2011 +0200
+++ b/src/com/beem/project/beem/ui/Chat.java Wed May 25 01:31:07 2011 +0200
@@ -75,7 +75,6 @@
import android.preference.PreferenceManager;
import android.text.util.Linkify;
import android.util.Log;
-import android.view.inputmethod.EditorInfo;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -84,6 +83,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
+import android.view.inputmethod.EditorInfo;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
@@ -91,8 +91,8 @@
import android.widget.ListView;
import android.widget.TextView;
+import com.beem.project.beem.BeemApplication;
import com.beem.project.beem.R;
-import com.beem.project.beem.BeemApplication;
import com.beem.project.beem.providers.AvatarProvider;
import com.beem.project.beem.service.Contact;
import com.beem.project.beem.service.Message;
@@ -404,6 +404,7 @@
mChat.setOpen(true);
mChat.addMessageListener(mMessageListener);
mChatManager.deleteChatNotification(mChat);
+ updateOtrInformations(mChat.getOtrStatus());
}
mContact = mRoster.getContact(contact.getJID());
String res = contact.getSelectedRes();
@@ -643,15 +644,7 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- String text = null;
- if ("PLAINTEXT".equals(otrState)) {
- text = Chat.this.getString(R.string.chat_otrstate_plaintext);
- } else if ("ENCRYPTED".equals(otrState)) {
- text = Chat.this.getString(R.string.chat_otrstate_encrypted);
- } else if ("FINISHED".equals(otrState)) {
- text = Chat.this.getString(R.string.chat_otrstate_finished);
- }
- mContactOtrState.setText(text);
+ updateOtrInformations(otrState);
}
});
@@ -684,6 +677,21 @@
setTitle(getString(R.string.chat_name) + " " + name + " (" + m.name() + ")");
}
}
+
+ /**
+ * Update the OTR informations.
+ */
+ private void updateOtrInformations(final String otrState) {
+ String text = null;
+ if ("ENCRYPTED".equals(otrState)) {
+ text = Chat.this.getString(R.string.chat_otrstate_encrypted);
+ } else if ("FINISHED".equals(otrState)) {
+ text = Chat.this.getString(R.string.chat_otrstate_finished);
+ } else {
+ text = Chat.this.getString(R.string.chat_otrstate_plaintext);
+ }
+ mContactOtrState.setText(text);
+ }