mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-03 15:55:14 +00:00
PasswordStore: refresh password list on swipe down in non-git mode (#862)
* PasswordStore: refresh password list on swipe down in non-git mode Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Address review comments Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> Co-authored-by: Fabian Henneke <FabianHenneke@users.noreply.github.com>
This commit is contained in:
@@ -62,9 +62,11 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) {
|
|||||||
private fun initializePasswordList() {
|
private fun initializePasswordList() {
|
||||||
val gitDir = File(PasswordRepository.getRepositoryDirectory(requireContext()), ".git")
|
val gitDir = File(PasswordRepository.getRepositoryDirectory(requireContext()), ".git")
|
||||||
val hasGitDir = gitDir.exists() && gitDir.isDirectory && (gitDir.listFiles()?.isNotEmpty() == true)
|
val hasGitDir = gitDir.exists() && gitDir.isDirectory && (gitDir.listFiles()?.isNotEmpty() == true)
|
||||||
if (hasGitDir) {
|
|
||||||
binding.swipeRefresher.setOnRefreshListener {
|
binding.swipeRefresher.setOnRefreshListener {
|
||||||
if (!PasswordRepository.isGitRepo()) {
|
if (!hasGitDir) {
|
||||||
|
requireStore().refreshPasswordList()
|
||||||
|
binding.swipeRefresher.isRefreshing = false
|
||||||
|
} else if (!PasswordRepository.isGitRepo()) {
|
||||||
Snackbar.make(binding.root, getString(R.string.clone_git_repo), Snackbar.LENGTH_INDEFINITE)
|
Snackbar.make(binding.root, getString(R.string.clone_git_repo), Snackbar.LENGTH_INDEFINITE)
|
||||||
.setAction(R.string.clone_button) {
|
.setAction(R.string.clone_button) {
|
||||||
val intent = Intent(context, GitServerConfigActivity::class.java)
|
val intent = Intent(context, GitServerConfigActivity::class.java)
|
||||||
@@ -85,7 +87,6 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) {
|
|||||||
startActivityForResult(intent, operationId)
|
startActivityForResult(intent, operationId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
recyclerAdapter = PasswordItemRecyclerAdapter()
|
recyclerAdapter = PasswordItemRecyclerAdapter()
|
||||||
.onItemClicked { _, item ->
|
.onItemClicked { _, item ->
|
||||||
|
Reference in New Issue
Block a user