From 0bec5ab46fa4b0f38911e6c418b971dd90b8d404 Mon Sep 17 00:00:00 2001 From: Arne Date: Sat, 4 Nov 2023 18:53:47 +0100 Subject: [PATCH] change title bar font --- .../conversations/ui/ConversationsActivity.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index fbfe893cf..fdc09872d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -55,6 +55,10 @@ import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; +import android.text.SpannableString; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.style.TypefaceSpan; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; @@ -77,6 +81,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.Toolbar; +import androidx.core.content.res.ResourcesCompat; import androidx.databinding.DataBindingUtil; import org.openintents.openpgp.util.OpenPgpApi; @@ -1158,8 +1163,13 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio return; } } + Typeface font = ResourcesCompat.getFont(this, R.font.notosanssemibold); + SpannableStringBuilder app_title = new SpannableStringBuilder("monocles chat"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + app_title.setSpan (new TypefaceSpan(font), 0, 13, Spanned.SPAN_EXCLUSIVE_INCLUSIVE); + } actionBar.setDisplayShowCustomEnabled(false); - actionBar.setTitle(R.string.app_title); + actionBar.setTitle(app_title); actionBar.setDisplayHomeAsUpEnabled(false); ActionBarUtil.resetCustomActionBarOnClickListeners(binding.toolbar); }