| |
---|
| | |
---|
| | call.enqueue(new Callback<ResponseBody>() { |
---|
| | @Override |
---|
| | public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { |
---|
| | if (response.isSuccessful()){ |
---|
| | if(hintPreData == null){ |
---|
| | try { |
---|
| | hintMutableLiveData.setValue(response.body().string()); |
---|
| | |
---|
| | hintPreData = hintMutableLiveData.getValue(); |
---|
| | System.out.println("今回のヒントは" + hintPreData + "です(初回)"+hintMutableLiveData.getValue()); |
---|
| | } catch (IOException e) { |
---|
| | e.printStackTrace(); |
---|
| | if (response.isSuccessful()) { |
---|
| | if (response.body() != null) { |
---|
| | if (hintPreData == null) { |
---|
| | try { |
---|
| | hintMutableLiveData.setValue(response.body().string()); |
---|
| | |
---|
| | hintPreData = hintMutableLiveData.getValue(); |
---|
| | System.out.println("今回のヒントは" + hintPreData + "です(初回)" + hintMutableLiveData.getValue()); |
---|
| | } catch (IOException e) { |
---|
| | e.printStackTrace(); |
---|
| | } |
---|
| | } else if (hintMutableLiveData.getValue().equals(hintPreData)) { |
---|
| | //値が一緒なら書き換えない |
---|
| | } else { |
---|
| | try { |
---|
| | hintMutableLiveData.setValue(response.body().string()); |
---|
| | hintPreData = hintMutableLiveData.getValue(); |
---|
| | } catch (IOException e) { |
---|
| | e.printStackTrace(); |
---|
| | } |
---|
| | |
---|
| | System.out.println("今回のヒントは" + hintPreData + "です"); |
---|
| | } |
---|
| | }else if(hintMutableLiveData.getValue().equals(hintPreData)){ |
---|
| | //値が一緒なら書き換えない |
---|
| | }else{ |
---|
| | try { |
---|
| | hintMutableLiveData.setValue(response.body().string()); |
---|
| | hintPreData = hintMutableLiveData.getValue(); |
---|
| | } catch (IOException e) { |
---|
| | e.printStackTrace(); |
---|
| | } |
---|
| | |
---|
| | System.out.println("今回のヒントは" + hintPreData + "です"); |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | |
---|
| |
---|
| | call.enqueue(new Callback<Integer>() { |
---|
| | @Override |
---|
| | public void onResponse(Call<Integer> call, Response<Integer> response) { |
---|
| | if (response.isSuccessful()){ |
---|
| | if(maxPreData == null){ |
---|
| | //初回代入 |
---|
| | maxMutableLiveData.setValue(response.body()); |
---|
| | maxPreData = response.body(); |
---|
| | }else if(response.body().equals(maxPreData)){ |
---|
| | //値が一緒なら書き換えない |
---|
| | }else{ |
---|
| | //値が異なるときのみライブデータを上書き |
---|
| | maxMutableLiveData.setValue(response.body()); |
---|
| | maxPreData = response.body(); |
---|
| | if (response.body() != null) { |
---|
| | if (maxPreData == null) { |
---|
| | //初回代入 |
---|
| | maxMutableLiveData.setValue(response.body()); |
---|
| | maxPreData = response.body(); |
---|
| | } else if (response.body().equals(maxPreData)) { |
---|
| | //値が一緒なら書き換えない |
---|
| | } else { |
---|
| | //値が異なるときのみライブデータを上書き |
---|
| | maxMutableLiveData.setValue(response.body()); |
---|
| | maxPreData = response.body(); |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | |
---|
| |
---|
| | |
---|
| | call.enqueue(new Callback<Integer>() { |
---|
| | @Override |
---|
| | public void onResponse(Call<Integer> call, Response<Integer> response) { |
---|
| | if (response.isSuccessful()){ |
---|
| | if(turnNumberPreData == null){ |
---|
| | if (response.isSuccessful()) { |
---|
| | if (turnNumberPreData == null) { |
---|
| | //初回代入 |
---|
| | turnNumberMutableLiveData.setValue(response.body()); |
---|
| | turnNumberPreData = response.body(); |
---|
| | tno = response.body(); |
---|
| | System.out.println("TurnNumberは" + turnNumberPreData + "です"); |
---|
| | }else if(response.body().equals(turnNumberPreData)){ |
---|
| | //値が一緒なら書き換えない |
---|
| | }else{ |
---|
| | } else if (response.body().equals(turnNumberPreData)) { |
---|
| | //値が一緒なら書き換えない |
---|
| | } else { |
---|
| | //値が異なるときのみライブデータを上書き |
---|
| | turnNumberMutableLiveData.setValue(response.body()); |
---|
| | turnNumberPreData = response.body(); |
---|
| | tno = response.body(); |
---|
| |
---|
| | |