diff options
Diffstat (limited to 'src/eu/siacs/conversations/ui/adapter')
3 files changed, 41 insertions, 28 deletions
diff --git a/src/eu/siacs/conversations/ui/adapter/AccountAdapter.java b/src/eu/siacs/conversations/ui/adapter/AccountAdapter.java index cd8b376f..5c25bf34 100644 --- a/src/eu/siacs/conversations/ui/adapter/AccountAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/AccountAdapter.java @@ -14,9 +14,9 @@ import android.widget.ImageView; import android.widget.TextView; public class AccountAdapter extends ArrayAdapter<Account> { - + private XmppActivity activity; - + public AccountAdapter(XmppActivity activity, List<Account> objects) { super(activity, 0, objects); this.activity = activity; @@ -34,7 +34,7 @@ public class AccountAdapter extends ArrayAdapter<Account> { jid.setText(account.getJid()); TextView statusView = (TextView) view.findViewById(R.id.account_status); ImageView imageView = (ImageView) view.findViewById(R.id.account_image); - imageView.setImageBitmap(account.getImage(activity,48)); + imageView.setImageBitmap(account.getImage(activity, 48)); switch (account.getStatus()) { case Account.STATUS_DISABLED: statusView.setText(getContext().getString( diff --git a/src/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java b/src/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java index d286052c..0534bc25 100644 --- a/src/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java @@ -19,7 +19,8 @@ public class KnownHostsAdapter extends ArrayAdapter<String> { final String[] split = constraint.toString().split("@"); if (split.length == 1) { for (String domain : domains) { - suggestions.add(split[0].toLowerCase(Locale.getDefault()) + "@" + domain); + suggestions.add(split[0].toLowerCase(Locale + .getDefault()) + "@" + domain); } } else if (split.length == 2) { for (String domain : domains) { @@ -27,7 +28,8 @@ public class KnownHostsAdapter extends ArrayAdapter<String> { suggestions.clear(); break; } else if (domain.contains(split[1])) { - suggestions.add(split[0].toLowerCase(Locale.getDefault()) + "@" + domain); + suggestions.add(split[0].toLowerCase(Locale + .getDefault()) + "@" + domain); } } } else { diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 48e1414b..fcb57490 100644 --- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -14,7 +14,6 @@ import android.content.Context; 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; @@ -68,8 +67,9 @@ public class MessageAdapter extends ArrayAdapter<Message> { public void setOnContactPictureClicked(OnContactPictureClicked listener) { this.mOnContactPictureClickedListener = listener; } - - public void setOnContactPictureLongClicked(OnContactPictureLongClicked listener) { + + public void setOnContactPictureLongClicked( + OnContactPictureLongClicked listener) { this.mOnContactPictureLongClickedListener = listener; } @@ -219,7 +219,8 @@ public class MessageAdapter extends ArrayAdapter<Message> { } else { String privateMarker; if (message.getStatus() <= Message.STATUS_RECEIVED) { - privateMarker = activity.getString(R.string.private_message); + privateMarker = activity + .getString(R.string.private_message); } else { String to; if (message.getPresence() != null) { @@ -227,11 +228,18 @@ public class MessageAdapter extends ArrayAdapter<Message> { } else { to = message.getCounterpart(); } - privateMarker = activity.getString(R.string.private_message_to, to); + privateMarker = activity.getString( + R.string.private_message_to, to); } - 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); + 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 { @@ -401,10 +409,11 @@ public class MessageAdapter extends ArrayAdapter<Message> { contact, getContext())); } else { String name = item.getPresence(); - if (name==null) { + if (name == null) { name = item.getCounterpart(); } - viewHolder.contact_picture.setImageBitmap(mBitmapCache.get(name, getContext())); + viewHolder.contact_picture.setImageBitmap(mBitmapCache.get( + name, getContext())); } viewHolder.contact_picture .setOnClickListener(new OnClickListener() { @@ -419,18 +428,20 @@ public class MessageAdapter extends ArrayAdapter<Message> { } }); - viewHolder.contact_picture.setOnLongClickListener(new OnLongClickListener() { - - @Override - public boolean onLongClick(View v) { - if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) { - MessageAdapter.this.mOnContactPictureLongClickedListener.onContactPictureLongClicked(item); - return true; - } else { - return false; - } - } - }); + viewHolder.contact_picture + .setOnLongClickListener(new OnLongClickListener() { + + @Override + public boolean onLongClick(View v) { + if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) { + MessageAdapter.this.mOnContactPictureLongClickedListener + .onContactPictureLongClicked(item); + return true; + } else { + return false; + } + } + }); } } @@ -529,7 +540,7 @@ public class MessageAdapter extends ArrayAdapter<Message> { public interface OnContactPictureClicked { public void onContactPictureClicked(Message message); } - + public interface OnContactPictureLongClicked { public void onContactPictureLongClicked(Message message); } |