From c319909582fe3e1d9741b7595073ac3e0b245c0d Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 7 Jun 2022 13:06:28 +0530 Subject: Remove SourceCode Pro typeface (#1938) --- app/src/main/assets/fonts/sourcecodepro.ttf | Bin 52660 -> 0 bytes .../dialogs/DicewarePasswordGeneratorDialogFragment.kt | 8 +++++--- .../aps/ui/dialogs/PasswordGeneratorDialogFragment.kt | 12 +++--------- app/src/main/res/font/sourcecodepro.ttf | Bin 52660 -> 0 bytes app/src/main/res/layout/item_field.xml | 1 - 5 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 app/src/main/assets/fonts/sourcecodepro.ttf delete mode 100644 app/src/main/res/font/sourcecodepro.ttf diff --git a/app/src/main/assets/fonts/sourcecodepro.ttf b/app/src/main/assets/fonts/sourcecodepro.ttf deleted file mode 100644 index 6eb48e7d..00000000 Binary files a/app/src/main/assets/fonts/sourcecodepro.ttf and /dev/null differ diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt b/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt index cac60de3..22f991c5 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt @@ -39,12 +39,14 @@ class DicewarePasswordGeneratorDialogFragment : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val builder = MaterialAlertDialogBuilder(requireContext()) + val binding = FragmentPwgenDicewareBinding.inflate(layoutInflater) - val monoTypeface = Typeface.createFromAsset(requireContext().assets, "fonts/sourcecodepro.ttf") + builder.setView(binding.root) + binding.passwordSeparatorText.setText(prefs.getString(DICEWARE_SEPARATOR) ?: "-") binding.passwordLengthText.setText(prefs.getInt(DICEWARE_LENGTH, 5).toString()) - binding.passwordText.typeface = monoTypeface - builder.setView(binding.root) + binding.passwordText.typeface = Typeface.MONOSPACE + merge( binding.passwordLengthText.afterTextChanges(), binding.passwordSeparatorText.afterTextChanges(), diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/PasswordGeneratorDialogFragment.kt b/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/PasswordGeneratorDialogFragment.kt index b0ddc8a7..e14076b1 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/PasswordGeneratorDialogFragment.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/dialogs/PasswordGeneratorDialogFragment.kt @@ -31,25 +31,19 @@ import dev.msfjarvis.aps.passgen.random.PasswordLengthTooShortException import dev.msfjarvis.aps.passgen.random.PasswordOption import dev.msfjarvis.aps.ui.crypto.PasswordCreationActivity import dev.msfjarvis.aps.util.settings.PreferenceKeys -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.onEach import reactivecircus.flowbinding.android.widget.afterTextChanges import reactivecircus.flowbinding.android.widget.checkedChanges -@OptIn(ExperimentalCoroutinesApi::class) class PasswordGeneratorDialogFragment : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val prefs = requireContext().getSharedPreferences("PasswordGenerator", Context.MODE_PRIVATE) val builder = MaterialAlertDialogBuilder(requireContext()) - val callingActivity = requireActivity() - val binding = FragmentPwgenBinding.inflate(layoutInflater) - val monoTypeface = Typeface.createFromAsset(callingActivity.assets, "fonts/sourcecodepro.ttf") - val prefs = - requireActivity() - .applicationContext.getSharedPreferences("PasswordGenerator", Context.MODE_PRIVATE) + val binding = FragmentPwgenBinding.inflate(layoutInflater) builder.setView(binding.root) binding.numerals.isChecked = !prefs.getBoolean(PasswordOption.NoDigits.key, false) @@ -59,7 +53,7 @@ class PasswordGeneratorDialogFragment : DialogFragment() { binding.ambiguous.isChecked = !prefs.getBoolean(PasswordOption.NoAmbiguousCharacters.key, false) binding.pronounceable.isChecked = !prefs.getBoolean(PasswordOption.FullyRandom.key, true) binding.lengthNumber.setText(prefs.getInt(PreferenceKeys.LENGTH, 20).toString()) - binding.passwordText.typeface = monoTypeface + binding.passwordText.typeface = Typeface.MONOSPACE merge( binding.numerals.checkedChanges().skipInitialValue(), diff --git a/app/src/main/res/font/sourcecodepro.ttf b/app/src/main/res/font/sourcecodepro.ttf deleted file mode 100644 index 6eb48e7d..00000000 Binary files a/app/src/main/res/font/sourcecodepro.ttf and /dev/null differ diff --git a/app/src/main/res/layout/item_field.xml b/app/src/main/res/layout/item_field.xml index 1bdf2a91..9e8dec3c 100644 --- a/app/src/main/res/layout/item_field.xml +++ b/app/src/main/res/layout/item_field.xml @@ -21,7 +21,6 @@ android:id="@+id/item_text" android:layout_width="match_parent" android:layout_height="wrap_content" - android:fontFamily="@font/sourcecodepro" android:inputType="none" android:textIsSelectable="true" tools:text="p@55w0rd!" /> -- cgit v1.2.3