Commit 288b8b71 by yuichiro ogawa

#38370 印刷アイコンの活性制御 印刷画面への遷移

parent 89ebc857
......@@ -158,6 +158,8 @@ public class AcmsApis {
public static final String ApiGetApertureMasterData = "getApertureMasterData";
// 簡易帳票一覧取得
public static final String ApiQuickReportSearch = "quickReportSearch";
// 簡易帳票リビジョン一覧取得
public static final String ApiQuickReportRevision = "quickReportRevision";
// download
/**
......@@ -202,7 +204,7 @@ public class AcmsApis {
} 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(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch)) {
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision)) {
apiValue = Constant.ApiValue.checkapi;
}
......
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() {
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();
}
}
......@@ -136,6 +136,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/print_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
......
......@@ -136,6 +136,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/print_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......
......@@ -128,6 +128,16 @@
android:visibility="gone" />
<ImageButton
android:id="@+id/btn_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/btn_operation_print"
android:contentDescription="@string/print"
android:visibility="gone" />
<ImageButton
android:id="@+id/btn_download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -25,6 +25,7 @@ import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.TextView;
......@@ -129,7 +130,9 @@ public class OperationListActivity extends ABVUIActivity {
private ImageButton mCommonContentButton; // 共通資料ボタン
private ImageButton mOperationBatchSyncButton; // カテゴリの一括同期ボタン
private ImageButton mCategoryLocationButton; // カテゴリ選択ボタン
private ImageButton mQuickReportPrintButton; // 簡易帳票印刷
private ImageButton mQuickReportPrintButton; // 簡易帳票印刷ボタン
private LinearLayout mPrintLinearLayout; // 簡易帳票印刷ボタン表示領域
private TextView mOperationTitle; // 一覧のタイトル
......@@ -210,6 +213,7 @@ public class OperationListActivity extends ABVUIActivity {
mCommonContentButton = (ImageButton) findViewById(R.id.btn_common_content);
mCategoryLocationButton = (ImageButton) findViewById(R.id.btn_category_location);
mQuickReportPrintButton = (ImageButton) findViewById(R.id.btn_operation_print);
mPrintLinearLayout = findViewById(R.id.print_layout);
// 定期点検で同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合、needSyncFlgをtrueに更新
updateNeedSyncRoutineOperation();
......@@ -416,6 +420,9 @@ public class OperationListActivity extends ABVUIActivity {
if (isSearched()) {
mOperationTitle.setText(R.string.search_result);
}
// 簡易帳票印刷ボタンの活性制御
printButtonActivityControl();
}
// 検索ワードのクリア
......@@ -1890,4 +1897,21 @@ public class OperationListActivity extends ABVUIActivity {
public int getSortCondition() {
return getABVUIDataCache().getSortCondition();
}
/**
* 簡易帳票印刷ボタン活性制御
* 簡易帳票区分が1のデータが存在する場合表示、それ以外非表示
*/
private void printButtonActivityControl() {
List<OperationDto> operations = mOperationDao.getAllOperation();
for (OperationDto operation : operations) {
if (operation.quickReport == 1) {
mQuickReportPrintButton.setVisibility(View.VISIBLE);
mPrintLinearLayout.setVisibility(View.VISIBLE);
return;
}
}
mQuickReportPrintButton.setVisibility(View.GONE);
mPrintLinearLayout.setVisibility(View.GONE);
}
}
package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
......@@ -13,7 +14,6 @@ import android.view.Window;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
......@@ -24,45 +24,38 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.Toast;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.IOException;
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.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.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;
//TODO: later 遠隔連動関連はContentView,NoPdfViewと共通しているので要集約
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.
*/
......@@ -71,6 +64,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
private ImageButton reloadButton;
private ImageButton downloadButton;
private ImageButton printButton;
private int objectLogId;
private WebView webView;
......@@ -320,6 +314,15 @@ 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();
}
});
downloadButton = (ImageButton) findViewById(R.id.btn_download);
downloadButton.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -379,6 +382,8 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
});
printButtonActivityControl();
historyListBtn.setVisibility(View.GONE);
if (isLinkedContent) {
......@@ -612,6 +617,53 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
});
}
/**
* 簡易帳票印刷ボタン活性制御
* 簡易帳票区分が1のデータが存在する場合表示、それ以外非表示
*/
private void printButtonActivityControl() {
OperationDto operation = mOperationDao.getOperation(mOperationId);
if (operation != null && operation.quickReport == 1) {
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();
}
});
}
@Override
protected void webViewLoadUrl(String url) {
if (webView != null) {
......
......@@ -10,6 +10,9 @@ import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.TextView;
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;
......@@ -35,14 +38,19 @@ public class OnlineHTMLWebViewActivity extends ABVContentViewActivity {
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
setWebView();
final Long operaitonId = intent.getLongExtra("operationId", -1);
Map<String, String> param = new HashMap<>();
if (operaitonId != -1) {
param.put("operationId", operaitonId.toString());
}
OnlineHTMLWebViewLogic logic = AbstractLogic.getLogic(OnlineHTMLWebViewLogic.class);
webView.postUrl(url, logic.getPostData());
webView.postUrl(url, logic.getPostData(param));
// ***** 戻るボタン
closeButton = findViewById(R.id.closeBtn);
......
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