diff --git a/app/src/main/java/com/example/cosmosclient/entities/JoinGroupResponse.java b/app/src/main/java/com/example/cosmosclient/entities/JoinGroupResponse.java index b98a746..3b1b5c9 100644 --- a/app/src/main/java/com/example/cosmosclient/entities/JoinGroupResponse.java +++ b/app/src/main/java/com/example/cosmosclient/entities/JoinGroupResponse.java @@ -1,11 +1,16 @@ package com.example.cosmosclient.entities; +import java.lang.reflect.Member; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; - +import java.util.Map; public class JoinGroupResponse { - public String gId; - public String uId; - public String token; - public String uri; -} + public List members=new ArrayList<>();; + + public List getListMembers() { + return members; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/cosmosclient/resources/JoinGroupRest.java b/app/src/main/java/com/example/cosmosclient/resources/JoinGroupRest.java index 8472bfb..54d994b 100644 --- a/app/src/main/java/com/example/cosmosclient/resources/JoinGroupRest.java +++ b/app/src/main/java/com/example/cosmosclient/resources/JoinGroupRest.java @@ -13,6 +13,6 @@ public interface JoinGroupRest { @POST("groups/{gId}/members") @FormUrlEncoded - Call JoinGroup(@Path("gId") String gId, @Field("uId ") String uId , @Field("token ") String token); + Call JoinGroup(@Path("gId") String gId, @Field("uId") String uId , @Field("token") String token); } diff --git a/app/src/main/java/com/example/cosmosclient/views/JoinGroupByIDActivity.java b/app/src/main/java/com/example/cosmosclient/views/JoinGroupByIDActivity.java index df0f054..e231ab6 100644 --- a/app/src/main/java/com/example/cosmosclient/views/JoinGroupByIDActivity.java +++ b/app/src/main/java/com/example/cosmosclient/views/JoinGroupByIDActivity.java @@ -1,8 +1,8 @@ package com.example.cosmosclient.views; -import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; @@ -11,10 +11,13 @@ import com.example.cosmosclient.R; import com.example.cosmosclient.app.Cosmos; -import com.example.cosmosclient.entities.Group; import com.example.cosmosclient.entities.JoinGroupResponse; +import com.example.cosmosclient.entities.User; import com.example.cosmosclient.resources.JoinGroupRest; +import java.lang.reflect.Member; +import java.util.List; + import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -49,16 +52,16 @@ //* 必要値取得 *// //現在のグループ情報を格納しているものからuid,tokenを取得 -// Cosmos app = (Cosmos) getApplication(); + Cosmos app = (Cosmos) getApplication(); //元となるgId,uid,tokenを取得完了 // String gId = GroupID; -// String uId=app.getuId(); -// String token=app.getToken(); + String uId=app.getuId(); + String token=app.getToken(); //テスト値 - String gId="qwer"; - String uId="asdf"; - String token="sggh"; + String gId="df6cddf2-7aff-4601-9ba7-d32bdc5d7e75"; +// String uId="asdf"; +// String token="sggh"; //API呼び出しのための値入力 Call call = joinGroupService.JoinGroup(gId, uId, token); @@ -68,6 +71,11 @@ @Override public void onResponse(Call call, Response response) { if (response.isSuccessful()) { + ListlistMembers= response.body().getListMembers(); + int s = listMembers.size(); +// for(int i = 0; i < s; i++){ +// Log.d("debug3", String.valueOf(listMembers.get(i))); +// } // JoinGroupResponse result = response.body(); test.setText("成功"); Cosmos app = (Cosmos) getApplication(); diff --git a/app/src/main/java/com/example/cosmosclient/views/QRcodeReadingActivity.java b/app/src/main/java/com/example/cosmosclient/views/QRcodeReadingActivity.java index c49cee9..ab61b35 100644 --- a/app/src/main/java/com/example/cosmosclient/views/QRcodeReadingActivity.java +++ b/app/src/main/java/com/example/cosmosclient/views/QRcodeReadingActivity.java @@ -12,11 +12,15 @@ import com.example.cosmosclient.R; import com.example.cosmosclient.app.Cosmos; import com.example.cosmosclient.entities.JoinGroupResponse; +import com.example.cosmosclient.entities.User; import com.example.cosmosclient.resources.JoinGroupRest; import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult; import com.journeyapps.barcodescanner.CaptureActivity; +import java.lang.reflect.Member; +import java.util.List; + import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -67,15 +71,15 @@ //* 必要値取得 *// //現在のグループ情報を格納しているものからuid,tokenを取得 -// Cosmos app = (Cosmos) getApplication(); + Cosmos app = (Cosmos) getApplication(); //元となるgId,uid,tokenを取得完了 // String gId = (String)result.getContents(); -// String uId=app.getuId(); -// String token=app.getToken(); + String uId=app.getuId(); + String token=app.getToken(); - String gId="dnjewvhoirae"; - String uId="dnjewvhfgoirae"; - String token="dnjewvhoidgfrae"; + String gId="df6cddf2-7aff-4601-9ba7-d32bdc5d7e75"; +// String uId="dnjewvhfgoirae"; +// String token="dnjewvhoidgfrae"; //API呼び出しのための値入力 Call call = joinGroupService.JoinGroup(gId, uId, token); @@ -86,8 +90,11 @@ @Override public void onResponse(Call call, Response response) { if (response.isSuccessful()) { - JoinGroupResponse result = response.body(); - + List listMembers= response.body().getListMembers(); + int s = listMembers.size(); +// for(int i = 0; i < s; i++){ +// Log.d("debug3", String.valueOf(listMembers.get(i))); +// } Cosmos app = (Cosmos) getApplication(); //test // System.out.println(result.uId);