diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-09-20 14:21:41 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-09-20 14:21:41 +0200 |
commit | 5790d4c4ab6faa0ea390ca92833bbc3315d813e0 (patch) | |
tree | dcabff3e64adce940bd73363f245bb955dafcdc1 /src | |
parent | 98ab9beec73dbc6186dd77425ac6d425439e3c98 (diff) |
fixed styling in blocking dialog
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java | 19 | ||||
-rw-r--r-- | src/main/res/layout/dialog_block_contact.xml | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java index b55a701f..91ce34a9 100644 --- a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java @@ -3,6 +3,9 @@ package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.text.SpannableString; +import android.text.Spanned; +import android.text.style.TypefaceSpan; import android.view.LayoutInflater; import android.view.View; import android.widget.CheckBox; @@ -28,15 +31,23 @@ public final class BlockContactDialog { report.setVisibility(!isBlocked && reporting ? View.VISIBLE : View.GONE); builder.setView(view); + String value; + SpannableString spannable; if (blockable.getJid().isDomainJid() || blockable.getAccount().isBlocked(blockable.getJid().toDomainJid())) { builder.setTitle(isBlocked ? R.string.action_unblock_domain : R.string.action_block_domain); - message.setText(context.getResources().getString(isBlocked ? R.string.unblock_domain_text : R.string.block_domain_text, - blockable.getJid().toDomainJid())); + value = blockable.getJid().toDomainJid().toString(); + spannable = new SpannableString(context.getString(isBlocked ? R.string.unblock_domain_text : R.string.block_domain_text, value)); + message.setText(spannable); } else { builder.setTitle(isBlocked ? R.string.action_unblock_contact : R.string.action_block_contact); - message.setText(context.getResources().getString(isBlocked ? R.string.unblock_contact_text : R.string.block_contact_text, - blockable.getJid().toBareJid())); + value = blockable.getJid().toBareJid().toString(); + spannable = new SpannableString(context.getString(isBlocked ? R.string.unblock_contact_text : R.string.block_contact_text, value)); } + int start = spannable.toString().indexOf(value); + if (start >= 0) { + spannable.setSpan(new TypefaceSpan("monospace"),start,start + value.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + message.setText(spannable); builder.setPositiveButton(isBlocked ? R.string.unblock : R.string.block, new DialogInterface.OnClickListener() { @Override diff --git a/src/main/res/layout/dialog_block_contact.xml b/src/main/res/layout/dialog_block_contact.xml index b3615533..661af7d5 100644 --- a/src/main/res/layout/dialog_block_contact.xml +++ b/src/main/res/layout/dialog_block_contact.xml @@ -13,7 +13,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="?attr/TextSizeBody" - android:textColor="@color/black87"/> + android:textColor="?attr/color_text_primary"/> <CheckBox android:layout_marginTop="8dp" android:id="@+id/report_spam" |