tiny redesign for private muc messages
This commit is contained in:
parent
4875b52f09
commit
c40c8ee910
|
@ -279,8 +279,8 @@
|
||||||
<string name="error_saving_avatar">Could not save avatar to disk</string>
|
<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="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="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">whispered</string>
|
||||||
<string name="private_message_to">in private to %s</string>
|
<string name="private_message_to">to %s</string>
|
||||||
<string name="send_private_message_to">Send private message to %s</string>
|
<string name="send_private_message_to">Send private message to %s</string>
|
||||||
<string name="connect">Connect</string>
|
<string name="connect">Connect</string>
|
||||||
<string name="account_already_exists">This account does already exist</string>
|
<string name="account_already_exists">This account does already exist</string>
|
||||||
|
|
|
@ -187,18 +187,22 @@ public class ConversationFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateChatMsgHint() {
|
public void updateChatMsgHint() {
|
||||||
switch (conversation.getNextEncryption()) {
|
if (conversation.getNextPresence() != null) {
|
||||||
case Message.ENCRYPTION_NONE:
|
this.mEditMessage.setHint(getString(R.string.send_private_message_to,conversation.getNextPresence()));
|
||||||
mEditMessage.setHint(getString(R.string.send_plain_text_message));
|
} else {
|
||||||
break;
|
switch (conversation.getNextEncryption()) {
|
||||||
case Message.ENCRYPTION_OTR:
|
case Message.ENCRYPTION_NONE:
|
||||||
mEditMessage.setHint(getString(R.string.send_otr_message));
|
mEditMessage.setHint(getString(R.string.send_plain_text_message));
|
||||||
break;
|
break;
|
||||||
case Message.ENCRYPTION_PGP:
|
case Message.ENCRYPTION_OTR:
|
||||||
mEditMessage.setHint(getString(R.string.send_pgp_message));
|
mEditMessage.setHint(getString(R.string.send_otr_message));
|
||||||
break;
|
break;
|
||||||
default:
|
case Message.ENCRYPTION_PGP:
|
||||||
break;
|
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) {
|
protected void privateMessageWith(String counterpart) {
|
||||||
this.mEditMessage.setHint(getString(R.string.send_private_message_to,counterpart));
|
|
||||||
this.mEditMessage.setText("");
|
this.mEditMessage.setText("");
|
||||||
this.conversation.setNextPresence(counterpart);
|
this.conversation.setNextPresence(counterpart);
|
||||||
|
updateChatMsgHint();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void highlightInConference(String nick) {
|
protected void highlightInConference(String nick) {
|
||||||
|
@ -328,7 +332,6 @@ public class ConversationFragment extends Fragment {
|
||||||
int position = mEditMessage.length();
|
int position = mEditMessage.length();
|
||||||
Editable etext = mEditMessage.getText();
|
Editable etext = mEditMessage.getText();
|
||||||
Selection.setSelection(etext, position);
|
Selection.setSelection(etext, position);
|
||||||
updateMessages();
|
|
||||||
if (activity.getSlidingPaneLayout().isSlideable()) {
|
if (activity.getSlidingPaneLayout().isSlideable()) {
|
||||||
if (!activity.shouldPaneBeOpen()) {
|
if (!activity.shouldPaneBeOpen()) {
|
||||||
activity.getSlidingPaneLayout().closePane();
|
activity.getSlidingPaneLayout().closePane();
|
||||||
|
@ -342,6 +345,7 @@ public class ConversationFragment extends Fragment {
|
||||||
if (this.conversation.getMode() == Conversation.MODE_MULTI) {
|
if (this.conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
conversation.setNextPresence(null);
|
conversation.setNextPresence(null);
|
||||||
}
|
}
|
||||||
|
updateMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decryptMessage(Message message) {
|
private void decryptMessage(Message message) {
|
||||||
|
|
|
@ -15,6 +15,10 @@ import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.Html;
|
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.util.DisplayMetrics;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -210,11 +214,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
if (message.getType() != Message.TYPE_PRIVATE) {
|
if (message.getType() != Message.TYPE_PRIVATE) {
|
||||||
viewHolder.messageBody.setText(message.getBody().trim());
|
viewHolder.messageBody.setText(message.getBody().trim());
|
||||||
} else {
|
} else {
|
||||||
StringBuilder builder = new StringBuilder();
|
String privateMarker;
|
||||||
builder.append(message.getBody().trim());
|
|
||||||
builder.append(" <b><i>(");
|
|
||||||
if (message.getStatus() <= Message.STATUS_RECIEVED) {
|
if (message.getStatus() <= Message.STATUS_RECIEVED) {
|
||||||
builder.append(activity.getString(R.string.private_message));
|
privateMarker = activity.getString(R.string.private_message);
|
||||||
} else {
|
} else {
|
||||||
String to;
|
String to;
|
||||||
if (message.getPresence() != null) {
|
if (message.getPresence() != null) {
|
||||||
|
@ -222,10 +224,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
} else {
|
} else {
|
||||||
to = message.getCounterpart();
|
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>");
|
SpannableString span = new SpannableString(privateMarker+" "+message.getBody());
|
||||||
viewHolder.messageBody.setText(Html.fromHtml(builder.toString()));
|
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 {
|
} else {
|
||||||
viewHolder.messageBody.setText("");
|
viewHolder.messageBody.setText("");
|
||||||
|
|
Loading…
Reference in a new issue