corrected a small issue with commit and added push to origin
This commit is contained in:
parent
4002791b15
commit
bac44808d3
2 changed files with 21 additions and 4 deletions
|
@ -151,6 +151,10 @@ public class GitHandler extends Activity {
|
|||
case REQUEST_PULL:
|
||||
authenticateAndRun("pullOperation");
|
||||
break;
|
||||
|
||||
case REQUEST_PUSH:
|
||||
authenticateAndRun("pushOperation");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,6 +404,13 @@ public class GitHandler extends Activity {
|
|||
.setCredentialsProvider(provider));
|
||||
}
|
||||
|
||||
|
||||
public void pushOperation(UsernamePasswordCredentialsProvider provider) {
|
||||
new GitAsyncTask(activity, true).execute(new Git(PasswordRepository.getRepository(new File("")))
|
||||
.push()
|
||||
.setCredentialsProvider(provider));
|
||||
}
|
||||
|
||||
/** Finds the method and provides it with authentication paramters via invokeWithAuthentication */
|
||||
private void authenticateAndRun(String operation) {
|
||||
try {
|
||||
|
|
|
@ -78,10 +78,12 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
|
|||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
Intent intent;
|
||||
|
||||
switch (id) {
|
||||
case R.id.user_pref:
|
||||
try {
|
||||
Intent intent = new Intent(this, UserPreference.class);
|
||||
intent = new Intent(this, UserPreference.class);
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception caught :(");
|
||||
|
@ -98,10 +100,14 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
|
|||
// break;
|
||||
|
||||
case R.id.git_push:
|
||||
break;
|
||||
intent = new Intent(this, GitHandler.class);
|
||||
intent.putExtra("Operation", GitHandler.REQUEST_PUSH);
|
||||
startActivity(intent);
|
||||
this.leftActivity = true;
|
||||
return true;
|
||||
|
||||
case R.id.git_pull:
|
||||
Intent intent = new Intent(this, GitHandler.class);
|
||||
intent = new Intent(this, GitHandler.class);
|
||||
intent.putExtra("Operation", GitHandler.REQUEST_PULL);
|
||||
startActivity(intent);
|
||||
this.leftActivity = true;
|
||||
|
@ -255,7 +261,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
|
|||
Git git = new Git(PasswordRepository.getRepository(new File("")));
|
||||
GitAsyncTask tasks = new GitAsyncTask(this, false);
|
||||
tasks.execute(
|
||||
git.add().addFilepattern(data.getExtras().getString("CREATED_FILE")),
|
||||
git.add().addFilepattern("."),
|
||||
git.commit().setMessage("Added " + data.getExtras().getString("NAME"))
|
||||
);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue