Commit f84f136a by Kim Jinsung

Merge branch 'contract/sato/1.0.0_33190' into contract/sato/1.0.0

# Conflicts:
#	ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookKeys.java
#	ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
parents c41b4a33 133c6526
......@@ -21,6 +21,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
......@@ -194,6 +195,8 @@ public class AcmsClient implements AcmsClientResponseListener {
dto.userId = json.userId;
dto.workerCode = json.workerCode;
// dto.resourcePatternType = json.resourcePatternType; // 文言リソースパターンを取得する。
if (json.result) {
dto.invalidPasswordCount = (short) 0;
dto.lastLoginDate = json.presentTime;
......@@ -963,4 +966,17 @@ public class AcmsClient implements AcmsClientResponseListener {
}
}
}
/**
* ACMSから、マスタデータ情報を取得します。
* @param param {@link AcmsParameters} オブジェクトです。
* @return コンテンツバージョン情報を格納した {@link ContentDto} のリストを返します。
* 情報の変更がない(HttpStatus 304)場合はnullを返す。
* @since 1.0.0
*/
public MasterDataJSON masterData(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiGetMasterData, param);
MasterDataJSON json = new MasterDataJSON(response.httpResponseBody);
return json;
}
}
package jp.agentec.abook.abv.bl.acms.client.json;
import java.util.HashMap;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
/**
* {@link AcmsClient#contentVersion} の戻り値です。
* @author Taejin Hong
* @version 1.0.0
*/
public class MasterDataJSON extends AcmsCommonJSON {
public static final String MasterData = "masterData";
public static final String BelongGroup = "belongGroup";
public static final String Staff = "staff";
public static final String Selective = "selective";
public static final String InspectCheck = "inspectCheck";
public static final String InspectNumber = "inspectNumber";
public static final String FetchDate = "fetchDate";
public String fetchDate; // 取得日時(Timestamp yyyy-MM-dd HH:mm:ssGMT)
public Map<String, String> masterDataMap; // JSONマスタ(JSONオブジェクト)
public MasterDataJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// fechDateの値をデバイスに保持し、次回API呼び出し時のパラメータに設定する。
if (json.has(FetchDate)) {
fetchDate = json.getString(FetchDate);
}
// マスタデータを取得する。
if (json.has(MasterData)) {
masterDataMap = new HashMap<String, String>();
JSONObject masterData = json.getJSONObject(MasterData);
// belongGroupの報告対象マスタ(JSONオブジェクト)
if (masterData.has(BelongGroup)) {
JSONObject belognGroupJson = masterData.getJSONObject(BelongGroup);
masterDataMap.put(BelongGroup, belognGroupJson.toString());
}
// staffの報告者マスタ(JSONオブジェクト)
if (masterData.has(Staff)) {
JSONObject staffJson = masterData.getJSONObject(Staff);
masterDataMap.put(Staff, staffJson.toString());
}
// selectiveの選択型マスタ(JSONオブジェクト)
if (masterData.has(Selective)) {
JSONObject selectiveJson = masterData.getJSONObject(Selective);
masterDataMap.put(Selective, selectiveJson.toString());
}
// inspectCheckの点検チェック型マスタ(JSONオブジェクト)
if (masterData.has(InspectCheck)) {
JSONObject inspectCheckJson = masterData.getJSONObject(InspectCheck);
masterDataMap.put(InspectCheck, inspectCheckJson.toString());
}
// inspectNumberの点検数値型マスタ(JSONオブジェクト)
if (masterData.has(InspectNumber)) {
JSONObject inspectNumberJson = masterData.getJSONObject(InspectNumber);
masterDataMap.put(InspectNumber, inspectNumberJson.toString());
}
} else {
throw new JSONValidationException(json.toString(), MasterData + " property not found.");
}
}
}
......@@ -154,6 +154,9 @@ public class AcmsApis {
public static final String ApiSendRoutineTaskData = "routineTaskData";
// HACCPマスタデータ取得
public static final String ApiGetMasterData = "getMasterData";
// download
/**
* コンテンツのZIPファイルを取得<br>
......@@ -196,7 +199,8 @@ public class AcmsApis {
apiValue = Constant.ApiValue.nuapi;
} else if (methodName.equals(ApiOperationList) || methodName.equals(ApiWorkingGroupList) || methodName.equals(ApiSendTaskData) || methodName.equals(ApiGetOperationData) ||
methodName.equals(ApiGetTaskFile) || methodName.equals(ApiSceneEntry) || methodName.equals(ApiTaskContentEntry) ||
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiSendRoutineTaskData)) {
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiSendRoutineTaskData) ||
methodName.equals(ApiGetMasterData)) {
apiValue = Constant.ApiValue.checkapi;
}
......
......@@ -62,6 +62,9 @@ public class ABVEnvironment {
// Serverから取得したcontentVersion時のリソースパターンを一時的に保存するための変数
public int resourcePatternType;
// Serverから取得したmasterDataのfetchDateを一時的に保存するための変数
public String tempMasterDataFetchDate = "";
////////////////////////////// 定数 //////////////////////////////////
private static final String ServerTimeKey = "ABook";
......@@ -178,6 +181,9 @@ public class ABVEnvironment {
public boolean enableToastMessage = true;
// マスタ参照パス
public static final String OperationMasterDataDirFormat = "%s/ABook/operation/master";
private ABVEnvironment() {
}
......@@ -766,4 +772,10 @@ public class ABVEnvironment {
return reportDate;
}
}
// MasterDataに対したJSONファイルの位置
// 経路:root/files/operation/master
public String getMasterFilePath() {
return String.format(OperationMasterDataDirFormat, rootDirectory);
}
}
......@@ -126,6 +126,7 @@ public class Constant {
int AccessFineLocation = 1;
int Camera = 2;
int Audio =3;
int Bluetooth = 4; // Bluetooth ディバイス情報:beacon
}
public interface TaskReportLevel {
......@@ -168,4 +169,11 @@ public class Constant {
int NO = 0;
int YES = 1;
}
// 連携機器の区分
public interface DeviceType {
int thermomete = 1; // 芯温系
int sensor = 2; // おくだけセンサー
int barcode = 3; // バーコード
}
}
......@@ -123,4 +123,8 @@ public class ABookKeys {
// taskReport.Jsonに一時保存フラグを保持するためのキー
public static final String LOCAL_SAVE_FLG = "localSaveFlg";
// ディバイス情報取得
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
}
package jp.agentec.abook.abv.bl.download;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -29,6 +28,7 @@ import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.EnqueteLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.MasterDataLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -63,6 +63,9 @@ public class ContentRefresher {
private static final int refreshSleepInterval = 500;
private static final int maxRefreshWorker = 2;
// masterDataを取得するため登録
private MasterDataLogic masterDataLogic = AbstractLogic.getLogic(MasterDataLogic.class);
public static ContentRefresher getInstance() {
if (instance == null) {
synchronized (ContentRefresher.class) {
......@@ -157,6 +160,15 @@ public class ContentRefresher {
groupLogic.initializeGroups(); // グループ設定(グループ変更の場合、FetchDateをクリアする)
categoryLogic.initializeCategories(); // カテゴリ設定
// マスタデータの最新更新された時のFetchDateを一時に保存する。
Logger.d(TAG, "before fetchDate : " + ABVEnvironment.getInstance().tempMasterDataFetchDate);
// CMSでメンテナンスされるHACCPマスタデータをアプリから取得できるようにJSONファイルを生成する。
String fetchDate = masterDataLogic.initializeMasterData(ABVEnvironment.getInstance().tempMasterDataFetchDate);
Logger.d(TAG, "after fetchDate : " + fetchDate);
// マスタデータの最新更新された時のFetchDateを一時に保存する。
ABVEnvironment.getInstance().tempMasterDataFetchDate = fetchDate;
if (interrupt) { // この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別))
Logger.d(TAG, "stop refresh worker before content update.");
setFail();
......@@ -416,5 +428,4 @@ public class ContentRefresher {
Logger.e("batchSendDownloadLog failed.", e); // 例外は上にあげない。失敗したら次送られるはず(要確認)
}
}
}
package jp.agentec.abook.abv.bl.logic;
import java.io.IOException;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.MasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.FetchDateParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
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.AcmsDao;
import jp.agentec.adf.util.FileUtil;
public class MasterDataLogic extends AbstractLogic {
private static final java.lang.String TAG = "MasterDataLogic";
/**
* グループ情報をサーバから受信し、ローカルに保存します。既存のデータは上書きされます。また、サーバにないグループがローカルにある場合、そのグループは削除されます。
* マスタデータ情報をサーバから受信し、ローカルにJSONで保存する。で、
* データ単位で項目はあるが要素が0件のデータは削除、
* データ単位で項目が存在しないデータは変更無し
* @throws ABVException キャッシュにユーザ情報がありません。再度ログインする必要があります。
* @throws AcmsException
* @throws Exception その他、例外です。
* @since 1.0.0
*/
public String initializeMasterData(String lastFetchDate) throws NetworkDisconnectedException, AcmsException, IOException {
// コンテンツバージョン用lastFetchDateの取得
AcmsDao dao = AbstractDao.getDao(AcmsDao.class);
String daoLastFetchDate = dao.selectContentVersionLastFetchDate();
// ローカルに保存されている fetchDateがない場合、contentversionのlastFetchDateを利用する。
if (lastFetchDate.length() < 1) {
lastFetchDate = daoLastFetchDate;
}
FetchDateParameters param = new FetchDateParameters(cache.getMemberInfo().sid, lastFetchDate);
MasterDataJSON masterDataJson = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).masterData(param);
// get MAP
Map<String, String> masterDataMap = masterDataJson.masterDataMap;
// Map に保存されたデータをJSONに変換する。
for (Map.Entry<String, String> entry : masterDataMap.entrySet()) {
System.out.println(entry.getKey() + ":" + entry.getValue());
try {
createMasterDataJson(entry.getKey(), entry.getValue());
} catch (IOException e) {
Logger.e(TAG, "masterDataJSON error : ", e);
throw e;
}
}
// masterData の fetchDateを渡す。
return masterDataJson.fetchDate;
}
/**
* content.jsonファイル作成
*
* @param jsonKeyData
* @param jsonValueData
* @throws IOException
*/
private void createMasterDataJson(String jsonKeyData, String jsonValueData) throws IOException {
// マスタデータの保存されるパース
String masterDataJsonPath = ABVEnvironment.getInstance().getMasterFilePath() + "/" + jsonKeyData + ".json";
if (jsonValueData.contains(",")) {
// マスタデータのJSONのパース設定
FileUtil.createFile(masterDataJsonPath, jsonValueData);
} else {
// データ単位で項目はあるが要素が0件のデータは削除
FileUtil.deleteFileOnly(masterDataJsonPath);
}
}
}
......@@ -798,6 +798,9 @@ public class OperationLogic extends AbstractLogic {
jsonObject.put("attachedPath", "../../../../files/ABook/operation/" + operationId);
jsonObject.put("attachedMoviePath", ABVEnvironment.getInstance().getAttachedMoviesFilePath(contentId));
// マスタデータのパースを参照するために「content.json」に保存する。
jsonObject.put("masterPath", ABVEnvironment.getInstance().getMasterFilePath());
FileUtil.createFile(contentPath + "/content.json", jsonObject.toString());
}
......
......@@ -30,6 +30,9 @@
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<!-- BLE -->
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
......@@ -210,5 +213,10 @@
<activity android:name="jp.agentec.abook.abv.ui.viewer.activity.CheckOZDViewActivity" android:configChanges="orientation|screenSize"/>
<!-- ABookCheck1.0.0 Sato -->
<activity android:name="jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity"
android:theme="@style/AppTheme"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity"
android:theme="@style/AppTheme"/>
</application>
</manifest>
\ No newline at end of file
......@@ -1389,4 +1389,19 @@
<string name="Report_5">報告(5)</string>
<string name="Routine_5">定期点検(5)</string>
<string name="ReportReply_5">報告(回答)(5)</string>
<!-- ABookCheck Sato 1.0.0 -->
<string name="set_pairing">機器連携</string>
<string name="scan">Scan</string>
<string name="stop">Stop</string>
<string name="thermometer">芯温計</string>
<string name="ble_is_not_supported">BLEを支援しません。</string>
<string name="bluetooth_is_not_supported">ブルートゥースを支援しません。</string>
<string name="bluetooth_is_not_working">ブルートゥースが機能しません。</string>
<string name="msg_connected_bluetooth">%sに接続されました。</string>
<string name="msg_ble_not_connect">接続が停止しました。</string>
<string name="msg_ble_connect_error">%sと接続されていません。\n%sと接続状態を設定画面の機器連携から確認してください。</string>
<string name="msg_permission_dialog_bluetooth">ブルートゥース利用権限が必要です。\nアプリ設定画面へ遷移します。</string>
<string name="sensor">センサー</string>
<string name="barcode">バーコード</string>
</resources>
......@@ -1396,4 +1396,19 @@
<string name="Report_5">보고(5)</string>
<string name="Routine_5">정기점검(5)</string>
<string name="ReportReply_5">보고(회답)(5)</string>
<!-- ABookCheck Sato 1.0.0 -->
<string name="set_pairing">기기연결</string>
<string name="scan">Scan</string>
<string name="stop">Stop</string>
<string name="thermometer">芯温計</string>
<string name="ble_is_not_supported">BLE는 지원되지 않습니다.</string>
<string name="bluetooth_is_not_supported">블루투스는 지원되지 않습니다.</string>
<string name="bluetooth_is_not_working">블루투스가 작동하지 않습니다.</string>
<string name="msg_connected_bluetooth">%s에 접속되었습니다</string>
<string name="msg_ble_not_connect">접속이 정지되었습니다.</string>
<string name="msg_ble_connect_error">%s랑 접속되지않습니다.\n%s와의 접속상태를 설정화면의 기기연결에서 확인해주세요.</string>
<string name="msg_permission_dialog_bluetooth">블루투스이용권한이 필요합니다.\n설정화면으로 이동합니다.</string>
<string name="sensor">센서</string>
<string name="barcode">바코드</string>
</resources>
\ No newline at end of file
......@@ -1395,4 +1395,19 @@
<string name="Report_5">Report(5)</string>
<string name="Routine_5">Routine(5)</string>
<string name="ReportReply_5">ReportReply(5)</string>
<!-- ABookCheck Sato 1.0.0 -->
<string name="set_pairing">Device Connect</string>
<string name="scan">Scan</string>
<string name="stop">Stop</string>
<string name="thermometer">Thermometer</string>
<string name="ble_is_not_supported">BLE is not supported.</string>
<string name="bluetooth_is_not_supported">Bluetooth is not supported.</string>
<string name="bluetooth_is_not_working">Bluetooth is not working.</string>
<string name="msg_connected_bluetooth">Connected to %s</string>
<string name="msg_ble_not_connect">The connection has stopped.</string>
<string name="msg_ble_connect_error">Not connected with% %s. \nCheck %s and connection status from the device linkage on the setting screen.</string>
<string name="msg_permission_dialog_bluetooth">You need Bluetooth access authority. \nIt changes to the application setting.</string>
<string name="sensor">Sensor</string>
<string name="barcode">Barcode</string>
</resources>
\ No newline at end of file
......@@ -13,7 +13,6 @@ dependencies {
implementation files('libs/ozrv_android.jar')
api 'com.google.firebase:firebase-core:11.4.0'
api 'com.google.firebase:firebase-messaging:11.4.0'
implementation 'commons-codec:commons-codec:1.10'
implementation 'net.lingala.zip4j:zip4j:1.3.2'
implementation 'com.google.guava:guava:18.0'
......@@ -21,6 +20,7 @@ dependencies {
implementation 'org.jsoup:jsoup:1.9.2'
implementation project(':xwalk_core_library')
implementation files('libs/FoxitRDK.jar')
implementation project(':SwiftDecoderMobile')
}
android {
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="@drawable/setting_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/toolbar_layout"
style="@style/OperationSearchToolBar"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="@+id/tv_toolbar_title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/barcode"
android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" />
<ImageButton
android:id="@+id/close_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"
android:onClick="onClickCloseView" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.honeywell.barcode.HSMDecodeComponent
android:id="@+id/hsm_decodeComponent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/editTextDisplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="top"
android:inputType="textMultiLine" >
<requestFocus />
</EditText>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/textview_devicename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="24dp"/>
<TextView
android:id="@+id/textview_deviceaddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12dp"/>
</LinearLayout>
<ImageView
android:id="@+id/btn_connect"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="3dp"
android:background="@drawable/ic_reload_list"/>
<ImageView
android:id="@+id/btn_disconnect"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="3dp"
android:background="@drawable/ic_delete"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity">
<!--android:background="@drawable/setting_bg"-->
<!--android:layout_height="0dp"-->
<!--android:background="@drawable/setting_bg"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/toolbar_layout"
style="@style/OperationSearchToolBar"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="@+id/tv_toolbar_title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/set_pairing"
android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" />
<ImageButton
android:id="@+id/close_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"
android:onClick="onClickCloseView" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/toolbar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="50dp"
android:visibility="visible">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="left"
android:text="@string/thermometer"
android:textSize="20sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true">
<Button
android:id="@+id/scan_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:text="@string/scan" />
<Button
android:id="@+id/stop_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:text="@string/stop" />
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" />
<ListView
android:id="@+id/devicelist"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="8dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
......@@ -58,4 +58,10 @@
android:title="@string/operation_manual" >
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/set_pairing" android:key="set_pairing">
<PreferenceScreen
android:key="setPairing"
android:title="@string/set_pairing" >
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
......@@ -56,6 +56,12 @@ public interface AppDefType {
String OPERATION_REPORT_TYPES = "operationReportTypes";
String RESOURCE_PATTERN_TYPE = "resourcePatternType"; // 文言リソースパターン
String BLUETOOTH_DEVICE_TEMPERATURE_NAME = "bleDeviceTemperatureName"; // 温度計機器の名
String BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS = "bleDeviceTemperatureAddress"; // 温度計機器のアドレス
String BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED = "bleDeviceTemperatureConnected"; // 芯温計機器と接続可否
String MASTER_DATA_FETCH_DATE = "masterDataFetchDate"; // マスタデータのFetchDate
}
/**
......
......@@ -90,6 +90,9 @@ public class ABookSettingFragment extends PreferenceFragment {
protected AlertDialog alertDialog = null;
private SharedPreferences pref;
// 機器連携
private static final String SET_PAIRING = "setPairing";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -104,6 +107,9 @@ public class ABookSettingFragment extends PreferenceFragment {
setLogInfoSetting();
// アプリ情報
setAppInfoSetting();
// ペアリング設定
setPairingSetting();
}
@Override
......@@ -461,4 +467,25 @@ public class ABookSettingFragment extends PreferenceFragment {
Logger.d(TAG, "saveLeaveAppTime()");
PreferenceUtil.putUserPref(getActivity(), UserPrefKey.LEAVE_APP, System.currentTimeMillis());
}
// 機器連携のペアリング設定
private void setPairingSetting() {
PreferenceGroup devicePairing = (PreferenceGroup) findPreference(SET_PAIRING);
devicePairing.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
// ペアリング設定画面
Intent intent = new Intent();
intent.setClass(getActivity(), PairingSettingActivity.class);
intent.putExtra("beforeView", SET_PAIRING);
startActivity(intent);
} catch (Exception e) {
Logger.e(TAG, e);
}
return true;
}
});
}
}
package jp.agentec.abook.abv.ui.home.activity;
import com.honeywell.barcode.HSMDecodeComponent;
import com.honeywell.barcode.HSMDecodeResult;
import com.honeywell.barcode.HSMDecoder;
import com.honeywell.barcode.Symbology;
import com.honeywell.license.ActivationManager;
import com.honeywell.license.ActivationResult;
import com.honeywell.plugins.PluginResultListener;
import com.honeywell.plugins.decode.DecodeResultListener;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPlugin;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListener;
/* The purpose of this sample code is to show the multiple different ways you can use bar code scanning functionality in your application.
* Bar code scanning can be achieved in the following 3 ways:
* 1) You can let HSMDecoder handle everything for you by simply calling hsmDecoder.scanBarcode();
* 2) You can embed an HSMDecodeComponent into your own activity and size it how you see fit
* 3) You can create a custom SwiftPlugin to completely control the look and operation of a scan event.
* This custom plug-in must be registered with HSMDecoder and can be used with either method 1 or 2 mentioned above.
*/
public class BarCodeReaderActivity extends Activity implements DecodeResultListener, BarCodeReaderCustomPluginResultListener {
public HSMDecoder hsmDecoder;
private EditText editTextDisplay;
private HSMDecodeComponent decCom;
private int scanCount = 0;
public static final String BARCODE_READING_DATA = "barcode_data";
private static final String TAG = "BarCodeReaderActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
//initialize GUI
initGuiElements();
//activate the API with your license key
ActivationResult activationResult = ActivationManager.activate(this, "trial-image-areyn-12062017");
Toast.makeText(this, "Activation Result: " + activationResult, Toast.LENGTH_LONG).show();
//get the singleton instance of the decoder
hsmDecoder = HSMDecoder.getInstance(this);
Logger.d(TAG, "isDecodingEnabled !!!! [ " + hsmDecoder.isDecodingEnabled());
// Toast.makeText(this, "Activation isDecodingEnabled: " + hsmDecoder.isDecodingEnabled(), Toast.LENGTH_LONG).show();
//set all decoder related settings
setSymbology();
hsmDecoder.enableFlashOnDecode(false);
hsmDecoder.enableSound(true);
hsmDecoder.enableAimer(true);
hsmDecoder.setAimerColor(Color.RED);
hsmDecoder.setOverlayTextColor(Color.WHITE);
hsmDecoder.addResultListener(this);
} catch(Exception e) {
e.printStackTrace();
}
}
public static void onDisposeInstance() {
HSMDecoder.disposeInstance();
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
onDisposeInstance();
finish();
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
public void onHSMDecodeResult(HSMDecodeResult[] barcodeData) {
//handle results from the default decoding functionality
displayBarcodeData(barcodeData);
}
@Override
public void onCustomPluginResult(HSMDecodeResult[] barcodeData) {
//handle results from your custom plug-in
displayBarcodeData(barcodeData);
}
private void displayBarcodeData(HSMDecodeResult[] barcodeData) {
Toast.makeText(this, "barcodeData.length : [%d]" + barcodeData.length, Toast.LENGTH_LONG).show();
if( barcodeData.length > 0) {
HSMDecodeResult firstResult = barcodeData[0];
String msg = "Scan Count: " + ++scanCount + "\n\n" +
"onHSMDecodeResult\n" +
"Data: " + firstResult.getBarcodeData() + "\n" +
"Symbology: " + firstResult.getSymbology() + "\n" +
"Length: " + firstResult.getBarcodeDataLength() + "\n" +
"Decode Time: " + firstResult.getDecodeTime() + "ms";
if (scanCount == 1) {
hsmDecoder.enableSound(false);
editTextDisplay.setText(msg);
Toast.makeText(this, "Activation Result: " + msg, Toast.LENGTH_LONG).show();
final String readingBarcodeData = firstResult.getBarcodeData();
ABookAlertDialog saveDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.barcode));
saveDialog.setMessage(readingBarcodeData);
saveDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.confirm), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onDisposeInstance();
// Okボタンタップし、保存作業の処理
Intent intent = new Intent();
intent.putExtra(BARCODE_READING_DATA, readingBarcodeData);
setResult(Activity.RESULT_OK, intent);
finish();
}
});
saveDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// cancelボタンタップし、処理
scanCount = 0;
hsmDecoder.enableSound(true);
}
});
saveDialog.show();
}
}
}
// Setting Activity screen
private void initGuiElements() {
//stop the device from going to sleep and hide the title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.barcode_reader);
decCom = (HSMDecodeComponent)findViewById(R.id.hsm_decodeComponent);
editTextDisplay = (EditText)findViewById(R.id.editTextDisplay);
editTextDisplay.setEnabled(false);
editTextDisplay.setTextColor(Color.WHITE);
}
//set all decoder related settings
private void setSymbology() {
hsmDecoder.enableSymbology(Symbology.UPCA);
hsmDecoder.enableSymbology(Symbology.CODE128);
hsmDecoder.enableSymbology(Symbology.CODE39);
hsmDecoder.enableSymbology(Symbology.QR);
hsmDecoder.enableSymbology(Symbology.EAN8);
hsmDecoder.enableSymbology(Symbology.MENU_TYPE_INT);
hsmDecoder.enableSymbology(Symbology.MENU_TYPE_CHAR);
hsmDecoder.enableSymbology(Symbology.MENU_TYPE_ARRAY);
hsmDecoder.enableSymbology(Symbology.MENU_TYPE_MASK);
hsmDecoder.enableSymbology(Symbology.UPCA_2CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.UPCA_5CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.UPCE0);
hsmDecoder.enableSymbology(Symbology.UPCE1);
hsmDecoder.enableSymbology(Symbology.UPCE_EXPAND);
hsmDecoder.enableSymbology(Symbology.UPCE_2CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.UPCE_5CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.EAN8_2CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.EAN8_5CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.EAN13);
hsmDecoder.enableSymbology(Symbology.EAN13_2CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.EAN13_5CHAR_ADDENDA);
hsmDecoder.enableSymbology(Symbology.EAN13_ISBN);
hsmDecoder.enableSymbology(Symbology.GS1_128);
hsmDecoder.enableSymbology(Symbology.C128_ISBT);
hsmDecoder.enableSymbology(Symbology.COUPON_CODE);
hsmDecoder.enableSymbology(Symbology.TRIOPTIC);
hsmDecoder.enableSymbology(Symbology.I25);
hsmDecoder.enableSymbology(Symbology.S25);
hsmDecoder.enableSymbology(Symbology.IATA25);
hsmDecoder.enableSymbology(Symbology.M25);
hsmDecoder.enableSymbology(Symbology.CODE93);
hsmDecoder.enableSymbology(Symbology.CODE11);
hsmDecoder.enableSymbology(Symbology.CODABAR);
hsmDecoder.enableSymbology(Symbology.TELEPEN);
hsmDecoder.enableSymbology(Symbology.MSI);
hsmDecoder.enableSymbology(Symbology.RSS_14);
hsmDecoder.enableSymbology(Symbology.RSS_LIMITED);
hsmDecoder.enableSymbology(Symbology.RSS_EXPANDED);
hsmDecoder.enableSymbology(Symbology.CODABLOCK_F);
hsmDecoder.enableSymbology(Symbology.PDF417);
hsmDecoder.enableSymbology(Symbology.MICROPDF);
hsmDecoder.enableSymbology(Symbology.COMPOSITE);
hsmDecoder.enableSymbology(Symbology.COMPOSITE_WITH_UPC);
hsmDecoder.enableSymbology(Symbology.AZTEC);
hsmDecoder.enableSymbology(Symbology.MAXICODE);
hsmDecoder.enableSymbology(Symbology.DATAMATRIX);
hsmDecoder.enableSymbology(Symbology.DATAMATRIX_RECTANGLE);
hsmDecoder.enableSymbology(Symbology.NEC25);
hsmDecoder.enableSymbology(Symbology.GRID);
hsmDecoder.enableSymbology(Symbology.DOT);
hsmDecoder.enableSymbology(Symbology.HANXIN);
hsmDecoder.enableSymbology(Symbology.HK25);
hsmDecoder.enableSymbology(Symbology.KOREA_POST);
}
// 閉じるボタンの処理
public void onClickCloseView(View v) {
onDisposeInstance();
finish();
}
}
\ No newline at end of file
......@@ -392,6 +392,8 @@ public class OperationListActivity extends ABVUIActivity {
getABVUIDataCache().saveLastUpdateTime();
// リソースパターンを取得し、ローカルに保存する。
setResourcePattern();
// マスタデータ最新更新する時fetchDateをローカルに保存する。
setMasterDataFetchDate();
refreshOperationList();
}
}
......@@ -434,6 +436,9 @@ public class OperationListActivity extends ABVUIActivity {
});
}
// masterDataの fetchDateの取得する。
ABVEnvironment.getInstance().tempMasterDataFetchDate = getUserPref(AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, "");
if (!activityResultFlg && operationId == -1) {
dataRefresh(true);
}
......@@ -1778,6 +1783,10 @@ public class OperationListActivity extends ABVUIActivity {
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(lastUpdateTimeLabel);
}
}
// masterDataの fetchDateの取得する。
ABVEnvironment.getInstance().tempMasterDataFetchDate = getUserPref(AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, "");
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
......@@ -1912,4 +1921,9 @@ public class OperationListActivity extends ABVUIActivity {
imgBtn.setImageDrawable(getRDrawable(R.drawable.ic_filter_selected));
}
}
private void setMasterDataFetchDate() {
Logger.d(TAG, "ABVEnvironment.getInstance().tempMasterDataFetchDate : " + ABVEnvironment.getInstance().tempMasterDataFetchDate);
putUserPref(AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, ABVEnvironment.getInstance().tempMasterDataFetchDate);
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.launcher.android.R;
import static jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity.DEVICE_CONNECTED;
import static jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity.EXTRAS_DEVICE_ADDRESS;
import static jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity.EXTRAS_DEVICE_NAME;
import static org.chromium.base.ThreadUtils.runOnUiThread;
/**
* Created by kim, changgyun on 2018/11/15.
*/
public class BleListAdapter extends BaseAdapter {
private static final String TAG = "BleListAdapter";
protected BleListAdapter.BleListAdapterListener listener;
private Context mContext;
private LayoutInflater mInflater;
private List<Map<String, String>> mListItem;
private String savedDeviceAddress = ""; // 保存されているディバイスのアドレス
private String savedDeviceName = ""; // 保存されているディバイスの名
private boolean savedDeviceConnected = false; // 保存されているディバスの接続可否
public interface BleListAdapterListener {
// 接続
void onConnect(int postion);
// 切断
void onDisconnect(int position);
}
public BleListAdapter(Context context, List<Map<String, String>> listItem, BleListAdapterListener listener) {
mContext = context;
mListItem = listItem;
if (mListItem.size() > 0) {
savedDeviceAddress = mListItem.get(0).get(EXTRAS_DEVICE_ADDRESS);
savedDeviceName = mListItem.get(0).get(EXTRAS_DEVICE_NAME);
savedDeviceConnected = mListItem.get(0).get(DEVICE_CONNECTED) == "1" ? true : false;
}
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.listener = listener;
}
public List<Map<String, String>> getData() {
return mListItem;
}
// リストへの追加
public void addDevice( Map<String, String> deviceList ) {
if (!mListItem.contains(deviceList)) { // 加えられていなければ加える
mListItem.add(deviceList);
notifyDataSetChanged(); // ListViewの更新
}
}
public void updateDevice(int position, Map<String, String> deviceList) {
if (mListItem.get(position).get(EXTRAS_DEVICE_NAME).equals(deviceList.get(EXTRAS_DEVICE_NAME))) {
// if (mListItem.contains(deviceList)) { // 加えられていなければ加える
mListItem.set(position, deviceList);
savedDeviceAddress = deviceList.get(EXTRAS_DEVICE_ADDRESS);
savedDeviceName = deviceList.get(EXTRAS_DEVICE_NAME);
savedDeviceConnected = deviceList.get(DEVICE_CONNECTED) == "1" ? true : false;
notifyDataSetChanged();
}
}
@Override
public int getCount() {
return mListItem.size();
}
@Override
public Map<String, String> getItem(int position) {
return mListItem.get(position);
}
@Override
public long getItemId( int position ) {
return position;
}
public void setItem(List<Map<String, String>> listItem) {
mListItem= listItem;
}
// リストのクリア
public void clear() {
mListItem.clear();
notifyDataSetChanged(); // ListViewの更新
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.pairing_device_list_item, parent, false);
holder = new ViewHolder();
holder.deviceName = (TextView) convertView.findViewById(R.id.textview_devicename);
holder.deviceAddress = (TextView) convertView.findViewById(R.id.textview_deviceaddress);
holder.isConnect = (ImageView) convertView.findViewById(R.id.btn_connect);
holder.isDisConnect = (ImageView) convertView.findViewById(R.id.btn_disconnect);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final Map<String, String> device = mListItem.get(position);
String deviceName = device.get(EXTRAS_DEVICE_NAME);
String deviceAddress = device.get(EXTRAS_DEVICE_ADDRESS);
// Logger.d(TAG, "deviceName : [" + deviceName);
// Logger.d(TAG, "deviceAddress : [" + deviceAddress);
// Logger.d(TAG, "defaultDeviceAddress : [" + savedDeviceAddress);
// Logger.d(TAG, "defaultDeviceName : [" + savedDeviceName);
if( null != deviceName && 0 < deviceName.length() && !deviceName.equals(savedDeviceName)) {
holder.deviceName.setText( deviceName );
holder.deviceAddress.setText( deviceAddress );
} else if (null != deviceName && deviceName.equals(savedDeviceName)) {
holder.deviceName.setText( savedDeviceName );
holder.deviceAddress.setText( savedDeviceAddress );
}
if (holder.deviceAddress.getText().equals(savedDeviceAddress)) {
if (savedDeviceConnected) {
holder.isConnect.setVisibility(convertView.GONE);
holder.isDisConnect.setVisibility(convertView.VISIBLE);
} else {
holder.isConnect.setVisibility(convertView.VISIBLE);
holder.isDisConnect.setVisibility(convertView.GONE);
}
} else {
holder.isConnect.setVisibility(convertView.VISIBLE);
holder.isDisConnect.setVisibility(convertView.GONE);
}
holder.isConnect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onConnect(position);
}
});
holder.isDisConnect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onDisconnect(position);
}
});
return convertView;
}
private static class ViewHolder {
TextView deviceName; // ディバイスの名
TextView deviceAddress; // ディバイスのアドレス
ImageView isConnect; // ディバイスとの接続ボタン
ImageView isDisConnect; // ディバイスとの切断ボタン
}
public void setAdapterListener(BleListAdapterListener listener) {
this.listener = listener;
}
}
package jp.agentec.abook.abv.ui.home.helper;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
......@@ -82,6 +83,11 @@ public class ABookPermissionHelper {
android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.RECORD_AUDIO);
}
// Bluetooth
if (ContextCompat.checkSelfPermission(mActivity,
android.Manifest.permission.BLUETOOTH) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.BLUETOOTH);
}
return reqPermissions;
}
......@@ -149,6 +155,17 @@ public class ABookPermissionHelper {
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
break;
// Confirm Device Bluetooth
case Constant.ABookPermissionType.Bluetooth:
if (ContextCompat.checkSelfPermission(mActivity,
Manifest.permission.BLUETOOTH) != PERMISSION_GRANTED) {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_permission_dialog_bluetooth,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
break;
}
if (permitionTextResourceId > 0) {
......
package jp.agentec.abook.abv.ui.home.plugin;
import java.util.List;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.honeywell.barcode.HSMDecodeResult;
import com.honeywell.plugins.PluginResultListener;
import com.honeywell.plugins.SwiftPlugin;
import jp.agentec.abook.abv.launcher.android.R;
/*
* This plug-in does nothing more than render text in the middle of the screen and silently return decode results to its listeners
*/
public class BarCodeReaderCustomPlugin extends SwiftPlugin
{
private TextView tvMessage;
private int clickCount = 0;
public BarCodeReaderCustomPlugin(Context context)
{
super(context);
}
@Override
public void onStart()
{
super.onStart();
}
@Override
protected void onStop()
{
super.onStop();
}
@Override
public void onDestroy()
{
super.onDestroy();
}
@Override
public void onDecode(HSMDecodeResult[] results)
{
super.onDecode(results);
notifyListeners(results);
}
@Override
protected void onDecodeFailed()
{
super.onDecodeFailed();
}
@Override
protected void onImage(byte[] image, int width, int height)
{
super.onImage(image, width, height);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
super.onSizeChanged(w, h, oldw, oldh);
}
private void notifyListeners(HSMDecodeResult[] results)
{
//tells all plug-in monitor event listeners we have a result (used by the system)
this.finish();
//notify all plug-in listeners we have a result
List<PluginResultListener> listeners = this.getResultListeners();
for(PluginResultListener listener : listeners)
((BarCodeReaderCustomPluginResultListener)listener).onCustomPluginResult(results);
}
}
package jp.agentec.abook.abv.ui.home.plugin;
import com.honeywell.barcode.HSMDecodeResult;
import com.honeywell.plugins.PluginResultListener;
//this interface defines how the custom plug-in will return results to its listeners (must extend PluginResultListener)
public interface BarCodeReaderCustomPluginResultListener extends PluginResultListener
{
public void onCustomPluginResult(HSMDecodeResult[] barcodeData);
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ package jp.agentec.abook.abv.ui.viewer.activity;
* @author jang
*/
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
......@@ -135,6 +136,8 @@ import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVEditText;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.common.vo.Size;
import jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity;
import jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.Interface.MovePageInterface;
......@@ -3747,6 +3750,32 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
mUploadMessage.onReceiveValue(result);
break;
// 機器連携と繋がる処理 get DeviceInfo
// case REQUEST_ENABLEBLUETOOTH: // Bluetooth有効化要求
// if( Activity.RESULT_CANCELED == resultCode )
// { // 有効にされなかった
// ABVToastUtil.showMakeText(getApplicationContext(), R.string.bluetooth_is_not_working, Toast.LENGTH_SHORT);
// return;
// }
// break;
// case REQUEST_CONNECTDEVICE: // デバイス接続要求
// String strDeviceName;
// if( Activity.RESULT_OK == resultCode ) {
// // デバイスリストアクティビティからの情報の取得
// strDeviceName = intent.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_NAME );
// mDeviceAddress = intent.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_ADDRESS );
// setUserPref(strDeviceName, mDeviceAddress, 1);
// } else {
// strDeviceName = "";
// mDeviceAddress = "";
// setUserPref(strDeviceName, mDeviceAddress, 0);
// }
// break;
case REQUEST_BARCODE_READER: // バーコードレーダから読み取ったデータの処理
if (Activity.RESULT_OK == resultCode) {
setBarCodeData(intent.getStringExtra(BarCodeReaderActivity.BARCODE_READING_DATA));
}
break;
}
mUploadMessage = null;
}
......
package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.webkit.ValueCallback;
......@@ -10,11 +20,15 @@ import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Toast;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
......@@ -41,6 +55,7 @@ import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
......@@ -449,4 +464,34 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
public void callViewLoadUrl(String url) {
webViewLoadUrl(url);
}
// 機能の有効化ダイアログの操作結果
@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data )
{
switch( requestCode )
{
case REQUEST_ENABLEBLUETOOTH: // Bluetooth有効化要求
if( Activity.RESULT_CANCELED == resultCode )
{ // 有効にされなかった
return;
}
break;
case REQUEST_CONNECTDEVICE: // デバイス接続要求
String strDeviceName;
if( Activity.RESULT_OK == resultCode )
{
// デバイスリストアクティビティからの情報の取得
// strDeviceName = data.getStringExtra( DeviceListActivity.EXTRAS_DEVICE_NAME );
mDeviceAddress = data.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_ADDRESS );
}
else
{
strDeviceName = "";
mDeviceAddress = "";
}
break;
}
super.onActivityResult( requestCode, resultCode, data );
}
}
configurations.maybeCreate("default")
artifacts.add("default", file('SwiftDecoderMobile.aar'))
\ No newline at end of file
include ':ABVJE_BL', ':ABVJE_Launcher_Android', ':ABVJE_Res_Default_Android', ':ABVJE_UI_Android'
include ':ABVJE_BL', ':ABVJE_Launcher_Android', ':ABVJE_Res_Default_Android', ':ABVJE_UI_Android', ':SwiftDecoderMobile'
include ':xwalk_core_library'
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