diff options
author | zeapo <mohamed@zenadi.com> | 2017-06-05 14:46:16 +0200 |
---|---|---|
committer | zeapo <mohamed@zenadi.com> | 2017-06-05 14:46:16 +0200 |
commit | 38d02885ecc3a153d13efec2a3ee5613fad15227 (patch) | |
tree | ed16b8026b1823f8de780e24ca1bccb718045e0b /app/src/main/java/com/zeapo | |
parent | bbd7f661918fa2a96c7c2f2d954c0a10dc24ce9b (diff) |
Do not lock the interface for any operation in the gitactivity
Diffstat (limited to 'app/src/main/java/com/zeapo')
3 files changed, 13 insertions, 20 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 028d8263..4fb21428 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -352,7 +352,7 @@ public class PasswordStore extends AppCompatActivity { int lastSync = settings.getInt("last_sync", -1); int currentTime = (int) Calendar.getInstance().getTimeInMillis() / 1000; - if (settings.getBoolean("git_auto_sync", false) && currentTime > lastSync + 10) { + if (settings.getBoolean("git_auto_sync", false) && currentTime > lastSync + 3600) { Toast.makeText(getApplicationContext(), "Running git auto sync", Toast.LENGTH_LONG).show(); SyncOperation op = new SyncOperation(localDir.getAbsoluteFile(), activity).setCommands(); diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java index 5d72cd34..e0a63ab0 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java @@ -632,7 +632,10 @@ public class GitActivity extends AppCompatActivity { } try { - op.executeAfterAuthentication(connectionMode, settings.getString("git_remote_username", "git"), new File(getFilesDir() + "/.ssh_key"), true); + op.executeAfterAuthentication(connectionMode, + settings.getString("git_remote_username", "git"), + new File(getFilesDir() + "/.ssh_key"), true); + activity.finish(); } catch (Exception e) { e.printStackTrace(); } diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java index 644d3c6b..06a9376e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java @@ -32,19 +32,15 @@ public class GitAsyncTask extends AsyncTask<GitCommand, String, String> { } protected void onPreExecute() { -// Toast.makeText(activity.getApplicationContext(), String.format("Running %s", operation.toString()), Toast.LENGTH_LONG).show(); - snack = Snackbar.make(activity.findViewById(R.id.main_layout), - Html.fromHtml(String.format("<font color=\"#ffffff\">Running the Git operation %s</font>", operation.toString())), - Snackbar.LENGTH_INDEFINITE); - snack.show(); + Toast.makeText(activity.getApplicationContext(), + Html.fromHtml(String.format("<font color=\"#ffffff\">Running %s</font>", operation.getClass().getSimpleName())), + Toast.LENGTH_LONG).show(); } protected void onProgressUpdate(String... progress) { - if (this.snack != null) snack.dismiss(); - snack = Snackbar.make(activity.findViewById(R.id.main_layout), - Html.fromHtml(String.format("<font color=\"#ffffff\">Running: <strong>%s</strong></font>", progress[0])), - Snackbar.LENGTH_INDEFINITE); - snack.show(); + Toast.makeText(activity.getApplicationContext(), + Html.fromHtml(String.format("<font color=\"#ffffff\">Running jgit command: <strong>%s</strong></font>", progress[0])), + Toast.LENGTH_LONG).show(); } @Override @@ -63,7 +59,8 @@ public class GitAsyncTask extends AsyncTask<GitCommand, String, String> { } else { command.call(); } - publishProgress(command.getClass().getName()); + String opName = command.getClass().getSimpleName(); + publishProgress(opName); } catch (Exception e) { e.printStackTrace(); return e.getMessage() + "\nCaused by:\n" + e.getCause(); @@ -73,13 +70,6 @@ public class GitAsyncTask extends AsyncTask<GitCommand, String, String> { } protected void onPostExecute(String result) { - if (this.snack != null) - try { - this.snack.dismiss(); - } catch (Exception e) { - // ignore - } - if (result == null) result = "Unexpected error"; |