Commit 9d297936 by onuma

帳票表示機能 マージ完了。ビルドエラーなし。

parent 5a8a3b39
......@@ -706,6 +706,19 @@ public class AcmsClient implements AcmsClientResponseListener {
return json;
}
/**
* 作業種別の取得API
* @param param
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public OperationGroupMasterJSON getOperationGroupMaster(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiOperationGroupMaster, param);
OperationGroupMasterJSON json = new OperationGroupMasterJSON(response.httpResponseBody);
return json;
}
/**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/
/**********************************************************************************************/
......@@ -981,21 +994,4 @@ public class AcmsClient implements AcmsClientResponseListener {
MasterDataJSON json = new MasterDataJSON(response.httpResponseBody);
return json;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 作業種別の取得API
* @param param
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public OperationGroupMasterJSON getOperationGroupMaster(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiOperationGroupMaster, param);
OperationGroupMasterJSON json = new OperationGroupMasterJSON(response.httpResponseBody);
return json;
}
}
......@@ -152,11 +152,14 @@ public class AcmsApis {
public static final String ApiGetPushMessages = "getPushMessage";
// 定期点検データ送信
public static final String ApiSendRoutineTaskData = "routineTaskData";
// HACCPマスタデータ取得
public static final String ApiGetMasterData = "getMasterData";
// 作業種別データ取得
public static final String ApiOperationGroupMaster = "operationGroupMaster";
// 簡易帳票一覧取得
public static final String ApiQuickReportSearch = "quickReportSearch";
// 簡易帳票リビジョン一覧取得
public static final String ApiQuickReportRevision = "quickReportRevision";
// download
/**
* コンテンツのZIPファイルを取得<br>
......@@ -201,7 +204,8 @@ public class AcmsApis {
methodName.equals(ApiGetTaskFile) || methodName.equals(ApiSceneEntry) || methodName.equals(ApiTaskContentEntry) ||
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiSendRoutineTaskData) ||
methodName.equals(ApiGetMasterData) ||
methodName.equals(ApiOperationGroupMaster)) { // カテゴリ選択機能
// カテゴリ選択機能、IO帳票で3つ追加
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision)) {
apiValue = Constant.ApiValue.checkapi;
}
......@@ -259,10 +263,4 @@ public class AcmsApis {
public static String getTaskFileUrl(String host, String urlPath) {
return String.format(GetTaskFileUrlFormat, StringUtil.trimLastSlashOrSpace(host), StringUtil.trimLastSlashOrSpace(urlPath));
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
// 作業種別データ取得
public static final String ApiOperationGroupMaster = "operationGroupMaster";
}
......@@ -153,9 +153,6 @@ public interface ServiceOption {
*/
int OperationChangeTime = 173;
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 作業種別:N(通常)、Y(作業種別毎に絞り込み可能なボタン・画面表示)
*/
......
......@@ -351,9 +351,7 @@ public class ServiceOption {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.OperationChangeTime);
return dto.val;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 作業種別のサービスオプション情報取得
* @return
......
......@@ -101,9 +101,7 @@ public class ABVDataOpenHelper {
// SPP通信端末管理テーブルをスクリプトに追加
iTableScripts.add(new TSppDevice());
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能テーブルをスクリプトに追加
iTableScripts.add(new MOperationGroupMaster());
iTableScripts.add(new ROperationGroupMasterOperation());
......
......@@ -4,9 +4,6 @@ package jp.agentec.abook.abv.bl.data;
public class DatabaseVersions {
public static final int Ver1_0_0 = 1;
public static final int Ver1_0_2 = 11; // SATO HACCP 1.0.2
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
public static final int Ver1_0_3 = 21; // @From
public static final int Ver1_0_3 = 21; // @From カテゴリ選択機能追加
}
package jp.agentec.abook.abv.bl.logic;
import java.util.Map;
public class OnlineHTMLWebViewLogic extends AbstractLogic {
private static final String TAG = "OnlineHTMLWebViewLogic";
public byte[] getPostData(Map<String, String> param) {
String data = "sid=" + cache.getMemberInfo().sid;
for(Map.Entry<String, String> entry : param.entrySet()){
data += "&" + entry.getKey() + "=" + entry.getValue();
}
return data.getBytes();
}
}
......@@ -233,5 +233,13 @@
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.SppBluetoothPairingSettingActivity"
android:theme="@style/AppTheme"/>
<!-- @Form I/O帳票 -->
<activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.OnlineHTMLWebViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true" android:drawable="@drawable/ic_history_back_off" />
<item android:state_enabled="false" android:drawable="@drawable/ic_history_back_disable" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/home_print_white"/>
</selector>
\ No newline at end of file
......@@ -1438,5 +1438,6 @@
<string name="title_category">カテゴリ</string>
<string name="title_all_operation">全作業</string>
<string name="category_list">カテゴリ一覧</string>
<string name="title_quick_report_output">帳票確認</string>
</resources>
......@@ -1446,5 +1446,6 @@
<string name="title_category">분류</string>
<string name="title_all_operation">전체 작업</string>
<string name="category_list">분류 목록</string>
<string name="title_quick_report_output">장표 확인</string>
</resources>
\ No newline at end of file
......@@ -1444,5 +1444,6 @@
<string name="title_category">Category</string>
<string name="title_all_operation">All</string>
<string name="category_list">Select Category</string>
<string name="title_quick_report_output">Report confirmation</string>
</resources>
\ No newline at end of file
......@@ -179,12 +179,24 @@
android:background="@drawable/ic_operation_task_list"
android:layout_marginRight="10dp"
android:visibility="gone" />
<ImageButton
android:id="@+id/btn_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:layout_toLeftOf="@+id/btn_help"
android:background="@drawable/btn_operation_print_white"
android:scaleX="0.6"
android:scaleY="0.6"
android:visibility="gone" />
<ImageButton
android:id="@+id/btn_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_operation_help"
android:layout_marginTop="6dp"
android:layout_marginRight="10dp"
android:visibility="gone"
android:onClick="onClickShowHelpView"/>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/frameTopbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/app_color"
android:minHeight="50dp" >
<ImageButton
android:id="@+id/backBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="@+id/linearLayout"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:background="@null"
android:src="@drawable/btn_history_back_for_webview" />
<Button
android:id="@+id/closeBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/btn_close"
android:contentDescription="@string/cont_desc"
android:layout_alignParentRight="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:id="@+id/linearLayout">
<TextView
android:id="@+id/title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/text_dialog"
android:textStyle="bold"
android:visibility="visible" />
</LinearLayout>
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" >
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp" android:layout_marginStart="0dp" />
<ProgressBar
android:id="@+id/refresh_prog"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:visibility="gone" />
</FrameLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true" android:drawable="@drawable/ic_history_back_off" />
<item android:state_enabled="false" android:drawable="@drawable/ic_history_back_disable" />
</selector>
\ No newline at end of file
package jp.agentec.abook.abv.ui.home.activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.constant.NaviConsts;
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.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.OnlineHTMLWebViewActivity;
public class OperationActivity extends ABVUIActivity {
private static final String TAG = "OperationActivity";
protected ImageButton mOperationHomeButton; // ホームボタン
protected ImageButton mCommonContentButton; // 関連資料
protected ImageButton mCommunicationButton; // コミュニケーション
protected ImageButton mQuickReportPrintButton; // 簡易帳票印刷ボタン
private PushMessageLogic mPushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private Dialog mCommunicationMenuDialog;
protected void createCommonToolber() {
// ホームボタン
mOperationHomeButton = (ImageButton) findViewById(R.id.btn_operation_home);
// 共通資料
mCommonContentButton = (ImageButton) findViewById(R.id.btn_common_content);
mCommonContentButton.setEnabled(true);
mCommonContentButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showCommonContent();
}
});
// コミュニケーション
mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
List<PushMessageDto> pushMessageDtoList = mPushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = false;
for (PushMessageDto pushMessageDto : pushMessageDtoList) {
if (!pushMessageDto.readingFlg) {
existUnreadFlg = true;
break;
}
}
if (existUnreadFlg) {
mCommunicationButton.setImageDrawable(getRDrawable(R.drawable.ic_communication_menu_with_badge));
} else {
mCommunicationButton.setImageDrawable(getRDrawable(R.drawable.ic_communication_menu));
}
mCommunicationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showCommunicationMenuDialog();
}
});
// 簡易帳票印刷ボタン
mQuickReportPrintButton = (ImageButton) findViewById(R.id.btn_operation_print);
if (ABVDataCache.getInstance().serviceOption.isUnableIOReport()) {
mQuickReportPrintButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showPrintTargetSelect();
}
});
mQuickReportPrintButton.setVisibility(View.VISIBLE);
} else {
findViewById(R.id.print_layout).setVisibility(View.GONE);
mQuickReportPrintButton.setVisibility(View.GONE);
}
}
// 共通資料画面表示
private void showCommonContent() {
Intent intent = new Intent();
intent.setClass(OperationActivity.this, OperationRelatedContentActivity.class);
startActivity(intent);
}
/**
* コミュニケーションダイアログの表示
*/
private void showCommunicationMenuDialog() {
mCommunicationMenuDialog = new Dialog(OperationActivity.this);
mCommunicationMenuDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mCommunicationMenuDialog.setCanceledOnTouchOutside(false);
mCommunicationMenuDialog.setContentView(R.layout.communication_menu_dialog);
List<PushMessageDto> pushMessageDtoList = mPushMessageLogic.getAllPushMessageList();
LinearLayout ll_menuItem_meeting = (LinearLayout)mCommunicationMenuDialog.findViewById(R.id.ll_item_meeting);
ll_menuItem_meeting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityHandlingHelper.getInstance().startMeetingActivity();
mCommunicationMenuDialog.dismiss();
}
});
mCommunicationMenuDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCommunicationMenuDialog.dismiss();
}
});
mCommunicationMenuDialog.show();
}
// 設定画面へ遷移
public void onClickSetting(View v) {
showSetting();
}
/**
* インターネットが繋がってない場合のダイアログ表示
*/
protected void showDisConnectNetworkDialog() {
handler.post(new Runnable() {
@Override
public void run() {
// ヘッダーの新着更新処理を完了にさせる
stopUpdateAnimation();
final ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(OperationActivity.this, R.string.app_name);
messageDialog.setMessage(getString(R.string.msg_network_offline));
messageDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
messageDialog.dismiss();
}
});
messageDialog.show();
}
});
}
/**
* 簡易帳票印刷対象選択画面表示
*/
protected void showPrintTargetSelect() {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showDisConnectNetworkDialog();
return;
}
Intent intent = new Intent();
intent.setClass(OperationActivity.this, OnlineHTMLWebViewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("LINKURL", AcmsApis.getApiUrl(ABVEnvironment.getInstance().acmsAddress, ABVDataCache.getInstance().getUrlPath(), AcmsApis.ApiQuickReportSearch));
startActivity(intent, NaviConsts.Right);
}
}
package jp.agentec.abook.abv.ui.home.activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
......@@ -23,17 +21,13 @@ 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.ExceptionHandler;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.CategoryContentDto;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.bl.websocket.MeetingManager;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
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.ErrorMessage;
......@@ -49,12 +43,11 @@ import jp.agentec.adf.util.StringUtil;
* Created by kim, changgyun on 2018/09/10.
*/
public class OperationRelatedContentActivity extends ABVUIActivity {
public class OperationRelatedContentActivity extends OperationActivity {
private static final String TAG = "OperationRelatedContentActivity";
private OperationRelatedContentSectionAdapter mOperationRelatedContentSectionAdapter;
private ImageButton mOperationHomeButton;
private ImageView mRefreshButton;
private ImageButton mOperationHelpButton;
......@@ -74,19 +67,17 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_operation_related_content);
mOperationHomeButton = (ImageButton) findViewById(R.id.btn_operation_home);
mOperationHelpButton = (ImageButton) findViewById(R.id.btn_operation_help);
mTxtOperationName = (TextView) findViewById(R.id.txt_operation_name);
mAllSaveButton = (Button) findViewById(R.id.btn_all_save);
mContentListView = (ListView) findViewById(R.id.lv_content_list);
// 共通資料ボタン
mCommonContentButton = (ImageButton) findViewById(R.id.btn_common_content);
// コミュニケーションボタン
mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
// 簡易帳票印刷ボタン
mQuickReportPrintButton = (ImageButton) findViewById(R.id.btn_operation_print);
// 画面下ツールバー
createCommonToolber();
// 共通資料ボタン(非活性化)
mCommonContentButton.setEnabled(false);
Intent i = getIntent();
operationId = i.getLongExtra(ABookKeys.OPERATION_ID, 0);
......@@ -111,14 +102,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
mTxtOperationName.setText(operationName);
mAllSaveButton.setVisibility(View.GONE);
mCommunicationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showCommunicationMenuDialog();
}
});
// 下ツールバー設定
configurationToolbarIcon();
setOnButtonEvent();
}
......@@ -435,78 +419,4 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
showHelpViewDialog(Constant.HelpViewType.OperationDetail);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
private ImageButton mCommonContentButton; // 関連資料
private ImageButton mCommunicationButton; // コミュニケーション
private ImageButton mQuickReportPrintButton; // 簡易帳票印刷ボタン
private PushMessageLogic mPushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private Dialog mCommunicationMenuDialog;
// 設定画面へ遷移
public void onClickSetting(View v) {
showSetting();
}
// 下辺のツールバー設定
private void configurationToolbarIcon() {
// ホームボタン活性化
mOperationHomeButton.setEnabled(true);
// 共通資料ボタンの非活性化
mCommonContentButton.setEnabled(false);
// コミュニケーション
List<PushMessageDto> pushMessageDtoList = mPushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = false;
for (PushMessageDto pushMessageDto : pushMessageDtoList) {
if (!pushMessageDto.readingFlg) {
existUnreadFlg = true;
break;
}
}
if (existUnreadFlg) {
mCommunicationButton.setImageDrawable(getRDrawable(R.drawable.ic_communication_menu_with_badge));
} else {
mCommunicationButton.setImageDrawable(getRDrawable(R.drawable.ic_communication_menu));
}
// 簡易帳票印刷ボタン
if (ABVDataCache.getInstance().serviceOption.isUnableIOReport()) {
mQuickReportPrintButton.setVisibility(View.VISIBLE);
} else {
findViewById(R.id.print_layout).setVisibility(View.GONE);
mQuickReportPrintButton.setVisibility(View.GONE);
}
}
/**
* コミュニケーションダイアログの表示
*/
private void showCommunicationMenuDialog() {
mCommunicationMenuDialog = new Dialog(OperationRelatedContentActivity.this);
mCommunicationMenuDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mCommunicationMenuDialog.setCanceledOnTouchOutside(false);
mCommunicationMenuDialog.setContentView(R.layout.communication_menu_dialog);
List<PushMessageDto> pushMessageDtoList = mPushMessageLogic.getAllPushMessageList();
LinearLayout ll_menuItem_meeting = (LinearLayout)mCommunicationMenuDialog.findViewById(R.id.ll_item_meeting);
ll_menuItem_meeting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityHandlingHelper.getInstance().startMeetingActivity();
mCommunicationMenuDialog.dismiss();
}
});
mCommunicationMenuDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCommunicationMenuDialog.dismiss();
}
});
mCommunicationMenuDialog.show();
}
}
package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
......@@ -37,17 +38,21 @@ import java.util.ArrayList;
import java.util.Date;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
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.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
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.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
......@@ -58,7 +63,10 @@ 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.constant.NaviConsts;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.view.CheckFormWebview;
......@@ -68,6 +76,8 @@ import jp.agentec.abook.abv.ui.viewer.view.CheckFormXWalkWebview;
public class HTMLWebViewActivity extends ParentWebViewActivity {
private static final String TAG = "HTMLWebViewActivity";
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
/**
* Called when the activity is first created.
*/
......@@ -76,6 +86,8 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
private ImageButton reloadButton;
private ImageButton downloadButton;
// 簡易帳票印刷ボタン
private ImageButton printButton;
private int objectLogId;
private WebView webView;
......@@ -153,6 +165,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
boolean isFromHomeMenu = intent.getIntExtra("pageNumber", -1) == -1;
if (isFromHomeMenu) {
// ホームメニューから遷移してきた場合は、closeボタンをホームボタンに差替え
closeButton.setBackgroundResource(R.drawable.btn_home);
historyListBtn.setOnClickListener(new OnClickListener() {
@Override
......@@ -369,6 +382,17 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
});
printButton = (ImageButton) findViewById(R.id.btn_print);
printButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logger.d(TAG, "Print");
showPrintTargetSelect();
}
});
// 簡易帳票印刷ボタン表示・非表示設定
printButtonActivityControl();
downloadButton = (ImageButton) findViewById(R.id.btn_download);
downloadButton.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -713,4 +737,50 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
mUploadMessage = null;
}
/**
* 簡易帳票印刷ボタン活性制御
* 簡易帳票区分が1のデータが存在する場合表示、それ以外非表示
*/
private void printButtonActivityControl() {
OperationDto operation = mOperationDao.getOperation(mOperationId);
if (operation != null && operation.quickReport == 1 && ABVDataCache.getInstance().serviceOption.isUnableIOReport()) {
printButton.setVisibility(View.VISIBLE);
} else {
printButton.setVisibility(View.GONE);
}
}
// 簡易帳票印刷対象選択画面表示
private void showPrintTargetSelect() {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showDisConnectNetworkDialog();
return;
}
Intent intent = new Intent();
intent.setClass(HTMLWebViewActivity.this, OnlineHTMLWebViewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("LINKURL", AcmsApis.getApiUrl(ABVEnvironment.getInstance().acmsAddress, ABVDataCache.getInstance().getUrlPath(), AcmsApis.ApiQuickReportRevision));
intent.putExtra("operationId", mOperationId);
startActivity(intent, NaviConsts.Right);
}
/**
* インターネットが繋がってない場合のダイアログ表示
*/
private void showDisConnectNetworkDialog() {
handler.post(new Runnable() {
@Override
public void run() {
final ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(HTMLWebViewActivity.this, R.string.app_name);
messageDialog.setMessage(getString(R.string.msg_network_offline));
messageDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
messageDialog.dismiss();
}
});
messageDialog.show();
}
});
}
}
package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.DownloadManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.Window;
import android.webkit.CookieManager;
import android.webkit.DownloadListener;
import android.webkit.URLUtil;
import android.webkit.WebBackForwardList;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import java.util.HashMap;
import java.util.Map;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OnlineHTMLWebViewLogic;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
/**
* Created by ogawa-y on 2020/06/22.
*/
public class OnlineHTMLWebViewActivity extends ABVContentViewActivity {
private static final String TAG = "OnlineHTMLWebView";
private WebView webView;
private Button closeButton;
private ImageButton backButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
Logger.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); // タイトルバー非表示
setContentView(R.layout.ac_online_html_webview);
TextView title = findViewById(R.id.title);
title.setText(R.string.title_quick_report_output);
setWebView();
// 引継ぎパラメータ
Intent intent = getIntent();
final String url = intent.getStringExtra("LINKURL"); // LinkURL
final Long operaitonId = intent.getLongExtra("operationId", -1);
Map<String, String> param = new HashMap<>();
if (operaitonId != -1) {
param.put("operationId", operaitonId.toString());
}
Logger.d(TAG,"LINKURL=" + url);
OnlineHTMLWebViewLogic logic = AbstractLogic.getLogic(OnlineHTMLWebViewLogic.class);
webView.postUrl(url, logic.getPostData(param));
// ***** 閉じるボタン
closeButton = findViewById(R.id.closeBtn);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finishActivity();
}
});
// ***** 戻るボタン
backButton = findViewById(R.id.backBtn);
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// PDFダウンロードの場合はスキップする
WebBackForwardList bfList = webView.copyBackForwardList();
for (int i = 0, len = bfList.getCurrentIndex(); i < len; i++) {
String url = bfList.getItemAtIndex(len - i).getUrl();
if (url.contains("fileSelect")) {
continue;
}
if (webView.canGoBackOrForward(-1 * (i + 1))) {
webView.goBackOrForward(-1 * (i + 1));
break;
}
}
}
});
}
private void setWebView() {
webView = findViewById(R.id.webView);
webView.setVisibility(View.VISIBLE);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
if (Logger.isDebugEnabled()) {
webView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
}
// //ブラウザの描画領域を対象としたイベントをフック
WebSettings settings = webView.getSettings();
settings.setSupportMultipleWindows(true); // 新しいウィンドウを開くイベントを取得する
settings.setLoadsImagesAutomatically(true); // イメージを自動的にロードする
settings.setBuiltInZoomControls(true); // ズーム機能を有効にする
settings.setSupportZoom(true); // ズーム機能を有効にする
settings.setJavaScriptEnabled(true); // JavaScriptを有効にする
settings.setLoadWithOverviewMode(true); // 画面の横幅にページの横幅を合わせる
settings.setUseWideViewPort(true); // 画面の横幅にページの横幅を合わせる
settings.setPluginState(WebSettings.PluginState.ON); // 「EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.」のエラー対応(あまり効果ない?)
settings.setDomStorageEnabled(true); // WebStorage有効化
settings.setAppCacheEnabled(false);
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setAllowFileAccessFromFileURLs(true); //Android7利用で警告ダイヤログ表示問題対応
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Logger.v(TAG, "shouldOverrideUrlLoading: %s", url);
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
// ***** 戻るボタンの活性制御
backButton.setEnabled(webView.canGoBack());
super.onPageFinished(view, url);
}
});
webView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url));
final String fileName = URLUtil.guessFileName(url, contentDisposition, mimetype);
request.setMimeType(mimetype);
//------------------------COOKIE!!------------------------
String cookies = CookieManager.getInstance().getCookie(url);
request.addRequestHeader("cookie", cookies);
//------------------------COOKIE!!------------------------
request.addRequestHeader("User-Agent", userAgent);
request.setTitle(fileName);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
if (dm != null) {
dm.enqueue(request);
}
Toast.makeText(getApplicationContext(), getString(R.string.download_start), //To notify the Client that the file is being downloaded
Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void finishActivity() {
setResult(RESULT_OK, new Intent());
finish();
}
}
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