Skip to content

Commit

Permalink
Fixed language system
Browse files Browse the repository at this point in the history
  • Loading branch information
BeboKhouja committed Mar 27, 2024
1 parent e31cb2b commit 4cb57b6
Show file tree
Hide file tree
Showing 30 changed files with 584 additions and 247 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.vscode
ADB GUI.jar
LICENSE
/ADB GUI.jar
/out
/bin
/adb gui.xml
1 change: 1 addition & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/artifacts/ADB_GUI_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 5 additions & 72 deletions .idea/libraries/lib.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ADB GUI.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ADB GUI, GUI For ADB
Copyright (C) 2022 Bebo Khouja
Copyright (C) 2023 Bebo Khouja

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ADB GUI
ADB GUI is a free and open source Java based application that adds a GUI based ADB (Android Debug Bridge). It is also a alternative to Mauronofrio Matarrese's TOOL ALL IN ONE.
ADB GUI is a free and open source Java based application that adds a GUI based ADB (Android Debug Bridge). It is also an alternative to Mauronofrio Matarrese's TOOL ALL IN ONE.

# Getting Started
1. Install Java 17.0.2 or later.
Expand All @@ -13,7 +13,7 @@ sudo apt-get install openjdk-17-jre
1. To get started download the jar that is included in this application.
2. Download ADB from the official Android Developers website: https://developer.android.com/studio/releases/platform-tools#downloads
3. Put it on the root folder "C:\adb"
4. Put an environmment variable in PATH called "C:\adb"
4. Put an environment variable in PATH called "C:\adb"
5. Restart your computer.
6. You are done! Use ADB GUI to have fun!

Expand Down
31 changes: 31 additions & 0 deletions adb gui.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\Users\Bebo Khouja\Downloads\ADB GUI\out\artifacts\ADB_GUI_jar\ADB GUI.jar</jar>
<outfile>C:\Users\Bebo Khouja\Downloads\ADB GUI\ADB GUI.exe</outfile>
<errTitle>Please install a minimum version of Java 17.0.2 or later.</errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>https://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon>C:\Users\Bebo Khouja\Downloads\ADB GUI\src\resources\appicon.png</icon>
<jre>
<path>%JAVA_HOME%;%PATH%</path>
<requiresJdk>false</requiresJdk>
<requires64Bit>false</requires64Bit>
<minVersion>17.0.2</minVersion>
<maxVersion></maxVersion>
</jre>
<messages>
<startupErr>An error occurred while starting the application.</startupErr>
<jreNotFoundErr>This application requires a Java Runtime Environment.</jreNotFoundErr>
<jreVersionErr>This application requires Java 17.0.2 or later.</jreVersionErr>
<launcherErr>The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.</launcherErr>
<instanceAlreadyExistsMsg>An application instance is already running.</instanceAlreadyExistsMsg>
</messages>
</launch4jConfig>
Binary file removed lib/gson-2.8.2.jar
Binary file not shown.
Binary file added lib/json-20240303-javadoc.jar
Binary file not shown.
Binary file added lib/json-20240303.jar
Binary file not shown.
Binary file added lib/swt.jar
Binary file not shown.
21 changes: 21 additions & 0 deletions src/com/mokkachocolata/enums/Languages.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.mokkachocolata.enums;

/**
* The {@code Languages} enum holds the currently supported languages. <br>
* <strong>Currently supported languages</strong> <br>
* English, Indonesia
* @since 1.5.0
* @author Bebo Khouja
*/
public enum Languages {;
/**
* Language for American English.
* @since 1.5.0
*/
public static final int EN_US = 0;
/**
* Language for Bahasa Indonesia.
* @since 1.5.0
*/
public static final int ID_ID = 1;
}
7 changes: 5 additions & 2 deletions src/com/mokkachocolata/exception/JarNotFoundException.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
package com.mokkachocolata.exception;

/**
* Thrown when the Jar is not found.
* Thrown when a .jar file is not found.
* @since 1.2
* @author Bebo Khouja
*/
public class JarNotFoundException extends Exception {
/**
* Constructs a {@code JarNotFoundException}.
* @param message
* The message. Can also be {@code null}.
* The message.
* @since 1.2
* @author Bebo Khouja
*/
public JarNotFoundException(String message) {
super(message);
Expand Down
43 changes: 32 additions & 11 deletions src/com/mokkachocolata/project/adbgui/App.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
// Copyright (C) 2023 Bebo Khouja

package com.mokkachocolata.project.adbgui;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Scanner;

import com.mokkachocolata.exception.JarNotFoundException;
import com.mokkachocolata.util.AddonLoader;
import com.mokkachocolata.util.Link;
import com.mokkachocolata.util.Terminal;
import com.mokkachocolata.util.*;


import org.apache.log4j.*;

import javax.swing.*;

/**
* The {@code App} class is an essential class which is responsible for starting the application.
* It houses the main function that is executed first. <br>
* <strong>Note: </strong>This class should not be initialized.
* @since 1.0
* @author Bebo Khouja
*/
public class App {
public static String version = "1.4.0";
static final Logger logger = Logger.getLogger(App.class);
private static Link link = new Link();
public static final String version = "1.4.1";
private static final Logger logger = Logger.getLogger(App.class);
private static final Link link = new Link();
private static final AddonLoader addonLoader = new AddonLoader();
public static final Event onCommandExecute = new Event();

public static void main(String[] args) throws IOException, URISyntaxException, JarNotFoundException, ClassNotFoundException, InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException {

public static void main(String[] args) throws IOException, URISyntaxException, JarNotFoundException, ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException, UnsupportedLookAndFeelException, InstantiationException {
ArrayList<LoadedAddon> classes = (ArrayList<LoadedAddon>) addonLoader.LoadAddons().clone();
ConsoleAppender consoleAppender = new ConsoleAppender();
consoleAppender.setThreshold(Level.ALL);
logger.info("ADB GUI\nVersion ".concat(version));
new AddonLoader().LoadAddonsOnInit();
for(LoadedAddon clazz : classes) {
clazz.initializeClassOnAppStartup();
System.out.println("Current mods: ");
System.out.println();

}
MainFrame myFrame = new MainFrame();
myFrame.init();
if (Terminal.isOpenedInConsole(args) == true) {
if (Terminal.isOpenedInConsole(args)) {
try (Scanner scanner = new Scanner(System.in)) {
while(true) {
String command = scanner.nextLine();
onCommandExecute.fireEvent();
new Thread(()->{try {
Terminal.GetOutput(Runtime.getRuntime().exec("adb " + command));
} catch (IOException e) {
Expand All @@ -49,8 +68,10 @@ public static void main(String[] args) throws IOException, URISyntaxException, J
link.OpenLink("https://discord.gg/y6AcUNTKxX");
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}

}

}
Expand Down
49 changes: 49 additions & 0 deletions src/com/mokkachocolata/project/adbgui/ExceptionHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.mokkachocolata.project.adbgui;

import com.mokkachocolata.exception.JarNotFoundException;
import com.mokkachocolata.util.AddonLoader;
import io.sentry.Sentry;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

import java.net.URISyntaxException;

public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
private final Logger logger = LogManager.getLogger(ExceptionHandler.class);
private static int getVersion() {
String version = System.getProperty("java.version");
if(version.startsWith("1.")) {
version = version.substring(2, 3);
} else {
int dot = version.indexOf(".");
if(dot != -1) { version = version.substring(0, dot); }
} return Integer.parseInt(version);
}

public void uncaughtException(Thread thread, Throwable exception) {
ConsoleAppender consoleAppender = new ConsoleAppender();
consoleAppender.setThreshold(Level.FATAL);

Sentry.captureException(exception);
logger.error("Reported exception thrown at thread " + thread.getName() + '!');
exception.printStackTrace();
try {
if (new AddonLoader().getModsFolder().exists()) {
logger.info("The details as explained below is shown.\nJava version " + getVersion() + "\nMods path: " + new AddonLoader().getModsFolder().toPath());
}
} catch (JarNotFoundException ignored) {
} catch (URISyntaxException ignored) {
}
MessageBox message = new MessageBox(new Shell(), SWT.OK);
message.setMessage("An error has occurred. The application will now terminate.");
int chosen = message.open();
if (chosen == SWT.OK) {
System.exit(0);
}
}
}
Loading

0 comments on commit 4cb57b6

Please sign in to comment.