Commit ae5457df by Lee Jaebin

#37367 HT付きスマートデバイスでのチェック項目遷移

parent 0c522b34
...@@ -193,17 +193,12 @@ ...@@ -193,17 +193,12 @@
</RelativeLayout> </RelativeLayout>
<FrameLayout <FrameLayout
android:id="@+id/frameWebView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" > android:orientation="vertical" >
<WebView
android:id="@+id/webView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp" />
<ProgressBar <ProgressBar
android:id="@+id/refresh_prog" android:id="@+id/refresh_prog"
style="?android:attr/progressBarStyleLarge" style="?android:attr/progressBarStyleLarge"
......
...@@ -10,6 +10,7 @@ import android.view.View.OnClickListener; ...@@ -10,6 +10,7 @@ import android.view.View.OnClickListener;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.inputmethod.EditorInfo;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
...@@ -20,7 +21,9 @@ import android.webkit.WebView; ...@@ -20,7 +21,9 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
...@@ -58,6 +61,8 @@ import jp.agentec.abook.abv.ui.common.constant.ErrorMessage; ...@@ -58,6 +61,8 @@ 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.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
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.view.CheckFormWebview;
import jp.agentec.abook.abv.ui.viewer.view.CheckFormXWalkWebview;
//TODO: later 遠隔連動関連はContentView,NoPdfViewと共通しているので要集約 //TODO: later 遠隔連動関連はContentView,NoPdfViewと共通しているので要集約
public class HTMLWebViewActivity extends ParentWebViewActivity { public class HTMLWebViewActivity extends ParentWebViewActivity {
...@@ -100,7 +105,18 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -100,7 +105,18 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
// ***** WebViewセット // ***** WebViewセット
webView = (WebView) findViewById(R.id.webView2); FrameLayout frameLayout = findViewById(R.id.frameWebView);
// WebView上のIMEキーボード入力をハンドリングするため、カスタムWebViewに変更
this.webView = new CheckFormWebview(this, new CheckFormWebview.KeyActionCallback() {
@Override
public void keyActionCallback(int editorInfoAction) {
if (editorInfoAction == EditorInfo.IME_ACTION_GO || editorInfoAction == EditorInfo.IME_ACTION_NEXT) {
// キーボードの次ボタン検知
doEnterEvent();
}
}
});
frameLayout.addView(webView, new LinearLayout.LayoutParams(FP, FP));
webView.setVisibility(View.VISIBLE); webView.setVisibility(View.VISIBLE);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
if (Logger.isDebugEnabled()) { if (Logger.isDebugEnabled()) {
...@@ -535,27 +551,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -535,27 +551,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
finishWebView(); finishWebView();
} }
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return super.onKeyDown(keyCode, event);
}
@Override @Override
protected void finishActivity() { protected void finishActivity() {
......
package jp.agentec.abook.abv.ui.viewer.activity; package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
...@@ -9,6 +8,7 @@ import android.view.MotionEvent; ...@@ -9,6 +8,7 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.inputmethod.EditorInfo;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.AdapterView; import android.widget.AdapterView;
...@@ -46,9 +46,7 @@ import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification; ...@@ -46,9 +46,7 @@ import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContentDto; import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic; import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil; import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; 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;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode; import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
...@@ -57,6 +55,8 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil; ...@@ -57,6 +55,8 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil; import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
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.view.CheckFormXWalkWebview;
/** /**
* Created by leej on 2018/04/17. * Created by leej on 2018/04/17.
...@@ -70,7 +70,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity { ...@@ -70,7 +70,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
private ImageButton reloadButton; private ImageButton reloadButton;
private ImageButton downloadButton; private ImageButton downloadButton;
private int objectLogId; private int objectLogId;
private XWalkView webView; private CheckFormXWalkWebview webView;
private HTMLXWalkWebViewActivity.JsInf jsInf = new HTMLXWalkWebViewActivity.JsInf(); private HTMLXWalkWebViewActivity.JsInf jsInf = new HTMLXWalkWebViewActivity.JsInf();
...@@ -101,9 +101,17 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity { ...@@ -101,9 +101,17 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
// ***** WebViewセット // ***** WebViewセット
// WebView上のIMEキーボード入力をハンドリングするため、カスタムWebViewに変更
webView = new XWalkView(this);
xWalkLayout = (FrameLayout) findViewById(R.id.xWalkLayout); xWalkLayout = (FrameLayout) findViewById(R.id.xWalkLayout);
webView = new CheckFormXWalkWebview(this, new CheckFormXWalkWebview.KeyActionCallback() {
@Override
public void keyActionCallback(int editorInfoAction) {
if (editorInfoAction == EditorInfo.IME_ACTION_GO || editorInfoAction == EditorInfo.IME_ACTION_NEXT) {
// キーボードの次ボタン検知
doEnterEvent();
}
}
});
xWalkLayout.setVisibility(View.VISIBLE); xWalkLayout.setVisibility(View.VISIBLE);
xWalkLayout.addView(webView, new ViewGroup.LayoutParams(WC, WC)); xWalkLayout.addView(webView, new ViewGroup.LayoutParams(WC, WC));
webView.setVerticalFadingEdgeEnabled(false); webView.setVerticalFadingEdgeEnabled(false);
...@@ -573,27 +581,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity { ...@@ -573,27 +581,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
} }
@Override @Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return super.onKeyDown(keyCode, event);
}
@Override
protected void finishActivity() { protected void finishActivity() {
setResult(RESULT_OK, new Intent()); setResult(RESULT_OK, new Intent());
finish(); finish();
......
...@@ -4,6 +4,7 @@ import android.app.Activity; ...@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.net.Uri; import android.net.Uri;
import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
...@@ -217,6 +218,29 @@ public class ParentWebViewActivity extends ABVCheckContentViewActivity { ...@@ -217,6 +218,29 @@ public class ParentWebViewActivity extends ABVCheckContentViewActivity {
} }
@Override @Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return super.onKeyDown(keyCode, event);
}
@Override
protected void onDestroy() { protected void onDestroy() {
Logger.d(TAG, "onDestroy"); Logger.d(TAG, "onDestroy");
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) { if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
...@@ -430,4 +454,28 @@ public class ParentWebViewActivity extends ABVCheckContentViewActivity { ...@@ -430,4 +454,28 @@ public class ParentWebViewActivity extends ABVCheckContentViewActivity {
webViewLoadUrl(url); webViewLoadUrl(url);
} }
// キーボードのエンターを検知してJavascriptを実行
protected void doEnterEvent() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Logger.i(TAG, "javascript:CHK.notifyMoveForcus()");
webViewLoadUrl("javascript:CHK.notifyMoveForcus()");
}
});
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Enterキー入力イベントのみ検知、他の検知はonKeyUpで行う
if (event.getAction()==KeyEvent.ACTION_DOWN || event.getAction()==KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_ENTER:
// バーコード読み取り時のEnterキー入力イベントをハンドリング
doEnterEvent();
break;
}
}
return super.dispatchKeyEvent(event);
}
} }
package jp.agentec.abook.abv.ui.viewer.view;
import android.content.Context;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
import android.webkit.WebView;
/**
* WebViewのキーボード検知するクラス
*/
public class CheckFormWebview extends WebView {
private Context mContext;
private KeyActionCallback mKeyActionCallback;
public interface KeyActionCallback {
void keyActionCallback(int editorInfoAction);
}
public CheckFormWebview(Context context, KeyActionCallback callback) {
super(context);
mContext = context;
mKeyActionCallback = callback;
}
@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(mKeyActionCallback != null) {
mKeyActionCallback.keyActionCallback(action);
}
return true;
}
}
}
package jp.agentec.abook.abv.ui.viewer.view;
import android.content.Context;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
import org.xwalk.core.XWalkView;
/**
* XWalkViewのキーボード検知するクラス
*/
public class CheckFormXWalkWebview extends XWalkView {
private Context mContext;
private KeyActionCallback mKeyActionCallback;
public interface KeyActionCallback {
void keyActionCallback(int editorInfoAction);
}
public CheckFormXWalkWebview(Context context, KeyActionCallback callback) {
super(context);
mContext = context;
mKeyActionCallback = callback;
}
@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(mKeyActionCallback != null) {
mKeyActionCallback.keyActionCallback(action);
}
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