Commit df49fae1 by Kazuyuki Hida

JSとのデータの受け渡しはしていないが、ダミーの値でダッシュボードが表示されるところまでできた。

parent 76af564a
......@@ -36,6 +36,7 @@ public class ABookKeys {
public static final String CMD_PAGE_NUM = "pageNum";
public static final String CMD_LOCK_REPORT = "lockReport";
public static final String CMD_UNLOCK_REPORT = "unlockReport";
public static final String CMD_GET_REPORT_LIST = "getReportList";
public static final String GPS_TYPE = "gpsType";
public static final String STATUS_CODE = "statusCode";
......
......@@ -5,7 +5,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
......@@ -15,11 +14,18 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import java.util.HashMap;
import java.util.Map;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.viewer.view.CheckFormWebview;
import static jp.agentec.abook.abv.bl.common.constant.ABookCommConstants.DASHBOARD_URL;
import static jp.agentec.abook.abv.bl.common.constant.ABookKeys.CMD_GET_REPORT_LIST;
import static jp.agentec.abook.abv.bl.common.constant.ABookKeys.CMD_LOCK_REPORT;
import static jp.agentec.abook.abv.bl.common.constant.ABookKeys.CMD_UNLOCK_REPORT;
public class DashboardActivity extends OperationActivity {
private static final String TAG = "DashboardActivity";
......@@ -88,7 +94,7 @@ public class DashboardActivity extends OperationActivity {
}
initSettings(webView.getSettings());
webView.setWebChromeClient(new ChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.setWebViewClient(new ViewClient());
// webView.addJavascriptInterface(jsInf, "android");
Logger.d(TAG, "loadUrl: " + DASHBOARD_URL);
......@@ -125,13 +131,6 @@ public class DashboardActivity extends OperationActivity {
}
}
}
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
FileChooserParams fileChooserParams) {
Logger.i(TAG, "oepnFile acceptType : %s", fileChooserParams.getAcceptTypes()[0]);
return false;
}
}
// private class JsInf {
......@@ -175,4 +174,69 @@ public class DashboardActivity extends OperationActivity {
// commonAttachedDataUrl(taskKey, data);
// }
// }
private class ViewClient extends WebViewClient {
@SuppressWarnings("deprecation")
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Logger.e(TAG, "onReceivedError errorCode=%s, description=%s, failingUrl=%s", errorCode, description, failingUrl);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Logger.v(TAG, "shouldOverrideUrlLoading: %s", url);
if (url.startsWith("abook")) {
final Uri uri = Uri.parse(url);
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
return checkApiLoding(uri);
}
return true;
}
return false;
}
}
private boolean checkApiLoding(Uri uri) {
Map<String, String> abookCheckParam = new HashMap<>();
for (String key : uri.getQueryParameterNames()) {
abookCheckParam.put(key, uri.getQueryParameter(key));
}
String cmd = abookCheckParam.get(ABookKeys.CMD);
if (cmd == null) {
return false;
}
switch (cmd) {
case CMD_GET_REPORT_LIST: {
return getReportList();
}
case CMD_LOCK_REPORT: {
return lockReport();
}
case CMD_UNLOCK_REPORT: {
return unlockReport();
}
}
return false;
}
private boolean getReportList() {
//todo
return true;
}
private boolean lockReport() {
//todo
return true;
}
private boolean unlockReport() {
//todo
return true;
}
}
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