remove some TODOs

This commit is contained in:
badaix 2017-02-07 19:03:32 +01:00
parent 5c78d2380b
commit 88cf84aa50
4 changed files with 9 additions and 27 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -423,16 +423,11 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
if (data.hasExtra("clients")) {
ArrayList<String> clients = data.getStringArrayListExtra("clients");
remoteControl.setClients(groupId, clients);
changed = true;
}
if (data.hasExtra("stream")) {
String streamId = data.getStringExtra("stream");
remoteControl.setStream(groupId, streamId);
changed = true;
}
//TODO
// if (changed)
// remoteControl.getServerStatus();
}
}
@ -467,20 +462,11 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
@Override
public void onClientEvent(RemoteControl remoteControl, RemoteControl.RpcEvent rpcEvent, Client client, RemoteControl.ClientEvent event) {
Log.d(TAG, "onClientEvent: " + event.toString());
// remoteControl.getServerStatus();
/* TODO: group
if (event == RemoteControl.ClientEvent.deleted)
serverStatus.removeClient(client);
else
serverStatus.updateClient(client);
sectionsPagerAdapter.updateServer(serverStatus);
*/
/// update only in case of notifications
if (rpcEvent == RemoteControl.RpcEvent.response)
return;
if (event != RemoteControl.ClientEvent.deleted)
serverStatus.updateClient(client);
serverStatus.updateClient(client);
groupListFragment.updateServer(serverStatus);
}
@ -492,15 +478,12 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
@Override
public void onStreamUpdate(RemoteControl remoteControl, RemoteControl.RpcEvent rpcEvent, Stream stream) {
// TODO
serverStatus.updateStream(stream);
groupListFragment.updateServer(serverStatus);
}
@Override
public void onGroupUpdate(RemoteControl remoteControl, RemoteControl.RpcEvent rpcEvent, Group group) {
// TODO
Log.d(TAG, "onGroupUpdate: " + group.toString());
serverStatus.updateGroup(group);
groupListFragment.updateServer(serverStatus);
}

View file

@ -46,7 +46,7 @@ public class RemoteControl implements TcpClient.TcpClientListener {
private RemoteControlListener listener;
private String host;
private int port;
private HashMap<Long, String> pendingRequests;
private final HashMap<Long, String> pendingRequests;
public RemoteControl(RemoteControlListener listener) {
this.listener = listener;
@ -96,18 +96,18 @@ public class RemoteControl implements TcpClient.TcpClientListener {
JSONArray jsonArray = new JSONArray(message);
for (int i = 0; i < jsonArray.length(); ++i) {
JSONObject json = jsonArray.getJSONObject(i);
processJson(tcpClient, json);
processJson(json);
}
} else {
JSONObject json = new JSONObject(message);
processJson(tcpClient, json);
processJson(json);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public void processJson(TcpClient tcpClient, JSONObject json) {
private void processJson(JSONObject json) {
// Log.d(TAG, "Msg received: " + message);
try {
@ -323,8 +323,8 @@ public class RemoteControl implements TcpClient.TcpClientListener {
public enum ClientEvent {
connected("Client.OnConnect"),
disconnected("Client.OnDisconnect"),
updated("Client.OnUpdate"),
deleted("Client.OnDelete");
updated("Client.OnUpdate");
//deleted("Client.OnDelete");
private String text;
ClientEvent(String text) {

View file

@ -48,7 +48,6 @@ public class TcpClient {
private BufferedReader mBufferIn;
private Thread readerThread = null;
private Socket socket = null;
private String uid;
private BlockingQueue<String> messages = new LinkedBlockingQueue<>();
/**
@ -215,7 +214,7 @@ public class TcpClient {
if (socket != null) {
try {
socket.close();
} catch (Exception e) {
} catch (Exception ignored) {
}
}
socket = null;