Clean code.
This commit is contained in:
parent
27f506c253
commit
371f5aa1cb
|
|
@ -67,7 +67,6 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
|
|||
private AbstractXMPPConnection connection;
|
||||
private String jid;
|
||||
private String otherJid;
|
||||
private Roster roster;
|
||||
private final ServiceXmpp thsi;
|
||||
|
||||
private boolean isEnable = false;
|
||||
|
|
@ -100,7 +99,7 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
|
|||
connection.login();
|
||||
|
||||
registerCommands();
|
||||
roster = Roster.getInstanceFor(connection);
|
||||
Roster roster = Roster.getInstanceFor(connection);
|
||||
roster.addPresenceEventListener(this);
|
||||
|
||||
isConnected = connection.isConnected();
|
||||
|
|
@ -127,6 +126,7 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
|
|||
try {
|
||||
sendPresenceUnavailable(otherJid);
|
||||
} catch (SmackException.NotConnectedException | InterruptedException | XmppStringprepException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
|
|
@ -218,25 +218,25 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
|
|||
private void registerCommands() {
|
||||
commandManager.registerCommand(XMPP_NODE_TRAIL_GEOLOC, XMPP_NODE_TRAIL_GEOLOC, new LocalCommandFactory() {
|
||||
@Override
|
||||
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException {
|
||||
public LocalCommand getInstance() {
|
||||
return new TrailGeolocCommand(thsi);
|
||||
}
|
||||
});
|
||||
commandManager.registerCommand(XMPP_NODE_OBJECT_GEOLOC, XMPP_NODE_OBJECT_GEOLOC, new LocalCommandFactory() {
|
||||
@Override
|
||||
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException {
|
||||
public LocalCommand getInstance() {
|
||||
return new ObjectGeolocCommand(thsi);
|
||||
}
|
||||
});
|
||||
commandManager.registerCommand(XMPP_NODE_START_TRAIL_GEOLOC, XMPP_NODE_START_TRAIL_GEOLOC, new LocalCommandFactory() {
|
||||
@Override
|
||||
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException {
|
||||
public LocalCommand getInstance() {
|
||||
return new StartTrailGeolocCommand(thsi);
|
||||
}
|
||||
});
|
||||
commandManager.registerCommand(XMPP_NODE_STOP_TRAIL_GEOLOC, XMPP_NODE_STOP_TRAIL_GEOLOC, new LocalCommandFactory() {
|
||||
@Override
|
||||
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException {
|
||||
public LocalCommand getInstance() {
|
||||
return new StopTrailGeolocCommand(thsi);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue