From 2e141b2a900e530df8350d3de42dbc23a5aecd5f Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 29 Dec 2014 14:32:29 -0800 Subject: [PATCH] group visual fixes // FREEBIE --- .../securesms/database/model/MessageRecord.java | 4 +++- .../thoughtcrime/securesms/util/GroupUtil.java | 15 ++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java index 491644e865..88c266ce7d 100644 --- a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java +++ b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java @@ -19,6 +19,8 @@ package org.thoughtcrime.securesms.database.model; import android.content.Context; import android.text.Spannable; import android.text.SpannableString; +import android.text.style.ForegroundColorSpan; +import android.text.style.RelativeSizeSpan; import android.text.style.StyleSpan; import android.text.style.TextAppearanceSpan; @@ -177,7 +179,7 @@ public abstract class MessageRecord extends DisplayRecord { protected SpannableString emphasisAdded(String sequence) { SpannableString spannable = new SpannableString(sequence); - spannable.setSpan(new TextAppearanceSpan(context, android.R.style.TextAppearance_Small), 0, sequence.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + spannable.setSpan(new RelativeSizeSpan(0.9f), 0, sequence.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); spannable.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, sequence.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return spannable; diff --git a/src/org/thoughtcrime/securesms/util/GroupUtil.java b/src/org/thoughtcrime/securesms/util/GroupUtil.java index e63cc71387..4fac5d8897 100644 --- a/src/org/thoughtcrime/securesms/util/GroupUtil.java +++ b/src/org/thoughtcrime/securesms/util/GroupUtil.java @@ -37,20 +37,21 @@ public class GroupUtil { } try { - String description = ""; - GroupContext groupContext = GroupContext.parseFrom(Base64.decode(encodedGroup)); - List members = groupContext.getMembersList(); - String title = groupContext.getName(); + StringBuilder description = new StringBuilder(); + GroupContext groupContext = GroupContext.parseFrom(Base64.decode(encodedGroup)); + List members = groupContext.getMembersList(); + String title = groupContext.getName(); if (!members.isEmpty()) { - description += context.getString(R.string.GroupUtil_joined_the_group, Util.join(members, ", ")); + description.append(context.getString(R.string.GroupUtil_joined_the_group, Util.join(members, ", "))); } if (title != null && !title.trim().isEmpty()) { - description += context.getString(R.string.GroupUtil_title_is_now, title); + if (description.length() > 0) description.append(" "); + description.append(context.getString(R.string.GroupUtil_title_is_now, title)); } - return description; + return description.toString(); } catch (InvalidProtocolBufferException e) { Log.w("GroupUtil", e); return context.getString(R.string.GroupUtil_group_updated);