Commit 8c512c3f by Kim Jinsung

サイネージ再生画面からメンテナンス画面に遷移時に通信失敗数およびネットワーク接続状態を送る処理追加

parent 0148a589
...@@ -34,6 +34,16 @@ public class MainActivity extends ParentActivity { ...@@ -34,6 +34,16 @@ public class MainActivity extends ParentActivity {
mMessageTextView = findViewById(R.id.fullscreen_content); mMessageTextView = findViewById(R.id.fullscreen_content);
mMessageTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf")); mMessageTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
//サイネージ画面から戻った時の情報収集
Intent intent = getIntent();
if (intent != null) {
int errorCount = intent.getIntExtra(ToiletConstants.KEY_ERROR_COUNT, -1);
boolean isNetworkConnect = intent.getBooleanExtra(ToiletConstants.KEY_NETWORK_CONNECT, false);
if (errorCount != -1 && errorCount != 0) {
reloadDisplayView(errorCount, isNetworkConnect);
}
}
if (!toiletInfo.getUsbFileCopyComplete()) { if (!toiletInfo.getUsbFileCopyComplete()) {
//外部ストレージの権限付与 //外部ストレージの権限付与
if (checkPermission()) { if (checkPermission()) {
......
...@@ -36,7 +36,8 @@ public class SignageActivity extends ParentActivity { ...@@ -36,7 +36,8 @@ public class SignageActivity extends ParentActivity {
} else if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_3) { } else if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_3) {
setContentView(R.layout.activity_signage_3); setContentView(R.layout.activity_signage_3);
} else { //USBから取得したトイレ情報がない場合 } else { //USBから取得したトイレ情報がない場合
moveMainView(); //強制にエラーカウント1設定
moveMainView(1, true);
return; return;
} }
...@@ -135,19 +136,23 @@ public class SignageActivity extends ParentActivity { ...@@ -135,19 +136,23 @@ public class SignageActivity extends ParentActivity {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (toiletInfo.getConnectErrorCount() > ToiletInfo.MAX_ERROR_COUNT) { if (errorCount > ToiletInfo.MAX_ERROR_COUNT) {
//サーバ側から取得したトイレ情報削除 //サーバ側から取得したトイレ情報削除
toiletInfo.clearResultToiletJsonMap(); toiletInfo.clearResultToiletJsonMap();
moveMainView(); moveMainView(errorCount, isNetworkConnect);
} else { } else {
if (errorCount == 0) {
settingDisplay(); settingDisplay();
} }
} }
}
}); });
} }
private void moveMainView() { private void moveMainView(int errorCount, boolean isNetworkConnect) {
Intent intent = new Intent(SignageActivity.this, MainActivity.class); Intent intent = new Intent(SignageActivity.this, MainActivity.class);
intent.putExtra(ToiletConstants.KEY_ERROR_COUNT, errorCount);
intent.putExtra(ToiletConstants.KEY_NETWORK_CONNECT, isNetworkConnect);
startActivity(intent); startActivity(intent);
finish(); finish();
} }
...@@ -156,8 +161,8 @@ public class SignageActivity extends ParentActivity { ...@@ -156,8 +161,8 @@ public class SignageActivity extends ParentActivity {
ArrayList<USBToiletDefaultJson> toiletDefaultJsonArray = toiletInfo.getToiletDefaultJsonArray(); ArrayList<USBToiletDefaultJson> toiletDefaultJsonArray = toiletInfo.getToiletDefaultJsonArray();
if (toiletDefaultJsonArray == null || toiletDefaultJsonArray.size() == 0) { if (toiletDefaultJsonArray == null || toiletDefaultJsonArray.size() == 0) {
//MainActivity 移動 //MainActivity 移動(強制にエラーカウント1)
moveMainView(); moveMainView(1, true);
} }
int vacantCount = 0; int vacantCount = 0;
...@@ -208,7 +213,8 @@ public class SignageActivity extends ParentActivity { ...@@ -208,7 +213,8 @@ public class SignageActivity extends ParentActivity {
//サーバから取得したデータが不正なのでMainに遷移 //サーバから取得したデータが不正なのでMainに遷移
if (vacantCount == -1 || totalCount == -1) { if (vacantCount == -1 || totalCount == -1) {
moveMainView(); //強制にエラーカウント1設定
moveMainView(1, true);
} }
} }
} }
...@@ -28,14 +28,11 @@ public class ToiletInfo { ...@@ -28,14 +28,11 @@ public class ToiletInfo {
public static final int VALUE_NETWORK_DIS_CONNECT = 2; public static final int VALUE_NETWORK_DIS_CONNECT = 2;
public static final int VALUE_TOILET_SERVER_CONNECT_FAIL = 3; public static final int VALUE_TOILET_SERVER_CONNECT_FAIL = 3;
public static final int MAX_ERROR_COUNT = 6; public static final int MAX_ERROR_COUNT = 5;
private ArrayList<USBToiletDefaultJson> mToiletDefaultJsonArray; private ArrayList<USBToiletDefaultJson> mToiletDefaultJsonArray;
private Map<Integer, ArrayList<ResultToiletJson>> mResultToiletJsonMap = new HashMap<>(); private Map<Integer, ArrayList<ResultToiletJson>> mResultToiletJsonMap = new HashMap<>();
private boolean isValidation = false;
private boolean isUsbFileCopyComplete = false; private boolean isUsbFileCopyComplete = false;
private int mConnectErrorCount = 0;
private boolean isNetworkConnect = false;
public static synchronized ToiletInfo getInstance() { public static synchronized ToiletInfo getInstance() {
if (instance == null) { if (instance == null) {
...@@ -98,14 +95,6 @@ public class ToiletInfo { ...@@ -98,14 +95,6 @@ public class ToiletInfo {
return -1; return -1;
} }
public void setValidation(boolean validation) {
isValidation = validation;
}
public boolean getValidation() {
return isValidation;
}
public void setUsbFileCopyComplete(boolean usbFileCopyComplete) { public void setUsbFileCopyComplete(boolean usbFileCopyComplete) {
isUsbFileCopyComplete = usbFileCopyComplete; isUsbFileCopyComplete = usbFileCopyComplete;
} }
...@@ -114,22 +103,6 @@ public class ToiletInfo { ...@@ -114,22 +103,6 @@ public class ToiletInfo {
return isUsbFileCopyComplete; return isUsbFileCopyComplete;
} }
public void setConnectErrorCount(int connectErrorCount) {
mConnectErrorCount = connectErrorCount;
}
public int getConnectErrorCount() {
return mConnectErrorCount;
}
public void setNetworkConnect(boolean networkConnect) {
isNetworkConnect = networkConnect;
}
public boolean getNetworkConnect() {
return isNetworkConnect;
}
public int getToiletGateType() { public int getToiletGateType() {
if (mToiletDefaultJsonArray == null) { if (mToiletDefaultJsonArray == null) {
return ToiletConstants.VALUE_TOILET_GATE_TYPE_0; return ToiletConstants.VALUE_TOILET_GATE_TYPE_0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment