Skip to content

Commit

Permalink
Implement Login (error message still needs fixing)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ljaysoft committed Aug 14, 2016
1 parent 2d13cb7 commit 2688e7b
Show file tree
Hide file tree
Showing 12 changed files with 511 additions and 359 deletions.
7 changes: 4 additions & 3 deletions src/main/resources/layout/ChooseGUIWindow.fxml
Expand Up @@ -4,16 +4,17 @@
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.Pane?>
<Pane prefHeight="65.0" prefWidth="304.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="me.corriekay.pokegoutil.GUI.controller.ChooseGuiWindowController">
<Pane prefHeight="65.0" prefWidth="304.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<children> <children>
<HBox alignment="CENTER" prefHeight="51.0" prefWidth="295.0"> <HBox alignment="CENTER" prefHeight="51.0" prefWidth="295.0">
<children> <children>
<Button fx:id="oldGuiBtn" mnemonicParsing="false" onAction="#onOldGuiBtnClicked" prefHeight="25.0" prefWidth="79.0" text="Current GUI" HBox.hgrow="NEVER"> <Button fx:id="oldGuiBtn" mnemonicParsing="false" prefHeight="25.0" prefWidth="79.0" text="Current GUI" HBox.hgrow="NEVER">
<HBox.margin> <HBox.margin>
<Insets right="14.0"/> <Insets right="14.0"/>
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button fx:id="newGuiBtn" cancelButton="true" minWidth="80.0" mnemonicParsing="false" onAction="#onNewGuiBtnClicked" prefHeight="25.0" prefWidth="171.0" text="WARNING MAY EXPLODE"/> <Button fx:id="newGuiBtn" cancelButton="true" minWidth="80.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="171.0" text="WARNING MAY EXPLODE"/>
</children> </children>
</HBox> </HBox>
</children> </children>
Expand Down
32 changes: 19 additions & 13 deletions src/main/resources/layout/Login.fxml
@@ -1,31 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>


<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<StackPane prefHeight="148.0" prefWidth="286.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="me.corriekay.pokegoutil.GUI.controller.LoginController">
<?import javafx.scene.control.PasswordField?>
<StackPane xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<children> <children>
<StackPane prefHeight="0.0" prefWidth="0.0"> <StackPane prefHeight="0.0" prefWidth="0.0">
<children> <children>
<VBox prefHeight="0.0" prefWidth="0.0" spacing="10.0"> <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="10.0">
<children> <children>
<TextField fx:id="user" prefHeight="25.0" prefWidth="330.0" promptText="PTC Username:"/> <TextField fx:id="usernameField" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="25.0" prefWidth="266.0" promptText="PTC Username:" />
<TextField fx:id="password" promptText="PTC Password:"/> <PasswordField fx:id="passwordField" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="25.0" prefWidth="266.0" promptText="PTC Password:" />
<Pane prefHeight="29.0" prefWidth="0.0"> <Button fx:id="ptcLoginBtn" alignment="CENTER" contentDisplay="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="25.0" prefWidth="111.0" text="Use PTC Auth" />
<children> <Pane>
<Button fx:id="googleAuthBtn" alignment="CENTER" contentDisplay="CENTER" layoutX="144.0" layoutY="2.0" mnemonicParsing="false" onAction="#onGoogleAuthBtnClicked" prefHeight="25.0" prefWidth="111.0" text="Use Google Auth"/> <children>
<Button fx:id="ptcLoginBtn" alignment="CENTER" contentDisplay="CENTER" layoutY="2.0" mnemonicParsing="false" onAction="#onPTCLoginBtnClicked" prefHeight="25.0" prefWidth="111.0" text="Use PTC Auth"/> <TextField fx:id="tokenField" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="25.0" prefWidth="187.0" promptText="Google Auth Token:" />
</children> <Button fx:id="getTokenBtn" layoutX="198.0" mnemonicParsing="false" text="Get Token" />
</Pane> </children>
<CheckBox fx:id="autoRelogChkbx" mnemonicParsing="false" prefHeight="17.0" prefWidth="147.0" text="Remember Credencials"/> </Pane>
<Button fx:id="googleAuthBtn" alignment="CENTER" contentDisplay="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="25.0" prefWidth="111.0" text="Use Google Auth" />
<CheckBox fx:id="saveAuthChkbx" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="17.0" prefWidth="147.0" text="Remember Credencials" />
</children> </children>
</VBox> </VBox>
</children> </children>
</StackPane> </StackPane>
</children> </children>
<padding> <padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding> </padding>
</StackPane> </StackPane>
8 changes: 4 additions & 4 deletions src/main/resources/layout/LuckyEggGrinder.fxml
Expand Up @@ -4,14 +4,14 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<BorderPane fx:id="luckyEggGrinderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="me.corriekay.pokegoutil.GUI.controller.LuckyEggGrinderController"> <BorderPane fx:id="luckyEggGrinderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" >
<center> <center>
<AnchorPane fx:id="optionsPane" disable="true" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" BorderPane.alignment="CENTER"> <AnchorPane fx:id="optionsPane" disable="true" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" BorderPane.alignment="CENTER">
<children> <children>
<ComboBox id="optionComboBox" fx:id="optionsComboBox" layoutX="369.0" layoutY="2.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="25.0" prefWidth="189.0" promptText="add/remove to the grinder"/> <ComboBox id="optionComboBox" fx:id="optionsComboBox" layoutX="369.0" layoutY="2.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="25.0" prefWidth="189.0" promptText="add/remove to the grinder"/>
<RadioButton id="caterpieRadioBtn" fx:id="noTransferLowerThanRadioBtn" layoutY="6.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#onNoTransferThanIV" text="Don't transfer low CP if IV is higher than : "/> <RadioButton id="caterpieRadioBtn" fx:id="noTransferLowerThanRadioBtn" layoutY="6.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="Don't transfer low CP if IV is higher than : "/>
<Spinner fx:id="noTransferLowerThanSpinner" disable="true" layoutX="242.0" layoutY="2.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="25.0" prefWidth="75.0"/> <Spinner fx:id="noTransferLowerThanSpinner" disable="true" layoutX="242.0" layoutY="2.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="25.0" prefWidth="75.0"/>
<RadioButton id="caterpieRadioBtn" fx:id="transferFavRadioBtn" layoutY="27.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#onTransferFav" text="Transfer favorites."/> <RadioButton id="caterpieRadioBtn" fx:id="transferFavRadioBtn" layoutY="27.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="Transfer favorites."/>
</children> </children>
</AnchorPane> </AnchorPane>
</center> </center>
Expand Down Expand Up @@ -62,7 +62,7 @@
<RadioButton id="caterpieRadioBtn" fx:id="caterpieRadioBtn2" layoutX="19.0" layoutY="46.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="### Extra Caterpie(s), transfer those from lowest CP to highest"/> <RadioButton id="caterpieRadioBtn" fx:id="caterpieRadioBtn2" layoutX="19.0" layoutY="46.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="### Extra Caterpie(s), transfer those from lowest CP to highest"/>
<RadioButton id="caterpieRadioBtn" fx:id="weedleRadioBtn2" layoutX="19.0" layoutY="97.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="### Extra Weedle(s), transfer those from lowest CP to highest"/> <RadioButton id="caterpieRadioBtn" fx:id="weedleRadioBtn2" layoutX="19.0" layoutY="97.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="### Extra Weedle(s), transfer those from lowest CP to highest"/>
<RadioButton id="caterpieRadioBtn" fx:id="pidgeyRadioBtn1" layoutX="21.0" layoutY="154.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="### Extra Pidgey(s), transfer those from lowest CP to highest"/> <RadioButton id="caterpieRadioBtn" fx:id="pidgeyRadioBtn1" layoutX="21.0" layoutY="154.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="### Extra Pidgey(s), transfer those from lowest CP to highest"/>
<CheckBox fx:id="enableOptionsChkBox" layoutX="2.0" layoutY="185.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#onEnableOptions" text="Enable Options" underline="true"/> <CheckBox fx:id="enableOptionsChkBox" layoutX="2.0" layoutY="185.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" text="Enable Options" underline="true"/>
</children> </children>
</AnchorPane> </AnchorPane>
</top> </top>
Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/layout/MainWindow.fxml
Expand Up @@ -4,21 +4,21 @@
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<VBox prefHeight="487.0" prefWidth="599.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="me.corriekay.pokegoutil.GUI.controller.MainWindowController"> <VBox prefHeight="487.0" prefWidth="599.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" >
<children> <children>
<MenuBar prefHeight="25.0" prefWidth="634.0" VBox.vgrow="NEVER"> <MenuBar prefHeight="25.0" prefWidth="634.0" VBox.vgrow="NEVER">
<menus> <menus>
<Menu mnemonicParsing="false" text="File"> <Menu mnemonicParsing="false" text="File">
<items> <items>
<MenuItem fx:id="settingsMenuItem" mnemonicParsing="false" onAction="#onSettingsClicked" text="Settings..."/> <MenuItem fx:id="settingsMenuItem" mnemonicParsing="false" text="Settings..."/>
<SeparatorMenuItem mnemonicParsing="false"/> <SeparatorMenuItem mnemonicParsing="false"/>
<MenuItem fx:id="logOffMenuItem" mnemonicParsing="false" onAction="#onLogOffClicked" text="LogOff"/> <MenuItem fx:id="logOffMenuItem" mnemonicParsing="false" text="LogOff"/>
<MenuItem fx:id="quitMenuItem" mnemonicParsing="false" onAction="#onQuitClicked" text="Quit"/> <MenuItem fx:id="quitMenuItem" mnemonicParsing="false" text="Quit"/>
</items> </items>
</Menu> </Menu>
<Menu mnemonicParsing="false" text="Help"> <Menu mnemonicParsing="false" text="Help">
<items> <items>
<MenuItem fx:id="aboutMenuItem" mnemonicParsing="false" onAction="#onAboutClicked" text="About"/> <MenuItem fx:id="aboutMenuItem" mnemonicParsing="false" text="About"/>
</items> </items>
</Menu> </Menu>
</menus> </menus>
Expand Down Expand Up @@ -57,7 +57,7 @@
<tabs> <tabs>
<Tab text="LuckyEggGrinder"> <Tab text="LuckyEggGrinder">
<content> <content>
<Button fx:id="openGrinderBtn" onAction="#onOpenGrinderClicked" prefHeight="25.0" prefWidth="105.0" text="Open"/> <Button fx:id="openGrinderBtn" prefHeight="25.0" prefWidth="105.0" text="Open"/>
<!-- problem with the embeding atm --> <!-- problem with the embeding atm -->
<!--fx:include fx:id="grinderPane" source="LuckyEggGrinder.fxml" />--> <!--fx:include fx:id="grinderPane" source="LuckyEggGrinder.fxml" />-->
</content> </content>
Expand Down
39 changes: 16 additions & 23 deletions src/me/corriekay/pokegoutil/BlossomsPoGoManager.java
@@ -1,24 +1,21 @@
package me.corriekay.pokegoutil; package me.corriekay.pokegoutil;


import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.scene.layout.Pane;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.stage.StageStyle;
import me.corriekay.pokegoutil.DATA.controllers.AccountController; import me.corriekay.pokegoutil.DATA.controllers.AccountController;
import me.corriekay.pokegoutil.GUI.controller.ChooseGuiWindowController;
import me.corriekay.pokegoutil.utils.Config; import me.corriekay.pokegoutil.utils.Config;
import me.corriekay.pokegoutil.utils.ui.Console;
import me.corriekay.pokegoutil.utils.helpers.UIHelper; import me.corriekay.pokegoutil.utils.helpers.UIHelper;
import me.corriekay.pokegoutil.utils.ui.Console;


import javax.swing.*; import javax.swing.*;
import java.io.IOException;




public class BlossomsPoGoManager extends Application { public class BlossomsPoGoManager extends Application {


public static final String VERSION = "v0.1.2-alpha.2"; public static final String VERSION = "v0.1.2-alpha.2";
private static Stage sPrimaryStage;


private ClassLoader classLoader = getClass().getClassLoader(); private ClassLoader classLoader = getClass().getClassLoader();


Expand All @@ -28,8 +25,10 @@ public static void main(String[] args) {


@Override @Override
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
if (Config.getConfig().getBool("develop", false)) if (Config.getConfig().getBool("develop", false)) {
openGUIChooser(primaryStage); new ChooseGuiWindowController();
sPrimaryStage.show();
}
else else
openOldGui(); openOldGui();
} }
Expand All @@ -49,19 +48,13 @@ public void run() {
}); });
} }


public void openGUIChooser(Stage primaryStage) { public static Stage getPrimaryStage(){
Parent root; return sPrimaryStage;
try { }
root = FXMLLoader.load(classLoader.getResource("layout/ChooseGUIWindow.fxml"));
} catch (IOException e) { public static void setNewPrimaryStage(Stage stage){
System.err.println("Problem loading .fxml file: " + e.toString()); if(sPrimaryStage != null && sPrimaryStage.isShowing())
return; sPrimaryStage.hide();
} sPrimaryStage = stage;
primaryStage.setScene(new Scene(root));
primaryStage.getIcons().add(new Image(classLoader.getResource("icon/PokeBall-icon.png").toExternalForm()));
primaryStage.setTitle("Choose a GUI");
primaryStage.initStyle(StageStyle.UTILITY);
primaryStage.setResizable(false);
primaryStage.show();
} }
} }
Expand Up @@ -34,8 +34,6 @@ public final class AccountController {


protected PokemonGoMainWindow mainWindow = null; protected PokemonGoMainWindow mainWindow = null;
protected PokemonGo go = null; protected PokemonGo go = null;
protected OkHttpClient http;
protected CredentialProvider cp;


private static Config config = Config.getConfig(); private static Config config = Config.getConfig();


Expand Down

0 comments on commit 2688e7b

Please sign in to comment.