Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman-android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolFi <wolfi@wolfi.es>2021-10-23 17:47:52 +0300
committerWolFi <wolfi@wolfi.es>2021-10-23 17:47:52 +0300
commit772556a24f1f1dc44d7a7762356998afc95437d3 (patch)
tree8f188717348d60ed771c6874d7d7c089c232e2ab
parent28bbb8afa1ccac87e0279ffa35facdafe7a0996f (diff)
parentfd68f46f9285633a5eec0519497c7d1ad6cba3ec (diff)
Merge branch 'use-unified-progress-dialog-creator'
-rw-r--r--app/src/main/java/es/wolfi/app/passman/activities/PasswordListActivity.java22
-rw-r--r--app/src/main/java/es/wolfi/passman/API/Vault.java15
2 files changed, 19 insertions, 18 deletions
diff --git a/app/src/main/java/es/wolfi/app/passman/activities/PasswordListActivity.java b/app/src/main/java/es/wolfi/app/passman/activities/PasswordListActivity.java
index c0a817c..a739664 100644
--- a/app/src/main/java/es/wolfi/app/passman/activities/PasswordListActivity.java
+++ b/app/src/main/java/es/wolfi/app/passman/activities/PasswordListActivity.java
@@ -83,6 +83,7 @@ import es.wolfi.passman.API.Credential;
import es.wolfi.passman.API.File;
import es.wolfi.passman.API.Vault;
import es.wolfi.utils.FileUtils;
+import es.wolfi.utils.ProgressUtils;
public class PasswordListActivity extends AppCompatActivity implements
VaultFragment.OnListFragmentInteractionListener,
@@ -178,7 +179,7 @@ public class PasswordListActivity extends AppCompatActivity implements
initialAuthentication(true);
}
} else {
- final ProgressDialog progress = getProgressDialog();
+ final ProgressDialog progress = ProgressUtils.showLoadingSequence(this);
progress.show();
Core.checkLogin(this, false, new FutureCallback<Boolean>() {
@@ -250,15 +251,6 @@ public class PasswordListActivity extends AppCompatActivity implements
return onPrimaryClipChangedListener;
}
- private ProgressDialog getProgressDialog() {
- final ProgressDialog progress = new ProgressDialog(this);
- progress.setTitle(getString(R.string.loading));
- progress.setMessage(getString(R.string.wait_while_loading));
- progress.setCancelable(false); // disable dismiss by tapping outside of the dialog
-
- return progress;
- }
-
private void updateShortcuts() {
if (settings.getBoolean(SettingValues.ENABLE_PASSWORD_GENERATOR_SHORTCUT.toString(), true) &&
android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
@@ -295,7 +287,7 @@ public class PasswordListActivity extends AppCompatActivity implements
.commit();
Log.d("PL", "committed transaction");
} else {
- final ProgressDialog progress = getProgressDialog();
+ final ProgressDialog progress = ProgressUtils.showLoadingSequence(this);
progress.show();
Vault.getVaults(this, (e, result) -> {
progress.dismiss();
@@ -323,7 +315,7 @@ public class PasswordListActivity extends AppCompatActivity implements
}
public void showActiveVault() {
- final ProgressDialog progress = getProgressDialog();
+ final ProgressDialog progress = ProgressUtils.showLoadingSequence(this);
progress.show();
Vault vault = (Vault) ton.getExtra(SettingValues.ACTIVE_VAULT.toString());
if (vault.getCredentials() != null) {
@@ -472,7 +464,7 @@ public class PasswordListActivity extends AppCompatActivity implements
void refreshVault() {
final Vault vault = (Vault) ton.getExtra(SettingValues.ACTIVE_VAULT.toString());
- ProgressDialog progress = getProgressDialog();
+ ProgressDialog progress = ProgressUtils.showLoadingSequence(this);
progress.show();
Vault.getVault(this, vault.guid, new FutureCallback<Vault>() {
@Override
@@ -557,7 +549,7 @@ public class PasswordListActivity extends AppCompatActivity implements
if (doRebirth) {
triggerRebirth(this);
} else {
- final ProgressDialog progress = getProgressDialog();
+ final ProgressDialog progress = ProgressUtils.showLoadingSequence(this);
progress.show();
Core.checkLogin(this, false, new FutureCallback<Boolean>() {
@Override
@@ -708,7 +700,7 @@ public class PasswordListActivity extends AppCompatActivity implements
public void onListFragmentInteraction(File item) {
Vault v = (Vault) ton.getExtra(SettingValues.ACTIVE_VAULT.toString());
- final ProgressDialog progress = getProgressDialog();
+ final ProgressDialog progress = ProgressUtils.showLoadingSequence(this);
progress.setMessage(getString(R.string.wait_while_downloading));
progress.show();
diff --git a/app/src/main/java/es/wolfi/passman/API/Vault.java b/app/src/main/java/es/wolfi/passman/API/Vault.java
index ad3dc20..89747e0 100644
--- a/app/src/main/java/es/wolfi/passman/API/Vault.java
+++ b/app/src/main/java/es/wolfi/passman/API/Vault.java
@@ -259,20 +259,29 @@ public class Vault extends Core implements Filterable {
}
public void updateCredential(Credential updatedCredential) {
+ int newIndex = -1;
for (Credential credential : credentials) {
if (credential.getGuid().equals(updatedCredential.getGuid())) {
- int index = credentials.indexOf(credential);
- credentials.set(index, updatedCredential);
+ newIndex = credentials.indexOf(credential);
+ break;
}
}
+ if (newIndex >= 0) {
+ credentials.set(newIndex, updatedCredential);
+ }
}
public void deleteCredential(Credential updatedCredential) {
+ Credential credentialToRemove = null;
for (Credential credential : credentials) {
if (credential.getGuid().equals(updatedCredential.getGuid())) {
- credentials.remove(credential);
+ credentialToRemove = credential;
+ break;
}
}
+ if (credentialToRemove != null) {
+ credentials.remove(credentialToRemove);
+ }
}
public static Vault getVaultByGuid(String guid) {