fix: bundle JetBrainsMono for monospace use cases

This commit is contained in:
Harsh Shandilya 2024-05-29 01:59:01 +05:30
parent 936f933bfd
commit 4939153e81
3 changed files with 8 additions and 3 deletions

View file

@ -5,17 +5,18 @@
package app.passwordstore.ui.adapters package app.passwordstore.ui.adapters
import android.graphics.Typeface
import android.text.method.PasswordTransformationMethod import android.text.method.PasswordTransformationMethod
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import app.passwordstore.R import app.passwordstore.R
import app.passwordstore.data.passfile.Totp import app.passwordstore.data.passfile.Totp
import app.passwordstore.data.password.FieldItem import app.passwordstore.data.password.FieldItem
import app.passwordstore.databinding.ItemFieldBinding import app.passwordstore.databinding.ItemFieldBinding
import app.passwordstore.ui.compose.R as composeR
import com.google.android.material.textfield.TextInputLayout import com.google.android.material.textfield.TextInputLayout
class FieldItemAdapter( class FieldItemAdapter(
@ -84,7 +85,11 @@ class FieldItemAdapter(
null null
} }
if (fieldItem.key == FieldItem.ItemType.PASSWORD.type) { 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()) } setOnClickListener { copyTextToClipboard(itemText.text.toString()) }
} }

View file

@ -158,7 +158,7 @@
android:layout_marginStart="@dimen/activity_horizontal_margin" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="@dimen/activity_horizontal_margin" android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:fontFamily="monospace" android:fontFamily="@font/jetbrainsmono_nl_regular"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="10sp" android:textSize="10sp"