Skip to content
This repository was archived by the owner on Apr 8, 2018. It is now read-only.

Commit cb222d1

Browse files
committed
Exchanges messages and points and small bugs fixed
(still needs to update the server when points are exchanged between users) #49, closes #48, #43, #39, closes #33, closes #20
1 parent 506d3ee commit cb222d1

File tree

12 files changed

+1010
-187
lines changed

12 files changed

+1010
-187
lines changed

app/src/main/java/pt/ulisboa/tecnico/cmu/ubibike/ScoreHistory.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.widget.Button;
1313
import android.widget.ListView;
1414
import android.widget.TextView;
15+
import android.widget.Toast;
1516

1617
import org.json.JSONException;
1718
import org.json.JSONObject;
@@ -179,9 +180,11 @@ protected Void doInBackground(Void... params) {
179180

180181
json = new JSONObject();
181182
json.put(REQUEST_TYPE, ADD_POINTS);
182-
json.put(CLIENT_POINTS, ADD_POINTS_TEST_125);
183-
json.put(POINTS_ORIGIN, ADD_POINTS_TEST_125_ORIGIN);
183+
json.put(POINTS_TO_ADD, ADD_POINTS_TEST_10);
184+
json.put(POINTS_ORIGIN, ADD_POINTS_TEST_10_ORIGIN);
184185
json.put(CLIENT_NAME, bikerName);
186+
// TODO: 27-Apr-16 so funciona quando é a joana a querer adicionar
187+
json.put(USER_WIFI, "joao");
185188

186189

187190
dataOutputStream = new DataOutputStream(
@@ -194,12 +197,14 @@ protected Void doInBackground(Void... params) {
194197
dataOutputStream.writeUTF(json.toString());
195198

196199
// Thread will wait till server replies
197-
String response = dataInputStream.readUTF();
198-
199-
// Toast.makeText(ScoreHistory.this, response,
200-
// Toast.LENGTH_LONG).show();
200+
final String response = dataInputStream.readUTF();
201201

202202

203+
ScoreHistory.this.runOnUiThread(new Runnable() {
204+
public void run() {
205+
Toast.makeText(ScoreHistory.this, response, Toast.LENGTH_SHORT).show();
206+
}
207+
});
203208

204209
// new BufferedWriter(new OutputStreamWriter(mySocketOutputStream, "UTF-8")));
205210

0 commit comments

Comments
 (0)