Skip to content

Commit

Permalink
Added commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
BeboKhouja committed Jul 12, 2022
1 parent 875c0eb commit bceccdf
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 9 deletions.
Binary file not shown.
Binary file modified bin/com/mokkachocolata/project/adbgui/App.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/com/mokkachocolata/project/adbgui/MainFrame.class
Binary file not shown.
Binary file removed bin/com/mokkachocolata/util/JarNotFoundException.class
Binary file not shown.
Binary file modified bin/com/mokkachocolata/util/Util.class
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mokkachocolata.util;
package com.mokkachocolata.exception;

/**
* Thrown when the Jar is not found.
Expand Down
38 changes: 36 additions & 2 deletions src/com/mokkachocolata/project/adbgui/App.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package com.mokkachocolata.project.adbgui;

import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Scanner;

import com.mokkachocolata.exception.JarNotFoundException;
import com.mokkachocolata.util.Terminal;
import com.mokkachocolata.util.Util;

public class App {
public static String version = "1.3";
public static void main(String[] args) throws IOException {
public static String version = "1.3.1";
public static void main(String[] args) throws IOException, URISyntaxException, JarNotFoundException {
System.out.println("ADB GUI\nVersion ".concat(version));
MainFrame myFrame = new MainFrame();
myFrame.init();
Expand All @@ -22,6 +27,35 @@ public static void main(String[] args) throws IOException {
e.printStackTrace();
}}).start();
System.out.println("Execute command \"adb "+command+"\"");
if (command.equals("version")) {
System.out.println("ADB GUI version " + version);
}
if (command.equals("jarlocation")) {
System.out.println(Util.getJarLocation());
}
if (command.equals("help")) {
System.out.println("Handy commands:\n1. version\n2. jarlocation");
}
if (command.equals("github")) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI("https://github.com/BeboKhouja/ADB-GUI"));
} catch (IOException | URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if (command.equals("discord")) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI("https://github.com/BeboKhouja/ADB-GUI"));
} catch (IOException | URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}

Expand Down
27 changes: 21 additions & 6 deletions src/com/mokkachocolata/project/adbgui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import java.net.URI;
import java.net.URISyntaxException;
import java.security.KeyException;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
Expand Down Expand Up @@ -30,7 +31,7 @@ public class MainFrame extends JFrame implements ActionListener, MenuListener, K
//Vars
JMenuBar menubar1;
JMenu filemenu1,advancedmenu1,helpmenu1;
JMenuItem exitmenu1,aboutmenu1,executecommandmenu2,discordmenu3;
JMenuItem exitmenu1,aboutmenu1,executecommandmenu2,discordmenu3,githubmenu3;
JTextField edittext1;
JButton button1,button2,button3,button4;
JLabel text1;
Expand Down Expand Up @@ -64,6 +65,7 @@ public void init() {
aboutmenu1 = new JMenuItem("About ADB GUI");
executecommandmenu2 = new JMenuItem("Execute command");
discordmenu3 = new JMenuItem("Discord Server");
githubmenu3 = new JMenuItem("GitHub Repository");
button1 = new JButton("Reboot device");
button2 = new JButton("Reboot to recovery");
button3 = new JButton("Reboot to sideload");
Expand All @@ -86,10 +88,12 @@ public void init() {
executecommandmenu2.setMnemonic(KeyEvent.VK_E);
helpmenu1.setMnemonic(KeyEvent.VK_H);
discordmenu3.setMnemonic(KeyEvent.VK_D);
githubmenu3.setMnemonic(KeyEvent.VK_G);
filemenu1.add(aboutmenu1);
filemenu1.add(exitmenu1);
advancedmenu1.add(executecommandmenu2);
helpmenu1.add(discordmenu3);
helpmenu1.add(githubmenu3);
labelPanel.add(text1);
buttonPanel.add(button1);
buttonPanel.add(button2);
Expand All @@ -107,6 +111,7 @@ public void init() {
exitmenu1.addActionListener(this);
executecommandmenu2.addActionListener(this);
discordmenu3.addActionListener(this);
githubmenu3.addActionListener(this);
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
Expand Down Expand Up @@ -170,18 +175,28 @@ public void actionPerformed(ActionEvent arg0) {
}
} catch (IOException e) {
}
}
if (arg0.getSource() == discordmenu3) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI("https://discord.gg/y6AcUNTKxX"));
} catch (IOException | URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

if (arg0.getSource() == githubmenu3) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI("https://discord.gg/y6AcUNTKxX"));
Desktop.getDesktop().browse(new URI("https://github.com/BeboKhouja/ADB-GUI"));
} catch (IOException | URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} else {
}}

}
}
}

public void menuSelected(MenuEvent me) {
Expand Down
2 changes: 2 additions & 0 deletions src/com/mokkachocolata/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import java.io.File;
import java.net.URISyntaxException;

import com.mokkachocolata.exception.JarNotFoundException;

public class Util {
/**
* Gets the downloaded JAR location.
Expand Down

0 comments on commit bceccdf

Please sign in to comment.