Remove SourceCode Pro typeface (#1938)

This commit is contained in:
Harsh Shandilya 2022-06-07 13:06:28 +05:30 committed by GitHub
parent 9e717b6809
commit c319909582
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 13 deletions

View file

@ -39,12 +39,14 @@ class DicewarePasswordGeneratorDialogFragment : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = MaterialAlertDialogBuilder(requireContext()) val builder = MaterialAlertDialogBuilder(requireContext())
val binding = FragmentPwgenDicewareBinding.inflate(layoutInflater) 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.passwordSeparatorText.setText(prefs.getString(DICEWARE_SEPARATOR) ?: "-")
binding.passwordLengthText.setText(prefs.getInt(DICEWARE_LENGTH, 5).toString()) binding.passwordLengthText.setText(prefs.getInt(DICEWARE_LENGTH, 5).toString())
binding.passwordText.typeface = monoTypeface binding.passwordText.typeface = Typeface.MONOSPACE
builder.setView(binding.root)
merge( merge(
binding.passwordLengthText.afterTextChanges(), binding.passwordLengthText.afterTextChanges(),
binding.passwordSeparatorText.afterTextChanges(), binding.passwordSeparatorText.afterTextChanges(),

View file

@ -31,25 +31,19 @@ import dev.msfjarvis.aps.passgen.random.PasswordLengthTooShortException
import dev.msfjarvis.aps.passgen.random.PasswordOption import dev.msfjarvis.aps.passgen.random.PasswordOption
import dev.msfjarvis.aps.ui.crypto.PasswordCreationActivity import dev.msfjarvis.aps.ui.crypto.PasswordCreationActivity
import dev.msfjarvis.aps.util.settings.PreferenceKeys import dev.msfjarvis.aps.util.settings.PreferenceKeys
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import reactivecircus.flowbinding.android.widget.afterTextChanges import reactivecircus.flowbinding.android.widget.afterTextChanges
import reactivecircus.flowbinding.android.widget.checkedChanges import reactivecircus.flowbinding.android.widget.checkedChanges
@OptIn(ExperimentalCoroutinesApi::class)
class PasswordGeneratorDialogFragment : DialogFragment() { class PasswordGeneratorDialogFragment : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val prefs = requireContext().getSharedPreferences("PasswordGenerator", Context.MODE_PRIVATE)
val builder = MaterialAlertDialogBuilder(requireContext()) 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) builder.setView(binding.root)
binding.numerals.isChecked = !prefs.getBoolean(PasswordOption.NoDigits.key, false) 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.ambiguous.isChecked = !prefs.getBoolean(PasswordOption.NoAmbiguousCharacters.key, false)
binding.pronounceable.isChecked = !prefs.getBoolean(PasswordOption.FullyRandom.key, true) binding.pronounceable.isChecked = !prefs.getBoolean(PasswordOption.FullyRandom.key, true)
binding.lengthNumber.setText(prefs.getInt(PreferenceKeys.LENGTH, 20).toString()) binding.lengthNumber.setText(prefs.getInt(PreferenceKeys.LENGTH, 20).toString())
binding.passwordText.typeface = monoTypeface binding.passwordText.typeface = Typeface.MONOSPACE
merge( merge(
binding.numerals.checkedChanges().skipInitialValue(), binding.numerals.checkedChanges().skipInitialValue(),

View file

@ -21,7 +21,6 @@
android:id="@+id/item_text" android:id="@+id/item_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/sourcecodepro"
android:inputType="none" android:inputType="none"
android:textIsSelectable="true" android:textIsSelectable="true"
tools:text="p@55w0rd!" /> tools:text="p@55w0rd!" />