From 934c256edded0ecd5229a39d2581a0f1709fc075 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 18 Apr 2020 23:52:08 +0530 Subject: Resolve lint warnings Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/PasswordFragment.kt | 2 +- app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt | 1 + app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/com/zeapo') diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.kt index fd7bdf83..c9b9824f 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.kt +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.kt @@ -120,7 +120,7 @@ class PasswordFragment : Fragment() { val path = requireNotNull(requireArguments().getString(PasswordStore.REQUEST_ARG_PATH)) model.navigateTo(File(path), pushPreviousLocation = false) - model.searchResult.observe(this) { result -> + model.searchResult.observe(viewLifecycleOwner) { result -> // Only run animations when the new list is filtered, i.e., the user submitted a search, // and not on folder navigations since the latter leads to too many removal animations. (recyclerView.itemAnimator as OnOffItemAnimator).isEnabled = result.isFiltered diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt index 90b2e631..ce5300c1 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt @@ -170,6 +170,7 @@ class PasswordStore : AppCompatActivity() { } override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) // If request is cancelled, the result arrays are empty. if (requestCode == REQUEST_EXTERNAL_STORAGE) { if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { diff --git a/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt b/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt index a7489893..b9e2e6be 100644 --- a/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt +++ b/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt @@ -57,7 +57,7 @@ class SelectFolderFragment : Fragment() { val path = requireNotNull(requireArguments().getString(PasswordStore.REQUEST_ARG_PATH)) model.navigateTo(File(path), listMode = ListMode.DirectoriesOnly, pushPreviousLocation = false) - model.searchResult.observe(this) { result -> + model.searchResult.observe(viewLifecycleOwner) { result -> recyclerAdapter.submitList(result.passwordItems) } } -- cgit v1.2.3