aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt8
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/dialogs/PasswordGeneratorDialogFragment.kt12
2 files changed, 8 insertions, 12 deletions
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(),