-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
appt2
committed
Apr 27, 2024
1 parent
65f5b10
commit 4c4e396
Showing
10 changed files
with
597 additions
and
314 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"allFiles": [ | ||
{ | ||
"file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/git/GitUtils.java", | ||
"selection": { | ||
"end": { | ||
"column": 31, | ||
"index": 7615, | ||
"line": 249 | ||
}, | ||
"start": { | ||
"column": 31, | ||
"index": 7615, | ||
"line": 249 | ||
} | ||
} | ||
}, | ||
{ | ||
"file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/git/GitListSheet.java", | ||
"selection": { | ||
"end": { | ||
"column": 0, | ||
"index": 0, | ||
"line": 0 | ||
}, | ||
"start": { | ||
"column": 0, | ||
"index": 0, | ||
"line": 0 | ||
} | ||
} | ||
} | ||
], | ||
"selectedFile": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/git/GitUtils.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
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
164 changes: 164 additions & 0 deletions
164
app/src/main/java/Ninja/coder/Ghostemane/code/git/GitListSheet.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,164 @@ | ||
package Ninja.coder.Ghostemane.code.git; | ||
|
||
import Ninja.coder.Ghostemane.code.databinding.MakefolderBinding; | ||
import Ninja.coder.Ghostemane.code.model.ListSheet; | ||
import android.content.Context; | ||
import android.content.DialogInterface; | ||
import android.view.LayoutInflater; | ||
import com.google.android.material.dialog.MaterialAlertDialogBuilder; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import org.eclipse.jgit.api.errors.GitAPIException; | ||
|
||
public class GitListSheet { | ||
protected ListSheet listItem; | ||
protected File fileDir; | ||
protected Context ctx; | ||
protected GitUtils utils; | ||
private MaterialAlertDialogBuilder dialog; | ||
private MakefolderBinding bin; | ||
|
||
public GitListSheet(File fileDir, Context ctx) { | ||
this.fileDir = fileDir; | ||
this.ctx = ctx; | ||
try { | ||
utils = new GitUtils(fileDir); | ||
} catch (IOException err) { | ||
err.printStackTrace(); | ||
} | ||
setVaribaleGit(); | ||
} | ||
|
||
void setVaribaleGit() { | ||
listItem = new ListSheet(); | ||
listItem.setSheetDialog(ctx); | ||
listItem.addItem("Git init", 0, utils.isGitinit(fileDir) || utils.isRep(fileDir)); | ||
listItem.addItem("Git CreateBranch"); | ||
listItem.addItem("Git MergeBranch"); | ||
listItem.addItem("Git CommitChanges"); | ||
listItem.addItem("Git Pull"); | ||
listItem.addItem("Git Push"); | ||
listItem.addItem("Git AddAll"); | ||
listItem.addItem("Git Status"); | ||
|
||
listItem.setOnItemClickLabe( | ||
new ListSheet.OnItemClick() { | ||
|
||
@Override | ||
public void OnItemClick(int pos) { | ||
switch (pos) { | ||
case 0: | ||
{ | ||
try { | ||
utils.init(fileDir); | ||
} catch (Exception err) { | ||
err.printStackTrace(); | ||
} | ||
break; | ||
} | ||
case 1: | ||
{ | ||
MaterialDialogHelper( | ||
new DialogInterface.OnClickListener() { | ||
|
||
@Override | ||
public void onClick(DialogInterface arg0, int arg1) { | ||
try { | ||
utils.createBranch(bin.editor.getText().toString()); | ||
} catch (Exception err) { | ||
|
||
} | ||
} | ||
}); | ||
|
||
break; | ||
} | ||
case 2: | ||
{ | ||
MaterialDialogHelper( | ||
(c, d) -> { | ||
try { | ||
utils.mergeBranch(bin.editor.getText().toString()); | ||
} catch (Exception err) { | ||
|
||
} | ||
}); | ||
|
||
break; | ||
} | ||
case 3: | ||
{ | ||
MaterialDialogHelper( | ||
(c, d) -> { | ||
try { | ||
utils.commitChanges(bin.editor.getText().toString()); | ||
} catch (Exception err) { | ||
|
||
} | ||
}); | ||
break; | ||
} | ||
|
||
case 4: | ||
{ | ||
MaterialDialogHelper( | ||
(c, d) -> { | ||
try { | ||
utils.pull(bin.editor.getText().toString()); | ||
} catch (Exception err) { | ||
|
||
} | ||
}); | ||
|
||
break; | ||
} | ||
case 5: | ||
{ | ||
MaterialDialogHelper( | ||
(c, d) -> { | ||
try { | ||
utils.push(bin.editor.getText().toString()); | ||
} catch (Exception err) { | ||
|
||
} | ||
}); | ||
|
||
break; | ||
} | ||
case 6: | ||
{ | ||
try { | ||
utils.addAllFiles(); | ||
} catch (Exception err) { | ||
|
||
} | ||
break; | ||
} | ||
case 7: | ||
{ | ||
try { | ||
MaterialDialogHelper(null); | ||
bin.editor.setText(utils.getUncommittedChangesAsString()); | ||
} catch (Exception err) { | ||
|
||
} | ||
|
||
break; | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
|
||
void MaterialDialogHelper(DialogInterface.OnClickListener di) { | ||
// makefolder | ||
bin = MakefolderBinding.inflate(LayoutInflater.from(ctx)); | ||
dialog = new MaterialAlertDialogBuilder(ctx); | ||
dialog.setView(bin.getRoot()); | ||
dialog.setTitle("Helper"); | ||
dialog.setNegativeButton(android.R.string.ok, di); | ||
if (dialog != null) { | ||
dialog.show(); | ||
} | ||
} | ||
} |
Oops, something went wrong.