From fe945c32e6bf84306c46f7a2e5d9d8c75ac00904 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 5 Nov 2017 17:52:10 +0100 Subject: [PATCH] Can retrieve user informations on the server --- .../android/comunic/client/MainActivity.java | 9 +-- .../comunic/client/api/APIRequestTask.java | 2 + .../client/data/UsersInfo/GetUsersInfos.java | 56 ++++++++++++++++++- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java index 4380b36..da02911 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java @@ -44,15 +44,16 @@ public class MainActivity extends AppCompatActivity { //DEVELOPMENT : Try to get information about a user over the network GetUsersInfos uInfos = new GetUsersInfos(this, null); - //Get infos... about me! - int uID = 1; + //Get infos... about me! :) + final int uID = 1; uInfos.get(uID, new GetUsersInfos.getUserInfosCallback() { @Override public void callback(UserInfo info) { if(info == null) Toast.makeText(MainActivity.this, "Failure !", Toast.LENGTH_SHORT).show(); - else - Toast.makeText(MainActivity.this, "Success !", Toast.LENGTH_SHORT).show(); + else { + Toast.makeText(MainActivity.this, uID + " is " + info.getFullName() + "!", Toast.LENGTH_SHORT).show(); + } } }); } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequestTask.java b/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequestTask.java index 5fdcfeb..84f86a6 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequestTask.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequestTask.java @@ -148,6 +148,8 @@ public abstract class APIRequestTask extends AsyncTask