/** * A publish action has been successfully completed, update connection object associated with the * client this action belongs to, then notify the user of success */ private void publish() { Connection c = Connection.getInstance(); String actionTaken = context.getString(R.string.toast_pub_success, (Object[]) additionalArgs); Notify.toast(context, actionTaken, Toast.LENGTH_SHORT); }
// we keep pointer to map object and grid object public MessageReader(SetUp grid) { conn = Connection.getInstance(); messagelist = new ArrayList<>(); this.grid = grid; conn.sendMessage("JOIN#"); }
/** * A connection action has been successfully completed, update the connection object associated * with the client this action belongs to and then notify the user of success. */ private void connect() { Connection c = Connection.getInstance(); c.changeConnectionStatus(Connection.ConnectionStatus.CONNECTED); Notify.toast(context, "Connected", Toast.LENGTH_LONG); }
/** * A connect action was unsuccessful, notify the user and update client history * * @param exception This argument is not used */ private void connect(Throwable exception) { Connection c = Connection.getInstance(); c.changeConnectionStatus(Connection.ConnectionStatus.ERROR); }
/** * A disconnect action was unsuccessful, notify user and update client history * * @param exception This argument is not used */ private void disconnect(Throwable exception) { Connection c = Connection.getInstance(); c.changeConnectionStatus(Connection.ConnectionStatus.DISCONNECTED); }
/** * A subscribe action was unsuccessful, notify user and update client history * * @param exception This argument is not used */ private void subscribe(Throwable exception) { Connection c = Connection.getInstance(); String action = context.getString(R.string.toast_sub_failed, (Object[]) additionalArgs); Notify.toast(context, action, Toast.LENGTH_SHORT); }
/** * A disconnection action has been successfully completed, update the connection object associated * with the client this action belongs to and then notify the user of success. */ private void disconnect() { Connection c = Connection.getInstance(); c.changeConnectionStatus(Connection.ConnectionStatus.DISCONNECTED); String actionTaken = context.getString(R.string.toast_disconnected); Notify.toast(context, actionTaken, Toast.LENGTH_LONG); }