aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java17
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java32
-rw-r--r--src/eu/siacs/conversations/ui/adapter/MessageAdapter.java18
4 files changed, 41 insertions, 30 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 573cc04b..f11b4705 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -279,8 +279,8 @@
<string name="error_saving_avatar">Could not save avatar to disk</string>
<string name="or_long_press_for_default">(Or long press to bring back default)</string>
<string name="error_publish_avatar_no_server_support">Your server does not support the publication of avatars</string>
- <string name="private_message">in private</string>
- <string name="private_message_to">in private to %s</string>
+ <string name="private_message">whispered</string>
+ <string name="private_message_to">to %s</string>
<string name="send_private_message_to">Send private message to %s</string>
<string name="connect">Connect</string>
<string name="account_already_exists">This account does already exist</string>
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index a6853f8a..c535f1a3 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -177,13 +177,16 @@ public class XmppConnectionService extends Service {
reconnectAccount(account, true);
} else if ((account.getStatus() != Account.STATUS_CONNECTING)
&& (account.getStatus() != Account.STATUS_NO_INTERNET)) {
- int next = account.getXmppConnection().getTimeToNextAttempt();
- Log.d(LOGTAG, account.getJid()
- + ": error connecting account. try again in " + next
- + "s for the "
- + (account.getXmppConnection().getAttempt() + 1)
- + " time");
- scheduleWakeupCall((int) (next * 1.2), false);
+ XmppConnection connection = account.getXmppConnection();
+ if (connection!=null) {
+ int next = connection.getTimeToNextAttempt();
+ Log.d(LOGTAG, account.getJid()
+ + ": error connecting account. try again in " + next
+ + "s for the "
+ + (connection.getAttempt() + 1)
+ + " time");
+ scheduleWakeupCall((int) (next * 1.2), false);
+ }
}
UIHelper.showErrorNotification(getApplicationContext(),
getAccounts());
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 1270d23a..b7fcbae4 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -187,18 +187,22 @@ public class ConversationFragment extends Fragment {
}
public void updateChatMsgHint() {
- switch (conversation.getNextEncryption()) {
- case Message.ENCRYPTION_NONE:
- mEditMessage.setHint(getString(R.string.send_plain_text_message));
- break;
- case Message.ENCRYPTION_OTR:
- mEditMessage.setHint(getString(R.string.send_otr_message));
- break;
- case Message.ENCRYPTION_PGP:
- mEditMessage.setHint(getString(R.string.send_pgp_message));
- break;
- default:
- break;
+ if (conversation.getNextPresence() != null) {
+ this.mEditMessage.setHint(getString(R.string.send_private_message_to,conversation.getNextPresence()));
+ } else {
+ switch (conversation.getNextEncryption()) {
+ case Message.ENCRYPTION_NONE:
+ mEditMessage.setHint(getString(R.string.send_plain_text_message));
+ break;
+ case Message.ENCRYPTION_OTR:
+ mEditMessage.setHint(getString(R.string.send_otr_message));
+ break;
+ case Message.ENCRYPTION_PGP:
+ mEditMessage.setHint(getString(R.string.send_pgp_message));
+ break;
+ default:
+ break;
+ }
}
}
@@ -270,9 +274,9 @@ public class ConversationFragment extends Fragment {
}
protected void privateMessageWith(String counterpart) {
- this.mEditMessage.setHint(getString(R.string.send_private_message_to,counterpart));
this.mEditMessage.setText("");
this.conversation.setNextPresence(counterpart);
+ updateChatMsgHint();
}
protected void highlightInConference(String nick) {
@@ -328,7 +332,6 @@ public class ConversationFragment extends Fragment {
int position = mEditMessage.length();
Editable etext = mEditMessage.getText();
Selection.setSelection(etext, position);
- updateMessages();
if (activity.getSlidingPaneLayout().isSlideable()) {
if (!activity.shouldPaneBeOpen()) {
activity.getSlidingPaneLayout().closePane();
@@ -342,6 +345,7 @@ public class ConversationFragment extends Fragment {
if (this.conversation.getMode() == Conversation.MODE_MULTI) {
conversation.setNextPresence(null);
}
+ updateMessages();
}
private void decryptMessage(Message message) {
diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 34fea41f..72587f99 100644
--- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -15,6 +15,10 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.text.Html;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
+import android.text.style.StyleSpan;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
@@ -210,11 +214,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
if (message.getType() != Message.TYPE_PRIVATE) {
viewHolder.messageBody.setText(message.getBody().trim());
} else {
- StringBuilder builder = new StringBuilder();
- builder.append(message.getBody().trim());
- builder.append("&nbsp;<b><i>(");
+ String privateMarker;
if (message.getStatus() <= Message.STATUS_RECIEVED) {
- builder.append(activity.getString(R.string.private_message));
+ privateMarker = activity.getString(R.string.private_message);
} else {
String to;
if (message.getPresence() != null) {
@@ -222,10 +224,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
} else {
to = message.getCounterpart();
}
- builder.append(activity.getString(R.string.private_message_to, to));
+ privateMarker = activity.getString(R.string.private_message_to, to);
}
- builder.append(")</i></b>");
- viewHolder.messageBody.setText(Html.fromHtml(builder.toString()));
+ SpannableString span = new SpannableString(privateMarker+" "+message.getBody());
+ span.setSpan(new ForegroundColorSpan(activity.getSecondaryTextColor()), 0, privateMarker.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ span.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, privateMarker.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ viewHolder.messageBody.setText(span);
}
} else {
viewHolder.messageBody.setText("");