Skip to content

Commit

Permalink
change the ui of git clone
Browse files Browse the repository at this point in the history
  • Loading branch information
PangBaiWork committed Mar 5, 2024
1 parent 0c06f02 commit 32034b0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions app/src/main/java/com/pangbai/weblog/activity/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
import com.pangbai.weblog.tool.util;
import com.pangbai.weblog.view.FileListSelect;

import java.util.Objects;

public class HomeActivity extends AppCompatActivity implements View.OnClickListener {
ActivityHomeBinding binding;
ActivityResultLauncher chooseFolder;

boolean isTerminalOpen = false;
Project selectProject;

Expand Down Expand Up @@ -69,6 +71,10 @@ public void onClick(View v) {
} else if (id == R.id.create_project) {

select(file -> {
if (Objects.requireNonNull(file.list()).length != 0) {
Snackbar.make(binding.getRoot(), "The folder should be empty", Snackbar.LENGTH_SHORT).show();
return;
}
DialogUtils.showSingleSelectDialog(this, getString(R.string.select_blog_engine),ProjectManager.getTypeArray(), select -> {
selectProject = new Project(file.getName(), file.getAbsolutePath(), ProjectManager.Type.valueOf(select));
ProjectManager projectManager = new ProjectManager(selectProject);
Expand All @@ -93,12 +99,14 @@ public void onClick(View v) {


} else if (id == R.id.pull_project) {
select(file -> {
if (file.list().length != 0) {
Snackbar.make(binding.getRoot(), "The folder should be empty", Snackbar.LENGTH_SHORT).show();
return;
}

DialogUtils.showInputDialog(this, getString(R.string.clone_git), userInput -> {

select(file -> {
if (Objects.requireNonNull(file.list()).length != 0) {
Snackbar.make(binding.getRoot(), "The folder should be empty", Snackbar.LENGTH_SHORT).show();
return;
}
AlertDialog dialog = DialogUtils.showLoadingDialog(this);
ThreadUtil.thread(() -> {
boolean clone = cmdExer.execute("git clone " + userInput + " " + file.getAbsolutePath(), false) == 0;
Expand All @@ -121,8 +129,10 @@ public void onClick(View v) {
});
});


});



});
} else if (id == R.id.open_project) {
select(file -> {
Expand Down
Binary file modified doc/deploy.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/ui.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 32034b0

Please sign in to comment.