diff options
| author | Harsh Shandilya <msfjarvis@gmail.com> | 2019-10-02 18:04:18 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-02 18:04:18 +0530 |
| commit | f1f59dc1ed26c2351dc31e55902ff8e4b5a6ed0e (patch) | |
| tree | 2afb98c921714ccefcd22f35a7340584d1bfba53 /app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java | |
| parent | 9a1a54a6fcfa6fd6cf142f2af9804375255d14cf (diff) | |
| download | HardenedPass-f1f59dc1ed26c2351dc31e55902ff8e4b5a6ed0e.tar.gz HardenedPass-f1f59dc1ed26c2351dc31e55902ff8e4b5a6ed0e.zip | |
Add Spotless to regulate codestyle (#550)
* Add Spotless to regulate codestyle
* treewide: Run spotless
* Add spotlessCheck to CI test
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java | 27 |
1 files changed, 14 insertions, 13 deletions
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 0f0cf508..3dd1cd94 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java @@ -3,10 +3,9 @@ package com.zeapo.pwdstore.git; import android.app.Activity; import android.app.ProgressDialog; import android.os.AsyncTask; - import com.zeapo.pwdstore.PasswordStore; import com.zeapo.pwdstore.R; - +import java.lang.ref.WeakReference; import org.eclipse.jgit.api.CommitCommand; import org.eclipse.jgit.api.GitCommand; import org.eclipse.jgit.api.PullCommand; @@ -17,9 +16,6 @@ import org.eclipse.jgit.api.StatusCommand; import org.eclipse.jgit.transport.PushResult; import org.eclipse.jgit.transport.RemoteRefUpdate; -import java.lang.ref.WeakReference; - - public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> { private WeakReference<Activity> activityWeakReference; private boolean finishOnEnd; @@ -27,7 +23,11 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> { private ProgressDialog dialog; private GitOperation operation; - public GitAsyncTask(Activity activity, boolean finishOnEnd, boolean refreshListOnEnd, GitOperation operation) { + public GitAsyncTask( + Activity activity, + boolean finishOnEnd, + boolean refreshListOnEnd, + GitOperation operation) { this.activityWeakReference = new WeakReference<>(activity); this.finishOnEnd = finishOnEnd; this.refreshListOnEnd = refreshListOnEnd; @@ -41,7 +41,8 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> { } protected void onPreExecute() { - this.dialog.setMessage(getActivity().getResources().getString(R.string.running_dialog_text)); + this.dialog.setMessage( + getActivity().getResources().getString(R.string.running_dialog_text)); this.dialog.setCancelable(false); this.dialog.show(); } @@ -58,8 +59,7 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> { nbChanges = status.getChanged().size() + status.getMissing().size(); } else if (command instanceof CommitCommand) { // the previous status will eventually be used to avoid a commit - if (nbChanges == null || nbChanges > 0) - command.call(); + if (nbChanges == null || nbChanges > 0) command.call(); } else if (command instanceof PullCommand) { final PullResult result = ((PullCommand) command).call(); final RebaseResult rr = result.getRebaseResult(); @@ -79,12 +79,14 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> { case REJECTED_REMOTE_CHANGED: case NON_EXISTING: case NOT_ATTEMPTED: - return activity.getString(R.string.git_push_generic_error) + rru.getStatus().name(); + return activity.getString(R.string.git_push_generic_error) + + rru.getStatus().name(); case REJECTED_OTHER_REASON: if ("non-fast-forward".equals(rru.getMessage())) { return activity.getString(R.string.git_push_other_error); } else { - return activity.getString(R.string.git_push_generic_error) + rru.getMessage(); + return activity.getString(R.string.git_push_generic_error) + + rru.getMessage(); } default: break; @@ -111,8 +113,7 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> { // ignore } - if (result == null) - result = "Unexpected error"; + if (result == null) result = "Unexpected error"; if (!result.isEmpty()) { this.operation.onError(result); |
