Skip to content

Commit

Permalink
Leave game in WaitForGameActivity modification. Seems to work now
Browse files Browse the repository at this point in the history
  • Loading branch information
IevgenRagulin committed Nov 18, 2013
1 parent 0620057 commit 7592cd6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/cz/fit/tam/NewGameActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ protected Boolean doInBackground(NewGameActivity... activity) {
}

protected void onPostExecute(Boolean result) {
// activity.setGameProperties(result);

Intent myIntent1 = new Intent(NewGameActivity.this,
WaitForGameActivity.class);
Expand Down
9 changes: 2 additions & 7 deletions src/cz/fit/tam/WaitForGameActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import cz.fit.tam.model.Game;
import cz.fit.tam.model.GameClient;
import cz.fit.tam.model.GameProperties;

/*
Expand Down Expand Up @@ -95,12 +95,7 @@ private class StopGameAsyncTask extends

protected Boolean doInBackground(WaitForGameActivity... activity) {
activityWait = activity[0];
try {
activity[0].getCurrentGame().stop();
} catch (Exception e) {
Toast.makeText(activity[0], "ERROR " + e.getMessage(),
Toast.LENGTH_SHORT).show();
}
activity[0].getCurrentGame().stop();
return true;
}

Expand Down
4 changes: 1 addition & 3 deletions src/cz/fit/tam/model/GameClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,12 @@ public void connect(Integer joiningGameId) {
public void stop(Integer gameId) {
Map<String, String> arguments = new HashMap<String, String>();
arguments.put("command", GameClient.COMMAND_STOP_GAME);
Log.v("STOP GAME", gameId.toString());
arguments.put("id", gameId.toString());
arguments.put("admin_token", ((Admin) player).getAdminToken()
.getValue());

try {
JSONObject response = messaging.sendMessage(arguments);
Log.v("STOP GAME", response.toString());
messaging.sendMessage(arguments);
connected = false;
} catch (IOException ex) {
Logger.getLogger(GameClient.class.getName()).log(Level.SEVERE,
Expand Down

0 comments on commit 7592cd6

Please sign in to comment.