Commit 3b4b2f25 by Kim Peace

Merge branch…

Merge branch 'features/1.2.360_develop_#ABCOMM233_Offline時ABCommを開いたらPlaceholder画面を表示' into 'features/1.2.360_develop'

Modify to display placeholder when not connected network

See merge request !85
parents 502112c3 1d256d23
...@@ -32,8 +32,10 @@ import java.io.File; ...@@ -32,8 +32,10 @@ import java.io.File;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.PushMessageDto; import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
...@@ -48,6 +50,8 @@ import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; ...@@ -48,6 +50,8 @@ import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity; import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import static org.chromium.net.NetError.ERR_FAILED;
/** /**
* Created by AIS-NB-048 on 2019/07/31. * Created by AIS-NB-048 on 2019/07/31.
*/ */
...@@ -57,6 +61,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -57,6 +61,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private String chatWebviewUrl; private String chatWebviewUrl;
private final String TAG = "ChatWebviewActivity"; private final String TAG = "ChatWebviewActivity";
private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/index.html";
//AISDevelop //AISDevelop
private JsInf jsInf = new JsInf(); private JsInf jsInf = new JsInf();
...@@ -81,18 +88,26 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -81,18 +88,26 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
setContentView(R.layout.chat_webview); setContentView(R.layout.chat_webview);
Intent intent = getIntent(); Intent intent = getIntent();
//ネットワークがない場合専用のページを表示。
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
chatWebviewUrl = intent.getStringExtra("chatWebviewUrl");
} else {
chatWebviewUrl = "file:///android_asset/chat/public/index.html";
}
sid = intent.getStringExtra("sid"); sid = intent.getStringExtra("sid");
roomId = intent.getLongExtra("roomId", 0); roomId = intent.getLongExtra("roomId", 0);
roomName = intent.getStringExtra("roomName"); roomName = intent.getStringExtra("roomName");
loginId = intent.getStringExtra("loginId"); loginId = intent.getStringExtra("loginId");
shopName = intent.getStringExtra("shopName"); shopName = intent.getStringExtra("shopName");
//ネットワークがない場合専用のページを表示。
chatWebviewUrl = NETWORK_ERROR_PLACE_HOLDER;
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
try {
if (AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).checkSid(sid)) {
chatWebviewUrl = intent.getStringExtra("chatWebviewUrl");
}
} catch (Exception e) {
Logger.d("SID_CHECK_ERROR");
}
} else {
Logger.d("DEVICE_NOT_CONNECTED_NETWORK:");
}
mChatWebView = findViewById(R.id.chatWebview2); mChatWebView = findViewById(R.id.chatWebview2);
mChatWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); //オーバースクロールしない。 mChatWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); //オーバースクロールしない。
mChatWebView.setVerticalScrollBarEnabled(false); //スクロールバーを消す。 mChatWebView.setVerticalScrollBarEnabled(false); //スクロールバーを消す。
...@@ -307,7 +322,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -307,7 +322,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@Override @Override
public void onReceivedError(WebView view, int errorCode, public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) { String description, String failingUrl) {
Logger.d("WEB_VIEW_TEST", "error code:" + errorCode + " - " + description);
if (errorCode == ERR_FAILED) {
mChatWebView.removeView(view);
view.removeAllViews();
mChatWebView.reload();
mChatWebView.loadUrl(NETWORK_ERROR_PLACE_HOLDER);
}
Logger.d("WEB_VIEW_ERROR", "error code:" + errorCode + " - " + description);
} }
@Override @Override
......
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