aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/dev/msfjarvis/aps/ui/passwords
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/dev/msfjarvis/aps/ui/passwords')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordFragment.kt40
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordStore.kt9
2 files changed, 23 insertions, 26 deletions
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()