forked from maks/MGit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'Frank997/quick_push' into develop
maks#645 - Quick Push Action and Add All bug fixed
- Loading branch information
Showing
25 changed files
with
126 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
app/src/main/java/me/sheimi/sgit/activities/delegate/actions/QuickPushAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package me.sheimi.sgit.activities.delegate.actions; | ||
|
||
import java.util.Set; | ||
|
||
import me.sheimi.android.utils.Profile; | ||
import me.sheimi.sgit.R; | ||
import me.sheimi.sgit.activities.RepoDetailActivity; | ||
import me.sheimi.sgit.database.models.Repo; | ||
import me.sheimi.sgit.repo.tasks.repo.AddToStageTask; | ||
import me.sheimi.sgit.repo.tasks.repo.CommitChangesTask; | ||
import me.sheimi.sgit.repo.tasks.repo.PushTask; | ||
|
||
public class QuickPushAction extends RepoAction { | ||
|
||
public QuickPushAction(Repo repo, RepoDetailActivity activity) { | ||
super(repo, activity); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
Set<String> remotes = mRepo.getRemotes(); | ||
if (remotes == null || remotes.isEmpty()) { | ||
mActivity.showToastMessage(R.string.alert_please_add_a_remote); | ||
return; | ||
} | ||
|
||
String quickPushMsg = Profile.getQuickPushMsg(mActivity.getApplicationContext()); | ||
if(quickPushMsg==null || quickPushMsg.isEmpty()) { | ||
mActivity.showToastMessage(R.string.alert_plese_set_commit_msg_for_quick_push); | ||
return; | ||
} | ||
|
||
mActivity.closeOperationDrawer(); | ||
|
||
// stageAll(include new file), commit, push | ||
AddToStageTask addTask = new AddToStageTask(mRepo, ".") { | ||
@Override | ||
protected void onPostExecute(Boolean isSuccess) { | ||
super.onPostExecute(isSuccess); | ||
//commit | ||
CommitChangesTask commitTask = new CommitChangesTask(mRepo, | ||
quickPushMsg, false, false, | ||
Profile.getUsername(mActivity.getApplicationContext()), | ||
Profile.getEmail(mActivity.getApplicationContext()), | ||
new AsyncTaskPostCallback() { | ||
@Override | ||
public void onPostExecute(Boolean isSuccess) { | ||
// mActivity.reset() is copy from existed code when new CommitChangeTask(), | ||
// idk this line work for what, but it work bad on here, so comment. | ||
// mActivity.reset(); | ||
|
||
PushTask pushTask = new PushTask(mRepo,remotes.toArray()[0].toString(), | ||
false,false, | ||
mActivity.new ProgressCallback(R.string.push_msg_init)); | ||
pushTask.executeTask(); | ||
} | ||
}); | ||
commitTask.executeTask(); | ||
} | ||
}; | ||
|
||
addTask.executeTask(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters