mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Merge branch '326-trim-leading-and-trailing-whitespace-when-displaying-messages' into 'master'
Trim leading and trailing whitespace when displaying messages Closes #326 See merge request !234
This commit is contained in:
@@ -163,7 +163,8 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
||||
if (item.getBody() == null) {
|
||||
ui.body.setText("\u2026");
|
||||
} else if (header.getContentType().equals("text/plain")) {
|
||||
ui.body.setText(StringUtils.fromUtf8(item.getBody()));
|
||||
ui.body.setText(
|
||||
StringUtils.trim(StringUtils.fromUtf8(item.getBody())));
|
||||
} else {
|
||||
// TODO support other content types
|
||||
}
|
||||
@@ -182,7 +183,7 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
||||
ui.messageLayout.setVisibility(View.GONE);
|
||||
} else {
|
||||
ui.messageLayout.setVisibility(View.VISIBLE);
|
||||
ui.message.body.setText(message);
|
||||
ui.message.body.setText(StringUtils.trim(message));
|
||||
ui.message.date.setText(
|
||||
DateUtils.getRelativeTimeSpanString(ctx, item.getTime()));
|
||||
}
|
||||
@@ -286,7 +287,7 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
||||
ui.messageLayout.setVisibility(View.GONE);
|
||||
} else {
|
||||
ui.messageLayout.setVisibility(View.VISIBLE);
|
||||
ui.message.body.setText(message);
|
||||
ui.message.body.setText(StringUtils.trim(message));
|
||||
ui.message.date.setText(
|
||||
DateUtils.getRelativeTimeSpanString(ctx, item.getTime()));
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ public class ForumActivity extends BriarActivity implements
|
||||
data.setRead(true);
|
||||
forumController.entryRead(data);
|
||||
}
|
||||
ui.textView.setText(data.getText());
|
||||
ui.textView.setText(StringUtils.trim(data.getText()));
|
||||
|
||||
if (position == 0) {
|
||||
ui.topDivider.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -82,4 +82,8 @@ public class StringUtils {
|
||||
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
|
||||
throw new IllegalArgumentException("Not a hex digit: " + c);
|
||||
}
|
||||
|
||||
public static String trim(String s) {
|
||||
return s.trim();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user