diff options
author | zeapo <mohamed@zenadi.com> | 2017-08-11 09:37:09 +0200 |
---|---|---|
committer | zeapo <mohamed@zenadi.com> | 2017-08-11 09:37:09 +0200 |
commit | 552f3fe5a5caeb743764db5f78891d3c06d05156 (patch) | |
tree | 5c2f2ddf3a5ab50cfa65fc7588584ae363c51b3d /app/src | |
parent | 040f000d99b6ba2be9caa512431cc25fe4e68df1 (diff) |
Put the rebase abort in an async task
uhum... there was network operation
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java | 23 |
1 files changed, 14 insertions, 9 deletions
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 1a43fec4..9ea4415b 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java @@ -520,16 +520,21 @@ public class GitActivity extends AppCompatActivity { } public void abortRebase(View view) { - Repository repo = PasswordRepository.getRepository(PasswordRepository.getRepositoryDirectory(getApplicationContext())); + final Repository repo = PasswordRepository.getRepository(PasswordRepository.getRepositoryDirectory(getApplicationContext())); if (repo != null) { - try { - // no network or heavy computation done, it's ok to do it on the ui-thread - new Git(repo).rebase().setOperation(RebaseCommand.Operation.ABORT).call(); - } catch (Exception e) { - //ignore - } finally { - showGitConfig(); - } + new GitOperation(PasswordRepository.getRepositoryDirectory(activity), activity) { + @Override + public void execute() { + Log.d(TAG, "Resetting the repository"); + assert repository != null; + GitAsyncTask tasks = new GitAsyncTask(activity, false, true, this); + tasks.execute(new Git(repo).rebase().setOperation(RebaseCommand.Operation.ABORT)); + } + @Override + public void onSuccess() { + showGitConfig(); + } + }.execute(); } } |