little refactor and version bump

This commit is contained in:
zeapo 2017-05-08 13:07:40 +02:00
parent 87a26c8808
commit 81c63e9402
3 changed files with 15 additions and 13 deletions

View file

@ -9,8 +9,8 @@ android {
applicationId "com.zeapo.pwdstore"
minSdkVersion 15
targetSdkVersion 25
versionCode 77
versionName "1.2.0.57"
versionCode 78
versionName "1.2.0.58"
}
compileOptions {
@ -58,10 +58,10 @@ android {
}
dependencies {
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'org.sufficientlysecure:openpgp-api:11.0'
compile 'com.nononsenseapps:filepicker:2.4.2'
compile('org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r') {

View file

@ -476,7 +476,7 @@ public class PasswordStore extends AppCompatActivity {
it.remove();
adapter.updateSelectedItems(position, selectedItems);
commitAdd("[ANDROID PwdStore] Remove " + item + " from store.");
commitChange("[ANDROID PwdStore] Remove " + item + " from store.");
deletePasswords(adapter, selectedItems);
}
})
@ -532,7 +532,7 @@ public class PasswordStore extends AppCompatActivity {
return PasswordRepository.getRepositoryDirectory(getApplicationContext());
}
private void commitAdd(final String message) {
private void commitChange(final String message) {
new GitOperation(PasswordRepository.getRepositoryDirectory(activity), activity) {
@Override
public void execute() {
@ -556,18 +556,18 @@ public class PasswordStore extends AppCompatActivity {
settings.edit().putBoolean("repository_initialized", true).apply();
break;
case PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY:
// if went from decrypt->edit and user saved changes, we need to commitAdd
// if went from decrypt->edit and user saved changes, we need to commitChange
if (data.getBooleanExtra("needCommit", false)) {
commitAdd(this.getResources().getString(R.string.edit_commit_text) + data.getExtras().getString("NAME"));
commitChange(this.getResources().getString(R.string.edit_commit_text) + data.getExtras().getString("NAME"));
refreshListAdapter();
}
break;
case PgpHandler.REQUEST_CODE_ENCRYPT:
commitAdd(this.getResources().getString(R.string.add_commit_text) + data.getExtras().getString("NAME") + this.getResources().getString(R.string.from_store));
commitChange(this.getResources().getString(R.string.add_commit_text) + data.getExtras().getString("NAME") + this.getResources().getString(R.string.from_store));
refreshListAdapter();
break;
case PgpHandler.REQUEST_CODE_EDIT:
commitAdd(this.getResources().getString(R.string.edit_commit_text) + data.getExtras().getString("NAME"));
commitChange(this.getResources().getString(R.string.edit_commit_text) + data.getExtras().getString("NAME"));
refreshListAdapter();
break;
case GitActivity.REQUEST_INIT:
@ -622,7 +622,7 @@ public class PasswordStore extends AppCompatActivity {
// TODO this should show a warning to the user
Log.e("Moving", "Something went wrong while moving.");
} else {
commitAdd("[ANDROID PwdStore] Moved "
commitChange("[ANDROID PwdStore] Moved "
+ string.replace(PasswordRepository.getRepositoryDirectory(getApplicationContext()) + "/", "")
+ " to "
+ target.getAbsolutePath().replace(PasswordRepository.getRepositoryDirectory(getApplicationContext()) + "/", "")

View file

@ -3,6 +3,7 @@ package com.zeapo.pwdstore.git;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.util.Log;
import com.zeapo.pwdstore.PasswordStore;
import com.zeapo.pwdstore.R;
@ -38,6 +39,7 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> {
protected String doInBackground(GitCommand... commands) {
Integer nbChanges = null;
for (GitCommand command : commands) {
Log.d("doInBackground", "Executing the command <" + command.toString() + ">");
try {
if (command instanceof StatusCommand) {
// in case we have changes, we want to keep track of it