diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eb12ece..eb8d4e8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,7 +28,7 @@ android:name=".GameActivity" android:theme="@style/DeltaWings.Color" android:screenOrientation="portrait" - android:windowSoftInputMode="stateHidden|adjustPan"> + android:windowSoftInputMode="stateAlwaysVisible|adjustResize"> { } catch (IOException e){ System.out.println("\nDEBUG:\texception IOException"); System.out.println( e.getMessage() ); - } catch (ClassNotFoundException e) { - System.out.println("\nDEBUG:\texception ClassNotFoundException"); - System.out.println( e.getMessage() ); - } catch (InterruptedException e) { - System.out.println("\nDEBUG:\texception InterruptedException"); - System.out.println( e.getMessage() ); } publishProgress((int) (50)); @@ -45,57 +40,23 @@ public class Command extends AsyncTask { } //---------------------------------------------------------------------------------------------- - public void envoyer_commande(String c) throws IOException, ClassNotFoundException, InterruptedException { + public void envoyer_commande(String c) throws IOException { System.out.println("\nDEBUG:\tenvoyer_commande"); - Socket socket = null; - DataOutputStream dataOutputStream = null; - DataInputStream dataInputStream = null; + Socket socket = new Socket(MainActivity.getPref("setting_ip", MainActivity.instance.getApplicationContext()), Integer.parseInt(MainActivity.getPref("setting_port", MainActivity.instance.getApplicationContext()))); - try { - //establish socket connection to server - socket = new Socket("192.168.0.2", 53000); + DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream()); - dataOutputStream = new DataOutputStream(socket.getOutputStream()); + System.out.println("\nDEBUG:\tConnexion ok"); + System.out.println("\nDEBUG:\tdebut envoi"); + dataOutputStream.writeBytes(c); + System.out.println("\nDEBUG:\tfinenvoi"); - System.out.println("\nDEBUG:\tConnexion ok"); - System.out.println("\nDEBUG:\tdebut envoi"); - dataOutputStream.writeBytes(c); - System.out.println("\nDEBUG:\tfinenvoi"); + System.out.println("\nDEBUG:\tdebut reception"); + System.out.println("\nDEBUG:\tfin réception"); - System.out.println("\nDEBUG:\tdebut reception"); - System.out.println("\nDEBUG:\tfin réception"); - } - catch (UnknownHostException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - finally { - if (socket != null) { - try { - socket.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - if (dataOutputStream != null){ - try { - dataOutputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - if (dataInputStream != null){ - try { - dataInputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } + socket.close(); + dataOutputStream.close(); System.out.println("\nDEBUG:\tFin envoyer_commande"); } diff --git a/app/src/main/java/net/DeltaWings/Android/Hangman/Util/GameUtil.java b/app/src/main/java/net/DeltaWings/Android/Hangman/Util/GameUtil.java index 1f67898..4aa6cc7 100644 --- a/app/src/main/java/net/DeltaWings/Android/Hangman/Util/GameUtil.java +++ b/app/src/main/java/net/DeltaWings/Android/Hangman/Util/GameUtil.java @@ -5,9 +5,10 @@ import android.util.Log; import org.json.JSONObject; import java.io.BufferedReader; +import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.Objects; @@ -26,13 +27,13 @@ public class GameUtil { JSONObject obj = null; - String s = "https://raw.githubusercontent.com/dwyl/english-words/master/words_dictionary.json"; String r = ""; StringBuilder sb = new StringBuilder(); ArrayList list = new ArrayList<>(); try { - BufferedReader br = new BufferedReader(new FileReader("/sdcard/list.txt")); + + BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("/sdcard/list.txt"), "UTF-8")); String line = br.readLine(); diff --git a/app/src/main/res/drawable/shape_outline.xml b/app/src/main/res/drawable/shape_outline.xml index 8a891ec..8d379f8 100644 --- a/app/src/main/res/drawable/shape_outline.xml +++ b/app/src/main/res/drawable/shape_outline.xml @@ -4,6 +4,6 @@ android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"> - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index a40210f..d0d1a15 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -11,7 +11,7 @@ android:id="@+id/textView4" android:layout_width="0dp" android:layout_height="0dp" - android:text="TextView" + android:text="Fait par Florian Bouillon, Matéo Boulben et Killian Orain mots récupéré sur jsp.com" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/game_activity.xml b/app/src/main/res/layout/game_activity.xml index 37fd28a..97db352 100644 --- a/app/src/main/res/layout/game_activity.xml +++ b/app/src/main/res/layout/game_activity.xml @@ -65,6 +65,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.50" + android:contentDescription="image" app:srcCompat="@mipmap/logo"/> @@ -73,7 +74,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="sans-serif-condensed" - android:text="null" android:textAlignment="center" android:textSize="36sp" android:textStyle="bold"/> @@ -84,13 +84,13 @@ android:layout_height="wrap_content" android:layout_marginBottom="0dp" android:ems="10" + android:hint="Écrit une lettre/un mot" android:inputType="textPersonName" android:maxLength="16" android:maxLines="1" android:selectAllOnFocus="false" - android:windowSoftInputMode="adjustResize|adjustPan" - android:text="Name" android:textAlignment="center" + android:textAllCaps="false" android:textSize="36sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintHorizontal_bias="0.0" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26ed81f..0e3e60d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -21,6 +21,7 @@ Theme Select the server IP + Select the server port Singleplayer Singleplayer Configuration diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 87e6dd9..137849f 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -26,16 +26,19 @@ + @color/Black + @color/Black + @color/Black @color/Grey50 @color/Grey50 @color/BlueGrey500 - @color/Grey900