Commit bb42b57b by nakamura akane

Merge branch 'features/1.2.0_ogawa-y' into 'contract/kagome/1.2.1'

Features/1.2.0 ogawa y

See merge request !60
parents d26dffd4 9ccf8f07
......@@ -35,6 +35,7 @@ public class ABookKeys {
public static final String CMD_SHOW_RELATED_CONTENT = "showRelatedContent";
public static final String CMD_PAGE_NUM = "pageNum";
public static final String CMD_LABEL_PRINT = "labelPrint";
public static final String CMD_ABNORMALITY_REPORT = "abnormalityReport";
public static final String GPS_TYPE = "gpsType";
public static final String STATUS_CODE = "statusCode";
......@@ -54,6 +55,15 @@ public class ABookKeys {
public static final String LABEL_LOT_NUMBER_QR = "lotNumberQR";
// KAGOME対応 ラベル印刷パラメータend
// KAGOME対応Ph2 品質異常報告パラメータstart
public static final String UBNORMALITY_REPORT_OPERATION_ID = "operationId";
public static final String UBNORMALITY_REPORT_CONTENT_ID = "contentId";
public static final String UBNORMALITY_REPORT_LOT_NUMBER_7_FIGURE = "lotNumber7";
public static final String UBNORMALITY_REPORT_ITEM_NO = "itemNo";
public static final String UBNORMALITY_REPORT_FARM_NO = "farmNo";
public static final String UBNORMALITY_REPORT_SHIPPING_SOURCE_NO = "shippingSourceNo";
// KAGOME対応 品質異常報告パラメータend
// #32782 指示者テーブル関連削除 start
// TODO change TASK_DIRECTIONS 削除が必要
// public static final String TASK_DIRECTIONS = "taskReport";
......
......@@ -57,7 +57,7 @@
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:visibility="gone"
android:background="@drawable/ic_operation_home"
android:background="@drawable/ic_operation_home_wide"
android:contentDescription="@string/cont_desc" />
<ImageButton
android:id="@+id/btn_remote_pause"
......@@ -184,17 +184,12 @@
</RelativeLayout>
<FrameLayout
android:id="@+id/frameWebView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" >
<WebView
android:id="@+id/webView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp" />
<ProgressBar
android:id="@+id/refresh_prog"
style="?android:attr/progressBarStyleLarge"
......
......@@ -14,7 +14,10 @@ import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
import android.content.Context;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
public class ABVUIDataCache {
......@@ -44,6 +47,9 @@ public class ABVUIDataCache {
//コンテンツビューからコンテンツビューへ戻る時のコンテンツ情報リスト
public List<long[]> returnContentIdList = new ArrayList<>();
// KAGOME Ph2 検品→品質異常報告遷移時の引継ぎパラメータ
public Map<String, String> ubnormalityReportParam = new HashMap<>();
/**
* 最上部に表示されているActivityのクラス名、つまりユーザに見えているActivityのクラス名です。<br>
* Activityにfocusがあるかどうかをもとにアプリがバックグラウンドになったかを判断します。
......
package jp.agentec.abook.abv.ui.Interface;
/**
* Created by ogawa-y on 2020/01/21.
*/
public interface KeyActionCallback {
void keyActionCallback();
}
......@@ -14,7 +14,6 @@ import android.util.Xml;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
......@@ -41,7 +40,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
......@@ -1106,8 +1104,17 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
abookCheckParam.get(ABookKeys.LABEL_LOT_NUMBER),
abookCheckParam.get(ABookKeys.LABEL_OPERATION_NO),
abookCheckParam.get(ABookKeys.LABEL_LOT_NUMBER_QR));
} else if (mCmd.equals(ABookKeys.CMD_ABNORMALITY_REPORT)) { // KAGOME対応Ph2 検品からの品質異常報告
// 品質異常の初期値を設定
Map<String, String> param = getABVUIDataCache().ubnormalityReportParam;
param.put(ABookKeys.UBNORMALITY_REPORT_LOT_NUMBER_7_FIGURE, abookCheckParam.get(ABookKeys.UBNORMALITY_REPORT_LOT_NUMBER_7_FIGURE));
param.put(ABookKeys.UBNORMALITY_REPORT_ITEM_NO, abookCheckParam.get(ABookKeys.UBNORMALITY_REPORT_ITEM_NO));
param.put(ABookKeys.UBNORMALITY_REPORT_FARM_NO, abookCheckParam.get(ABookKeys.UBNORMALITY_REPORT_FARM_NO));
param.put(ABookKeys.UBNORMALITY_REPORT_SHIPPING_SOURCE_NO, abookCheckParam.get(ABookKeys.UBNORMALITY_REPORT_SHIPPING_SOURCE_NO));
// 品質異常へ遷移
ActivityHandlingHelper.getInstance().abnormalityReport(abookCheckParam.get(ABookKeys.UBNORMALITY_REPORT_OPERATION_ID),
abookCheckParam.get(ABookKeys.UBNORMALITY_REPORT_CONTENT_ID));
}
}
......
......@@ -31,7 +31,9 @@ import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.DeliveryType;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
......@@ -48,6 +50,7 @@ import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.MeetingDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
......@@ -94,6 +97,8 @@ import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.RuntimeUtil;
import jp.agentec.adf.util.StringUtil;
import static org.chromium.base.ThreadUtils.runOnUiThread;
// TODO: synchronizedメソッドは、currentActivityStackによるブロックに変更
// TODO: リファクタリング ActivityStackとActivity起動とMeeting関係をクラス分離
public class ActivityHandlingHelper extends ABookHelper implements RemoteObserver, ContentDownloadListener {
......@@ -1713,7 +1718,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
}
}
return context;
return null;
}
/**
......@@ -1731,4 +1736,36 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
public void setPreviousOfSettingActivity(ABVUIActivity activity) {
this.previousOfSettingActivity = activity;
}
/**
* KAGOME Ph2 検品→品質異常報告への遷移
*
* @param operationId
* @param contentId
*/
public void abnormalityReport(String operationId, String contentId) {
OperationDto dto = new OperationDto();
dto.operationId = Long.parseLong(operationId);
dto.contentId = Long.parseLong(contentId);
dto.operationType = OperationType.LIST;
dto.reportType = Constant.ReportType.Report;
for (final ABVAuthenticatedActivity activity : currentActivityStack) {
if (activity instanceof OperationListActivity) {
// 報告一覧の表示
((OperationListActivity) activity).startTaskDirectionOrReportView(dto);
// // 報告一覧のWebViewから報告の新規追加処理をキックする
// final ABVAuthenticatedActivity peekActivity = currentActivityStack.peek();
// if (peekActivity instanceof HTMLWebViewActivity) {
// ((HTMLWebViewActivity) peekActivity).addTaskReportFlg = true;
// //((HTMLWebViewActivity) peekActivity).kickAddTaskReport();
// return;
// }
}
}
// // 報告の新規追加が出来なかった場合例外をスロー
// throw new IllegalStateException("transitioning to abnormality report is failed.");
}
}
......@@ -13,25 +13,22 @@ import android.view.Window;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.adf.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
......@@ -40,27 +37,19 @@ import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.download.ContentDownloader;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.Interface.KeyActionCallback;
import jp.agentec.abook.abv.ui.viewer.view.CheckFormWebview;
//TODO: later 遠隔連動関連はContentView,NoPdfViewと共通しているので要集約
public class HTMLWebViewActivity extends ParentWebViewActivity {
public class HTMLWebViewActivity extends ParentWebViewActivity implements KeyActionCallback {
private static final String TAG = "HTMLWebViewActivity";
/**
......@@ -73,7 +62,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
private ImageButton downloadButton;
private int objectLogId;
private WebView webView;
private CheckFormWebview webView;
private JsInf jsInf = new JsInf();
private ValueCallback<Uri[]> mUploadMessage;
......@@ -97,10 +86,13 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
final String url = intent.getStringExtra("LINKURL"); // LinkURL
mOperationId = intent.getLongExtra(ABookKeys.OPERATION_ID, -1); // OperationId
// ***** WebViewセット
// KAGOME Ph2 WebView上のIMEキーボード入力をハンドリングするため、カスタムWebViewに変更
FrameLayout frameLayout = findViewById(R.id.frameWebView);
this.webView = new CheckFormWebview(this);
frameLayout.addView(webView, new LinearLayout.LayoutParams(FP, FP));
this.webView.setEnterCallback(this);
webView = (WebView) findViewById(R.id.webView2);
webView.setVisibility(View.VISIBLE);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
if (Logger.isDebugEnabled()) {
......@@ -282,6 +274,11 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
btnWebForward.setEnabled(false);
}
isPageFinished = true;
Map<String, String> addTaskReportInitParam = getABVUIDataCache().ubnormalityReportParam;
if (addTaskReportInitParam.size() > 0) {
kickAddTaskReport(addTaskReportInitParam);
}
}
@Override
......@@ -664,4 +661,38 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
mUploadMessage = null;
}
public void kickAddTaskReport(Map<String, String> addTaskReportInitParam) {
// キャッシュからパラメータを受け取りjsの関数に引数として渡す
JSONObject json = new JSONObject();
json.put(ABookKeys.UBNORMALITY_REPORT_LOT_NUMBER_7_FIGURE, addTaskReportInitParam.get(ABookKeys.UBNORMALITY_REPORT_LOT_NUMBER_7_FIGURE));
json.put(ABookKeys.UBNORMALITY_REPORT_ITEM_NO, addTaskReportInitParam.get(ABookKeys.UBNORMALITY_REPORT_ITEM_NO));
json.put(ABookKeys.UBNORMALITY_REPORT_FARM_NO, addTaskReportInitParam.get(ABookKeys.UBNORMALITY_REPORT_FARM_NO));
json.put(ABookKeys.UBNORMALITY_REPORT_SHIPPING_SOURCE_NO, addTaskReportInitParam.get(ABookKeys.UBNORMALITY_REPORT_SHIPPING_SOURCE_NO));
final String param = json.toString();
runOnUiThread(new Runnable() {
@Override
public void run() {
Logger.i(TAG, String.format("javascript:CHK_L.addTaskReportWithInitParam('%s')", param));
webViewLoadUrl(String.format("javascript:CHK_L.addTaskReportWithInitParam('%s')", param));
}
});
}
@Override
public void keyActionCallback() {
doEnterEvent();
}
@Override
protected void doEnterEvent() {
webView.post(new Runnable() {
@Override
public void run() {
Logger.i(TAG, "javascript:CHK.notifyMoveForcus()");
webViewLoadUrl("javascript:CHK.notifyMoveForcus()");
}
});
}
}
......@@ -459,4 +459,22 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
public void callViewLoadUrl(String url) {
webViewLoadUrl(url);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction()==KeyEvent.ACTION_DOWN || event.getAction()==KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
// KAGOME Ph2 WebView表示時に戻るボタンの誤打で報告が消えることがあるため非活性に変更
return true;
case KeyEvent.KEYCODE_ENTER:
// KAGOME Ph2 バーコード読み取り時のEnterキー入力イベントをハンドリング
doEnterEvent();
break;
}
}
return super.dispatchKeyEvent(event);
}
protected void doEnterEvent() {}
}
package jp.agentec.abook.abv.ui.viewer.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
import android.webkit.WebView;
import jp.agentec.abook.abv.ui.Interface.KeyActionCallback;
/**
* Created by ogawa-y on 2020/01/21.
*/
public class CheckFormWebview extends WebView {
private KeyActionCallback enterCallback;
public CheckFormWebview(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); }
public CheckFormWebview(Context context, AttributeSet attrs) { super(context, attrs); }
public CheckFormWebview(Context context) { super(context); }
public void setEnterCallback(KeyActionCallback function){ this.enterCallback = function; }
@Override public InputConnection onCreateInputConnection(EditorInfo ei) {
InputConnection input = super.onCreateInputConnection(ei);
if(input == null){
return null;
}
return new MyConnection(input);
}
private class MyConnection extends InputConnectionWrapper
{
public MyConnection(InputConnection wrapped) {
super(wrapped, false);
}
// WebView上でIMEキーボードのアクションがあった場合のハンドリングを行う
@Override public boolean performEditorAction(int action) {
if(action == EditorInfo.IME_ACTION_GO || action == EditorInfo.IME_ACTION_NEXT) {
if(enterCallback != null) {
enterCallback.keyActionCallback();
}
}
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