diff --git a/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/PCSettings.java b/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/PCSettings.java index 526ce46..c40d099 100644 --- a/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/PCSettings.java +++ b/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/PCSettings.java @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) { settingsLayout.setVisibility(View.VISIBLE); } - private boolean getSettings() throws InterruptedException { + void getSettings() throws InterruptedException { Packet p = new Packet(); p.Exec = "GetSettings"; Hub.cui.sendMsg(p); @@ -100,22 +100,5 @@ public void run() { // try { // input = new BufferedReader(new InputStreamReader(s.getInputStream())); // } catch (IOException e) { -// e.printStackTrace(); -// } -// try { -// while(json.length() == 0) { -// final String st = input.readLine(); -// if(st.trim().length() != 0) { -// setJson(st.toString()); -// } -// } -// } catch (SocketTimeoutException e) { -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// }); -// thread.start(); - return true; } } diff --git a/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/SocketCommunicator.java b/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/SocketCommunicator.java index 3bff727..e796ac4 100644 --- a/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/SocketCommunicator.java +++ b/Android/app/src/main/java/dev/kamilklecha/autoswitchmobile/SocketCommunicator.java @@ -39,10 +39,8 @@ public void run() { out = socket.getOutputStream(); output = new PrintWriter(out); - startReceiver(); cw.connected(); - } - catch(SocketTimeoutException e) { + } catch (SocketTimeoutException e) { //TODO info Log.e(TAG, "SocketCommunicator: SocketTimeOutException"); e.printStackTrace(); @@ -69,54 +67,4 @@ public void run() { }); thread.start(); } - - public void startReceiver() { -// Thread thread = new Thread(new Runnable() { -// @Override -// public void run() { -// boolean exception = false; -// try { -// Thread.sleep(1000); -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// while (!exception) { -// if(socket.isClosed()) { -// Log.e(TAG, "Socket Closedd"); -// break; -// } -// -// try { -// BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); -// final String st = input.readLine(); -// -// handler.post(new Runnable() { -// @Override -// public void run() { -// if (st.trim().length() != 0) { -// JsonObject json = (JsonObject) new JsonParser().parse(st); -// Set keys = json.keySet(); -// Log.e(TAG, keys.toString()); -// } -// } -// }); -// } catch (SocketException e) { -// //TODO info -// cw.finish(); -// } catch (IOException e) { -// e.printStackTrace(); -// exception = true; -// } catch (NetworkOnMainThreadException e) { -// Log.e(TAG, "startReceiver: NetworkOnMainThreadException"); -// e.printStackTrace(); -// exception = true; -// } catch (Exception e) { -// e.printStackTrace(); -// exception = true; -// } -// } -// } -// }); -// thread.start(); - } }