Commit 0a777699 by NGUYEN HOANG SON

Merge branch 'features/1.4.400_49464' into features/1.4.400

* features/1.4.400_49464:
  implement CMD 'saveJson'
parents 92ba5522 9ba619f9
......@@ -104,6 +104,7 @@ public class ABookKeys {
public static final String REFRESH_CONTENT = "refreshContent";
public static final String RESET_SEARCH = "resetSearch";
public static final String CHANGE_OPERATION_GROUP_MASTER = "changeOperationGroupMaster";
public static final String SAVE_JSON = "saveJson";
}
......@@ -239,4 +240,8 @@ public class ABookKeys {
public static final String CMD_GET_DEVICE_INFO = "getDeviceInfo"; // CMSのインターフェースのパラメータ:cmd
public static final String TASK_DEVICE_TYPE = "deviceType"; // CMSのインターフェースのパラメータ:devicetype
public static final String TASK_QUESTION_ID = "qid"; // CMSのインターフェースのパラメータ:qid
public static final String JSON_NAME = "jsonName";
public static final String JSON_DATA = "jsonData";
}
......@@ -16,6 +16,7 @@ import android.view.Window;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
......@@ -168,6 +169,17 @@ public class OperationListActivity extends ABVUIActivity {
mCheckWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); //オーバースクロールしない。
mCheckWebView.setVerticalScrollBarEnabled(false); //スクロールバーを消す。
mCheckWebView.addJavascriptInterface(jsInf, "android");
mCheckWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//fix FileUriExposedException error when webview load url with file://
// if (Uri.parse(url).getScheme().equals("file")) {
// view.loadUrl(url);
// return true;
// }
return super.shouldOverrideUrlLoading(view, url);
}
});
if (Logger.isDebugEnabled()) {
mCheckWebView.setWebContentsDebuggingEnabled(true);
}
......@@ -392,6 +404,11 @@ public class OperationListActivity extends ABVUIActivity {
}
});
break;
case ABookKeys.CMD_KEY.SAVE_JSON:
if (jsonParam.has(ABookKeys.JSON_NAME)) {
saveJson(jsonParam.getString(ABookKeys.JSON_NAME), jsonParam.getString(ABookKeys.JSON_DATA));
}
break;
}
}
}
......@@ -1732,4 +1749,17 @@ public class OperationListActivity extends ABVUIActivity {
});
}
}
private void saveJson(String jsonName, String jsonData) {
if (StringUtil.isNullOrEmpty(jsonName)) {
Logger.d(TAG,"saveJson:jsonName is null or empty");
return;
}
String filePath = getCacheDir().getAbsolutePath() + "/" + jsonName;
try {
FileUtil.createFile(filePath, jsonData);
} catch (IOException e) {
};
}
}
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