From 4939153e8150457c64d26ea76727f26880baf807 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 29 May 2024 01:59:01 +0530 Subject: fix: bundle JetBrainsMono for monospace use cases --- .../app/passwordstore/ui/adapters/FieldItemAdapter.kt | 9 +++++++-- .../activity_oreo_autofill_publisher_changed.xml | 2 +- .../src/main/res/font/jetbrainsmono_nl_regular.ttf | Bin 0 -> 208576 bytes 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 ui/compose/src/main/res/font/jetbrainsmono_nl_regular.ttf diff --git a/app/src/main/java/app/passwordstore/ui/adapters/FieldItemAdapter.kt b/app/src/main/java/app/passwordstore/ui/adapters/FieldItemAdapter.kt index 18bedfaf..11eefb20 100644 --- a/app/src/main/java/app/passwordstore/ui/adapters/FieldItemAdapter.kt +++ b/app/src/main/java/app/passwordstore/ui/adapters/FieldItemAdapter.kt @@ -5,17 +5,18 @@ package app.passwordstore.ui.adapters -import android.graphics.Typeface import android.text.method.PasswordTransformationMethod import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat +import androidx.core.content.res.ResourcesCompat import androidx.recyclerview.widget.RecyclerView import app.passwordstore.R import app.passwordstore.data.passfile.Totp import app.passwordstore.data.password.FieldItem import app.passwordstore.databinding.ItemFieldBinding +import app.passwordstore.ui.compose.R as composeR import com.google.android.material.textfield.TextInputLayout class FieldItemAdapter( @@ -84,7 +85,11 @@ class FieldItemAdapter( null } if (fieldItem.key == FieldItem.ItemType.PASSWORD.type) { - typeface = Typeface.create("monospace", Typeface.NORMAL) + typeface = + ResourcesCompat.getFont( + binding.root.context, + composeR.font.jetbrainsmono_nl_regular, + ) } setOnClickListener { copyTextToClipboard(itemText.text.toString()) } } diff --git a/app/src/main/res/layout/activity_oreo_autofill_publisher_changed.xml b/app/src/main/res/layout/activity_oreo_autofill_publisher_changed.xml index 0a2fb4d7..e79d34fc 100644 --- a/app/src/main/res/layout/activity_oreo_autofill_publisher_changed.xml +++ b/app/src/main/res/layout/activity_oreo_autofill_publisher_changed.xml @@ -158,7 +158,7 @@ android:layout_marginStart="@dimen/activity_horizontal_margin" android:layout_marginTop="16dp" android:layout_marginEnd="@dimen/activity_horizontal_margin" - android:fontFamily="monospace" + android:fontFamily="@font/jetbrainsmono_nl_regular" android:gravity="center_horizontal" android:textIsSelectable="true" android:textSize="10sp" diff --git a/ui/compose/src/main/res/font/jetbrainsmono_nl_regular.ttf b/ui/compose/src/main/res/font/jetbrainsmono_nl_regular.ttf new file mode 100644 index 00000000..70d2ec9e Binary files /dev/null and b/ui/compose/src/main/res/font/jetbrainsmono_nl_regular.ttf differ -- cgit v1.2.3