Commit e99ccc62 by Jeong Gilmo

#32861 作業情報追加(Android)

- CMSとの連携部分の修正
parent 970ee001
...@@ -132,7 +132,7 @@ public class ABVEnvironment { ...@@ -132,7 +132,7 @@ public class ABVEnvironment {
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
// 作業報告レベル(taskReportLevel)によってディレクトリを追加する // 作業報告レベル(taskReportLevel)によってディレクトリを追加する
public static final String TaskReportLevelDir = "/%s"; public static final String TaskReportLevelDir = "/%s";
public static final String SavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%s"; public static final String SavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir;
public static final String RoutineTaskSavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%d/%s/%s"; public static final String RoutineTaskSavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%d/%s/%s";
public static final String OperationTaskKeyReportSendDirFormat = OperationTaskKeyDirFormat + TaskReportLevelDir + "/reportSend/%d"; public static final String OperationTaskKeyReportSendDirFormat = OperationTaskKeyDirFormat + TaskReportLevelDir + "/reportSend/%d";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormat = OperationTaskKeyDirFormat + "/reportSend/%d/%s/%d"; public static final String OperationTaskKeyRoutineTaskReportSendDirFormat = OperationTaskKeyDirFormat + "/reportSend/%d/%s/%d";
...@@ -600,7 +600,7 @@ public class ABVEnvironment { ...@@ -600,7 +600,7 @@ public class ABVEnvironment {
* @return ファイルパス * @return ファイルパス
*/ */
public String getSavedOzFileTaskReportLevelPath(long operationId, String taskKey, String fileName, String taskReportLevel) { public String getSavedOzFileTaskReportLevelPath(long operationId, String taskKey, String fileName, String taskReportLevel) {
return String.format(SavedOzFileFormat, rootDirectory, operationId, taskKey, taskReportLevel, "report", fileName); return String.format(SavedOzFileFormat, rootDirectory, operationId, taskKey, taskReportLevel, fileName);
} }
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
......
...@@ -863,6 +863,13 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -863,6 +863,13 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
int taskReportId = 0; int taskReportId = 0;
String reportStartDate = ""; String reportStartDate = "";
// #32861 作業情報追加 start
mAddReport = true;
if (abookCheckParam.containsKey(ABookKeys.ADD_REPORT)) {
mAddReport = Integer.parseInt(abookCheckParam.get(ABookKeys.ADD_REPORT)) > 0 ? true : false;
}
// #32861 作業情報追加 end
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) { if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
taskReportId = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_ID)); taskReportId = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE); reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE);
...@@ -917,7 +924,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -917,7 +924,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
final boolean isError = (boolean)ret; final boolean isError = (boolean)ret;
closeProgressPopup(); closeProgressPopup();
// #32861 作業情報追加 start // #32861 作業情報追加 start
afterABookCheckApi(mCmd, mTaskKey, isNetWorkError(isError), "", null, isOperationPdf()); if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
ABookKeys.CMD_DELETE_TASK_REPORT, ABookKeys.CMD_CANCEL_TASK_REPORT) && !mAddReport) {
finish();
}else {
afterABookCheckApi(mCmd, mTaskKey, 0, "", null, isOperationPdf());
}
// #32861 作業情報追加 end // #32861 作業情報追加 end
return null; return null;
} }
...@@ -951,17 +963,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -951,17 +963,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, true, true, mReportFileName); ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, true, true, mReportFileName);
} else if (mCmd.equals(ABookKeys.CMD_SHOW_REPORT_OZD)) { } else if (mCmd.equals(ABookKeys.CMD_SHOW_REPORT_OZD)) {
mReportFileName = abookCheckParam.get(ABookKeys.REPORT_FILE_NAME); mReportFileName = abookCheckParam.get(ABookKeys.REPORT_FILE_NAME);
// #32861 作業情報追加 start // #32926 作業報告画面改善 start
if (abookCheckParam.containsKey(ABookKeys.LOCAL_SAVE)) { if (abookCheckParam.containsKey(ABookKeys.LOCAL_SAVE)) {
mLocalSave = Integer.parseInt(abookCheckParam.get(ABookKeys.LOCAL_SAVE)) > 0 ? true : false; mLocalSave = Integer.parseInt(abookCheckParam.get(ABookKeys.LOCAL_SAVE)) > 0 ? true : false;
} }
if (abookCheckParam.containsKey(ABookKeys.ADD_REPORT)) {
mAddReport = Integer.parseInt(abookCheckParam.get(ABookKeys.ADD_REPORT)) > 0 ? true : false;
}
// #32926 作業報告画面改善 start
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, false, taskReportId, reportStartDate, mReportFileName, mLocalSave, mAddReport, taskReportLevel); ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, false, taskReportId, reportStartDate, mReportFileName, mLocalSave, mAddReport, taskReportLevel);
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
// #32861 作業情報追加 end
} else if (mCmd.equals(ABookKeys.CMD_PREVIEW_REPORT_OZD)) { } else if (mCmd.equals(ABookKeys.CMD_PREVIEW_REPORT_OZD)) {
mReportFileName = abookCheckParam.get(ABookKeys.REPORT_FILE_NAME); mReportFileName = abookCheckParam.get(ABookKeys.REPORT_FILE_NAME);
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
...@@ -1090,9 +1097,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1090,9 +1097,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
Logger.i(TAG, String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message)); Logger.i(TAG, String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message));
webViewLoadUrl(String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message)); webViewLoadUrl(String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message));
} }
// #32861 作業情報追加 start
doneProcess(result); // HTML側の処理が終わった後の処理を行う
// #32861 作業情報追加 end
} }
}); });
} }
...@@ -1212,8 +1216,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1212,8 +1216,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override @Override
public void run () { public void run () {
// 実行Javascript - 保存 // 実行Javascript - 保存
webViewLoadUrl("javascript:CHK.saveOzReport()"); ActivityHandlingHelper.getInstance().callOzdHtmlScript("javascript:CHK.saveOzReport()");
Logger.d(TAG, "ozdSaveProcess"); Logger.d(TAG, "ozdSaveProcess");
doneProcess();
} }
}); });
} }
...@@ -1224,7 +1229,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1224,7 +1229,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override @Override
public void run () { public void run () {
// 実行Javascript - 一時保存 // 実行Javascript - 一時保存
webViewLoadUrl("javascript:CHK.localSaveOzReport()"); ActivityHandlingHelper.getInstance().callOzdHtmlScript("javascript:CHK.localSaveOzReport()");
Logger.d(TAG, "ozdLocalSaveProcess"); Logger.d(TAG, "ozdLocalSaveProcess");
} }
}); });
...@@ -1236,7 +1241,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1236,7 +1241,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override @Override
public void run () { public void run () {
// 実行Javascript - 閉じる // 実行Javascript - 閉じる
webViewLoadUrl("javascript:CHK.cancelOzReport()"); ActivityHandlingHelper.getInstance().callOzdHtmlScript("javascript:CHK.cancelOzReport()");
Logger.d(TAG, "ozdCancelProcess"); Logger.d(TAG, "ozdCancelProcess");
} }
}); });
...@@ -1248,8 +1253,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1248,8 +1253,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override @Override
public void run () { public void run () {
// 実行Javascript - 閉じる // 実行Javascript - 閉じる
webViewLoadUrl("javascript:CHK.deleteOzReport()"); ActivityHandlingHelper.getInstance().callOzdHtmlScript("javascript:CHK.deleteOzReport()");
Logger.d(TAG, "ozdDeleteProcess"); Logger.d(TAG, "ozdDeleteProcess");
doneProcess();
} }
}); });
} }
...@@ -1260,7 +1266,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1260,7 +1266,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
public void doProcess() { public void doProcess() {
// #32861 作業情報追加 start
// 押したボタンによってHTML側の処理を行う // 押したボタンによってHTML側の処理を行う
if (this instanceof CheckOZDViewActivity) { if (this instanceof CheckOZDViewActivity) {
if (mButtonStatus == R.id.btn_close) { if (mButtonStatus == R.id.btn_close) {
...@@ -1270,35 +1275,24 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1270,35 +1275,24 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
ozdLocalSaveProcess(); // 一時保存 ozdLocalSaveProcess(); // 一時保存
} else if (mButtonStatus == R.id.btn_save) { } else if (mButtonStatus == R.id.btn_save) {
ozdSaveProcess(); // 保存 ozdSaveProcess(); // 保存
doneProcess(1);
} else if (mButtonStatus == R.id.btn_delete) { } else if (mButtonStatus == R.id.btn_delete) {
ozdDeleteProcess(); // 削除 ozdDeleteProcess(); // 削除
} }
} }
// #32861 作業情報追加 end
} }
public void doneProcess(int isError) { public void doneProcess() {
// 押したボタンによってHTML側の処理が終わった後の処理を行う // 押したボタンによってHTML側の処理が終わった後の処理を行う
if (this instanceof CheckOZDViewActivity) { if (this instanceof CheckOZDViewActivity) {
if (mButtonStatus == R.id.btn_save || mButtonStatus == R.id.btn_close){ if (mButtonStatus == R.id.btn_save || mButtonStatus == R.id.btn_close || mButtonStatus == R.id.btn_delete){
// 作業追加区分ありの場合 // 作業追加区分ありの場合
if (mAddReport) { if (mAddReport) {
super.finish(); super.finish();
if (isError == 0) ozdCancelProcess(); // 通信成功の場合だけHTML側の処理を行う
} else { } else {
goToMain(); // 一覧画面に遷移 goToMain(); // 一覧画面に遷移
} }
} }
} }
} }
// ネットワークの非接続の場合の処理(OZ作業報告だけ)
protected int isNetWorkError(boolean isError) {
if (this instanceof CheckOZDViewActivity) {
return isError ? 0 : 1;
}
return 0;
}
// #32861 作業情報追加 end // #32861 作業情報追加 end
} }
...@@ -1594,4 +1594,19 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1594,4 +1594,19 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
@Override @Override
public void onAuthenticationFailed() { public void onAuthenticationFailed() {
} // ignore : not come here } // ignore : not come here
// #32861 start
// 上位のClassからHTML側のコールを行うための処理
public void callOzdHtmlScript(String url) {
if (!currentActivityStack.isEmpty()) {
for (final ABVAuthenticatedActivity activity : currentActivityStack) {
final ABVAuthenticatedActivity a = activity;
final String scriptUrl = url;
if (activity instanceof HTMLWebViewActivity) {
((HTMLWebViewActivity) activity).callViewLoadUrl(scriptUrl);
}
}
}
}
// #32861 end
} }
...@@ -552,7 +552,7 @@ public class CheckOZDViewActivity extends ABVContentViewActivity { ...@@ -552,7 +552,7 @@ public class CheckOZDViewActivity extends ABVContentViewActivity {
param.append("export.mode=silent#"); param.append("export.mode=silent#");
param.append("export.filename=" + FileUtil.getFilenameWithoutExt(mSaveOzdTempFileName) + "#"); param.append("export.filename=" + FileUtil.getFilenameWithoutExt(mSaveOzdTempFileName) + "#");
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
param.append("export.path=" + OzdFileHelper.getTempTaskDirPath(contentId, mTaskKey) + "/" + mTaskReportLevel + "#"); param.append("export.path=" + OzdFileHelper.getTempTaskDirPath(contentId, mTaskKey) + "#"); //OzdFileHelper.getTempTaskDirPath(contentId, mTaskKey) + "/" + mTaskReportLevel + "#");
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
param.append("export.confirmsave=false#"); param.append("export.confirmsave=false#");
param.append("export.format=ozd"); param.append("export.format=ozd");
......
...@@ -63,7 +63,9 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; ...@@ -63,7 +63,9 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
public class HTMLWebViewActivity extends ParentWebViewActivity { public class HTMLWebViewActivity extends ParentWebViewActivity {
private static final String TAG = "HTMLWebViewActivity"; private static final String TAG = "HTMLWebViewActivity";
/** Called when the activity is first created. */ /**
* Called when the activity is first created.
*/
boolean forwardCheckFlg = false; boolean forwardCheckFlg = false;
boolean backCheckFlg = false; boolean backCheckFlg = false;
...@@ -74,6 +76,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -74,6 +76,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
private WebView webView; private WebView webView;
private JsInf jsInf = new JsInf(); private JsInf jsInf = new JsInf();
private ValueCallback<Uri[]> mUploadMessage; private ValueCallback<Uri[]> mUploadMessage;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
Logger.i(TAG, "onCreate"); Logger.i(TAG, "onCreate");
...@@ -164,11 +167,11 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -164,11 +167,11 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) { switch (position) {
case 0 : case 0:
// お気に入り // お気に入り
contentLogic.setFavoriteContent(getContentId(), !isExist); contentLogic.setFavoriteContent(getContentId(), !isExist);
break; break;
default : default:
break; break;
} }
mShowedPopupWindow.dismiss(); mShowedPopupWindow.dismiss();
...@@ -278,7 +281,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -278,7 +281,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
} }
@Override @Override
public void onReceivedError (WebView view, int errorCode, String description, String failingUrl) { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Logger.e(TAG, "onReceivedError errorCode=%s, description=%s, failingUrl=%s", errorCode, description, failingUrl); Logger.e(TAG, "onReceivedError errorCode=%s, description=%s, failingUrl=%s", errorCode, description, failingUrl);
} }
...@@ -342,8 +345,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -342,8 +345,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
Logger.d(TAG, "ReloadUrl"); Logger.d(TAG, "ReloadUrl");
if (latitude != null && longitude != null) { if (latitude != null && longitude != null) {
webView.loadUrl(url + "&reload=true&latitude=" + latitude + "&longitude=" + longitude); webView.loadUrl(url + "&reload=true&latitude=" + latitude + "&longitude=" + longitude);
} } else {
else {
webView.loadUrl(url + "&reload=true"); webView.loadUrl(url + "&reload=true");
} }
} }
...@@ -359,7 +361,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -359,7 +361,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
ContentDownloader.getInstance().download(contentId); ContentDownloader.getInstance().download(contentId);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.download_start, Toast.LENGTH_SHORT); ABVToastUtil.showMakeText(getApplicationContext(), R.string.download_start, Toast.LENGTH_SHORT);
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG, "Download failed." ,e); Logger.e(TAG, "Download failed.", e);
downloadButton.setEnabled(true); downloadButton.setEnabled(true);
handleErrorMessageToast(e); handleErrorMessageToast(e);
} }
...@@ -369,8 +371,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -369,8 +371,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
downloadButton.setVisibility(View.VISIBLE); downloadButton.setVisibility(View.VISIBLE);
if (isUpdate) { if (isUpdate) {
downloadButton.setBackgroundResource(R.drawable.btn_update); downloadButton.setBackgroundResource(R.drawable.btn_update);
} } else {
else {
downloadButton.setBackgroundResource(R.drawable.btn_download); downloadButton.setBackgroundResource(R.drawable.btn_download);
} }
} }
...@@ -411,7 +412,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -411,7 +412,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
historyListBtn.setVisibility(View.GONE); historyListBtn.setVisibility(View.GONE);
if(isLinkedContent) { if (isLinkedContent) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId); ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ContentJSON.KEY_MOVIE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_MUSIC_TYPE.equals(contentDto.contentType) if (ContentJSON.KEY_MOVIE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_MUSIC_TYPE.equals(contentDto.contentType)
|| ContentJSON.KEY_PANO_IMAGE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_PANO_MOVIE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_PANO_IMAGE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_PANO_MOVIE_TYPE.equals(contentDto.contentType)
...@@ -453,8 +454,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -453,8 +454,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
Logger.d(TAG, "existSetLocation=%s", ret); Logger.d(TAG, "existSetLocation=%s", ret);
if (ret != null && ret.equals("true")) { // setLocationメソッドが存在する場合、ページ読み込み完了とみなす if (ret != null && ret.equals("true")) { // setLocationメソッドが存在する場合、ページ読み込み完了とみなす
isPageFinished = true; isPageFinished = true;
} } else { // 存在しない場合、ページ読み込み未完了とみなし1秒後に再度呼出しを繰り返す
else { // 存在しない場合、ページ読み込み未完了とみなし1秒後に再度呼出しを繰り返す
handler.postDelayed(new Runnable() { handler.postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -478,11 +478,11 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -478,11 +478,11 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
} }
} }
}); });
} } else {
else {
finishActivity(); finishActivity();
} }
} }
@JavascriptInterface @JavascriptInterface
public void getAttachedDataUrl(String data) { public void getAttachedDataUrl(String data) {
commonAttachedDataUrl(data); commonAttachedDataUrl(data);
...@@ -671,7 +671,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -671,7 +671,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
} }
@Override @Override
protected void webViewLoadUrl(String url){ protected void webViewLoadUrl(String url) {
if (webView != null) { if (webView != null) {
webView.loadUrl(url); webView.loadUrl(url);
} }
...@@ -722,4 +722,11 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -722,4 +722,11 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
} }
mUploadMessage = null; mUploadMessage = null;
} }
// #32861 start
// 上位のClassからHTML側のコールを行うための処理
public void callViewLoadUrl(String url) {
webViewLoadUrl(url);
}
// #32861 end
} }
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