From aaf6ceb8ecbc71f6948c84b1a19fb83abfe8a418 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 25 Apr 2022 10:47:02 +0530 Subject: all: reformat with ktfmt 0.36 --- .../msfjarvis/aps/ui/passwords/PasswordFragment.kt | 40 +++++++++++----------- .../msfjarvis/aps/ui/passwords/PasswordStore.kt | 9 ++--- 2 files changed, 23 insertions(+), 26 deletions(-) (limited to 'app/src/main/java/dev/msfjarvis/aps/ui/passwords') diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordFragment.kt b/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordFragment.kt index 063f472c..0d0f9cfc 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordFragment.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordFragment.kt @@ -293,32 +293,32 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) { override fun onAttach(context: Context) { super.onAttach(context) runCatching { - listener = - object : OnFragmentInteractionListener { - override fun onFragmentInteraction(item: PasswordItem) { - if (settings.getString(PreferenceKeys.SORT_ORDER) == - PasswordSortOrder.RECENTLY_USED.name - ) { - // save the time when password was used - val preferences = - context.getSharedPreferences("recent_password_history", Context.MODE_PRIVATE) - preferences.edit { - putString(item.file.absolutePath.base64(), System.currentTimeMillis().toString()) + listener = + object : OnFragmentInteractionListener { + override fun onFragmentInteraction(item: PasswordItem) { + if (settings.getString(PreferenceKeys.SORT_ORDER) == + PasswordSortOrder.RECENTLY_USED.name + ) { + // save the time when password was used + val preferences = + context.getSharedPreferences("recent_password_history", Context.MODE_PRIVATE) + preferences.edit { + putString(item.file.absolutePath.base64(), System.currentTimeMillis().toString()) + } } - } - if (item.type == PasswordItem.TYPE_CATEGORY) { - navigateTo(item.file) - } else { - if (requireArguments().getBoolean("matchWith", false)) { - requireStore().matchPasswordWithApp(item) + if (item.type == PasswordItem.TYPE_CATEGORY) { + navigateTo(item.file) } else { - requireStore().decryptPassword(item) + if (requireArguments().getBoolean("matchWith", false)) { + requireStore().matchPasswordWithApp(item) + } else { + requireStore().decryptPassword(item) + } } } } - } - } + } .onFailure { throw ClassCastException("$context must implement OnFragmentInteractionListener") } diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordStore.kt b/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordStore.kt index e4ec2359..84bef7bb 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordStore.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordStore.kt @@ -292,9 +292,8 @@ class PasswordStore : BaseGitActivity() { .setPositiveButton(resources.getString(R.string.dialog_ok), null) when (id) { R.id.user_pref -> { - runCatching { startActivity(Intent(this, SettingsActivity::class.java)) }.onFailure { e -> - e.printStackTrace() - } + runCatching { startActivity(Intent(this, SettingsActivity::class.java)) } + .onFailure { e -> e.printStackTrace() } } R.id.git_push -> { if (!PasswordRepository.isInitialized) { @@ -618,9 +617,7 @@ class PasswordStore : BaseGitActivity() { fun matchPasswordWithApp(item: PasswordItem) { val path = - item - .file - .absolutePath + item.file.absolutePath .replace(PasswordRepository.getRepositoryDirectory().toString() + "/", "") .replace(".gpg", "") val data = Intent() -- cgit v1.2.3