diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..cf0c740
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java b/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java
index d255f4a..f7af557 100644
--- a/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java
+++ b/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java
@@ -144,6 +144,14 @@
public void onChanged(Integer time) {
nowTime = time;
timerText.setText(nowTime+"");
+ if(nowTime == 0){//タイマーが0秒になったら強制put
+ //putDrawing
+ drawingCanvas.setDrawingCacheEnabled(true);//キャッシュを取得する設定にする
+ drawingCanvas.buildDrawingCache();
+ Bitmap bitmap = Bitmap.createBitmap(drawingCanvas.getDrawingCache());
+ drawingCanvas.destroyDrawingCache();//既存のキャッシュをクリアする
+ drawingStateViewModel.putDrawing(bitmap);
+ }
}
});
diff --git a/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java b/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java
index 0dd0e65..a709cd6 100644
--- a/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java
+++ b/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java
@@ -47,6 +47,7 @@
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -79,6 +80,11 @@
BaseAdapter adapter = new MemberListAdapter(this.getApplicationContext(), R.layout.member_list_layout, viewMembers, allMembers);
membersList.setAdapter(adapter);
+ TextView drawTimer = (TextView) findViewById(R.id.drawTimer);
+ TextView dTimersec = (TextView) findViewById(R.id.dTimersec);
+ TextView gameTimer = (TextView) findViewById(R.id.gameTimer);
+ TextView gTimersec = (TextView) findViewById(R.id.gTimersec);
+
//LiveData(List)への購読
roomViewModel.getMembersLiveData().observe(this, new Observer>() {
//private List members;
@@ -110,6 +116,31 @@
}
});
+ roomViewModel.getSettingsLiveData().observe(this, new Observer() {
+ @Override
+ public void onChanged(Settings settings) {
+ if(settings.isDrawingTimer()) {
+ drawTimer.setText("お絵描きタイマー:ON");
+
+ dTimersec.setText(Integer.toString(settings.getDrawingTimerTimes())+"秒");
+
+ }else {
+ drawTimer.setText("お絵描きタイマー:OFF");
+ dTimersec.setVisibility(View.GONE);
+ }
+
+ if(settings.isGameTimer()) {
+ gameTimer.setText("ゲームタイマー:ON");
+
+ gTimersec.setText(Integer.toString(settings.getGameTimerTimes())+"秒");
+
+ }else {
+ gameTimer.setText("ゲームタイマー:OFF");
+ gTimersec.setVisibility(View.GONE);
+ }
+ }
+ });
+
//--------------------------------------------------------------------------
//各ボタン処理
@@ -183,12 +214,6 @@
});
//---------------------------------------------------------------
- //settings情報
- String s = "設定されている内容がここに表示されるはずです";
- TextView settingsText = findViewById(R.id.settings);
- settingsText.setText(s);
-
- //---------------------------------------------------------------
//部屋ID情報
TextView RoomIdText = findViewById(R.id.roomID);
RoomIdText.setText(roomId);
diff --git a/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java b/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java
index be129c5..fb9712b 100644
--- a/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java
+++ b/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java
@@ -1,5 +1,6 @@
package org.ntlab.irisclient;
+import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.ClipData;
import android.content.ClipDescription;
@@ -11,9 +12,11 @@
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
+import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
+import android.widget.Switch;
import android.widget.TextView;
import com.google.android.material.snackbar.Snackbar;
@@ -25,6 +28,7 @@
import org.ntlab.irisclient.entities.RoomJson;
import org.ntlab.irisclient.models.Member;
+import org.ntlab.irisclient.models.Settings;
import org.ntlab.irisclient.resources.RoomsRest;
import org.ntlab.irisclient.viewmodels.RoomViewModel;
@@ -49,9 +53,14 @@
//String nickname;
String belongs;
Boolean isMaster;
+ boolean drawingTimer = true;
+ int drawingTimes = 50;
+ boolean gameTimer = true;
+ int gameTimes = 30;
+ int gameFirstTimes = 10;
private void homeButton(RoomViewModel roomViewModel){
- String strTitle = "ホーム画面に戻ってよろしいですか?";
+ String strTitle = "ホーム画面に戻ってもよろしいですか?";
String strMessage = "退出すると部屋は削除されます";
AlertDialog.Builder builder;
@@ -124,6 +133,7 @@
});
+
//各ボタン処理
ArrayList members = new ArrayList<>();
Button redMasterButton = (Button) findViewById(R.id.beRedMaster);
@@ -132,6 +142,10 @@
Button blueSpyButton = (Button) findViewById(R.id.beBlueSpy);
ImageButton copyButton = (ImageButton) findViewById(R.id.copyButton);
ImageButton homeButton = (ImageButton) findViewById(R.id.homeButton);
+ @SuppressLint("UseSwitchCompatOrMaterialCode")
+ Switch dTimer = findViewById(R.id.dTimer);
+ @SuppressLint("UseSwitchCompatOrMaterialCode")
+ Switch gTimer = findViewById(R.id.gTimer);
//OwnerRoom専用ボタン
Button randomButton = (Button) findViewById(R.id.random);
@@ -144,8 +158,6 @@
redMasterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- ((Iris) getApplication()).setMaster(true);
- ((Iris) getApplication()).setTeam("r");
roomViewModel.changeBelongsAndMaster(roomId, myName,"r",true);
}
});
@@ -154,8 +166,6 @@
redSpyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- ((Iris) getApplication()).setMaster(false);
- ((Iris) getApplication()).setTeam("r");
roomViewModel.changeBelongsAndMaster(roomId, myName,"r",false);
}
});
@@ -164,8 +174,6 @@
blueMasterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- ((Iris) getApplication()).setMaster(true);
- ((Iris) getApplication()).setTeam("b");
roomViewModel.changeBelongsAndMaster(roomId, myName,"b",true);
}
});
@@ -174,8 +182,6 @@
blueSpyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- ((Iris) getApplication()).setMaster(false);
- ((Iris) getApplication()).setTeam("b");
roomViewModel.changeBelongsAndMaster(roomId, myName,"b",false);
}
});
@@ -190,6 +196,26 @@
}
});
+/*
+ //設定ボタン
+ dTimer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+
+ drawingTimer = isChecked;
+ roomViewModel.changeSettings(roomId, drawingTimer, drawingTimes, gameTimer, gameTimes, gameFirstTimes);
+ }
+ });
+
+ gTimer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+
+ gameTimer = isChecked;
+ roomViewModel.changeSettings(roomId, drawingTimer, drawingTimes, gameTimer, gameTimes, gameFirstTimes);
+ }
+ });
+*/
//ランダムボタン
randomButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -219,9 +245,7 @@
//---------------------------------------------------------------
//settings情報
- String s = "設定";
- TextView settingsText = findViewById(R.id.settings);
- settingsText.setText(s);
+
//---------------------------------------------------------------
//部屋ID情報
diff --git a/app/src/main/java/org/ntlab/irisclient/entities/TurnJson.java b/app/src/main/java/org/ntlab/irisclient/entities/TurnJson.java
index 5a09694..896df40 100644
--- a/app/src/main/java/org/ntlab/irisclient/entities/TurnJson.java
+++ b/app/src/main/java/org/ntlab/irisclient/entities/TurnJson.java
@@ -40,7 +40,6 @@
//---------------------------------------------------------
//セッター
-
public void setHint(String hint) {
this.hint = hint;
}
@@ -57,10 +56,6 @@
public void setEndstate(int gamestate) {this.endstate = gamestate;}
- public void putHint(String rid, int tno){
- this.hint = hint;
- this.max = max;
- }
//---------------------------------------------------------
//openlist操作
diff --git a/app/src/main/java/org/ntlab/irisclient/resources/GameRest.java b/app/src/main/java/org/ntlab/irisclient/resources/GameRest.java
index 5e93b49..80f73df 100644
--- a/app/src/main/java/org/ntlab/irisclient/resources/GameRest.java
+++ b/app/src/main/java/org/ntlab/irisclient/resources/GameRest.java
@@ -47,6 +47,13 @@
);
//-----------------------------------------------
+ // 現在開いているすべてのカードを取得するメソッド true=開いている false=開いてない
+ @GET("rooms/{rid}/game/opens")
+ Call> getOpens(
+ @Path("rid") String rid
+ );
+
+ //-----------------------------------------------
// 現在のターンがどちらのチームであるかを取得するメソッド
@GET("rooms/{rid}/game/turn")
Call getTeam(
@@ -69,15 +76,22 @@
);
//-----------------------------------------------
- // 現在開いているすべてのカードを取得するメソッド true=開いている false=開いてない
- @GET("rooms/{rid}/game/opens")
- Call> getOpens(
- @Path("rid") String rid
+ @GET("rooms/{rid}/game/turns/{tno}/questions")
+ Call getQ(
+ @Path("rid") String rid,
+ @Path("tno") Integer tno
);
//-----------------------------------------------
- @GET("rooms/{rid}/game/turns/{tno}/questions")
- Call getQ(
+ @GET("rooms/{rid}/game/turns/{tno}/hint")
+ Call getHint(
+ @Path("rid") String rid,
+ @Path("tno") Integer tno
+ );
+
+ //-----------------------------------------------
+ @GET("rooms/{rid}/game/turns/{tno}/Max")
+ Call getMax(
@Path("rid") String rid,
@Path("tno") Integer tno
);
diff --git a/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java b/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java
index d5309fd..a022885 100644
--- a/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java
+++ b/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java
@@ -1,11 +1,9 @@
package org.ntlab.irisclient.viewmodels;
-import org.ntlab.irisclient.Iris;
import org.ntlab.irisclient.entities.GameJson;
-import org.ntlab.irisclient.entities.RoomJson;
import org.ntlab.irisclient.entities.TurnJson;
-import org.ntlab.irisclient.models.Room;
import org.ntlab.irisclient.resources.GameRest;
+
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
@@ -23,11 +21,6 @@
//フィールド
private String rid;
private Integer tno;
- private Integer cno;
- private String team;
- private String hint;
- private Integer max;
- private List openList;
final private MutableLiveData turnsMutableLiveData;
final private MutableLiveData turnMutableLiveData;
@@ -35,6 +28,7 @@
final private MutableLiveData> opensMutableLiveData;
final private MutableLiveData> mapMutableLiveData;
final private MutableLiveData imageMutableLiveData;
+ final private MutableLiveData QMutableLiveData;
private GameJson game = new GameJson();
final private GameRest gameRest;
final private Retrofit retrofit;
@@ -43,6 +37,7 @@
private String turnsPreData = null;
private TurnJson turnPreData = null;
private List opensPreData = null;
+ private Boolean[] QPreData = null;
//------------------------------------------------------------------
//コンストラクタ
@@ -50,157 +45,253 @@
this.turnsMutableLiveData = new MutableLiveData<>();
this.turnMutableLiveData = new MutableLiveData<>();
this.mapMutableLiveData = new MutableLiveData<>();
-
this.colorMutableLiveData = new MutableLiveData<>();
this.opensMutableLiveData = new MutableLiveData<>();
this.imageMutableLiveData = new MutableLiveData<>();
+ this.QMutableLiveData = new MutableLiveData<>();
this.retrofit = new Retrofit.Builder()
.baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/iris/")
.addConverterFactory(JacksonConverterFactory.create())
.build();
-
this.gameRest = retrofit.create(GameRest.class);
- //RoomJson roomJson = new RoomJson();
- //System.out.println("adfasdfdsafdsa" + roomJson.getRid());
- /**
- * 追記ここから(追記2個分の1個目)
- * 変更1)initが呼ばれていなかった()→ initを呼び出し
- * 変更2)gameが宣言のみで値がずっとnullだった → setGameの関数で通信を行う
- */
- init(); // 変更1
- setGame(rid); // 変更2
- /**
- * 追記ここまで
- */
+// startColor(rid);
+// startMap(rid);
+// startImage(rid);
+ testGame(); // 通信をして game に値をセットさせる関数
}
//----------------------------------------------------
//setter
public void setRid(String rid) {
this.rid = rid;
+ //初期値呼び出し
+ startColor(rid);
+ startMap(rid);
+ startImage(rid);
}
- public void setOpenList(Integer cno) {
- this.cno = cno;
- }
-
-
//--------------------------------------------------------------
// getter
- public LiveData getTurnsLiveData() {
- return this.turnsMutableLiveData;
- }
public LiveData getTurnLiveData() {
return this.turnMutableLiveData;
}
- // public LiveData> getColorLiveData() {
-// return this.colorMutableLiveData;
-// }
public LiveData> getOpenLiveData() {
return this.opensMutableLiveData;
}
- // public LiveData> getMapLiveData() {
-// return this.mapMutableLiveData;
-// }
public LiveData getImageLiveData() {
return this.imageMutableLiveData;
}
+ public LiveData getQLiveData() {
+ return this.QMutableLiveData;
+ }
public GameJson getGame() {
return game;
}
-
- //---------------------------------------------
- // マスターのヒントを送信するメソッド + 最大回答数も送信
- public void putHint(String hint, Integer max) {
-
+ //マスターのヒント、最大回答数を送信
+ public void sendHint(int tno, String hint, Integer max) {
Call call = gameRest.putHint(rid, tno, hint, max);
call.enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) {
if (response.isSuccessful()){
- System.out.println("通信成功:changeBelongsAndMaster");
+ System.out.println("通信成功:sendHint");
}
}
@Override
public void onFailure(Call call, Throwable t) {
- System.out.println("通信失敗:changeBelongsAndMaster");
+ System.out.println("通信失敗:sendHint");
System.out.println(t);
}
});
}
-// public void putTeam(String team){
-// final Iris iris = retrofit.create(Iris.class);
-// Call call = iris.setTeam(team);
-//
-// call.enqueue(new Callback() {
-// @Override
-// public void onResponse(Call call, Response response) {
-// if (response.isSuccessful()){
-// System.out.println("通信成功:changeBelongsAndMaster");
-// }
-// }
-// @Override
-// public void onFailure(Call call, Throwable t) {
-// System.out.println("通信失敗:changeBelongsAndMaster");
-// System.out.println(t);
-// }
-// });
-// }
+ //どのマスを開いたかを送信
+ public void sendOpenList(Integer cno) {
+ Call call = gameRest.setOpenList(rid, tno, cno);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()){
+ System.out.println("通信成功:sendOpenList");
+ }
+ }
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗:sendOpenList");
+ System.out.println(t);
+ }
+ });
+ }
+
+ //現在のTurnstateを送信
+ public void sendTurnstate(String rid) {
+ Call call = gameRest.setTurnstate(rid, tno);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()){
+ System.out.println("通信成功:sendTurnstate");
+ }
+ }
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗:sendTurnstate");
+ System.out.println(t);
+ }
+ });
+ }
+
+ //現在のGamestateを送信
+ public void sendEndstate(String rid) {
+ Call call = gameRest.setEndstate(rid, tno);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()){
+ System.out.println("通信成功:sendEndstate");
+ }
+ }
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗:sendEndstate");
+ System.out.println(t);
+ }
+ });
+ }
+
+ //疑っているマスの番号を送信
+ public void sendQ(Integer cno) {
+ Call call = gameRest.changeQ(rid, tno, cno);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()){
+ System.out.println("通信成功:sendQ");
+ }
+ }
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗:sendQ");
+ System.out.println(t);
+ }
+ });
+ }
+
+ //カードのカラー(r,b,g,d)の取得
+ private void startColor(String rid) {
+ Call> call = gameRest.getColorList(rid);
+
+ call.enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ if (response.isSuccessful()){
+ colorMutableLiveData.setValue(response.body());
+ }
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ System.out.println("通信失敗:updateColor");
+ System.out.println(t);
+ }
+ });
+ }
+
+ //カードの並び順の取得
+ private void startMap(String rid) {
+ Call> call = gameRest.getMap(rid);
+
+ call.enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ if (response.isSuccessful()) {
+ mapMutableLiveData.setValue(response.body());
+ }
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ System.out.println("通信失敗:updateMap");
+ System.out.println(t);
+ }
+ });
+ }
+
+ //カード(画像)の取得
+ private void startImage(String rid) {
+ Call call = gameRest.getGame(rid);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()) {
+ imageMutableLiveData.setValue(response.body());
+ }
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗:updateImage");
+ System.out.println(t);
+ }
+ });
+
+ }
//-----------------------------------------------------------------------------
// updates
- public void init() {
- updateColor(rid);
- updateMap(rid);
- updateImage(rid);
- }
-
@Override
public void update() {
//updateTurns(rid);
updateTurn(rid);
updateOpens(rid);
+ updateQ(rid);
}
-// //r,bの取得(今どちらのチームかの判別)
-// public void updateTurns(String rid) {
-// final GameRest gameRest = retrofit.create(GameRest.class);
-// Call call = gameRest.getTeam(rid);
-//
-// call.enqueue(new Callback() {
-// @Override
-// public void onResponse(Call call, Response response) {
-// if (response.isSuccessful()){
-// if(turnsPreData == null){
-// //初回代入
-// turnsMutableLiveData.setValue(response.body());
-// turnsPreData = response.body();
-// }else if(response.body().equals(turnsPreData)){
-// //値が一緒なら書き換えない
-// }else{
-// //値が異なるときのみライブデータを上書き
-// turnsMutableLiveData.setValue(response.body());
-// turnsPreData = response.body();
-// }
-// }
-// }
-//
-// @Override
-// public void onFailure(Call call, Throwable t) {
-// System.out.println("通信失敗:changeBelongsAndMaster");
-// System.out.println(t);
-// }
-// });
-// }
+/*
+ //r,bの取得(今どちらのチームかの判別)
+ public void updateTurns(String rid) {
+ final GameRest gameRest = retrofit.create(GameRest.class);
+ Call call = gameRest.getTeam(rid);
- //hint,openList,maxの取得
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()){
+ if(turnsPreData == null){
+ //初回代入
+ turnsMutableLiveData.setValue(response.body());
+ turnsPreData = response.body();
+ }else if(response.body().equals(turnsPreData)){
+ //値が一緒なら書き換えない
+ }else{
+ //値が異なるときのみライブデータを上書き
+ turnsMutableLiveData.setValue(response.body());
+ turnsPreData = response.body();
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗:updateTurns");
+ System.out.println(t);
+ }
+ });
+ }
+ */
+
+ //hint,openList,maxの更新
public void updateTurn(String rid) {
Call call = gameRest.getTurns(rid, tno);
@@ -224,36 +315,15 @@
@Override
public void onFailure(Call call, Throwable t) {
- System.out.println("通信失敗:changeBelongsAndMaster");
+ System.out.println("通信失敗:updateTurn.hint no yatsu");
System.out.println(t);
}
});
}
- //カードのカラー(r,b,g,d)の取得
- private void updateColor(String rid) {
- final GameRest gameRest = retrofit.create(GameRest.class);
- Call> call = gameRest.getColorList(rid);
-
- call.enqueue(new Callback>() {
- @Override
- public void onResponse(Call> call, Response> response) {
- if (response.isSuccessful()){
- colorMutableLiveData.setValue(response.body());
- }
- }
-
- @Override
- public void onFailure(Call> call, Throwable t) {
- System.out.println("通信失敗:changeBelongsAndMaster");
- System.out.println(t);
- }
- });
- }
//現在開いているすべてのカードを取得([tffftffffftttff]みたいなリストを逐一更新する、マスが開くたびに更新)
public void updateOpens(String rid) {
- final GameRest gameRest = retrofit.create(GameRest.class);
Call> call = gameRest.getOpens(rid);
call.enqueue(new Callback>() {
@@ -276,61 +346,46 @@
@Override
public void onFailure(Call> call, Throwable t) {
- System.out.println("通信失敗:changeBelongsAndMaster");
+ System.out.println("通信失敗:updateOpens");
System.out.println(t);
}
});
}
- //カードの並び順の取得
- private void updateMap(String rid) {
- final GameRest gameRest = retrofit.create(GameRest.class);
- Call> call = gameRest.getMap(rid);
- call.enqueue(new Callback>() {
+
+ //疑っているマス一覧の更新
+ public void updateQ(String rid) {
+ Call call = gameRest.getQ(rid, tno);
+
+ call.enqueue(new Callback() {
@Override
- public void onResponse(Call> call, Response> response) {
- if (response.isSuccessful()) {
- mapMutableLiveData.setValue(response.body());
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()){
+ if(turnsPreData == null){
+ //初回代入
+ QMutableLiveData.setValue(response.body());
+ QPreData = response.body();
+ }else if(response.body().equals(QPreData)){
+ //値が一緒なら書き換えない
+ }else{
+ //値が異なるときのみライブデータを上書き
+ QMutableLiveData.setValue(response.body());
+ QPreData = response.body();
+ }
}
}
@Override
- public void onFailure(Call> call, Throwable t) {
- System.out.println("通信失敗:changeBelongsAndMaster");
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗:updateTurn.hint no yatsu");
System.out.println(t);
}
});
}
- //カード(画像)の取得
- private void updateImage(String rid) {
- final GameRest gameRest = retrofit.create(GameRest.class);
- Call call = gameRest.getGame(rid);
-
- call.enqueue(new Callback() {
- @Override
- public void onResponse(Call call, Response response) {
- if (response.isSuccessful()) {
- imageMutableLiveData.setValue(response.body());
- }
- }
-
- @Override
- public void onFailure(Call call, Throwable t) {
- System.out.println("通信失敗:changeBelongsAndMaster");
- System.out.println(t);
- }
- });
- }
-
- /**
- * 追記ここから(追記2個分の2個目)
- * 変更3) 通信をして、gameとimageMutableLiveDataに初期値を代入する
- */
- public void setGame(String rid) {
- final GameRest gameRest = retrofit.create(GameRest.class);
- Call call = gameRest.getGame(rid);
+ public void testGame() {
+ Call call = gameRest.getGame("gametest");
call.enqueue(new Callback() {
@Override
@@ -343,11 +398,9 @@
@Override
public void onFailure(Call call, Throwable t) {
- System.out.println("");
+ System.out.println("通信失敗:testGame");
+ System.out.println(t);
}
});
}
- /**
- * 追記ここまで
- */
}
\ No newline at end of file
diff --git a/app/src/main/java/org/ntlab/irisclient/viewmodels/RoomViewModel.java b/app/src/main/java/org/ntlab/irisclient/viewmodels/RoomViewModel.java
index 10909e2..0b7ce70 100644
--- a/app/src/main/java/org/ntlab/irisclient/viewmodels/RoomViewModel.java
+++ b/app/src/main/java/org/ntlab/irisclient/viewmodels/RoomViewModel.java
@@ -386,7 +386,7 @@
if (response.body() == null) {
//もしもレスポンスが空なら何もしない
} else {
- if(compareSettings(response.body(), settingsPreData)) {
+ if(!compareSettings(response.body(), settingsPreData)) {
settingsMutableLiveData.setValue(response.body());
settingsPreData = response.body();
}
diff --git a/app/src/main/res/layout/activity_drawing.xml b/app/src/main/res/layout/activity_drawing.xml
index 9120138..8c19528 100644
--- a/app/src/main/res/layout/activity_drawing.xml
+++ b/app/src/main/res/layout/activity_drawing.xml
@@ -118,8 +118,8 @@
android:id="@+id/seekBar"
android:layout_width="185dp"
android:layout_height="58dp"
- android:max="60"
- android:progress="30"
+ android:max="100"
+ android:min="10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.056"
diff --git a/app/src/main/res/layout/activity_member_room.xml b/app/src/main/res/layout/activity_member_room.xml
index 09afd02..d9cc699 100644
--- a/app/src/main/res/layout/activity_member_room.xml
+++ b/app/src/main/res/layout/activity_member_room.xml
@@ -75,13 +75,14 @@
@@ -110,4 +111,52 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.619" />
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_owner_room.xml b/app/src/main/res/layout/activity_owner_room.xml
index 48c02af..9706b38 100644
--- a/app/src/main/res/layout/activity_owner_room.xml
+++ b/app/src/main/res/layout/activity_owner_room.xml
@@ -7,6 +7,55 @@
android:backgroundTint="#804747"
tools:context=".OwnerRoomActivity">
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.042" />
-
+ app:layout_constraintHorizontal_bias="0.8"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.38"
+ tools:ignore="UseSwitchCompatOrMaterialXml" />
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="1.0" />
+
\ No newline at end of file