Commit 65919394 by Lee Jaebin

サービスオプションの整理、要らない処理削除

parent 1e0ec13b
......@@ -20,7 +20,6 @@ import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentSetJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetBackupFileListJSON;
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.NewAppStoreLoginJSON;
......@@ -29,12 +28,12 @@ import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SubscriptionHistoryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectInspectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectInspectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AbstractAcmsLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
......@@ -55,14 +54,12 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ReaderShareParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.StandByPicParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SubscriptionHistoryParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SubscriptionHistorySendParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UpdateDeviceTokenParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UploadBackupFileParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.acms.type.LoginStatus;
import jp.agentec.abook.abv.bl.acms.type.RequirePasswordChangeCode;
......@@ -527,16 +524,6 @@ public class AcmsClient implements AcmsClientResponseListener {
return json.requirePasswordChange;
}
public GetBackupFileListJSON getBackupFileList(AcmsParameters param) throws AcmsException, NetworkDisconnectedException {
HttpResponse response = send(AcmsApis.ApiUrlGetBackupFileList, param);
GetBackupFileListJSON json = new GetBackupFileListJSON(response.httpResponseBody);
Logger.d(TAG, "json : %s", json);
return json;
}
public AuthLevelJSON getAuthLevel(AcmsParameters param) throws AcmsException, NetworkDisconnectedException {
HttpResponse response = send(AcmsApis.ApiUrlGetAuthLevel, param);
AuthLevelJSON json = new AuthLevelJSON(response.httpResponseBody);
......@@ -570,24 +557,6 @@ public class AcmsClient implements AcmsClientResponseListener {
return result;
}
public String uploadBackupFile(UploadBackupFileParameters param) throws AcmsException, NetworkDisconnectedException, IOException {
//HttpResponse response = send(AcmsApis.ApiUrlUploadBackupFile, param);
//UploadBackupFileJSON json = new UploadBackupFileJSON(response.httpResponseBody);
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiUrlUploadBackupFile);
HttpMultipart part1 = new HttpMultipart("sid", param.getSid());
// HttpMultipart part2 = new HttpMultipart("deviceType", param.getDeviceType());
HttpMultipart part3 = new HttpMultipart("formFile", param.getFile());
// HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[] {part1, part2, part3});
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[] {part1, part3});
ResultJSON json = new ResultJSON(result.httpResponseBody);
Logger.d(TAG, "백업 파일 업로드 %s", json);
return json.result;
}
public AcmsMessageJSON uploadLogFile(String sid, File uploadFile, String appVersion, String deviceTypeId, String uid, String ma) throws AcmsException, NetworkDisconnectedException, IOException {
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiUrlUploadLogFile);
HttpMultipart part1 = new HttpMultipart("sid", sid);
......@@ -620,24 +589,6 @@ public class AcmsClient implements AcmsClientResponseListener {
return json;
}
public String notifyBackupStart(GetBackupFileParameters param) throws AcmsException, NetworkDisconnectedException {
HttpResponse response = send(AcmsApis.ApiUrlNotifyBackupStart, param);
ResultJSON json = new ResultJSON(response.httpResponseBody);
Logger.d(TAG, "백업 개시 %s", json);
return json.result;
}
public String notifyBackupFinish(GetBackupFileParameters param) throws AcmsException, NetworkDisconnectedException {
HttpResponse response = send(AcmsApis.ApiUrlNotifyBackupFinish, param);
ResultJSON json = new ResultJSON(response.httpResponseBody);
Logger.d(TAG, "백업 완료 %s", json);
return json.result;
}
// TODO: リファクタリングの結果をABook+ブランチにも反映
public String enqueteReply(EnqueteReplyParameters postParam, GetEnqueteReplyParameters getParam) throws AcmsException, NetworkDisconnectedException {
......
package jp.agentec.abook.abv.bl.acms.client.json.reader;
package jp.agentec.abook.abv.bl.acms.client.json;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
......
......@@ -42,7 +42,6 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
public static final String ContractContentId = "contractContentId";
public static final String AlertMessageLevel = "alertMessageLevel";
public static final String AlertMessage = "alertMessage";
public static final String PdfSendMail = "pdfSendMail";
public static final String PrintFlg = "printFlg";
public static final String HideFlg = "hideFlg";
public static final String ShareUrl = "shareUrl";
......@@ -84,7 +83,6 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
public Date lastDeliveryDate;
public int alertMessageLevel;
public String alertMessage;
public boolean pdfSendMailFlg;
public boolean printFlg;
public boolean hideFlg;
public String shareUrl;
......@@ -174,7 +172,6 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
alertMessageLevel= getInt(json, AlertMessageLevel, 0);
alertMessage= getString(json, AlertMessage, "");
pdfSendMailFlg = (getInt(json, PdfSendMail) != 0);
printFlg = (getInt(json, PrintFlg) != 0);
hideFlg = (JsonUtil.getInt(json, HideFlg, 0) != 0); // 日比谷花壇のみのため、なければ0
shareUrl = JsonUtil.getString(json, ShareUrl);
......@@ -257,7 +254,6 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
dto.lastDeliveryDate = lastDeliveryDate;
dto.alertMessageLevel = alertMessageLevel;
dto.alertMessage = alertMessage;
dto.pdfSendMailFlg = pdfSendMailFlg;
dto.printFlg = printFlg;
dto.hideFlg = hideFlg;
dto.shareUrl = shareUrl;
......
package jp.agentec.abook.abv.bl.acms.client.json.check;
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
......
package jp.agentec.abook.abv.bl.acms.client.json;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
/**
* ACMSからのJSONがbooleanのresultという項目を予め持っているクラスです。booleanのresultを持つJSONに対応するクラスを作成するときはこのクラスを継承してください。
* @author Taejin Hong
* @version 1.0.0
*
*/
public class GetBackupFileListJSON extends AcmsCommonJSON {
public static final String FileList = "fileList";
public JSONArray fileList;
public GetBackupFileListJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
super.parse(json);
if (json.has(FileList)) {
fileList = json.getJSONArray(FileList);
}
}
}
package jp.agentec.abook.abv.bl.acms.client.json.check;
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
......
package jp.agentec.abook.abv.bl.acms.client.json.check;
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
......
package jp.agentec.abook.abv.bl.acms.client.json.check;
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
......
package jp.agentec.abook.abv.bl.acms.client.json.check;
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONObject;
......
package jp.agentec.abook.abv.bl.acms.client.json.check;
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
......
......@@ -58,22 +58,10 @@ public abstract class AbstractAcmsLoginParameters extends HttpParameterObject {
*/
public AbstractAcmsLoginParameters(String loginId, String memberPassword, int appId, String appVersion
, int deviceTypeId, String deviceToken, String ma) throws IllegalArgumentException {
if (ABVDataCache.getInstance().serviceOption.isEncryptUserInfo()) {
SecurityUtil.validateLoginInformation(loginId, memberPassword);
}
if (StringUtil.isNullOrWhiteSpace(appVersion)) {
throw new IllegalArgumentException("argument appVersion not allowed null or white space.");
}
// ログイン時にデバイストークンが取得できないことがあるので必須チェックは外す
// if (StringUtil.isNullOrWhiteSpace(deviceToken)) {
// throw new IllegalArgumentException("argument deviceToken not allowed null or white space.");
// }
// if (StringUtil.isNullOrWhiteSpace(ma)) {
// throw new IllegalArgumentException("argument ma not allowed null or white space.");
// }
this.loginId = loginId;
this.password = memberPassword;
......
......@@ -21,7 +21,6 @@ public class ContentReadingLogParameters extends AcmsContentParameters {
private Double longitude;
private JSONObject pageLog;
private JSONObject objectLog;
private JSONObject customLog;
private String loginId; // Reader
private String key; // Reader
private int mode;
......@@ -39,11 +38,10 @@ public class ContentReadingLogParameters extends AcmsContentParameters {
* @param longitude 経度です。
* @param pageLog ページ閲覧ログです。
* @param pageLog オブジェクトログです。
* @param customLog カスタマイズログ
* @since 1.0.0
*/
public ContentReadingLogParameters(String sid, long contentId, Timestamp readingStartDate, Timestamp readingEndDate
, int readingTime, int deviceTypeId, Double latitude, Double longitude, int mode, JSONObject pageLog, JSONObject objectLog, JSONObject customLog) {
, int readingTime, int deviceTypeId, Double latitude, Double longitude, int mode, JSONObject pageLog, JSONObject objectLog) {
super(sid, contentId);
this.readingStartDate = readingStartDate;
......@@ -55,7 +53,6 @@ public class ContentReadingLogParameters extends AcmsContentParameters {
this.mode = mode;
this.pageLog = pageLog;
this.objectLog = objectLog;
this.customLog = customLog;
}
/**
......@@ -150,18 +147,7 @@ public class ContentReadingLogParameters extends AcmsContentParameters {
}
return objectLog.toString();
}
/**
* カスタマイズログ
* @return
*/
public String getCustomLog() {
if (customLog == null) {
return null;
}
return customLog.toString();
}
public String getLoginId() {
return loginId;
}
......
......@@ -143,21 +143,6 @@ public class AcmsApis {
*/
public static final String ApiUrlServerTimeZone = "serverTimeZone";
//백업된 파일 리스트 조회
public static final String ApiUrlGetBackupFileList = "getBackupFileList";
//백업된 파일 다운로드
public static final String ApiUrlGetBackupFile = "getBackupFile";
//백업할 파일을 업로드
public static final String ApiUrlUploadBackupFile = "uploadBackupFile";
//백업 개시 서버에 알림
public static final String ApiUrlNotifyBackupStart = "notifyBackupStart";
//백업이 완료되었음을 서버에 알림
public static final String ApiUrlNotifyBackupFinish = "notifyBackupFinish";
//앙케이트 응답 내용을 서버에 송신
public static final String ApiUrlEnqueteReply = "enqueteReply";
......
......@@ -4,11 +4,6 @@ import jp.agentec.abook.abv.bl.logic.ContractLogic;
public interface ServiceOption {
interface ServiceOptionId {
/**
* 通知機能使用
*/
int Apns = 12;
/**
* 公開終了時のDL済コンテンツ強制削除
*/
......@@ -18,10 +13,6 @@ public interface ServiceOption {
*/
int NoauthDelete = 14;
/**
* 外部接続時閲覧禁止
*/
int DetectExtConnect = 17;
/**
* Office使用可
*/
int Office2pdf = 19;
......@@ -42,14 +33,6 @@ public interface ServiceOption {
*/
int UseridUdidOverwrite = 26;
/**
* バックアップオプション
*/
int Backup = 28;
/**
* PDF メール送信
*/
int PdfSendMail = 31;
/**
* PDFLink背景色設定
*/
int PdfLinkDisp = 32;
......@@ -88,10 +71,6 @@ public interface ServiceOption {
*/
int ForceOfflineWait = 59;
/**
* ダッシュボードの使用有無
*/
int UsableDashboard = 62;
/**
* サイネージ
*/
int Signage = 67;
......@@ -116,30 +95,6 @@ public interface ServiceOption {
*/
int UsableReadinglogObject = 72;
/**
* コンテンツ自動DL
*/
int AutoDownload = 73;
/**
* コンテンツアップロード
*/
int ContentUpload = 75;
/**
* コンテンツアップロード
*/
int QRCode = 76;
/**
* 日比谷花壇カタログ
*/
int HibiyakadanCatalog = 77;
/**
* コンテンツ共有URL
*/
int ContentShare = 78;
/**
* 事業者規模
*/
int ContractScale = 98;
/**
* グループ表示
*/
int UseGroup = 99;
......@@ -147,43 +102,11 @@ public interface ServiceOption {
* ジャンル表示
*/
int UseGenre = 100;
/**
* ロケーション切り替え
*/
int DeviceLocationMode = 103;
/**
* 初期表示メニュー
*/
int HomeMenuDefault = 104;
/**
* 決済
*/
int Payment = 106;
/**
* 定期購読あり
*/
int AutoSubscriptionAll = 107;
/**
* モード切替時間(秒)
*/
int ModeInterval = 108;
/**
* 自動ロック利用
*/
int UseAutoLock = 117;
/**
* 配布形式
*/
int DeliveryType = 110;
/**
* オフライン時試験送信
*/
int TransmitExamAtOfflLine = 124;
/**
* ユーザ情報暗号化
*/
int EncryptUserInfo = 126;
/**
* 試験
......@@ -194,16 +117,7 @@ public interface ServiceOption {
* クイズ
*/
int Quiz = 129;
/**
* 天気予報利用
*/
int UseWeather = 131;
/**
* HTMLカスタムログ
*/
int UseCustomLog = 137;
/**
* 360°動画
*/
......@@ -233,38 +147,5 @@ public interface ServiceOption {
* 報告タイプ:N(通常)、Y(定期点検)
*/
int ProjectReportType = 171;
// ↓↓------------- No Used------------------- ↓↓
/**
* トランスコーダ使用
*/
int Transcoder = 11;
/**
* ユーザID自動登録
*/
int UseridAutoRegister = 16;
/**
* iPad
*/
int iPad = 302;
/**
* iPhone
*/
int iPhone = 303;
/**
* Android
*/
int Android = 404;
}
/**
* ServiceOptionId.ContentShare
* {@link ContractLogic#getContentShareType}
*/
interface ContentShareType {
int NONE = 0;
int ABOOK_TYPE = 1;
}
}
\ No newline at end of file
......@@ -12,11 +12,6 @@ public enum ServiceOptionId {
*/
Transcoder(11),
/**
* 通知機能使用
* @since 1.0.0
*/
Apns(12),
/**
* 公開終了時のDL済コンテンツ強制削除
* @since 1.0.0
*/
......@@ -27,16 +22,6 @@ public enum ServiceOptionId {
*/
NoauthDelete(14),
/**
* ユーザID自動登録
* @since 1.0.0
*/
UseridAutoRegister(16),
/**
* 外部接続時閲覧禁止
* @since 1.0.0
*/
DetectExtConnect(17),
/**
* Office使用可
* @since 1.2.0
*/
......@@ -62,11 +47,6 @@ public enum ServiceOptionId {
*/
UseridUdidOverwrite(26),
/**
* 백업/복원 옵션
* @since 1.0.0
*/
Backup(28),
/**
* PDF 메일 보내기
* @since 1.0.0
*/
......@@ -117,11 +97,6 @@ public enum ServiceOptionId {
*/
ForceOfflineWait(59),
/**
* 대쉬보드 사용 유무
* @since 1.0.0
*/
UsableDashboard(62),
/**
* 閲覧ログGPS使用可
* @since 1.1.0
*/
......@@ -132,26 +107,6 @@ public enum ServiceOptionId {
*/
UsableReadinglogObject(72),
/**
* コンテンツ自動DL
* @since 1.0.0
*/
AutoDownload(73),
/**
* コンテンツアップロード
* @since 1.2.0
*/
ContentUpload(75),
/**
* 日比谷花壇カタログ
* @since 1.2.0
*/
HibiyakadanCatalog(77),
/**
* コンテンツ共有URL
* @since 1.2.0
*/
ContentShare(78),
/**
* iPad
* @since 1.0.0
*/
......
......@@ -4,7 +4,7 @@ import java.io.File;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import jp.agentec.abook.abv.bl.acms.client.json.reader.CmsUrlJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CmsUrlJSON;
import jp.agentec.abook.abv.bl.acms.type.ContentZipType;
import jp.agentec.abook.abv.bl.common.log.LogLevel;
import jp.agentec.abook.abv.bl.common.log.Logger;
......@@ -27,7 +27,6 @@ public class ABVEnvironment {
public String appVersion = null;
public String acmsAddress = null;
public String downloadServerAddress = null;
public int editionType;
public String defaultLogName = null;
private LogLevel logLevel = null;
public String mainFolderName = null;
......
......@@ -24,12 +24,6 @@ public class Constant {
int FLIP = 4;
}
public interface ContractScale {
int Default = 0;
int Mid = 1;
int Large = 2;
}
public interface BackupFileType {
String Memo = "1";
String Marking = "2";
......
......@@ -10,7 +10,6 @@ import jp.agentec.abook.abv.bl.acms.type.DeliveryType;
import jp.agentec.abook.abv.bl.acms.type.LoginStatus;
import jp.agentec.abook.abv.bl.acms.type.SecurityPolicyType;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
import jp.agentec.abook.abv.bl.common.Constant.ContractScale;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.common.util.SecurityUtil;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
......@@ -299,11 +298,7 @@ public class ABVDataCache {
public boolean isNoAuthDelete() {
return isServiceOptionEnable(ServiceOptionId.NoauthDelete);
}
public boolean isDetectExtConnect() {
return isServiceOptionEnable(ServiceOptionId.DetectExtConnect);
}
public SecurityPolicyType getForcePwChangeOnLogin() {
SecurityPolicyType code = SecurityPolicyType.None;
......@@ -343,10 +338,6 @@ public class ABVDataCache {
public boolean isPdfLinkDisp() {
return isServiceOptionEnable(ServiceOptionId.PdfLinkDisp);
}
public boolean isUsableDashboard() {
return isServiceOptionEnable(ServiceOptionId.UsableDashboard);
}
public boolean isCatalogEdition() {
return isServiceOptionEnable(ServiceOptionId.CatalogEdition);
......@@ -364,14 +355,6 @@ public class ABVDataCache {
return isServiceOptionEnable(ServiceOptionId.ProjectReportType);
}
public boolean isPayment() {
return isServiceOptionEnable(ServiceOptionId.Payment);
}
public boolean isUseAutoLock() {
return isServiceOptionEnable(ServiceOptionId.UseAutoLock);
}
public boolean isEnquete() {
return isServiceOptionEnable(ServiceOptionId.Enquete);
}
......@@ -383,46 +366,11 @@ public class ABVDataCache {
public boolean isQuiz() {
return isServiceOptionEnable(ServiceOptionId.Quiz);
}
public boolean isUseWeatherForecast() {
return isServiceOptionEnable(ServiceOptionId.UseWeather);
}
public boolean doUseCustomLog() {
return isServiceOptionEnable(ServiceOptionId.UseCustomLog);
}
public boolean isTransmitExamAtOffline() {
return isServiceOptionEnable(ServiceOptionId.TransmitExamAtOfflLine);
}
public boolean isEncryptUserInfo() {
return isServiceOptionEnable(ServiceOptionId.EncryptUserInfo);
}
public boolean isAutoSubscriptionAll() {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.AutoSubscriptionAll);
return dto != null && (NumericUtil.parseInt(dto.val) & 2) == 2;
}
public int getContractScale() {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.ContractScale);
int contractScale = ContractScale.Default;
if (dto != null) {
contractScale = NumericUtil.parseInt(dto.val);
}
return contractScale;
}
public int getDeviceLocationMode() {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.DeviceLocationMode);
int deviceLocationMode = 0;
if (dto != null) {
deviceLocationMode = NumericUtil.parseInt(dto.val);
}
return deviceLocationMode;
}
public boolean isUseGroup() {
return isServiceOptionEnable(ServiceOptionId.UseGroup);
}
......@@ -442,75 +390,8 @@ public class ABVDataCache {
}
return false;
}
/**
* 自動DLオプションが有効かどうか(値が1(初期値off)あるいは1(初期値on)の場合true)
*
* @return
*/
public boolean isAutoDownloadOptionEnable() {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.AutoDownload);
return dto != null && dto.val != null && (dto.val.equals("1") || dto.val.equals("2"));
}
/**
* 配信タイプを選択可能かどうか
*
* @return
*/
public boolean isDeliveryTypeSelectable() {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.DeliveryType);
return dto != null && dto.val != null && dto.val.equals("2");
}
/**
* 配信タイプを返す
*
* @return
*/
public int getDeliveryType() {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.DeliveryType);
int ret = DeliveryType.DOWNLOAD;
try {
ret = Integer.parseInt(dto.val);
} catch (Exception e) {
}
return ret;
}
public int getModeInterval() {
ServiceOptionDto dto = getServiceOption(ServiceOptionId.ModeInterval);
int defVal = 60;
if (dto != null) {
defVal = NumericUtil.parseInt(dto.val, defVal);
}
return defVal;
}
}
public synchronized void addDashboardList(ArrayList<DashboardDto> list) {
try {
if (dashboardList == null) {
dashboardList = new ArrayList<DashboardDto>();
}else{
if (dashboardList.equals(list)) {
return;
}
}
dashboardList = list;
} catch (Exception e) {
Logger.e(TAG, e.toString());
}
}
public ArrayList<DashboardDto> getDashboardList() {
return dashboardList;
}
public void setDiffMinFromUTC(String timeZone) {
// UserAuthenticateLogic.getServerTimeから移行
// "timeZone":"GMT +09:00"から抽出して、差分の分数を設定
......
......@@ -3,10 +3,8 @@ package jp.agentec.abook.abv.bl.data;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.tables.LContentCustomLog;
import jp.agentec.abook.abv.bl.data.tables.LContentObjectLog;
import jp.agentec.abook.abv.bl.data.tables.LContentPageReadingLog;
import jp.agentec.abook.abv.bl.data.tables.LContentReadingLog;
......@@ -39,8 +37,6 @@ import jp.agentec.abook.abv.bl.data.tables.TInspectTaskReport;
import jp.agentec.abook.abv.bl.data.tables.TMarkingSetting;
import jp.agentec.abook.abv.bl.data.tables.TProject;
import jp.agentec.abook.abv.bl.data.tables.TPushMessage;
import jp.agentec.abook.abv.bl.data.tables.TSearchHistory;
import jp.agentec.abook.abv.bl.data.tables.TSubscriptionHistory;
import jp.agentec.abook.abv.bl.data.tables.TTask;
import jp.agentec.abook.abv.bl.data.tables.TTaskDirections;
import jp.agentec.abook.abv.bl.data.tables.TTaskDirectionsItems;
......@@ -80,11 +76,9 @@ public class ABVDataOpenHelper {
iTableScripts.add(new LContentReadingLog());
iTableScripts.add(new LContentPageReadingLog());
iTableScripts.add(new LContentObjectLog());
iTableScripts.add(new LContentCustomLog());
iTableScripts.add(new MPasswordLockInfo());
iTableScripts.add(new TContentOldPdf());
iTableScripts.add(new TContentServerSearched());
iTableScripts.add(new TSearchHistory());
iTableScripts.add(new MAcms());
iTableScripts.add(new MAppConfig());
......@@ -96,7 +90,6 @@ public class ABVDataOpenHelper {
iTableScripts.add(new MServiceOption());
iTableScripts.add(new TMarkingSetting());
iTableScripts.add(new TEnquete());
iTableScripts.add(new TSubscriptionHistory());
iTableScripts.add(new MWorkerGroup());
iTableScripts.add(new TProject());
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ContentCustomLogDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ContentCustomLogDao extends AbstractDao {
/**
* {@link MemberInfoDao} のインスタンスを初期化します。
* context アンドロイドの android.content.Contextのインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
ContentCustomLogDao() {
}
@Override
protected ContentCustomLogDto convert(Cursor cursor) {
ContentCustomLogDto dto = new ContentCustomLogDto();
int column = cursor.getColumnIndex("content_custom_log_id");
if (column != -1) {
dto.content_custom_log_id = cursor.getInt(column);
}
column = cursor.getColumnIndex("reading_log_id");
if (column != -1) {
dto.readingLogId = cursor.getInt(column);
}
column = cursor.getColumnIndex("action_date");
if (column != -1) {
dto.actionDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
column = cursor.getColumnIndex("content_id");
if (column != -1) {
dto.contentId = cursor.getLong(column);
}
column = cursor.getColumnIndex("param1");
if (column != -1) {
dto.param1 = cursor.getString(column);
}
column = cursor.getColumnIndex("param2");
if (column != -1) {
dto.param2 = cursor.getString(column);
}
column = cursor.getColumnIndex("param3");
if (column != -1) {
dto.param3 = cursor.getString(column);
}
column = cursor.getColumnIndex("param4");
if (column != -1) {
dto.param4 = cursor.getString(column);
}
column = cursor.getColumnIndex("param5");
if (column != -1) {
dto.param5 = cursor.getString(column);
}
return dto;
}
public ContentCustomLogDto getContentCustomLog(int customLogId) {
String[] args = new String[] { "" + customLogId};
return rawQueryGetDto("select * from l_content_custom_log where content_custom_log_id=?", args, ContentCustomLogDto.class);
}
public List<ContentCustomLogDto> getContentCustomLogs(long contentId, int readingLogId) {
String[] args = new String[] { "" + contentId, "" + readingLogId };
return rawQueryGetDtoList("select * from l_content_custom_log where content_id=? and reading_log_id=?", args, ContentCustomLogDto.class);
}
public void insertContentCustomLog(ContentCustomLogDto dto) {
try {
insert("insert into l_content_custom_log (content_custom_log_id, reading_log_id, action_date, content_id, param1, param2, param3, param4, param5) values (?,?,?,?,?,?,?,?,?)",
new Object[] {getCustomLogMax(), dto.readingLogId, dto.actionDate, dto.contentId, dto.param1, dto.param2, dto.param3, dto.param4, dto.param5});
} catch (Exception e) {
Logger.w("ContentObjectLogDao", e.toString());
}
}
public boolean updateContentCustomLog(ContentCustomLogDto dto) {
long count = update("update l_content_custom_log set reading_log_id=?, action_date=?, content_id=?, param1 = ?, param2 = ?, param3 = ?, param4 = ?, param5 = ?, where content_custom_log_id=?", dto.getUpdateValues());
return count > 0;
}
public boolean deleteContentCustomLog(long contentId, int readingLogId) {
String[] args = new String[] { "" + contentId, "" + readingLogId};
long ret = delete("l_content_custom_log", "content_id=? and reading_log_id=?", args);
return ret > 0;
}
public boolean deleteContentCustomLog(int content_custom_log_id) {
String[] args = new String[] { "" +content_custom_log_id};
return (delete("l_content_custom_log", "content_custom_log_id = ? ", args) > 0);
}
public int getCustomLogMax() {
return rawQueryGetInt("select MAX(seq) AS seq from sqlite_sequence where name= ? ", new String[] {"l_content_custom_log"}) + 1;
}
}
\ No newline at end of file
......@@ -163,10 +163,6 @@ public class ContentDao extends AbstractDao {
if (column != -1) {
dto.alertMessage = cursor.getString(column);
}
column = cursor.getColumnIndex("pdf_send_mail_flg");
if (column != -1) {
dto.pdfSendMailFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("print_flg");
if (column != -1) {
dto.printFlg = toBool(cursor.getInt(column));
......@@ -908,10 +904,6 @@ public class ContentDao extends AbstractDao {
return rawQueryGetInt("select last_viewed_page from t_content where content_id = " + contentId, null);
}
public List<ContentDto> getUndeliverableDeleteContent(String curDate) {
return rawQueryGetDtoList("select * from t_content where delivery_end_date<? and content_id in (select content_id from t_content_id_conv a inner join m_contract b on a.site_id=b.site_id and a.contract_id=b.contract_id where b.undeliverable_delete='Y')", new String[]{(curDate)}, ContentDto.class);
}
public ContentDto getContentByProductId(String productId) {
return rawQueryGetDto("select * from t_content where product_id=?", new String[]{"" + productId}, ContentDto.class);
}
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.ContractDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ContractDao extends AbstractDao {
/*package*/ ContractDao() {
}
@Override
public ContractDto convert(Cursor cursor) {
ContractDto dto = new ContractDto();
int colnum = cursor.getColumnIndex("site_id");
if (colnum != -1) {
dto.siteId = cursor.getInt(colnum);
}
colnum = cursor.getColumnIndex("contract_id");
if (colnum != -1) {
dto.contractId = cursor.getInt(colnum);
}
colnum = cursor.getColumnIndex("company_name");
if (colnum != -1) {
dto.companyName = cursor.getString(colnum);
}
colnum = cursor.getColumnIndex("url_path");
if (colnum != -1) {
dto.urlPath = cursor.getString(colnum);
}
colnum = cursor.getColumnIndex("undeliverable_delete");
if (colnum != -1) {
dto.undeliverableDelete = cursor.getString(colnum);
}
colnum = cursor.getColumnIndex("usable_push_message");
if (colnum != -1) {
dto.usablePushMessage = cursor.getString(colnum);
}
colnum = cursor.getColumnIndex("usable_readinglog_gps");
if (colnum != -1) {
dto.usableReadinglogGps = cursor.getString(colnum);
}
colnum = cursor.getColumnIndex("usable_readinglog_object");
if (colnum != -1) {
dto.usableReadinglogObject = cursor.getString(colnum);
}
colnum = cursor.getColumnIndex("del_flg");
if (colnum != -1) {
dto.delFlg = cursor.getInt(colnum);
}
colnum = cursor.getColumnIndex("insert_date");
if (colnum != -1) {
dto.insertDate = DateTimeUtil.toDate(cursor.getString(colnum), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
colnum = cursor.getColumnIndex("update_date");
if (colnum != -1) {
dto.updateDate = DateTimeUtil.toDate(cursor.getString(colnum), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
colnum = cursor.getColumnIndex("receive_push_message");
if (colnum != -1) {
dto.receivePushMessage = cursor.getInt(colnum);
}
colnum = cursor.getColumnIndex("user_update_date");
if (colnum != -1) {
dto.userUpdateDate = DateTimeUtil.toDate(cursor.getString(colnum), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
return dto;
}
public ContractDto getDto(int siteId, int contractId) {
return rawQueryGetDto("select * from m_contract where site_id=? and contract_id=?", new String[]{""+siteId, ""+contractId}, ContractDto.class);
}
public boolean exists(int siteId, int contractId) {
return rawQueryGetString("select site_id from m_contract where site_id=? and contract_id=?", new String[]{""+siteId, ""+contractId}) != null;
}
public Date getLastUpdate() {
String updateDate = rawQueryGetString("select update_date from m_contract order by update_date desc limit 1", null);
if (updateDate == null) {
return null;
}
return DateTimeUtil.toDate(updateDate, "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
public void insert(ContractDto contractDto) {
insert("insert into m_contract (site_id, contract_id, company_name, url_path, undeliverable_delete, usable_push_message, usable_readinglog_gps, usable_readinglog_object, del_flg, insert_date, update_date, receive_push_message, user_update_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?)", contractDto.getInsertValues());
}
public void update(ContractDto contractDto) {
update("update m_contract set company_name=?, url_path=?, undeliverable_delete=?, usable_push_message=?, usable_readinglog_gps=?, usable_readinglog_object=?, del_flg=?, insert_date=?, update_date=?, receive_push_message=?, user_update_date=? where site_id=? and contract_id=?", contractDto.getUpdateValues());
}
public void insertOrUpdate(ContractDto contractDto) {
if (exists(contractDto.siteId, contractDto.contractId)) { // 更新
update(contractDto);
}
else { // 登録
insert(contractDto);
}
}
public List<ContractDto> getListByUndeliverableDelete() {
return rawQueryGetDtoList("select * from m_contract where undeliverable_delete='Y'", null, ContractDto.class);
}
public List<ContractDto> findByContentExist(){
StringBuilder sb = new StringBuilder();
sb.append(" select mc.* ");
sb.append(" from m_contract mc ");
sb.append(" inner join ");
sb.append(" ( ");
sb.append(" select site_id, contract_id ");
sb.append(" from t_content tc ");
sb.append(" inner join t_content_id_conv tcic ");
sb.append(" on tcic.content_id = tc.content_id ");
sb.append(" group by site_id, contract_id ");
sb.append(" ) c ");
sb.append(" on c.site_id = mc.site_id ");
sb.append(" and c.contract_id = mc.contract_id ");
sb.append(" order by mc.company_name ");
return rawQueryGetDtoList(sb.toString(), null, ContractDto.class);
}
public List<ContractDto> findByReceivePushMessage(int receivePushMessage) {
return rawQueryGetDtoList("select * from m_contract where receive_push_message=?",new String[]{""+receivePushMessage}, ContractDto.class);
}
public List<ContractDto> getListByUsablePushMessage() {
return rawQueryGetDtoList("select mc.* from m_contract mc inner join (select site_id, contract_id from t_content_id_conv group by site_id, contract_id ) tcic on mc.site_id = tcic.site_id and mc.contract_id = tcic.contract_id where mc.usable_push_message = 'Y' order by mc.company_name ",null, ContractDto.class);
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.SearchHistoryDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class SearchHistoryDao extends AbstractDao {
private static final String TAG = "SearchHistoryDao";
/**
* {@link SearchHistoryDao} のインスタンスを初期化します。
* @since 1.0.0
*/
/*package*/ SearchHistoryDao() {
}
@Override
protected SearchHistoryDto convert(Cursor cursor) {
SearchHistoryDto dto = new SearchHistoryDto();
int column = cursor.getColumnIndex("search_text");
if (column != -1) {
dto.searchText = cursor.getString(column);
}
column = cursor.getColumnIndex("insert_date");
if (column != -1) {
dto.insertDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
return dto;
}
public List<SearchHistoryDto> getSearchHistoryDtoList() {
return rawQueryGetDtoList("select * from t_search_history order by insert_date DESC limit 10", null, SearchHistoryDto.class);
}
public void insertUpdateSearchHistory(SearchHistoryDto dto) {
long count = update("update t_search_history set insert_date = ? where search_text = ? ", dto.getUpdateValues());
if (count == 0) {
insert("insert into t_search_history (search_text, insert_date) values (?, ?)", dto.getInsertValues());
Logger.d(TAG, "insert t_search_history");
} else {
Logger.d(TAG, "update t_search_history");
}
}
public void deleteSearchHistory(String searchText) {
delete("t_search_history", "search_text=?", new String[]{searchText});
}
public void deleteAllSearchHistory() {
delete("t_search_history", null, null);
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.SubscriptionDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionDto.Period;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class SubscriptionHistoryDao extends AbstractDao {
private static final String TAG = "SubscriptionHistoryDao";
/*package*/ SubscriptionHistoryDao() {
}
@Override
public SubscriptionHistoryDto convert(Cursor cursor) {
SubscriptionHistoryDto dto = new SubscriptionHistoryDto();
int column = cursor.getColumnIndex("subscription_history_id");
if (column != -1) {
dto.subscriptionHistoryId = cursor.getInt(column);
}
column = cursor.getColumnIndex("purchase_history_id");
if (column != -1) {
dto.purchaseHistoryId = cursor.getLong(column);
}
column = cursor.getColumnIndex("content_set_id");
if (column != -1) {
dto.contentSetId = cursor.getInt(column);
}
column = cursor.getColumnIndex("content_set_name");
if (column != -1) {
dto.contentSetName = cursor.getString(column);
}
column = cursor.getColumnIndex("all_flg");
if (column != -1) {
dto.allFlg = cursor.getInt(column);
}
column = cursor.getColumnIndex("product_id");
if (column != -1) {
dto.productId = cursor.getString(column);
}
column = cursor.getColumnIndex("order_id");
if (column != -1) {
dto.orderId = cursor.getString(column);
}
column = cursor.getColumnIndex("package_name");
if (column != -1) {
dto.packageName = cursor.getString(column);
}
column = cursor.getColumnIndex("purchase_time");
if (column != -1) {
dto.purchaseTime = cursor.getLong(column);
}
column = cursor.getColumnIndex("purchase_state");
if (column != -1) {
dto.purchaseState = cursor.getInt(column);
}
column = cursor.getColumnIndex("developer_payload");
if (column != -1) {
dto.developerPayload = cursor.getString(column);
}
column = cursor.getColumnIndex("purchase_token");
if (column != -1) {
dto.purchaseToken = cursor.getString(column);
}
column = cursor.getColumnIndex("auto_renewing");
if (column != -1) {
dto.autoRenewing = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("start_time_millis");
if (column != -1) {
dto.startTimeMillis = cursor.getLong(column);
}
column = cursor.getColumnIndex("expiry_time_millis");
if (column != -1) {
dto.expiryTimeMillis = cursor.getLong(column);
}
column = cursor.getColumnIndex("sent_flg");
if (column != -1) {
dto.sentFlg = cursor.getInt(column);
}
column = cursor.getColumnIndex("del_flg");
if (column != -1) {
dto.delFlg = cursor.getInt(column);
}
column = cursor.getColumnIndex("insert_date");
if (column != -1) {
dto.insertDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
column = cursor.getColumnIndex("update_date");
if (column != -1) {
dto.updateDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
return dto;
}
public int getSubscriptionHistorMax() {
return rawQueryGetInt("select MAX(seq) + 1 AS seq from sqlite_sequence where name=?", new String[]{"t_subscription_history"});
}
public List<SubscriptionHistoryDto> getAllValidList() {
return rawQueryGetDtoList("select * from t_subscription_history where all_flg=1 and del_flg<>1", null, SubscriptionHistoryDto.class);
}
public List<SubscriptionHistoryDto> getUnsentList() {
return rawQueryGetDtoList("select * from t_subscription_history where sent_flg=0", null, SubscriptionHistoryDto.class);
}
public void updateAsSent(int subscriptionHistoryId) {
update("update t_subscription_history set sent_flg=1, update_date=CURRENT_TIMESTAMP where subscription_history_id=?", new Object[]{subscriptionHistoryId});
}
public SubscriptionHistoryDto getDto(int subscriptionHistoryId) {
return rawQueryGetDto("select * from t_subscription_history where subscription_history_id=?", new String[]{""+subscriptionHistoryId}, SubscriptionHistoryDto.class);
}
public boolean exists(String purchaseToken) {
return rawQueryGetString("select purchase_history_id from t_subscription_history where purchase_token=?", new String[]{""+purchaseToken}) != null;
}
public SubscriptionHistoryDto findByPurchaseToken(String purchaseToken) {
return rawQueryGetDto("select * from t_subscription_history where purchase_token=?", new String[]{""+purchaseToken}, SubscriptionHistoryDto.class);
}
public void insert(SubscriptionHistoryDto subscriptionHistoryDto) {
insert("insert into t_subscription_history (subscription_history_id, purchase_history_id, content_set_id, content_set_name, all_flg, product_id, order_id, package_name, purchase_time, purchase_state, developer_payload, purchase_token, auto_renewing, start_time_millis, expiry_time_millis, sent_flg, del_flg, insert_date, update_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)", subscriptionHistoryDto.getInsertValues());
}
public void update(SubscriptionHistoryDto subscriptionHistoryDto) {
update("update t_subscription_history set purchase_history_id=?, content_set_id=?, content_set_name=?, all_flg=?, product_id=?, order_id=?, package_name=?, purchase_time=?, purchase_state=?, developer_payload=?, purchase_token=?, auto_renewing=?, start_time_millis=?, expiry_time_millis=?, sent_flg=?, del_flg=?, insert_date=?, update_date=CURRENT_TIMESTAMP where subscription_history_id=?", subscriptionHistoryDto.getUpdateValues());
}
public void insertOrUpdate(SubscriptionHistoryDto subscriptionHistoryDto) {
if (subscriptionHistoryDto.purchaseToken != null && exists(subscriptionHistoryDto.purchaseToken)) { // 更新
update(subscriptionHistoryDto);
}
else { // 登録
insert(subscriptionHistoryDto);
}
}
/**
* 履歴(定期購読の有効期間)を更新する。
*
* @param subscriptionDto
*/
public void update(SubscriptionDto subscriptionDto) {
if (subscriptionDto.historyList == null) {
return;
}
for (Period period : subscriptionDto.historyList) {
if (subscriptionDto.delFlg == 0 && period.start <= 0) { // startが不正な場合更新しない
continue;
}
update("update t_subscription_history set start_time_millis=?, expiry_time_millis=?, del_flg=?, update_date=CURRENT_TIMESTAMP where product_id=? and purchase_token=?",
new String[]{""+period.start, ""+period.end, ""+subscriptionDto.delFlg, subscriptionDto.productId, period.purchaseToken});
}
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class LContentCustomLog extends SQLiteTableScript {
public LContentCustomLog() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
ddl.add(createCustomLogTable());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
private String createCustomLogTable() {
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE l_content_custom_log ( ");
sql.append(" content_custom_log_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT ");
sql.append(" , reading_log_id INTEGER NOT NULL ");
sql.append(" , action_date DATETIME NOT NULL ");
sql.append(" , content_id BIGINT NOT NULL ");
sql.append(" , param1 TEXT");
sql.append(" , param2 TEXT");
sql.append(" , param3 TEXT");
sql.append(" , param4 TEXT");
sql.append(" , param5 TEXT");
sql.append(" , FOREIGN KEY (reading_log_id) REFERENCES l_content_reading_log (reading_log_id) ");
sql.append(" ) ");
return sql.toString();
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.adf.util.StringUtil;
/**
* 検索を行った検索語を保存するテーブル
* @author jang
*
*/
public class TSearchHistory extends SQLiteTableScript {
public TSearchHistory() {
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_search_history ( ");
sql.append(" search_text VARCHAR(256) NOT NULL ");
sql.append(" , insert_date DATETIME NOT NULL ");
sql.append(" , PRIMARY KEY (search_text) ");
sql.append(" ) ");
ddl.add(sql.toString());
StringUtil.clear(sql);
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object[] params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class TSubscriptionHistory extends SQLiteTableScript {
public TSubscriptionHistory() {
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
Logger.d("DATA", "create version : %s", version);
sql.append(" create table t_subscription_history ( ");
sql.append(" subscription_history_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT ");
sql.append(" , purchase_history_id bigint ");
sql.append(" , content_set_id INTEGER ");
sql.append(" , content_set_name VARCHAR(100) ");
sql.append(" , all_flg INTEGER not null ");
sql.append(" , product_id TEXT not null ");
sql.append(" , order_id TEXT not null ");
sql.append(" , package_name TEXT not null ");
sql.append(" , purchase_time bigint not null ");
sql.append(" , purchase_state bigint not null ");
sql.append(" , developer_payload TEXT not null ");
sql.append(" , purchase_token TEXT not null ");
sql.append(" , auto_renewing BOOLEAN ");
sql.append(" , start_time_millis bigint ");
sql.append(" , expiry_time_millis bigint ");
sql.append(" , sent_flg BOOLEAN default 0 not null ");
sql.append(" , del_flg INTEGER default 0 not null ");
sql.append(" , insert_date DATE not null ");
sql.append(" , update_date DATE not null ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... arg2) {
return null;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
}
......@@ -139,14 +139,6 @@ public class ContentDownloader {
this.downloadingPercentageNotifyInterval = downloadingPercentageNotifyInterval;
}
public void setAutoDownload(boolean isAutoDownload) {
this.isAutoDownload = isAutoDownload;
}
public boolean isAutoDownload() {
return isAutoDownload;
}
public void addAutoDownload(long contentId) {
autoDownloadList.add(contentId);
}
......@@ -303,7 +295,7 @@ public class ContentDownloader {
synchronized (targetContentMap) {
targetContentMap.remove(contentId);
}
if (isAutoDownload && targetContentMap.isEmpty()) {
if (targetContentMap.isEmpty()) {
Logger.i(TAG, "AutoDownloadEnd");
}
}
......@@ -514,7 +506,7 @@ public class ContentDownloader {
int targetCount = 0;
for (Long contentId : autoDownloadList) {
ContentDto contentDto = contentDao.getContent(contentId);
if ((isAutoDownload || contentDto.isLinkType()) && contentDto.isDownloadable(true)) {
if (contentDto.isLinkType() && contentDto.isDownloadable(true)) {
reserveDownload(contentId, false);
targetCount++;
}
......@@ -699,14 +691,9 @@ public class ContentDownloader {
private GetContentParameters getContentParameter(ContentDto contentDto) {
GetContentParameters param;
if (contentDto.payFlg) {
if (AbstractLogic.getLogic(ContentLogic.class).isAllSubscribed(contentDto)) { // 定期購読対象の場合
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload, ContentDownloader.getInstance().account);
}
else { // 単品の場合// purchaseTokenがない場合にdummy文字を入れて
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload, contentDto.productId, StringUtil.isNullOrEmpty(contentDto.purchaseToken)? "dummy": contentDto.purchaseToken);
}
}
else {
// 単品の場合// purchaseTokenがない場合にdummy文字を入れて
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload, contentDto.productId, StringUtil.isNullOrEmpty(contentDto.purchaseToken)? "dummy": contentDto.purchaseToken);
} else {
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload);
}
if (contentDto.payFlg) {
......
......@@ -10,11 +10,9 @@ import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentDownloadLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.FetchDateParameters;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
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.ABVExceptionCode;
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.common.nw.NetworkAdapter;
......@@ -24,7 +22,6 @@ import jp.agentec.abook.abv.bl.data.dao.AcmsDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.EnqueteDto;
import jp.agentec.abook.abv.bl.dto.ServiceOptionDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CategoryLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
......@@ -33,10 +30,8 @@ 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.ProjectLogic;
import jp.agentec.abook.abv.bl.logic.SubscriptionHistoryLogic;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.DateTimeUtil.DateUnit;
/**
* 新着更新を扱うクラス
......@@ -67,7 +62,6 @@ public class ContentRefresher {
private boolean initializingRefreshing = false;
private static final int refreshSleepInterval = 500;
private static final int maxRefreshWorker = 2;
private Date lastRefresh; // 前回更新日時(終了日時)
public static ContentRefresher getInstance() {
if (instance == null) {
......@@ -159,8 +153,7 @@ public class ContentRefresher {
List<ContentDto> localContents = contentDao.getAllContents();
if (networkAdapter.isNetworkConnected()) { // オンライン時の処理
resendLog(); // ログ送信
doWithServiceOption(); // サービスオプション関連処理
configureAutoDownload(); // 自動DLの設定を反映する(有効⇒無効、無効⇒有効(かつデフォルトオン))
contractLogic.initializeContractServiceOption(); // サービスオプション関連処理
groupLogic.initializeGroups(); // グループ設定(グループ変更の場合、FetchDateをクリアする)
categoryLogic.initializeCategories(); // カテゴリ設定
......@@ -184,8 +177,6 @@ public class ContentRefresher {
Logger.e("refreshContent failed.", e);
updateRefreshContentListState(-1L, e);
}
lastRefresh = new Date(); // 前回更新日時
contentDownloader.kickTask();
Logger.i(TAG, "refresh main thread end.-----------------------------------------------");
}
......@@ -321,11 +312,11 @@ public class ContentRefresher {
ContentDto localDto = localContents.get(localContentIndex);
if (!serverContentDto.equalsVersion(localDto)) { // 更新 ContentInfo.zipをダウンロードする。
contentDownloader.downloadContentInfo(serverContentDto.contentId);
if ((contentDownloader.isAutoDownload() || serverContentDto.isLinkType()) && localDto.isDownloadable(true)) {
if (serverContentDto.isLinkType() && localDto.isDownloadable(true)) {
contentDownloader.addAutoDownload(serverContentDto.contentId);
}
}
else if (!localDto.downloadedFlg && (contentDownloader.isAutoDownload() || serverContentDto.isLinkType()) && localDto.isDownloadable(true)) { // ダウンロード未完了も追加
else if (!localDto.downloadedFlg && serverContentDto.isLinkType() && localDto.isDownloadable(true)) { // ダウンロード未完了も追加
contentDownloader.addAutoDownload(serverContentDto.contentId);
}
......@@ -333,37 +324,14 @@ public class ContentRefresher {
} else {
// 新規 ContentInfo.zipをダウンロードする。
contentDownloader.downloadContentInfo(serverContentDto.contentId);
if ((contentDownloader.isAutoDownload() || serverContentDto.isLinkType()) && serverContentDto.isDownloadable(true)) {
if (serverContentDto.isLinkType() && serverContentDto.isDownloadable(true)) {
contentDownloader.addAutoDownload(serverContentDto.contentId);
}
}
}
}
return true;
}
private void configureAutoDownload() {
if (contentDownloader.isAutoDownload() && !cache.serviceOption.isAutoDownloadOptionEnable()) {
contentDownloader.setAutoDownload(false);
}
else if (!contentDownloader.isAutoDownload()) {
ServiceOptionDto autoDlOptionDto = ABVDataCache.getInstance().getServiceOption(ServiceOptionId.AutoDownload);
if (autoDlOptionDto != null && autoDlOptionDto.val.equals("2")) {
contentDownloader.setAutoDownload(true);
}
}
}
private void doWithServiceOption() throws NetworkDisconnectedException, AcmsException {
// サービスオプションの初期化
contractLogic.initializeContractServiceOption();
// 定期購読期間更新(決済ありの場合)
if (ABVDataCache.getInstance().serviceOption.isPayment() && ABVDataCache.getInstance().serviceOption.isAutoSubscriptionAll()) {
AbstractLogic.getLogic(SubscriptionHistoryLogic.class).refreshSubscription(contentDownloader.account);
}
}
}
public void updateRefreshContentListState(long contentId, Exception e) {
......@@ -378,7 +346,7 @@ public class ContentRefresher {
// 新着処理が終わったら以下の処理が実行
try {
// サーバー通信でプロジェクト取得
AbstractLogic.getLogic(ProjectLogic.class).initializeProjects();
projectLogic.initializeProjects();
} catch (Exception e1) {
Logger.e(TAG, e1);
e = e1;
......@@ -387,29 +355,6 @@ public class ContentRefresher {
contentDownloadListener.onRefreshedContent(e == null, contentId, e);
}
}
/**
* 前回更新日時を返す
*
* @return
*/
public Date getLastRefresh() {
return lastRefresh;
}
/**
* 前回更新日時からinterval日時経過したか
*
* @param interval
* @return
*/
public boolean isRefreshDateAfter(int interval) {
Logger.v(TAG, "isRefreshDateAfter=%s %s", interval, lastRefresh);
if (lastRefresh == null) { // 記録がないときは経過したとみなす
return true;
}
return new Date().after(DateTimeUtil.add(lastRefresh, DateUnit.Minute, interval));
}
public void stopRefresh() {
if (isRefreshing() && refreshWorker != null) {
......
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ContentCustomLogDto extends AbstractDto {
public int content_custom_log_id;
public int readingLogId;
public Date actionDate;
public long contentId;
public String param1;
public String param2;
public String param3;
public String param4;
public String param5;
@Override
public Object[] getInsertValues() {
return new Object[]{content_custom_log_id, readingLogId, actionDate, contentId, param1,param2, param3, param4, param5};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{readingLogId, actionDate, contentId,param1,param2, param3, param4, param5, content_custom_log_id};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ content_custom_log_id};
}
}
......@@ -45,7 +45,6 @@ public class ContentDto extends AbstractDto implements Serializable {
public Date lastDeliveryDate;
public int alertMessageLevel;
public String alertMessage;
public boolean pdfSendMailFlg;
public boolean printFlg;
public boolean hideFlg;
public String shareUrl;
......@@ -100,12 +99,12 @@ public class ContentDto extends AbstractDto implements Serializable {
@Override
public Object[] getInsertValues() {
return new Object[]{contentId, contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, pdfSendMailFlg, printFlg, hideFlg, shareUrl, readerShareFlg, disableAutoDl, payFlg, productId, deliveryType, signage, disableSwipe, signageDisableDl, isUnAuthorizedContent, commonContentFlg};
return new Object[]{contentId, contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, printFlg, hideFlg, shareUrl, readerShareFlg, disableAutoDl, payFlg, productId, deliveryType, signage, disableSwipe, signageDisableDl, isUnAuthorizedContent, commonContentFlg};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, pdfSendMailFlg, printFlg, hideFlg, shareUrl, readerShareFlg, disableAutoDl, payFlg, productId, deliveryType, signage, disableSwipe, downloadStartDate, status, signageDisableDl, commonContentFlg, contentId};
return new Object[]{contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, printFlg, hideFlg, shareUrl, readerShareFlg, disableAutoDl, payFlg, productId, deliveryType, signage, disableSwipe, downloadStartDate, status, signageDisableDl, commonContentFlg, contentId};
}
public ContentDto() {
......
package jp.agentec.abook.abv.bl.logic;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
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.ContentCustomLogDao;
import jp.agentec.abook.abv.bl.dto.ContentCustomLogDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
public class ContentCustomLogLogic extends AbstractLogic {
//private static final String TAG = "ContentCustomLogLogic";
private ContentCustomLogDao contentCustomLogDao = AbstractDao.getDao(ContentCustomLogDao.class);
/**
*
* @param contentId
* @param readingLogId
*/
public void insertContentCustomLog(long contentId, int readingLogId, Date actionDate, String param1, String param2, String param3, String param4, String param5) {
//カスタマイズログ利用の許可を得た場合のみカスタマイズログ情報を保存
if (ABVDataCache.getInstance().serviceOption.doUseCustomLog()) {
ContentCustomLogDto dto = new ContentCustomLogDto();
dto.contentId = contentId;
dto.readingLogId = readingLogId;
dto.actionDate = actionDate;
dto.param1 = param1;
dto.param2 = param2;
dto.param3 = param3;
dto.param4 = param4;
dto.param5 = param5;
contentCustomLogDao.insertContentCustomLog(dto);
}
}
public void deleteContentCustomLog(long contentId, int readingLogId) {
contentCustomLogDao.deleteContentCustomLog(contentId, readingLogId);
}
public JSONObject getContentCustomLogJson(long contentId, int readingLogId) {
JSONObject json = null;
List<ContentCustomLogDto> listDto = contentCustomLogDao.getContentCustomLogs(contentId, readingLogId);
if (listDto != null && !listDto.isEmpty()) {
json = new JSONObject();
//csvのheader部
JSONArray headerArr = new JSONArray();
headerArr.put("actionDate");
headerArr.put("param1");
headerArr.put("param2");
headerArr.put("param3");
headerArr.put("param4");
headerArr.put("param5");
json.put("header", headerArr);
JSONArray linesRootArr = new JSONArray();
//csvのbody部
for (ContentCustomLogDto contentCustomLogDto : listDto) {
JSONArray lineArr = new JSONArray();
Timestamp actionDate = new Timestamp(contentCustomLogDto.actionDate.getTime());
lineArr.put(DateTimeUtil.toStringInTimeZone(actionDate, DateTimeFormat.yyyyMMddHHmmss_hyphen,"GMT") + ",GMT");
lineArr.put(contentCustomLogDto.param1);
lineArr.put(contentCustomLogDto.param2);
lineArr.put(contentCustomLogDto.param3);
lineArr.put(contentCustomLogDto.param4);
lineArr.put(contentCustomLogDto.param5);
linesRootArr.put(lineArr);
}
json.put("lines", linesRootArr);
}
return json;
}
}
......@@ -26,7 +26,6 @@ import jp.agentec.abook.abv.bl.data.dao.ContentMarkingDao;
import jp.agentec.abook.abv.bl.data.dao.ContentPageDao;
import jp.agentec.abook.abv.bl.data.dao.ContentResourceDao;
import jp.agentec.abook.abv.bl.data.dao.ContentTagDao;
import jp.agentec.abook.abv.bl.data.dao.SubscriptionHistoryDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentPageDto;
import jp.agentec.abook.abv.bl.dto.ContentTagDto;
......@@ -176,7 +175,6 @@ public class ContentLogic extends AbstractLogic {
dto.contentSize = json.contentSize;
dto.alertMessageLevel = json.alertMessageLevel;
dto.alertMessage = json.alertMessage;
dto.pdfSendMailFlg = json.pdfSendMailFlg;
dto.printFlg = json.printFlg;
dto.hideFlg = json.hideFlg;
dto.shareUrl = json.shareUrl;
......@@ -521,39 +519,4 @@ public class ContentLogic extends AbstractLogic {
}
return new ContentJSON(text);
}
public boolean isAllSubscribed(ContentDto contentDto) {
return isAllSubscribed(AbstractDao.getDao(SubscriptionHistoryDao.class).getAllValidList(), contentDto);
}
/**
* 定期購読購入済みでその期間に含まれるか
*
* @param subscribeAllValidList
* @param contentDto
* @return
*/
public boolean isAllSubscribed(List<SubscriptionHistoryDto> subscribeAllValidList, ContentDto contentDto) {
if (subscribeAllValidList == null) {
return false;
}
for (SubscriptionHistoryDto subscriptionHistoryDto : subscribeAllValidList) {
Logger.v(TAG, "isAllSubscribed productId=%s, delFlg=%s, startTimeMillis=%s expiryTimeMillis=%s deliveryStartDate=%s", subscriptionHistoryDto.productId, subscriptionHistoryDto.delFlg, subscriptionHistoryDto.startTimeMillis, subscriptionHistoryDto.expiryTimeMillis, contentDto.deliveryStartDate.getTime());
// delFlg=2は新規購入不可扱いで過去の購入履歴としてはOKとする(テスト用途)
if (subscriptionHistoryDto.startTimeMillis != null && subscriptionHistoryDto.expiryTimeMillis != null) {
if (subscriptionHistoryDto.startTimeMillis < contentDto.deliveryStartDate.getTime() && contentDto.deliveryStartDate.getTime() < subscriptionHistoryDto.expiryTimeMillis) {
return true;
}
else {
// kpcのルールだと購入日の直近の公開日のコンテンツから購入可能というルール。
ContentDto nearestContent = contentDao.findNearest(subscriptionHistoryDto.startTimeMillis);
if (nearestContent != null && nearestContent.contentId == contentDto.contentId) {
Logger.d("You can dowlnload nearest content. contentId=" + nearestContent.contentId);
return true;
}
}
}
}
return false;
}
}
......@@ -26,7 +26,6 @@ public class ContentReadingLogLogic extends AbstractLogic {
private ContentPageReadingLogLogic contentPageReadingLogLogic = AbstractLogic.getLogic(ContentPageReadingLogLogic.class);
private ContentObjectLogDao contentObjectLogDao = AbstractDao.getDao(ContentObjectLogDao.class);
private ContentObjectLogLogic contentObjectLogLogic = AbstractLogic.getLogic(ContentObjectLogLogic.class);
private ContentCustomLogLogic contentCustomLogLogic = AbstractLogic.getLogic(ContentCustomLogLogic.class);
/*package*/ ContentReadingLogLogic() {
}
......@@ -155,8 +154,7 @@ public class ContentReadingLogLogic extends AbstractLogic {
logDto.longitude,
logDto.mode,
contentPageReadingLogLogic.getContentPageReadLogJson(logDto.contentId, logDto.readingLogId),
contentObjectLogLogic.getContentObjectLogJson(logDto.contentId, logDto.readingLogId),
contentCustomLogLogic.getContentCustomLogJson(logDto.contentId, logDto.readingLogId));
contentObjectLogLogic.getContentObjectLogJson(logDto.contentId, logDto.readingLogId));
boolean sendResult;
try {
sendResult = acms.contentReadingLog(logParam);
......@@ -169,7 +167,6 @@ public class ContentReadingLogLogic extends AbstractLogic {
// 送信完了したログは全て削除
contentPageReadingLogDao.deleteContentPageReadingLog(logDto.contentId, logDto.readingLogId);
contentObjectLogDao.deleteContentObjectLog(logDto.contentId, logDto.readingLogId);
contentCustomLogLogic.deleteContentCustomLog(logDto.contentId, logDto.readingLogId);
boolean result = contentReadingLogDao.deleteContentReadingLog(logDto);
if (result) {
Logger.i(TAG, "sent ContentReadingLog:%s", logDto.contentId);
......
......@@ -222,23 +222,6 @@ public class ContractLogic extends AbstractLogic {
}
/**
* ダッシュボードを使用するかを示します。
* @return マーキング機能する場合、trueを返します。
* @throws Exception
* @since 1.0.0
*/
public boolean getUsableDashboard() {
boolean result = false;
ServiceOptionDto dto = getServiceOptionFromId(ServiceOptionId.UsableDashboard);
if (dto != null) {
result = ContractLogic.getBooleanValue(dto.val);
}
return result;
}
/**
* 閲覧ログGPS使用可を示します。
* @return 閲覧ログGPS使用可の場合、trueを返します。
* @since 1.0.0
......@@ -270,34 +253,6 @@ public class ContractLogic extends AbstractLogic {
return result;
}
/**
* 백업/복원 사업자옵션 여부 확인
* @return 사용가능하면 true 반환
* @throws Exception
* @since 1.0.0
*/
public boolean getBackup() {
boolean result = false;
ServiceOptionDto dto = getServiceOptionFromId(ServiceOptionId.Backup);
if (dto != null) {
result = getBooleanValue(dto.val);
}
return result;
}
public boolean getPdfSendMail() {
boolean result = false;
ServiceOptionDto dto = getServiceOptionFromId(ServiceOptionId.PdfSendMail);
if (dto != null) {
result = getBooleanValue(dto.val);
}
return result;
}
public boolean getPdfLinkDisp() {
boolean result = false;
ServiceOptionDto dto = getServiceOptionFromId(ServiceOptionId.PdfLinkDisp);
......@@ -336,22 +291,7 @@ public class ContractLogic extends AbstractLogic {
return result;
}
/**
* コンテンツ共有に関するオプション
* @return 0:共有しない、1:ABook+Type 2:ABook ReaderType(複数CMS環境)
*/
public int getContentShareType() {
int result = 0;
ServiceOptionDto dto = getServiceOptionFromId(ServiceOptionId.ContentShare);
if (dto != null) {
result = Integer.valueOf(dto.val);
}
return result;
}
/**
* 契約事業者のサービスオプションを返します。
* @param serviceOptionId 取得するサービスオプションのサービスオプションIDです。
......
......@@ -17,10 +17,10 @@ import java.util.Map;
import java.util.UUID;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.type.ProjectAuthLevel;
......
......@@ -5,7 +5,7 @@ import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
......
package jp.agentec.abook.abv.bl.logic;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.parameters.SubscriptionHistoryParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SubscriptionHistorySendParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
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.SubscriptionHistoryDao;
import jp.agentec.abook.abv.bl.download.ContentDownloader;
import jp.agentec.abook.abv.bl.dto.SubscriptionDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionDto.Period;
import jp.agentec.adf.util.StringUtil;
public class SubscriptionHistoryLogic extends AbstractLogic {
private static final String TAG = "SubscriptionHistoryLogic";
private SubscriptionHistoryDao subscriptionHistoryDao = AbstractDao.getDao(SubscriptionHistoryDao.class);
public void restoreSubscriptionHistory(String account) throws AcmsException, NetworkDisconnectedException {
SubscriptionHistoryParameters subscriptionHistoryParameters = new SubscriptionHistoryParameters(cache.getMemberInfo().sid, account);
AcmsClient acmsClient = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
List<SubscriptionHistoryDto> list = acmsClient.getSubscriptionHistory(subscriptionHistoryParameters).dtoList;
if (list != null) {
for (SubscriptionHistoryDto subscriptionHistoryDto : list) {
Logger.d(TAG, "restore parchaseToke=%s", subscriptionHistoryDto.purchaseToken);
subscriptionHistoryDao.insertOrUpdate(subscriptionHistoryDto);
}
}
}
/**
* @throws NetworkDisconnectedException
* @throws AcmsException
*
*/
public void sendHistory() throws AcmsException, NetworkDisconnectedException {
List<SubscriptionHistoryDto> list = subscriptionHistoryDao.getUnsentList();
for (SubscriptionHistoryDto subscriptionHistoryDto : list) {
AcmsClient acmsClient = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
SubscriptionHistorySendParameters subParam = new SubscriptionHistorySendParameters(cache.getMemberInfo().sid, ContentDownloader.getInstance().account, subscriptionHistoryDto);
acmsClient.sendHistory(subParam);
subscriptionHistoryDao.updateAsSent(subscriptionHistoryDto.subscriptionHistoryId);
}
}
/**
* 定期購読の期間をサーバから取得して更新
* および現在購入可能な定期購読をセット
* @param account
*
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public void refreshSubscription(String account) throws NetworkDisconnectedException, AcmsException {
// 先にサーバに未送信の履歴を送信する。
sendHistory();
// 履歴の取得
AcmsClient acmsClient = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
SubscriptionHistoryParameters subParam = new SubscriptionHistoryParameters(cache.getMemberInfo().sid, account);
List<SubscriptionDto> subscriptionList = acmsClient.contentSet(subParam);
ABVEnvironment.getInstance().allSubscriptionProductId = null; // 一度リセット
long now = System.currentTimeMillis();
for (SubscriptionDto subscriptionDto : subscriptionList) {
// 定期購読期間を更新
AbstractDao.getDao(SubscriptionHistoryDao.class).update(subscriptionDto);
// 購入可能な定期購読のproductIdをセット(最初に有効なもの)
if (ABVEnvironment.getInstance().allSubscriptionProductId == null && subscriptionDto.delFlg == 0 && !StringUtil.isNullOrEmpty(subscriptionDto.productId)) {
boolean currentValid = false;
if (subscriptionDto.historyList != null) {
for (Period period : subscriptionDto.historyList) {
if (period.end > now) { // 購入済みで現在も有効なものは、現在は購入不可
currentValid = true;
break;
}
}
}
if (!currentValid) {
ABVEnvironment.getInstance().allSubscriptionProductId = subscriptionDto.productId;
}
}
}
}
}
......@@ -5,7 +5,7 @@ import java.util.Locale;
import org.json.adf.JSONObject;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.reader.CmsUrlJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CmsUrlJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Constant.ReaderConstant;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
......
......@@ -29,7 +29,6 @@ import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.nw.PCNetworkAdapter;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.SubscriptionHistoryDao;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
......
......@@ -114,7 +114,6 @@ public class ContentDaoTest extends TestCase {
dto.pagePath = "/data/data/jp.agentec.abook.abv.launcher.android/files/ABook/contents/1062/detail";
List<ContentPageDto>list = null;
dto.pages = list;
dto.pdfSendMailFlg = false;
dto.printFlg = false;
dto.readingCount =10;
dto.readingDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.dto.ContractDto;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class ContractDaoTest extends TestCase {
ContractDao contractDao = AbstractDao.getDao(ContractDao.class);
public ContractDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
ABVEnvironment.getInstance().isReader = true;
super.setUp();
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper)sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("ContractDaoTest");
// suite.addTest(new ContractDaoTest("testInsert"));
// suite.addTest(new ContractDaoTest("testUpdate"));
// suite.addTest(new ContractDaoTest("testLastUpdate"));
// suite.addTest(new ContractDaoTest("testExists"));
// suite.addTest(new ContractDaoTest("testInsertOrUpdate"));
// suite.addTest(new ContractDaoTest("testUndeliverableDelete"));
// suite.addTest(new ContractDaoTest("testGetListByUsablePushMessage"));
suite.addTest(new ContractDaoTest("testFindByContentExist"));
return suite;
}
public void testInsert() throws Exception {
ContractDto dto = new ContractDto(1, 1, "contractsss", "getnet", "Y", "N", "Y", "N", 0, new Date(), new Date(), 0 , null);
contractDao.insert(dto);
System.out.println(contractDao.getDto(1, 1).companyName);
}
public void testUpdate() throws Exception {
ContractDto dto = new ContractDto(1, 1, "contractsssU", "getnetU", "N", "Y", "N", "Y", 0, new Date(), new Date(), 1 , new Date());
contractDao.update(dto);
System.out.println(contractDao.getDto(1,1 ).companyName);
}
public void testLastUpdate() throws Exception {
System.out.println(contractDao.getLastUpdate());
}
public void testExists() throws Exception {
System.out.println(contractDao.exists(0, 1));
System.out.println(contractDao.exists(1, 1));
}
public void testInsertOrUpdate() throws Exception {
ContractDto dto = new ContractDto(1, 1, "fdsa", "get879sad7fd987frs9a87fds98fads798fds7fds798afdnet", "Y", "Y", "Y", "N", 0, new Date(), new Date(), 0 , null);
contractDao.insertOrUpdate(dto);
}
public void testUndeliverableDelete() throws Exception {
List<ContractDto> list = contractDao.getListByUndeliverableDelete();
for (ContractDto contractDto : list) {
System.out.println(contractDto.companyName);
}
}
public void testGetListByUsablePushMessage(){
List<ContractDto> list = contractDao.getListByUsablePushMessage();
for (ContractDto contractDto : list) {
System.out.println(contractDto.companyName);
}
}
public void testFindByContentExist() {
List<ContractDto> list = contractDao.findByContentExist();
for (ContractDto contractDto : list) {
System.out.println(contractDto.companyName);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.dto.FolderDto;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class FolderDaoTest extends TestCase {
private FolderDao dao = AbstractDao.getDao(FolderDao.class);
public FolderDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("FolderDaoTest");
suite.addTest(new FolderDaoTest("testGenerateGetFolderQuery"));
return suite;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testGenerateGetFolderQuery() {
int[] folderId = { 0, 1 };
List<FolderDto> folderList = dao.getFolderList(folderId);
for (FolderDto folder : folderList) {
Logger.d(folder.folderName);
Logger.d(folder.contentCount + "");
Logger.d(folder.displayCount);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentPageDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class InteractiveInfoDaoTest extends TestCase {
private InteractiveInfoDao dao = new InteractiveInfoDao();
private PlaylistDao playlistDao = new PlaylistDao();
private PlaylistDetailDao playlistDetailDao = new PlaylistDetailDao();
private ContentDao contentDao = new ContentDao();
public InteractiveInfoDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
ABVEnvironment.getInstance().isReader = true;
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("InteractiveInfoDaoTest");
suite.addTest(new InteractiveInfoDaoTest("testInsert"));
suite.addTest(new InteractiveInfoDaoTest("testUpdate"));
return suite;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testInsert() {
dao.beginTransaction();
ContentDto contentDto1 = insertDummyContent(100);
ContentDto contentDto2 = insertDummyContent(1000);
PlaylistDto playListDto1 = new PlaylistDto();
int playlistId = 1;
playListDto1.playlistId = playlistId;
playListDto1.playlistName = "Playlist01";
playlistDao.insert(playListDto1);
PlaylistDetailDto playlistDetailDto1 = new PlaylistDetailDto();
playlistDetailDto1.playlistId = playlistId;
playlistDetailDto1.listOrder = 1;
playlistDetailDto1.contentId = contentDto1.contentId;
playlistDetailDto1.slide = 3;
playlistDetailDto1.stay = 5;
playlistDetailDao.insert(playlistDetailDto1);
InteractiveInfoDto dto1 = new InteractiveInfoDto();
dto1.interactiveId = dao.getNewId();
dto1.playlistId = playlistDetailDto1.playlistId;
dto1.listOrder = playlistDetailDto1.listOrder;
dto1.dstContentId = contentDto2.contentId;
dto1.pageFrom = 1;
dto1.pageTo = 3;
dto1.dstPageFrom = 4;
dao.insert(dto1);
InteractiveInfoDto dto2 = dao.getInteractiveInfo(dto1.interactiveId);
assertEquals(dto1.interactiveId, dto2.interactiveId);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.listOrder, dto2.listOrder);
assertEquals(dto1.dstContentId, dto2.dstContentId);
assertEquals(dto1.pageFrom, dto2.pageFrom);
assertEquals(dto1.pageTo, dto2.pageTo);
assertEquals(dto1.dstPageFrom, dto2.dstPageFrom);
dao.rollback();
}
public void testUpdate() {
dao.beginTransaction();
ContentDto contentDto1 = insertDummyContent(100);
ContentDto contentDto2 = insertDummyContent(1000);
ContentDto contentDto3 = insertDummyContent(10000);
PlaylistDto playListDto1 = new PlaylistDto();
int playlistId1 = 1;
playListDto1.playlistId = playlistId1;
playListDto1.playlistName = "Playlist01";
playlistDao.insert(playListDto1);
PlaylistDetailDto playlistDetailDto1 = new PlaylistDetailDto();
playlistDetailDto1.playlistId = playlistId1;
playlistDetailDto1.listOrder = 1;
playlistDetailDto1.contentId = contentDto1.contentId;
playlistDetailDto1.slide = 3;
playlistDetailDto1.stay = 5;
playlistDetailDao.insert(playlistDetailDto1);
PlaylistDto playListDto2 = new PlaylistDto();
int playlistId2 = 2;
playListDto2.playlistId = playlistId2;
playListDto2.playlistName = "Playlist01";
playlistDao.insert(playListDto2);
PlaylistDetailDto playlistDetailDto2 = new PlaylistDetailDto();
playlistDetailDto2.playlistId = playlistId2;
playlistDetailDto2.listOrder = 2;
playlistDetailDto2.contentId = contentDto1.contentId;
playlistDetailDto2.slide = 3;
playlistDetailDto2.stay = 5;
playlistDetailDao.insert(playlistDetailDto2);
InteractiveInfoDto dto1 = new InteractiveInfoDto();
dto1.interactiveId = dao.getNewId();
dto1.playlistId = playlistDetailDto1.playlistId;
dto1.listOrder = playlistDetailDto1.listOrder;
dto1.dstContentId = contentDto2.contentId;
dto1.pageFrom = 1;
dto1.pageTo = 3;
dto1.dstPageFrom = 4;
dao.insert(dto1);
InteractiveInfoDto dto2 = dao.getInteractiveInfo(dto1.interactiveId);
assertEquals(dto1.interactiveId, dto2.interactiveId);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.listOrder, dto2.listOrder);
assertEquals(dto1.dstContentId, dto2.dstContentId);
assertEquals(dto1.pageFrom, dto2.pageFrom);
assertEquals(dto1.pageTo, dto2.pageTo);
assertEquals(dto1.dstPageFrom, dto2.dstPageFrom);
dto1.playlistId = playlistDetailDto2.playlistId;
dto1.listOrder = playlistDetailDto2.listOrder;
dto1.dstContentId = contentDto3.contentId;
dto1.pageFrom = 5;
dto1.pageTo = 10;
dto1.dstPageFrom = 6;
dao.update(dto1);
InteractiveInfoDto dto3 = dao.getInteractiveInfo(dto1.interactiveId);
assertEquals(dto1.interactiveId, dto3.interactiveId);
assertEquals(dto1.playlistId, dto3.playlistId);
assertEquals(dto1.listOrder, dto3.listOrder);
assertEquals(dto1.dstContentId, dto3.dstContentId);
assertEquals(dto1.pageFrom, dto3.pageFrom);
assertEquals(dto1.pageTo, dto3.pageTo);
assertEquals(dto1.dstPageFrom, dto3.dstPageFrom);
dao.rollback();
}
protected ContentDto insertDummyContent(long contentId) {
// コンテンツ登録
String time = "2013-08-08 15:00:00.0";
ContentDto contentDto = new ContentDto();
contentDto.alertMessage = "あらーと";
contentDto.alertMessageLevel = 1;
contentDto.allPageNum = 10;
contentDto.categoryId = 1233;
contentDto.contentDetail = "しょうさい";
contentDto.contentGroups = "ぐるーぷ";
contentDto.contentId = contentId;
contentDto.contentName = "たいとうr";
contentDto.contentNameKana = "...";
contentDto.contentProtectedFlg = true;
contentDto.contentSize = 1024;
contentDto.contentType = "pdfFile";
contentDto.contractContentId = 10;
contentDto.deliveryEndDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.deliveryStartDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.detailPageNum = 2;
contentDto.downloadedFlg = false;
contentDto.downloadingFlg = true;
contentDto.status = DownloadStatusType.Canceled.type();
contentDto.isChecked = false;
contentDto.favoriteFlg = false;
contentDto.groupIds = new int[] { 100, 200 };
contentDto.lastDeliveryDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.metaVersion = 2;
contentDto.newFlg = false;
contentDto.orientation = 1;
contentDto.pagePath = "/data/data/jp.agentec.abook.abv.launcher.android/files/ABook/contents/1062/detail";
List<ContentPageDto> list = null;
contentDto.pages = list;
contentDto.pdfSendMailFlg = false;
contentDto.printFlg = false;
contentDto.readingCount = 10;
contentDto.readingDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.downloadProgress = new Integer(1);
contentDto.resourcePath = null;
contentDto.resourceVersion = 3;
contentDto.tags = new String[3];
contentDto.thumbnailBigPath = "";
contentDto.thumbnailNormalPath = "";
contentDto.updatedFlg = true;
contentDao.insertContent(contentDto);
return contentDto;
}
}
package jp.agentec.abook.abv.bl.data.dao;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class LockDaoTest extends TestCase {
private LockDao dao = AbstractDao.getDao(LockDao.class);
public LockDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("LockDaoTest");
suite.addTest(new LockDaoTest(""));
return suite;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
}
package jp.agentec.abook.abv.bl.data.dao;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.adf.util.DateTimeUtil;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class PlaylistDaoTest extends TestCase {
private PlaylistDao dao = new PlaylistDao();
public PlaylistDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
ABVEnvironment.getInstance().isReader = true;
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("PlaylistDaoTest");
suite.addTest(new PlaylistDaoTest("testInsert"));
suite.addTest(new PlaylistDaoTest("testUpdate"));
return suite;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testInsert() {
dao.beginTransaction();
PlaylistDto dto1 = new PlaylistDto();
int playlistId = 1;
dto1.playlistId = playlistId;
dto1.playlistName = "Playlist01";
dto1.updateDate = DateTimeUtil.getCurrentDate();
dao.insert(dto1);
PlaylistDto dto2 = dao.getPlaylist(playlistId);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.playlistName, dto2.playlistName);
assertEquals(dto1.updateDate.toString(), dto2.updateDate.toString());
dao.rollback();
}
public void testUpdate() {
dao.beginTransaction();
PlaylistDto dto1 = new PlaylistDto();
int playlistId = 1;
dto1.playlistId = playlistId;
dto1.playlistName = "Playlist01";
dto1.updateDate = DateTimeUtil.getCurrentDate();
dao.insert(dto1);
PlaylistDto dto2 = dao.getPlaylist(playlistId);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.playlistName, dto2.playlistName);
assertEquals(dto1.updateDate.toString(), dto2.updateDate.toString());
dto2.playlistName = "NewPlaylist01";
dto1.updateDate = DateTimeUtil.getCurrentDate();
dao.update(dto2);
PlaylistDto dto3 = dao.getPlaylist(playlistId);
assertEquals(dto3.playlistId, dto2.playlistId);
assertEquals(dto3.playlistName, dto2.playlistName);
assertEquals(dto3.updateDate.toString(), dto2.updateDate.toString());
dao.rollback();
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentPageDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class PlaylistDetailDaoTest extends TestCase {
private PlaylistDetailDao dao = new PlaylistDetailDao();
private PlaylistDao playlistDao = new PlaylistDao();
private InteractiveInfoDao interactiveInfoDao = new InteractiveInfoDao();
private ContentDao contentDao = new ContentDao();
public PlaylistDetailDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
ABVEnvironment.getInstance().isReader = true;
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("PlaylistDetailDaoTest");
suite.addTest(new PlaylistDetailDaoTest("testInsert"));
suite.addTest(new PlaylistDetailDaoTest("testUpdate"));
suite.addTest(new PlaylistDetailDaoTest("testDeleteByContentId"));
return suite;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testInsert() {
dao.beginTransaction();
// コンテンツ登録
ContentDto contentDto = insertDummyContent(1000);
// プレイリスト登録
PlaylistDto playlistDto = new PlaylistDto();
int playlistId = 1;
playlistDto.playlistId = playlistId;
playlistDto.playlistName = "Playlist01";
playlistDao.insert(playlistDto);
PlaylistDetailDto dto1 = new PlaylistDetailDto();
dto1.playlistId = playlistId;
dto1.listOrder = 1;
dto1.contentId = contentDto.contentId;
dto1.slide = 3;
dto1.stay = 5;
dao.insert(dto1);
PlaylistDetailDto dto2 = dao.getPlaylistDetail(playlistId, dto1.listOrder);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.listOrder, dto2.listOrder);
assertEquals(dto1.contentId, dto2.contentId);
assertEquals(dto1.slide, dto2.slide);
assertEquals(dto1.stay, dto2.stay);
dao.rollback();
}
public void testUpdate() {
dao.beginTransaction();
// コンテンツ登録
ContentDto contentDto1 = insertDummyContent(1000);
ContentDto contentDto2 = insertDummyContent(10010);
// プレイリスト登録
PlaylistDto playlistDto = new PlaylistDto();
int playlistId = 1;
playlistDto.playlistId = playlistId;
playlistDto.playlistName = "Playlist01";
playlistDao.insert(playlistDto);
PlaylistDetailDto dto1 = new PlaylistDetailDto();
dto1.playlistId = playlistId;
dto1.listOrder = 1;
dto1.contentId = contentDto1.contentId;
dto1.slide = 3;
dto1.stay = 5;
dao.insert(dto1);
PlaylistDetailDto dto2 = dao.getPlaylistDetail(playlistId, dto1.listOrder);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.listOrder, dto2.listOrder);
assertEquals(dto1.contentId, dto2.contentId);
assertEquals(dto1.slide, dto2.slide);
assertEquals(dto1.stay, dto2.stay);
dto2.contentId = contentDto2.contentId;
dto2.slide = 6;
dto2.stay = 10;
dao.update(dto2);
PlaylistDetailDto dto3 = dao.getPlaylistDetail(playlistId, dto2.listOrder);
assertEquals(dto3.playlistId, dto2.playlistId);
assertEquals(dto3.listOrder, dto2.listOrder);
assertEquals(dto3.contentId, dto2.contentId);
assertEquals(dto3.slide, dto2.slide);
assertEquals(dto3.stay, dto2.stay);
dao.rollback();
}
public void testDeleteByContentId() {
dao.beginTransaction();
ContentDto contentDto1 = insertDummyContent(100);
ContentDto contentDto2 = insertDummyContent(1000);
PlaylistDto playListDto1 = new PlaylistDto();
int playlistId = 1;
playListDto1.playlistId = playlistId;
playListDto1.playlistName = "Playlist01";
playlistDao.insert(playListDto1);
PlaylistDetailDto playlistDetailDto1 = new PlaylistDetailDto();
playlistDetailDto1.playlistId = playlistId;
playlistDetailDto1.listOrder = 1;
playlistDetailDto1.contentId = contentDto1.contentId;
playlistDetailDto1.slide = 3;
playlistDetailDto1.stay = 5;
dao.insert(playlistDetailDto1);
PlaylistDetailDto playlistDetailDto2 = new PlaylistDetailDto();
playlistDetailDto2.playlistId = playlistId;
playlistDetailDto2.listOrder = 2;
playlistDetailDto2.contentId = contentDto2.contentId;
playlistDetailDto2.slide = 3;
playlistDetailDto2.stay = 5;
dao.insert(playlistDetailDto2);
InteractiveInfoDto dto1 = new InteractiveInfoDto();
dto1.interactiveId = interactiveInfoDao.getNewId();
dto1.playlistId = playlistDetailDto2.playlistId;
dto1.listOrder = playlistDetailDto2.listOrder;
dto1.dstContentId = contentDto2.contentId;
dto1.pageFrom = 1;
dto1.pageTo = 3;
dto1.dstPageFrom = 4;
interactiveInfoDao.insert(dto1);
InteractiveInfoDto dto2 = new InteractiveInfoDto();
dto2.interactiveId = interactiveInfoDao.getNewId();
dto2.playlistId = playlistDetailDto1.playlistId;
dto2.listOrder = playlistDetailDto1.listOrder;
dto2.dstContentId = contentDto1.contentId;
dto2.pageFrom = 1;
dto2.pageTo = 3;
dto2.dstPageFrom = 4;
interactiveInfoDao.insert(dto2);
dao.deleteByContentId(100);
dao.rollback();
}
protected ContentDto insertDummyContent(long contentId) {
// コンテンツ登録
String time = "2013-08-08 15:00:00.0";
ContentDto contentDto = new ContentDto();
contentDto.alertMessage = "あらーと";
contentDto.alertMessageLevel = 1;
contentDto.allPageNum = 10;
contentDto.categoryId = 1233;
contentDto.contentDetail = "しょうさい";
contentDto.contentGroups = "ぐるーぷ";
contentDto.contentId = contentId;
contentDto.contentName = "たいとうr";
contentDto.contentNameKana = "...";
contentDto.contentProtectedFlg = true;
contentDto.contentSize = 1024;
contentDto.contentType = "pdfFile";
contentDto.contractContentId = 10;
contentDto.deliveryEndDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.deliveryStartDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.detailPageNum = 2;
contentDto.downloadedFlg = false;
contentDto.downloadingFlg = true;
contentDto.status = DownloadStatusType.Canceled.type();
contentDto.isChecked = false;
contentDto.favoriteFlg = false;
contentDto.groupIds = new int[] { 100, 200 };
contentDto.lastDeliveryDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.metaVersion = 2;
contentDto.newFlg = false;
contentDto.orientation = 1;
contentDto.pagePath = "/data/data/jp.agentec.abook.abv.launcher.android/files/ABook/contents/1062/detail";
List<ContentPageDto> list = null;
contentDto.pages = list;
contentDto.pdfSendMailFlg = false;
contentDto.printFlg = false;
contentDto.readingCount = 10;
contentDto.readingDate = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
contentDto.downloadProgress = new Integer(1);
contentDto.resourcePath = null;
contentDto.resourceVersion = 3;
contentDto.tags = new String[3];
contentDto.thumbnailBigPath = "";
contentDto.thumbnailNormalPath = "";
contentDto.updatedFlg = true;
contentDao.insertContent(contentDto);
return contentDto;
}
}
package jp.agentec.abook.abv.bl.data.dao;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class ScheduleDaoTest extends TestCase {
private ScheduleDao dao = new ScheduleDao();
private PlaylistDao playlistDao = new PlaylistDao();
public ScheduleDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
ABVEnvironment.getInstance().isReader = true;
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("ScheduleDaoTest");
suite.addTest(new ScheduleDaoTest("testInsert"));
suite.addTest(new ScheduleDaoTest("testUpdate"));
return suite;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testInsert() {
dao.beginTransaction();
PlaylistDto playlistDto1 = new PlaylistDto();
int playlistId1 = 1;
playlistDto1.playlistId = playlistId1;
playlistDto1.playlistName = "Playlist01";
playlistDao.insert(playlistDto1);
PlaylistDto playlistDto2 = new PlaylistDto();
int playlistId2 = 2;
playlistDto2.playlistId = playlistId2;
playlistDto2.playlistName = "Playlist02";
playlistDao.insert(playlistDto2);
ScheduleDto dto1 = new ScheduleDto();
dto1.scheduleId = dao.getNewId();
dto1.start = DateTimeUtil.toDate("2015-01-01 09:00:00.0", DateTimeFormat.yyyyMMddHHmmss_hyphen);
dto1.end = DateTimeUtil.toDate("2015-01-01 17:00:00.0", DateTimeFormat.yyyyMMddHHmmss_hyphen);
dto1.playlistId = playlistId1;
dto1.subPlaylistId = playlistId2;
dao.insert(dto1);
ScheduleDto dto2 = dao.getSchedule(dto1.scheduleId);
assertEquals(dto1.scheduleId, dto2.scheduleId);
assertEquals(dto1.start, dto2.start);
assertEquals(dto1.end, dto2.end);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.subPlaylistId, dto2.subPlaylistId);
dao.rollback();
}
public void testUpdate() {
dao.beginTransaction();
PlaylistDto playlistDto1 = new PlaylistDto();
int playlistId1 = 1;
playlistDto1.playlistId = playlistId1;
playlistDto1.playlistName = "Playlist01";
playlistDao.insert(playlistDto1);
PlaylistDto playlistDto2 = new PlaylistDto();
int playlistId2 = 2;
playlistDto2.playlistId = playlistId2;
playlistDto2.playlistName = "Playlist02";
playlistDao.insert(playlistDto2);
ScheduleDto dto1 = new ScheduleDto();
dto1.scheduleId = dao.getNewId();
dto1.start = DateTimeUtil.toDate("2015-01-01 09:00:00.0", DateTimeFormat.yyyyMMddHHmmss_hyphen);
dto1.end = DateTimeUtil.toDate("2015-01-01 17:00:00.0", DateTimeFormat.yyyyMMddHHmmss_hyphen);
dto1.playlistId = playlistId1;
dto1.subPlaylistId = playlistId2;
dao.insert(dto1);
ScheduleDto dto2 = dao.getSchedule(dto1.scheduleId);
assertEquals(dto1.scheduleId, dto2.scheduleId);
assertEquals(dto1.start, dto2.start);
assertEquals(dto1.end, dto2.end);
assertEquals(dto1.playlistId, dto2.playlistId);
assertEquals(dto1.subPlaylistId, dto2.subPlaylistId);
dto2.start = DateTimeUtil.toDate("2015-01-01 21:00:00.0", DateTimeFormat.yyyyMMddHHmmss_hyphen);
dto2.end = DateTimeUtil.toDate("2015-01-01 05:00:00.0", DateTimeFormat.yyyyMMddHHmmss_hyphen);
dto2.playlistId = playlistId2;
dto2.subPlaylistId = playlistId1;
dao.update(dto2);
ScheduleDto dto3 = dao.getSchedule(dto1.scheduleId);
assertEquals(dto3.scheduleId, dto2.scheduleId);
assertEquals(dto3.start, dto2.start);
assertEquals(dto3.end, dto2.end);
assertEquals(dto3.playlistId, dto2.playlistId);
assertEquals(dto3.subPlaylistId, dto2.subPlaylistId);
dao.rollback();
}
}
......@@ -56,7 +56,6 @@ android {
//abvFunctionOptions
resValue("integer", "login_mode", "${login_mode}")
resValue("string", "account_path", "${account_path}")
resValue("integer", "location_mode", "${location_mode}")
resValue("integer", "setting_menu_account", "${setting_menu_account}")
resValue("integer", "setting_menu_logout", "${setting_menu_logout}")
resValue("integer", "setting_menu_password_change", "${setting_menu_password_change}")
......@@ -64,23 +63,9 @@ android {
resValue("integer", "setting_menu_app_info", "${setting_menu_app_info}")
resValue("integer", "setting_menu_url_path", "${setting_menu_url_path}")
resValue("integer", "setting_menu_loginId", "${setting_menu_loginId}")
resValue("integer", "viewer_menu_exit", "${viewer_menu_exit}")
resValue("integer", "viewer_menu_history", "${viewer_menu_history}")
resValue("integer", "viewer_menu_index", "${viewer_menu_index}")
resValue("integer", "viewer_menu_search", "${viewer_menu_search}")
resValue("integer", "viewer_menu_memo", "${viewer_menu_memo}")
resValue("integer", "viewer_menu_marking", "${viewer_menu_marking}")
resValue("integer", "viewer_menu_bookmark", "${viewer_menu_bookmark}")
resValue("integer", "usable_location_service", "${usable_location_service}")
resValue("integer", "usable_content_tag_search", "${usable_content_tag_search}")
resValue("integer", "push_message", "${push_message}")
resValue("integer", "check_app_update", "${check_app_update}")
resValue("integer", "download_service_check", "${download_service_check}")
resValue("string", "download_service_start_time", "${download_service_start_time}")
resValue("integer", "download_service_check_interval", "${download_service_check_interval}")
resValue("integer", "set_random_time", "${set_random_time}")
resValue("integer", "not_delete_all_contents", "${not_delete_all_contents}")
resValue("integer", "edition_type", "${edition_type}")
}
sourceSets {
main {
......
......@@ -654,9 +654,6 @@
<string name="monitor_mode_notouch">非タッチモード</string>
<string name="pdf_image_size_touch">外部モニタ解像度設定/タッチモニタ設定</string>
<!-- 1.8.5.4-->
<string name="default_schedule_label">デフォルト</string>
<!-- 1.9.0.0-->
<string name="meetingroom_setting">会議室設定</string>
<string name="marking_share_setting">マーキング共有設定</string>
......
......@@ -654,9 +654,6 @@
<string name="monitor_mode_notouch">비 터치 모드</string>
<string name="pdf_image_size_touch">외부 모니터 해상도 설정/터치 모니터 설정</string>
<!-- 1.8.5.4-->
<string name="default_schedule_label">기본</string>
<!-- 1.9.0.0-->
<string name="meetingroom_setting">회의실 설정</string>
<string name="marking_share_setting">마킹 공유 설정</string>
......
......@@ -671,9 +671,6 @@
<string name="monitor_mode_notouch">NoTouch Mode</string>
<string name="pdf_image_size_touch">External monitor resolution/Touch monitor setting</string>
<!-- 1.8.5.4-->
<string name="default_schedule_label">default</string>
<!-- 1.9.0.0-->
<string name="meetingroom_setting">Meeting room setting</string>
<string name="marking_share_setting">Marking sharing setting</string>
......
......@@ -50,10 +50,6 @@
android:title="@string/licence_info" >
</PreferenceScreen>
<PreferenceScreen
android:key="termOfUse"
android:title="@string/term_of_use" >
</PreferenceScreen>
<PreferenceScreen
android:key="checkAppUpdate"
android:title="@string/check_app_update" >
</PreferenceScreen>
......
......@@ -51,7 +51,7 @@ public class ContentLogUtil {
int readingLogId = contentReadingLogLogic.startContentReadLog(contentId);
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (permissionAccessLocation && checkUsableReadinglogGps(contentId) && context.getResources().getInteger(R.integer.usable_location_service) == 1) {
if (permissionAccessLocation && checkUsableReadinglogGps(contentId)) {
// 位置情報取得
locationManagerUtil = new LocationManagerUtil(context, new LocationManagerUtil.LocationManagerUtilListener() {
@Override
......
......@@ -37,10 +37,6 @@ public class ABVUIDataCache {
public Stack<FolderDto> folderStack;
public boolean preIsCatalogEdition;
public int preScale;
public int preDeviceLocationMode;
public boolean preUseGroup;
public boolean preUseGenre;
// ユーザ情報コピー元コンテンツID
public long srcContentId = -1;
......
package jp.agentec.abook.abv.launcher.android;
import java.util.Calendar;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
public class AlarmService {
private Context context;
private SharedPreferences pref;
public AlarmService(Context context){
this.context = context;
}
public void setTimeDownload(int hour, int minute){
boolean checkDownload;
long lastTimeDownload;
//ダウンロードしたかどうかチェック
pref = context.getSharedPreferences("DOWNLOADED", Context.MODE_PRIVATE);
checkDownload = pref.getBoolean("downloaded", false);
lastTimeDownload = pref.getLong("DateTime", System.currentTimeMillis());
//指定した時間ダウンロード設定
Calendar cal_setTime = Calendar.getInstance();
cal_setTime.set(Calendar.HOUR_OF_DAY, hour);
cal_setTime.set(Calendar.MINUTE, minute);
long setTime_ms = cal_setTime.getTimeInMillis();
//現在の時間
Calendar cal_now = Calendar.getInstance();
cal_now.set(Calendar.SECOND, 2);
long now_ms = cal_now.getTimeInMillis();
//指定時間になっていない
if(setTime_ms >= now_ms){
scheduleService(setTime_ms);
} else {
//指定した時間を過ぎたがダウンロードしていない
if (checkDownload) {
//ダウンロードした場合、指定時間を次の日にセット、ダウンロードフラグfalseにする。
if (setTime_ms < lastTimeDownload) {
cal_setTime.add(Calendar.DAY_OF_MONTH, 1);
setTime_ms = cal_setTime.getTimeInMillis();
scheduleService(setTime_ms);
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean("downloaded", false);
editor.commit();
} else {
//前の日ダウンロードを実行していなかったので、ダウンロードフラグtrueのまま
scheduleService(now_ms);
}
} else {
scheduleService(now_ms);
}
}
}
public void scheduleService(long timeStart){
Intent intent = new Intent(context, AutoDownloadService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, -1,intent , PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, timeStart,AlarmManager.INTERVAL_FIFTEEN_MINUTES, pendingIntent);
}
public void cancelService () {
Intent intent = new Intent(context, AutoDownloadService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, -1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
}
}
package jp.agentec.abook.abv.launcher.android;
import java.util.Random;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.LogLevel;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.download.ContentDownloader;
import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.PrefName;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import android.app.IntentService;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.widget.Toast;
public class AutoDownloadService extends IntentService {
private final static String TAG="AutoDownloadService";
private long autoDownloadStartTime;
private Runnable downloadStart;
private Runnable refreshContentList;
private final Handler mHandler = new Handler();
private final long ONE_MINUTE = 60000;
@Override
public void onCreate() {
super.onCreate();
}
public AutoDownloadService() {
super(TAG);
}
@Override
protected void onHandleIntent(Intent intent) {
Logger.d(TAG, "ServiceStart");
autoDownloadStartTime = intent.getLongExtra("AUTO_DOWNLOAD_START_TIME", System.currentTimeMillis());
SharedPreferences pref = getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, MODE_PRIVATE);
if (!pref.getBoolean(AppDefType.AutoDownloadPrefKey.AUTO_DOWNLOAD_WAITTING, false)) {
if (!checkPauseStatus() && checkAutoDownloadTime()) {
setTimeDownloadRandom();
}
}
}
//自動ダウンロード停止する条件になっているかどうか確認
private boolean checkPauseStatus(){
SharedPreferences pref = getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, MODE_PRIVATE);
boolean contentOpenPause = pref.getBoolean(AppDefType.AutoDownloadPrefKey.CONTENT_OPEN, false);
return contentOpenPause;
}
/**
* ダウンロード中にWifi ONからOFFになった場合再開するため
* @return
*/
// private boolean checkWifiNotAccess(){
//
// boolean isWifiOff = true;
//
// NetworkAdapter networkAdapter = ABVEnvironment.getInstance().networkAdapter;
// SharedPreferences pref = getPrefData();
// SharedPreferences.Editor editor = pref.edit();
// if (networkAdapter.isWifiConnected()) {
// isWifiOff = false;
// if (pref.getBoolean(AppDefType.PreferenceKey.WIFI_OFF, false)) {
// editor.putBoolean(AppDefType.PreferenceKey.WIFI_OFF_STATUS_CHANGE, true);
// editor.putBoolean(AppDefType.PreferenceKey.WIFI_OFF, false);
// editor.commit();
// }
// } else {
// editor.putBoolean(AppDefType.PreferenceKey.WIFI_OFF, true);
// editor.commit();
// }
//
// return isWifiOff;
// }
private boolean checkAutoDownloadTime(){
boolean isDownloadStart = false;
SharedPreferences pref = getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, MODE_PRIVATE);
long autoDownloadStartedTime = pref.getLong(AppDefType.AutoDownloadPrefKey.AUTO_DOWNLOAD_STARTED_TIME, 0);
//指定した時間になった場合または過ぎた場合
if (autoDownloadStartTime <= System.currentTimeMillis() && autoDownloadStartTime > autoDownloadStartedTime) {
isDownloadStart = true;
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean(AppDefType.AutoDownloadPrefKey.AUTO_DOWNLOAD_WAITTING, true);
editor.commit();
}
return isDownloadStart;
//自動ダウンロード再開するため
// else {
// //ダウンロードの停止された問題が解決されたかどうか確認
// boolean contentCloseStatus = pref.getBoolean(AppDefType.PreferenceKey.CONTENT_OPEN_STATUS_CHANGE, false);
// boolean wifiOnStatus = pref.getBoolean(AppDefType.PreferenceKey.WIFI_OFF_STATUS_CHANGE, false);
// //停止された問題が解決されたらダウンロード再開
// if ( contentCloseStatus || wifiOnStatus ) {
// isDownloadStart = true;
// editor.putBoolean(AppDefType.PreferenceKey.CONTENT_OPEN_STATUS_CHANGE, false);
// editor.putBoolean(AppDefType.PreferenceKey.WIFI_OFF_STATUS_CHANGE, false);
// editor.commit();
// }
// }
}
private void setTimeDownloadRandom(){
int downloadStartRandomTime = getResources().getInteger(R.integer.set_random_time);
Random timeRandom = new Random();
int getTimeRandom = timeRandom.nextInt(downloadStartRandomTime);
refreshContentList = new Runnable() {
@Override
public void run() {
try {
ContentRefresher.getInstance().refreshContentList(null);
if (ABVEnvironment.getInstance().getLogLevel().level() <= LogLevel.debug.level()) {
ABVToastUtil.showMakeText(getBaseContext(), "自動ダウンロードサービス開始", Toast.LENGTH_SHORT);
}
Logger.d(TAG, "自動ダウンロードサービス開始");
} catch (Exception e) {
Logger.e(TAG, "onHandleIntent refreshContentList", e);
}
}
};
downloadStart = new Runnable() {
@Override
public void run() {
ContentDownloader.getInstance().autoDownload();
Logger.d(TAG,"AutoDownloadCall");
SharedPreferences pref = getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.putLong(AppDefType.AutoDownloadPrefKey.AUTO_DOWNLOAD_STARTED_TIME, System.currentTimeMillis());
editor.putBoolean(AppDefType.AutoDownloadPrefKey.AUTO_DOWNLOAD_WAITTING, false);
editor.commit();
}
};
Logger.i(TAG, "DownloadStartTime: After " + getTimeRandom + " minute");
mHandler.postDelayed(refreshContentList, getTimeRandom*ONE_MINUTE);
mHandler.postDelayed(downloadStart, (getTimeRandom+5)*ONE_MINUTE);
}
@Override
public void onDestroy(){
super.onDestroy();
}
}
......@@ -16,28 +16,9 @@ public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) || intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED) || intent.getAction().equals(Intent.ACTION_MY_PACKAGE_REPLACED)) {
// 自動ダウンロードチェックの開始
// TODO later ABVNoAuthenticatedActivityとソース重複のため統一
Resources res = context.getResources();
if (res.getInteger(R.integer.download_service_check) == 1) {
Calendar autoDownloadCalendar = Calendar.getInstance();
String autoDownTime = res.getString(R.string.download_service_start_time);
String[] setTimeDownload = autoDownTime.split(":");
//自動ダウンロード時間設定
autoDownloadCalendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(setTimeDownload[0]));
autoDownloadCalendar.set(Calendar.MINUTE, Integer.parseInt(setTimeDownload[1]));
long timeAutoDownload = autoDownloadCalendar.getTimeInMillis();
Intent serviceIntent = new Intent(context.getApplicationContext(), AutoDownloadService.class);
serviceIntent.putExtra("AUTO_DOWNLOAD_START_TIME", timeAutoDownload);
PendingIntent pendingIntent = PendingIntent.getService(context.getApplicationContext(), -1, serviceIntent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarmManager = (AlarmManager) context.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 5 * 60 * 1000, pendingIntent);
Logger.d("OnBootReceiver onReceive Alarm register");
}
}
}
}
\ No newline at end of file
......@@ -69,7 +69,6 @@ import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
import jp.agentec.abook.abv.launcher.android.ABVUIDataCache;
import jp.agentec.abook.abv.launcher.android.AutoDownloadService;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.PrefName;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
......@@ -109,7 +108,6 @@ public abstract class ABVActivity extends Activity {
public static final String CID="cid";
public static final String PAGE="page";
public static final String IS_STREAMING="isStreaming";
public static final String URL = "url";
public static final String MESSAGE = "message";
public static final String PASSWORD = "password";
......@@ -302,12 +300,7 @@ public abstract class ABVActivity extends Activity {
}
protected void configureKeepScreen() {
// 自動ロックがYの場合、スリープを有効にする
if (ABVDataCache.getInstance().serviceOption.isUseAutoLock()) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
public void logRunningTaskInfo() {
......@@ -733,19 +726,6 @@ public abstract class ABVActivity extends Activity {
user.forceSignoutUser();
} else {
user.signoutUser();
//自動ダウンロードする場合サービスキャンル、ダウンロード関する保存したデータを削除
if (getRInteger(R.integer.download_service_check) == 1) {
//プリファレンスデータ削除
SharedPreferences pref = getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.clear();
editor.commit();
//ユーザ切り替え、前回のサービスキャンセル
Intent intent = new Intent(getApplicationContext(), AutoDownloadService.class);
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), -1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager)getApplicationContext().getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
}
}
}
} catch (Exception e) {
......
......@@ -337,7 +337,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
private void contentViewActivityMoveWithAccessLocationAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) {
if (!getABVUIDataCache().isShowedPermissionAccessLocationAlert() && ( AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()) && getRInteger(R.integer.usable_location_service) == 1) {
if (!getABVUIDataCache().isShowedPermissionAccessLocationAlert() && ( AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps())) {
// 位置情報取得許可アラートを一度も表示していない場合表示する
putUserPref(UserPrefKey.SHOWED_PERMISSION_ACCESS_LOCATION_ALERT, true);
showPermissionAccessLocationAlert(intent, contentId, ABVNavi);
......@@ -595,20 +595,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
}
}
if (dto.payFlg) { // 有料の場合
// 定期購読があるかどうか
if (!AbstractLogic.getLogic(ContentLogic.class).isAllSubscribed(dto)) {
// ない場合個別に購入状況をチェック
Purchase purchase = BillingHelper.getInstance().queryPurchae(dto.productId);
Logger.d(TAG, "purchase: " + purchase);
if (purchase == null || purchase.getPurchaseState() != 0) {
checkStatus = ContentCheckResultType.PAYMENT;
handleErrorMessageDialog(R.string.app_name, ErrorCode.M007);
}
}
}
} catch (NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException" + e);
handleErrorMessageToast(ErrorCode.NETWORK);
......@@ -748,11 +734,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
}
protected int getContentShareType() {
ContractLogic contractLogic = AbstractLogic.getLogic(ContractLogic.class);
return contractLogic.getContentShareType();
}
protected String handleException(final AcmsException e) {
String msg;
if (e.getHttpStatus() == 401) { // パスワードが不正な場合
......@@ -776,190 +757,9 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
return msg;
}
/**
* 設定に応じて開く・DL・選択のいずれかを行う
*/
public void contentOpenOrDownload(ContentDto contentDto) {
Logger.d(TAG, "contentOpenOrDownload start. contentId=%s", contentDto.contentId);
int deliveryType = ABVDataCache.getInstance().serviceOption.getDeliveryType();
int tapActionOnDeliverySelect = PreferenceUtil.getInt(this, DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT, "2");
int tapActionOnUpdate = PreferenceUtil.getInt(this, DefPrefKey.TAP_ACTION_ON_UPDATE, "0");
if (deliveryType == DeliveryType.DOWNLOAD || (deliveryType != DeliveryType.STREAMING && contentDto.deliveryType == DeliveryType.DOWNLOAD)) {
if (contentDto.downloadedFlg) {
if (contentDto.updatedFlg) {
switch (tapActionOnUpdate) {
case UpdateSelect.SELECT:
showUpdateSelectDialog(contentDto, true, true, false, true);
break;
case UpdateSelect.OPEN:
startContentViewActivity(contentDto.contentId);
break;
case UpdateSelect.UPDATE:
contentValidCheckAndDownload(contentDto.contentId);
break;
}
}
else {
startContentViewActivity(contentDto.contentId);
}
}
else {
contentValidCheckAndDownload(contentDto.contentId);
}
}
else if (deliveryType == DeliveryType.STREAMING || contentDto.deliveryType == DeliveryType.STREAMING) {
if (contentDto.downloadedFlg) {
if (contentDto.updatedFlg) {
switch (tapActionOnUpdate) {
case UpdateSelect.SELECT:
showUpdateSelectDialog(contentDto, true, false, true, false);
break;
case UpdateSelect.OPEN:
startContentViewActivity(contentDto.contentId);
break;
case UpdateSelect.UPDATE:
startStreamingActivity(contentDto.contentId);
}
}
else {
startContentViewActivity(contentDto.contentId);
}
}
else {
startStreamingActivity(contentDto.contentId);
}
}
else {
if (contentDto.downloadedFlg) {
if (contentDto.updatedFlg) {
switch (tapActionOnDeliverySelect) {
case DeliveryType.DOWNLOAD:
switch (tapActionOnUpdate) {
case UpdateSelect.SELECT:
showUpdateSelectDialog(contentDto, true, true, false, true);
break;
case UpdateSelect.OPEN:
startContentViewActivity(contentDto.contentId);
break;
case UpdateSelect.UPDATE:
contentValidCheckAndDownload(contentDto.contentId);
break;
}
break;
case DeliveryType.STREAMING:
switch (tapActionOnUpdate) {
case UpdateSelect.SELECT:
startStreamingActivity(contentDto.contentId);
break;
case UpdateSelect.OPEN:
startContentViewActivity(contentDto.contentId);
break;
case UpdateSelect.UPDATE:
startStreamingActivity(contentDto.contentId);
}
break;
case DeliveryType.SELECT:
switch (tapActionOnUpdate) {
case UpdateSelect.SELECT:
showUpdateSelectDialog(contentDto, true, true, true, true);
break;
case UpdateSelect.OPEN:
startContentViewActivity(contentDto.contentId);
break;
case UpdateSelect.UPDATE:
contentValidCheckAndDownload(contentDto.contentId);
break;
}
break;
}
}
else {
startContentViewActivity(contentDto.contentId);
}
}
else {
switch (tapActionOnDeliverySelect) {
case DeliveryType.DOWNLOAD:
contentValidCheckAndDownload(contentDto.contentId);
break;
case DeliveryType.STREAMING:
startStreamingActivity(contentDto.contentId);
break;
case DeliveryType.SELECT:
showUpdateSelectDialog(contentDto, false, true, true, false);
break;
}
}
}
}
public void startStreamingActivity(final long contentId) {
startStreamingActivity(contentId, null);
}
public void startStreamingActivity(long contentId, Intent intent) {
if (intent == null) {
intent = new Intent();
}
intent.putExtra(ABVActivity.IS_STREAMING, true);
startContentViewActivity(intent, contentId);
}
public abstract boolean contentValidCheckAndDownload(long contentId);
/**
* ダウンロードアイコンのリソースIDを返す。表示しない場合はnullを返す。
*
* @param contentDto
* @return
*/
public Integer getDownloadIconResId(ContentDto contentDto) {
Logger.d(TAG, "getDownloadIconResId start. contentId=%s", contentDto.contentId);
int deliveryType = ABVDataCache.getInstance().serviceOption.getDeliveryType();
if (deliveryType == DeliveryType.DOWNLOAD || (deliveryType != DeliveryType.STREAMING && contentDto.deliveryType == DeliveryType.DOWNLOAD)) {
if (contentDto.downloadedFlg) {
if (contentDto.updatedFlg) {
return R.drawable.ic_download_update;
}
else {
return null;
}
}
else {
return R.drawable.ic_download;
}
}
else if (deliveryType == DeliveryType.STREAMING || contentDto.deliveryType == DeliveryType.STREAMING) {
if (contentDto.downloadedFlg) {
if (contentDto.updatedFlg) {
return R.drawable.icon_contentdetail_streaming;
}
else {
return null;
}
}
else {
return R.drawable.icon_contentdetail_streaming;
}
}
else {
if (contentDto.downloadedFlg) {
if (contentDto.updatedFlg) {
return R.drawable.ic_update_streaming_select;
}
else {
return null;
}
}
else {
return R.drawable.ic_download_streaming_select;
}
}
}
/**
* Beacon共通ダイアログ表示
* @param contentId
* @param contentURL
......@@ -1043,15 +843,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
return dialog;
}
public boolean isStreamingOnly(ContentDto contentDto) {
return ContentViewHelper.getInstance().isStreamingOnly(contentDto);
}
public boolean isStreamingEnable(ContentDto contentDto) {
return activityHandlingHelper.isStreamingEnable(contentDto);
}
public void startContentViewActivity(long contentId) {
startContentViewActivity(contentId, 0);
}
......@@ -1064,95 +855,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
startContentViewActivity(intent, contentId);
}
protected void showUpdateSelectDialog(final ContentDto contentDto, final boolean hasOpen, final boolean hasUpdate, final boolean hasStreaming, boolean isUpdate) {
Logger.d(TAG, "showUpdateSelectDialog start");
View parent = getWindow().findViewById(android.R.id.content);
final View view = getLayoutInflater().inflate(R.layout.popup_select_with_checkbox, null);
final PopupWindow popup = new PopupWindow(this);
popup.setContentView(view);
popup.setWidth(getRDimensionSize(R.dimen.popup_size_xlarge));
final TextView titleTextView = (TextView) view.findViewById(R.id.select_title);
titleTextView.setText(contentDto.contentName);
final CheckedTextView checkedNonNexttime = (CheckedTextView) view.findViewById(R.id.checkedNonNexttime);
checkedNonNexttime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((CheckedTextView) v).toggle();
}
});
Button selectOpen = (Button) view.findViewById(R.id.select_open);
selectOpen.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startContentViewActivity(contentDto.contentId);
if (checkedNonNexttime.isChecked()) {
PreferenceUtil.put(getApplicationContext(), DefPrefKey.TAP_ACTION_ON_UPDATE, "" + UpdateSelect.OPEN);
}
popup.dismiss();
}
});
if (!hasOpen) {
selectOpen.setVisibility(View.GONE);
}
Button selectDownload = (Button) view.findViewById(R.id.select_download); // ダウンロードとアップデートのボタンを兼ねる
selectDownload.setText(getString(isUpdate? R.string.update: R.string.download));
selectDownload.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popup.dismiss();
handler.post(new Runnable() {
@Override
public void run() {
contentValidCheckAndDownload(contentDto.contentId);
}
});
if (checkedNonNexttime.isChecked()) {
if (hasStreaming && !(hasOpen && hasUpdate)) { // 3つの選択肢があるときは、Update優先のみを変更する
PreferenceUtil.put(getApplicationContext(), DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT, "" + DeliveryType.DOWNLOAD);
}
else {
PreferenceUtil.put(getApplicationContext(), DefPrefKey.TAP_ACTION_ON_UPDATE, "" + UpdateSelect.UPDATE);
}
}
}
});
if (!hasUpdate) {
selectDownload.setVisibility(View.GONE);
}
Button selectStreaming = (Button) view.findViewById(R.id.select_streaming);
selectStreaming.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startStreamingActivity(contentDto.contentId);
if (checkedNonNexttime.isChecked() && !hasOpen) { // 開くとセットの時は無視
PreferenceUtil.put(getApplicationContext(), DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT, "" + DeliveryType.STREAMING);
}
popup.dismiss();
}
});
if (!hasStreaming) {
selectStreaming.setVisibility(View.GONE);
}
Button selectCancel= (Button) view.findViewById(R.id.select_cancel);
selectCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popup.dismiss();
}
});
popup.setWidth(LayoutParams.WRAP_CONTENT);
popup.setHeight(LayoutParams.WRAP_CONTENT);
popup.setOutsideTouchable(true);
popup.showAtLocation(parent, Gravity.CENTER, 0, 0);
}
protected void setDisplaySize() {
mDisplaySize = DisplayUtil.getDisplaySize2(getApplicationContext());
......
......@@ -324,14 +324,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (!getRBoolean(R.bool.use_cache) && objectId == -1) {
ContentFileExtractor.getInstance().removeContentCash(contentId);
}
//自動ダウンロード再開設定
if (getRInteger(R.integer.download_service_check) == 1) {
//Autoダウンロード再開登録
SharedPreferences pref = getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean(AppDefType.AutoDownloadPrefKey.CONTENT_OPEN, false);
editor.commit();
}
}
public long getContentId() {
......@@ -573,11 +565,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
@Override
public boolean contentValidCheckAndDownload(long contentId) {
return false; // dummy
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
Logger.v(TAG, "[dispatchTouchEvent]:start");
try {
......@@ -589,6 +576,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
}
@Override
public boolean contentValidCheckAndDownload(long contentId) {
return false; // dummy
}
protected void setMeetingParticipantCount(boolean isVisible, View toolBar) {
final TextView textView = (TextView)toolBar.findViewById(R.id.txt_meeting_participant);
if (textView == null) {
......
......@@ -48,7 +48,6 @@ import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.environment.NetworkAdapter;
import jp.agentec.abook.abv.cl.push.FcmManager;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.AutoDownloadService;
import jp.agentec.abook.abv.launcher.android.OnAppDownloadReceiver;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -95,47 +94,12 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
*/
protected void showMainActivity(String loginId) {
//init_admin_modeがtrueの場合、管理者画面に遷移
alarmServiceStart();
startActivity(new Intent().setClassName(getApplicationContext().getPackageName(), getMainActivityClassName()).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP), NaviConsts.Right);
finish();
Intent intent = new Intent();
getApplicationContext().sendBroadcast(intent);
}
//AlarmService起動
private void alarmServiceStart() {
if (getRInteger(R.integer.download_service_check) == 1) {
Calendar autoDownloadCalendar = Calendar.getInstance();
String autoDownTime = getRString(R.string.download_service_start_time);
String[] setTimeDownload = autoDownTime.split(":");
//自動ダウンロード時間設定
int hourTime = Integer.parseInt(setTimeDownload[0]);
int minuteTime = Integer.parseInt(setTimeDownload[1]);
autoDownloadCalendar.set(Calendar.HOUR_OF_DAY, hourTime);
autoDownloadCalendar.set(Calendar.MINUTE, minuteTime);
long timeAutoDownload = autoDownloadCalendar.getTimeInMillis();
Logger.d(TAG, "AutoDownload Day:" + autoDownloadCalendar.get(Calendar.DAY_OF_MONTH));
// 開始予定時間が過去の場合は明日の同じ時間に変更
if (timeAutoDownload < System.currentTimeMillis()) {
autoDownloadCalendar.add(Calendar.DATE, 1);
timeAutoDownload = autoDownloadCalendar.getTimeInMillis();
Logger.d(TAG, "Change AutoDownload Day:" + autoDownloadCalendar.get(Calendar.DAY_OF_MONTH));
}
Intent intent = new Intent(getApplicationContext(), AutoDownloadService.class);
intent.putExtra("AUTO_DOWNLOAD_START_TIME", timeAutoDownload);
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), -1, intent , PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarmManager = (AlarmManager)getApplicationContext().getSystemService(ALARM_SERVICE);
// N分単位でチェックされるように設定
int checkInterval = getRInteger(R.integer.download_service_check_interval);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), checkInterval * 60 * 1000, pendingIntent);
}
}
// ログインなしの場合専用
protected void noAuthenticatedLogin(final boolean isGuestLogin, final String urlPath) {
CommonExecutor.execute(new Runnable() {
......@@ -446,10 +410,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
final Uri data = getIntent().getData();
Logger.i(TAG, "call from URI intent : %s", data);
if (data != null && data.getScheme() != null) {
if (data.getScheme().equals("file")) { // CMS入稿
contentUpload(intent, data);
return;
}
if (data.getScheme().equals(getString(R.string.scheme_url))) { // カスタムURI
intent.putExtra(CID, getLongValFromURI(data, CID));
intent.putExtra(PAGE, (int)getLongValFromURI(data, PAGE));
......@@ -469,43 +429,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
}
}
/**
* CMSへファイルアップロード処理
*
* @param intent
* @param data
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
private void contentUpload(final Intent intent, Uri data) throws AcmsException, NetworkDisconnectedException {
String ext = FileUtil.getExtension(data.getPath()).toLowerCase(Locale.getDefault());
ABVDataCache.getInstance().refreshServiceOptions();
boolean isUploadEnable = ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.ContentUpload); // サービスオプション(CMS入稿)
boolean isEditor = (AbstractLogic.getLogic(UserAuthenticateLogic.class).getAuthLevel() != AuthLevel.MOBILE); // 編集者(管理者含む)かどうか
boolean isOfficeEnable = ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Office2pdf); // サービスオプション(Office入稿)
boolean isContentContainerEnable = ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.ContentContainer); // サービスオプション(コンテンツコンテナ)
if (StringUtil.contains(ext, new String[]{"xls","xlsx","doc","docx","ppt", "pptx"}) && !isOfficeEnable) { // Office入稿チェック
Logger.w(TAG, "Office2pdf is not allowed.");
showUploadAlertDialog(intent, R.string.error, R.string.content_upload_file_not_allowed);
}
else if (!StringUtil.contains(ext, new String[]{"pdf", "xls","xlsx","doc","docx","ppt", "pptx"}) && !isContentContainerEnable) { // コンテンツコンテナチェック
Logger.w(TAG, "ContentContainer is not allowed.");
showUploadAlertDialog(intent, R.string.error, R.string.content_upload_file_not_allowed);
}
else if (!isUploadEnable || !isEditor) { // サービスオプションが無効もしくは閲覧者の場合アップロード不可
showUploadAlertDialog(intent, R.string.error, R.string.content_upload_not_allowed);
}
else { // サービスオプション可能かつ編集者以上ならCMS入稿可能
showContentUploadDialog(intent, data.getPath(), ABVDataCache.getInstance().getUrlPath(), ABVDataCache.getInstance().getMemberInfo().sid);
}
}
private void showUploadAlertDialog(final Intent intent, int titleResId, int bodyResId) {
showUploadAlertDialog(intent, titleResId, getString(bodyResId));
}
private void showUploadAlertDialog(final Intent intent, final int titleResId, final String body) {
handler.post(new Runnable() {
@Override
......@@ -522,69 +445,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
});
}
/**
* ファイルアップロードダイアログ表示
*
* @param intent
* @param path
* @param urlPath
* @param sid
*/
private void showContentUploadDialog(final Intent intent, final String path, final String urlPath, final String sid) {
final CharSequence[] items = {getString(R.string.content_upload_auto_delivery)};
final boolean[] checkedItems = {true};
new AlertDialog.Builder(this)
.setTitle(R.string.content_upload_confirm)
.setMultiChoiceItems(items, checkedItems, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
checkedItems[which] = isChecked;
}
})
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, int id) {
Logger.v(TAG, "auto delivery:" + checkedItems[0]);
showProgressPopup();
dialog.cancel();
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
try {
// ファイルアップロード処理
AcmsMessageJSON json = AcmsClient.getInstance(urlPath, ABVEnvironment.getInstance().networkAdapter).contentRegist(sid, new File(path), checkedItems[0]);
if (json.httpStatus == 200) {
showUploadAlertDialog(intent, R.string.confirm, R.string.content_upload_completed);
}
else {
Logger.e(TAG, "Content Upload failed. status=" + json.httpStatus + " message=" + StringUtil.join(",", json.errorMessage));
showUploadAlertDialog(intent, R.string.error, R.string.content_upload_failed);
}
} catch (AcmsException e) {
Logger.e(TAG, "Content Upload failed. ", e);
String msg = ErrorMessage.getErrorMessage(mContext, e);
showUploadAlertDialog(intent, R.string.error, msg);
} catch (Exception e) {
Logger.e(TAG, "Content Upload failed. ", e);
showUploadAlertDialog(intent, R.string.error, R.string.content_upload_failed);
} catch (OutOfMemoryError e) {
Logger.e(TAG, "Content Upload failed. ", e);
showUploadAlertDialog(intent, R.string.error, R.string.OUT_OF_MEMORY);
}
}
});
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
moveToHome(intent, dialog);
}
})
.show();
}
private void moveToHome(final Intent intent, DialogInterface dialog) {
showProgressPopup();
dialog.dismiss();
......
......@@ -149,10 +149,6 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
Logger.d(TAG, "contentDownloader.isRefreshing() %s", result);
getABVUIDataCache().preIsCatalogEdition = ABVDataCache.getInstance().serviceOption.isCatalogEdition();
getABVUIDataCache().preScale = ABVDataCache.getInstance().serviceOption.getContractScale();
getABVUIDataCache().preDeviceLocationMode = ABVDataCache.getInstance().serviceOption.getDeviceLocationMode();
getABVUIDataCache().preUseGroup = ABVDataCache.getInstance().serviceOption.isUseGroup();
getABVUIDataCache().preUseGenre = ABVDataCache.getInstance().serviceOption.isUseGenre();
if (!result) {
startUpdateAnimation();
......@@ -397,10 +393,8 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
Logger.w(TAG, "you need to set mRefreshImage.");
}
if (getRInteger(R.integer.download_service_check) == 0) {
// 自動ダウンロード対象がある場合、新着更新が完了したあとに開始するように修正(jang)
ContentDownloader.getInstance().autoDownload();
}
// 自動ダウンロード対象がある場合、新着更新が完了したあとに開始するように修正(jang)
ContentDownloader.getInstance().autoDownload();
}
/**
......
......@@ -31,7 +31,6 @@ public interface AppDefType {
String PERMISSION_ACCESS_LOCATION = "permissionAccessLocation";
String PUSH_MESSAGE ="pushMessage";
String CURSOR_ENABLE = "cursorEnable";
String AUTO_DOWNLOAD = "autoDownload";
String IMAGE_CHANGE_EFFECT = "imageChangeEffect";
String ERROR_SEND_ENABLE = "errorSendEnable";
String LOG_SEND_ENABLE = "logSendEnable";
......
......@@ -16,15 +16,6 @@ public class ABVFunctionOptions extends AbstractOptions {
}
@Override
public int getLocationMode() {
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return ABVDataCache.getInstance().serviceOption.getDeviceLocationMode();
} else {
return context.getResources().getInteger(R.integer.location_mode);
}
}
@Override
public int getSettingMenuAccount() {
return context.getResources().getInteger(R.integer.setting_menu_account);
}
......@@ -50,41 +41,15 @@ public class ABVFunctionOptions extends AbstractOptions {
}
@Override
public int getViewerMenuExit() {
return context.getResources().getInteger(R.integer.viewer_menu_exit);
}
@Override
public int getViewerMenuIndex() {
return context.getResources().getInteger(R.integer.viewer_menu_index);
}
@Override
public int getViewerMenuSearch() {
return context.getResources().getInteger(R.integer.viewer_menu_search);
}
@Override
public int getViewerMenuTextcopy() {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
@Override
public int getViewerMenuMemo() {
return context.getResources().getInteger(R.integer.viewer_menu_memo);
}
@Override
public int getViewerMenuMarking() {
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
} else {
return context.getResources().getInteger(R.integer.viewer_menu_marking);
}
}
@Override
public int getViewerMenuBookmark() {
return context.getResources().getInteger(R.integer.viewer_menu_bookmark);
return 1;
}
}
package jp.agentec.abook.abv.ui.common.appinfo.options;
import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ContentShareType;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.common.util.ContentFileUtil;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
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 android.content.Context;
/**
......@@ -24,33 +13,4 @@ public abstract class AbstractOptions implements IOptions {
public AbstractOptions(Context context) {
this.context = context.getApplicationContext();
}
protected int getContentShareVisibility(long contentId) {
int visible = 0;
int contentShareType = AbstractLogic.getLogic(ContractLogic.class).getContentShareType();
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (contentShareType == ContentShareType.ABOOK_TYPE) {
visible = 1;
}
return visible;
}
protected int getPdfSendMailVisibility(long contentId) {
ContractLogic cl = AbstractLogic.getLogic(ContractLogic.class);
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
try {
DownloadedContentInfoJSON json = ContentFileUtil.getDownloadedContentInfoJSON(contentId);
if (contentDto.contentType.equals(ContentJSON.KEY_PDF_TYPE) && cl.getPdfSendMail() && json.pdfSendMailFlg) {
return 1;
}
} catch (Exception e) {
Logger.e("PdfSendMail", "error", e);
}
return 0;
}
@Override
public int getSettingMenuErrorSend() {
return 1;
}
}
......@@ -13,11 +13,6 @@ public class DefaultOptions extends AbstractOptions {
}
@Override
public int getLocationMode() {
return 0;
}
@Override
public int getSettingMenuAccount() {
return 1;
}
......@@ -43,37 +38,12 @@ public class DefaultOptions extends AbstractOptions {
}
@Override
public int getViewerMenuExit() {
return 1;
}
@Override
public int getViewerMenuIndex() {
return 0;
}
@Override
public int getViewerMenuSearch() {
return 1;
}
@Override
public int getViewerMenuTextcopy() {
return 0;
}
@Override
public int getViewerMenuMemo() {
return 0;
}
@Override
public int getViewerMenuMarking() {
return 0;
}
@Override
public int getViewerMenuBookmark() {
return 0;
}
}
package jp.agentec.abook.abv.ui.common.appinfo.options;
public interface IOptions {
/**
* ロケーション切り替え
* @return 0:非表示(全部の固定)、1:表示
*/
int getLocationMode();
/**
* 設定:アカウント
......@@ -38,51 +33,15 @@ public interface IOptions {
int getSettingMenuLogInfo();
/**
* 設定:障害情報送信
* @return 0:非表示 1:表示
*/
int getSettingMenuErrorSend();
/**
* Viewerツールバー:戻る
* @return 0:非表示、1:表示
*/
int getViewerMenuExit();
/**
* Viewerツールバー:インデックス
* @return 0:非表示、1:表示
*/
int getViewerMenuIndex();
/**
* Viewerツールバー:検索
* @return 0:非表示、1:表示
*/
int getViewerMenuSearch();
/**
* Viewerツールバー:テキストコピー
* @return 0:非表示、1:表示
*/
int getViewerMenuTextcopy();
/**
* Viewer:メモ
* @return
*/
int getViewerMenuMemo();
/**
* Viewerツールバー:マーキング
* @return
*/
int getViewerMenuMarking();
/**
* Viewerツールバー:しおり
* @return
*/
int getViewerMenuBookmark();
}
......@@ -15,11 +15,6 @@ public class LargeOptions extends AbstractOptions {
}
@Override
public int getLocationMode() {
return ABVDataCache.getInstance().serviceOption.getDeviceLocationMode();
}
@Override
public int getSettingMenuAccount() {
return 1;
}
......@@ -45,37 +40,12 @@ public class LargeOptions extends AbstractOptions {
}
@Override
public int getViewerMenuExit() {
return 1;
}
@Override
public int getViewerMenuIndex() {
return 1;
}
@Override
public int getViewerMenuSearch() {
return 1;
}
@Override
public int getViewerMenuTextcopy() {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
@Override
public int getViewerMenuMemo() {
return 1;
}
@Override
public int getViewerMenuMarking() {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
}
@Override
public int getViewerMenuBookmark() {
return 1;
}
}
......@@ -15,11 +15,6 @@ public class MidOptions extends AbstractOptions {
}
@Override
public int getLocationMode() {
return 0;
}
@Override
public int getSettingMenuAccount() {
return 1;
}
......@@ -45,37 +40,12 @@ public class MidOptions extends AbstractOptions {
}
@Override
public int getViewerMenuExit() {
return 1;
}
@Override
public int getViewerMenuIndex() {
return 0;
}
@Override
public int getViewerMenuSearch() {
return 1;
}
@Override
public int getViewerMenuTextcopy() {
return 0;
}
@Override
public int getViewerMenuMemo() {
return 0;
}
@Override
public int getViewerMenuMarking() {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
}
@Override
public int getViewerMenuBookmark() {
return 0;
}
}
package jp.agentec.abook.abv.ui.common.appinfo.options;
import jp.agentec.abook.abv.bl.common.Constant.ContractScale;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
......@@ -14,33 +13,8 @@ public class Options {
public static IOptions getInstance(Context context) {
ABVDataCache cache = ABVDataCache.getInstance();
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
if (cache.serviceOption.isCatalogEdition()) {
switch (cache.serviceOption.getContractScale()) {
case ContractScale.Large:
if (!(options instanceof LargeOptions)) {
options = new LargeOptions(context);
}
break;
case ContractScale.Mid:
if (!(options instanceof MidOptions)) {
options = new MidOptions(context);
}
break;
default:
if (!(options instanceof DefaultOptions)) {
options = new DefaultOptions(context);
}
}
} else {
if (!(options instanceof ABVFunctionOptions)) {
options = new ABVFunctionOptions(context);
}
}
} else {
if (!(options instanceof ABVFunctionOptions)) {
options = new ABVFunctionOptions(context);
}
if (!(options instanceof ABVFunctionOptions)) {
options = new ABVFunctionOptions(context);
}
return options;
}
......
......@@ -2,7 +2,6 @@ package jp.agentec.abook.abv.ui.common.helper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
......@@ -12,11 +11,8 @@ 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.SubscriptionHistoryDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.SubscriptionHistoryLogic;
import jp.agentec.abook.abv.cl.billing.IabException;
import jp.agentec.abook.abv.cl.billing.IabHelper;
import jp.agentec.abook.abv.cl.billing.IabResult;
......@@ -24,8 +20,6 @@ import jp.agentec.abook.abv.cl.billing.Inventory;
import jp.agentec.abook.abv.cl.billing.Purchase;
import jp.agentec.abook.abv.cl.billing.SkuDetails;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.DateTimeUtil.DateUnit;
import jp.agentec.adf.util.StringUtil;
import android.app.Activity;
import android.app.AlertDialog;
......@@ -328,37 +322,6 @@ public class BillingHelper {
if (purchase.getItemType().equals(IabHelper.ITEM_TYPE_INAPP)) { // 単品購入の場合
AbstractDao.getDao(ContentDao.class).updatePurchaseStateBySku(purchase.getSku(), purchase.getPurchaseState(), purchase.getToken());
}
else { // 定期購読の場合
ABVEnvironment.getInstance().allSubscriptionProductId = null; // 購入済みなので購入不可に変更
SubscriptionHistoryDao subscriptionHistoryDao = AbstractDao.getDao(SubscriptionHistoryDao.class);
SubscriptionHistoryDto subscriptionHistoryDto = subscriptionHistoryDao.findByPurchaseToken(purchase.getToken());
if (subscriptionHistoryDto == null) {
subscriptionHistoryDto = new SubscriptionHistoryDto();
subscriptionHistoryDto.packageName = purchase.getPackageName();
subscriptionHistoryDto.developerPayload = purchase.getDeveloperPayload();
subscriptionHistoryDto.orderId = purchase.getOrderId();
subscriptionHistoryDto.purchaseTime = purchase.getPurchaseTime();
subscriptionHistoryDto.purchaseState = purchase.getPurchaseState();
subscriptionHistoryDto.purchaseToken = purchase.getToken();
subscriptionHistoryDto.productId = purchase.getSku();
subscriptionHistoryDto.startTimeMillis = purchase.getPurchaseTime(); // 仮の値を入れる
// この時点でYearlyかMonthlyかを判断することができないので、後でサーバでAPIで取得したデータで上書きされることになる。 TODO: 新着更新以外でも定期購読更新を実行した方がよい
subscriptionHistoryDto.expiryTimeMillis = DateTimeUtil.add(new Date(purchase.getPurchaseTime()), DateUnit.Month, 1).getTime();
subscriptionHistoryDto.allFlg = 1;
subscriptionHistoryDto.sentFlg = 0;
subscriptionHistoryDto.delFlg = 0;
AbstractDao.getDao(SubscriptionHistoryDao.class).insert(subscriptionHistoryDto);
}
}
try {
// サーバに履歴を送信する。未送信のものをまとめて送る。
AbstractLogic.getLogic(SubscriptionHistoryLogic.class).sendHistory();
} catch (AcmsException e) {
Logger.e(TAG, "sendHistory failed.", e);
Toast.makeText(act, R.string.S_E_ACMS_0500, Toast.LENGTH_SHORT).show();
} catch (NetworkDisconnectedException e) {
Toast.makeText(act, R.string.NETWORK, Toast.LENGTH_SHORT).show();
}
// 画面リフレッシュ
refreshContentList(purchase);
......
......@@ -99,7 +99,6 @@ public class Initializer {
env.websocketServerWsUrl = s(R.string.websocket_server_ws_url);
}
env.isCheckInvalidPasswordLimit = b(R.bool.is_check_invalid_passward_limit);
env.editionType = i(R.integer.edition_type);
env.isContentProtected = b(R.bool.content_protected);
env.isPdfThumbnailOutput = b(R.bool.pdf_thumbnail_output);
env.defaultLogName = s(R.string.default_log_name);
......
......@@ -35,7 +35,6 @@ import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.parameters.AppLastVersionParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.acms.type.LoginMode;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
......@@ -43,19 +42,15 @@ 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.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ServiceOptionDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.cl.util.RawResourceUtil;
import jp.agentec.abook.abv.launcher.android.AutoDownloadService;
import jp.agentec.abook.abv.launcher.android.OnAppDownloadReceiver;
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.appinfo.AppDefType.PrefName;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.options.Options;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
......@@ -74,10 +69,6 @@ public class ABookSettingFragment extends PreferenceFragment {
private static final String LOG_INFO = "log_info";
private static final String APP_INFO = "app_info";
// 会議室設定
private static final String CHAIRMAN_MARKING_SHARE = "charmanMarkingShare";
private static final String MARKING_SHARE_AUTO_SAVE = "markingShareAutoSave";
// アカウント
private static final String ACCOUNT_PATH = "accountPath";
private static final String LOGINID = "loginid";
......@@ -85,18 +76,12 @@ public class ABookSettingFragment extends PreferenceFragment {
private static final String PASSWORD_CHANGE = "passwordChange";
private static final String LOGOUT = "logout";
// データ管理
private static final String BACKUP = "backup";
private static final String RESTORE = "restore";
private static final String RESTORE_PURCHASE_HISTORY = "restore_purchase_history";
// ログ情報
private static final String EXPORT = "export";
private static final String ERROR_SEND_ENABLE = "errorSendEnable";
// アプリ情報
private static final String LICENSE_INFO = "licenseInfo";
private static final String TERM_OF_USE = "termOfUse";
private static final String CHECK_APP_UPDATE = "checkAppUpdate";
private static final String ABOUT_A_BOOK = "aboutABook";
private static final String ABOOK_CHECK_MANUAL = "abookCheckManual";
......@@ -112,13 +97,6 @@ public class ABookSettingFragment extends PreferenceFragment {
handler = new Handler();
pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
// 自動DLの初期値を設定する(レイアウトをセットした時点でPreferenceが保存されてしまうのでその前の段階で行う)
ServiceOptionDto dto = ABVDataCache.getInstance().getServiceOption(ServiceOptionId.AutoDownload);
if (!contains(DefPrefKey.AUTO_DOWNLOAD)) {
if (dto != null && "2".equals(dto.val)) {// 0:自動DL無効、1:自動DL有効&初期値はOFF、2:自動DL有効&初期値はON
put(DefPrefKey.AUTO_DOWNLOAD, true);
}
}
addPreferencesFromResource(R.xml.pref);
// アカウント
setAccountSetting();
......@@ -279,20 +257,6 @@ public class ABookSettingFragment extends PreferenceFragment {
SharedPreferences sharedPreferences = getActivity().getSharedPreferences(AppDefType.PrefName.USER_PREFERENCE, Context.MODE_PRIVATE);
sharedPreferences.edit().remove(AppDefType.UserPrefKey.GUEST_LOGIN).commit();
if(getResources().getInteger(R.integer.download_service_check) == 1) {
//AlarmServiceをキャンセル
Intent intentService = new Intent(getActivity().getApplicationContext(), AutoDownloadService.class);
PendingIntent pendingIntent = PendingIntent.getService(getActivity().getApplicationContext(), -1, intentService, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager)getActivity().getApplicationContext().getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
//ダウンロード履歴削除
SharedPreferences preferences = getActivity().getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.commit();
}
Intent intent = new Intent(getActivity(), LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
......@@ -326,9 +290,6 @@ public class ABookSettingFragment extends PreferenceFragment {
return true;
}
});
if (Options.getInstance(getActivity()).getSettingMenuErrorSend() == 0) {
remove((PreferenceGroup)findPreference(LOG_INFO), ERROR_SEND_ENABLE);
}
}
private void setAppInfoSetting() {
......@@ -355,20 +316,6 @@ public class ABookSettingFragment extends PreferenceFragment {
}
});
// 利用規約
Preference termOfUse = findPreference(TERM_OF_USE);
if (ABVDataCache.getInstance().serviceOption.isPayment()) {
termOfUse.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showTermOfUseDialog();
return true;
}
});
} else {
appInfo.removePreference(termOfUse);
}
// アップデート確認
Preference checkAppUpdate = findPreference(CHECK_APP_UPDATE);
if (getResources().getInteger(R.integer.check_app_update) == 1) {
......
......@@ -609,9 +609,7 @@ public class GuideViewActivity extends ABVContentViewActivity {
private void unlimitViewer() {
overlapLayout.setVisibility(View.GONE);
if (Options.getInstance(this).getViewerMenuExit() == 1) {
mExitBtn.setVisibility(View.VISIBLE);
}
mExitBtn.setVisibility(View.VISIBLE);
}
private void initRemoteLayout() {
......@@ -831,47 +829,6 @@ public class GuideViewActivity extends ABVContentViewActivity {
mMainLayout.addView(mToolBar, param1);
}
private void showPdfSendMailDialog(final DownloadedContentInfoJSON json) {
String fileName = mContentJSON.getPdfFileName();
String filepath = mContentDir + "/" + fileName;
File pdfFile = new File(filepath);
final Uri fileUri = Uri.parse("content://" + getPackageName() + ".pdffileprovider/" + contentId + "/" + fileName);
ABookAlertDialog messageDialog;
long L = pdfFile.length();
if (L > 20971520) {
//20메가 보다 큰 경우 송신 못한다고 메일 보냄
messageDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.pdf_mail), getString(R.string.mail_size_over));
messageDialog.setPositiveButton(R.string.ok, null);
} else {
//다 통과... 이제 보낼껀지 체크하는 팝업
messageDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.pdf_mail), getString(R.string.mail_submit));
messageDialog.setNegativeButton(R.string.cancel, null);
messageDialog.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendPDF(json, fileUri);
}
});
}
messageDialog.show();
return;
}
private void sendPDF(DownloadedContentInfoJSON json, Uri fileUri){
PDFFileProvider.expired = DateTimeUtil.add(new Date(), DateUnit.Minute, 60);
Intent it = new Intent(Intent.ACTION_SEND);
it.setType("plain/text");
it.putExtra(Intent.EXTRA_SUBJECT, json.contentName);
it.putExtra(Intent.EXTRA_TEXT, json.contentName + getResources().getString(R.string.send_to));
it.putExtra(Intent.EXTRA_STREAM, fileUri);
startActivity(it);
}
private void setMarkingViewVisibility(boolean visible){
for (MarkingView markingView : mMarkingViewList) {
if (visible) {
......
package jp.agentec.abook.abv.ui.home.activity;
import jp.agentec.abook.abv.bl.acms.client.json.reader.CmsUrlJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CmsUrlJSON;
import jp.agentec.abook.abv.bl.acms.type.DeleteDataType;
import jp.agentec.abook.abv.bl.acms.type.LoginMode;
import jp.agentec.abook.abv.bl.acms.type.LoginStatus;
......@@ -18,7 +18,6 @@ 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.abook.abv.bl.data.dao.MemberInfoDao;
import jp.agentec.abook.abv.bl.data.dao.SearchHistoryDao;
import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.PasswordLockInfoDto;
......@@ -706,9 +705,6 @@ public class LoginActivity extends ABVLoginActivity {
ProjectLogic projectLogic = AbstractLogic.getLogic(ProjectLogic.class);
projectLogic.deleteAllProject();
memberInfoDao.deleteMemberContentInfo(isAllDelete);
// バグ対応:ユーザ切り替え時検索結果の履歴が削除する。
SearchHistoryDao searchHistoryDao = AbstractDao.getDao(SearchHistoryDao.class);
searchHistoryDao.deleteAllSearchHistory();
// MacAddress取得回答はOK済みと見なす
Editor editor = PreferenceUtil.getUserEditor(this);
......
......@@ -46,8 +46,8 @@ import java.util.List;
import java.util.concurrent.CountDownLatch;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectInspectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectInspectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetProjectDataParameters;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.ProjectAuthLevel;
......
......@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.check.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProjectDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetProjectDataParameters;
import jp.agentec.abook.abv.bl.acms.type.ProjectAuthLevel;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
......
......@@ -182,11 +182,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
public void startContentActivity(Context context, Intent intent, NaviConsts aBVNavi, Integer flags, long contentId) throws Exception {
Logger.i(TAG, "startContentActivity contentId=" + contentId + " intent=" + intent);
if (isStreaming(contentId, intent)) {
startStreamingActivity(getCurrentActivity(), intent, contentId);
return;
}
String path = ContentFileExtractor.getInstance().getContentCacheDirWithExtract(contentId);
if (path == null) {
Logger.e(TAG, "startContentActivity: JSON Data is Null.mContentDir=" + null);
......@@ -285,66 +280,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
});
}
/**
* ストリーミングかどうかを判断する
* サービスオプション、コンテンツの指定がダウンロードの場合か、ダウンロードが完了しているか、
* さもなければストリーミングとみなす。(ここでは選択はなし)
*
* @param intent
*/
private boolean isStreaming(long contentId, Intent intent) {
if (intent.hasExtra(ABVActivity.IS_STREAMING)) {
return true;
}
int deliveryType = ABVDataCache.getInstance().serviceOption.getDeliveryType();
ContentDto contentDto = contentDao.getContent(contentId);
if (deliveryType == DeliveryType.DOWNLOAD || (deliveryType != DeliveryType.STREAMING && contentDto.deliveryType == DeliveryType.DOWNLOAD)) {
return false;
}
return !contentDto.downloadedFlg;
}
public void startStreamingActivity(final ABVAuthenticatedActivity activity, final Intent intentParam, final long contentId) {
if (!checkOwner(activity)) {
return;
}
// アラートを表示する設定かつ3G回線がアクティブの場合警告を表示
try {
activity.showWifiDisconnectAlert(R.string.C_E_SYSTEM_0005, R.string.streaming, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ContentDto contentDto = contentDao.getContent(contentId);
Intent intent = (intentParam != null) ? intentParam : new Intent();
String baseUrl = ABVEnvironment.getInstance().acmsAddress + "webvw/stview.html?cid=%s&page=%s&sid=%s";
String url = String.format(baseUrl, contentId, intent.getIntExtra("page", 0), ABVDataCache.getInstance().getMemberInfo().sid);
Logger.d(TAG, "Streaming URL=%s", url);
if (StringUtil.equals(contentDto.contentType, ContentJSON.KEY_PANO_MOVIE_TYPE) && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // 360°動画の場合Chromeで表示
startChrome(activity, url);
return;
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(ABookKeys.CONTENT_ID, contentId);
intent.putExtra("isStreaming", true);
intent.putExtra("isDownloadable", (!contentDto.downloadedFlg || contentDto.updatedFlg) && contentDto.deliveryType != DeliveryType.STREAMING);
intent.putExtra("isUpdate", contentDto.downloadedFlg && contentDto.updatedFlg);
intent.putExtra(ABookKeys.CONTENT_TYPE, contentDto.contentType);
intent.putExtra(ABookKeys.CONTENT_NAME, contentDto.contentName);
startHTMLWebActivity(activity, intent, url, contentId, -1, -1, -1, -1,-1);
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
} catch (NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException" + e);
activity.handleErrorMessageToast(ErrorCode.NETWORK);
}
}
private void startActivity(Context context, Intent intent, NaviConsts ABVNavi, Integer flags, long contentId, String contentType, String path) throws Exception {
contentRefresher.stopRefresh(); // 新着更新を停止する
if (intent == null) {
......@@ -1111,35 +1046,11 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
public boolean isDownloadEnable(ContentDto contentDto) {
return !isStreamingOnly(contentDto) && !contentDto.downloadedFlg;
return !contentDto.downloadedFlg;
}
public boolean isUpdateEnable(ContentDto contentDto) {
return !isStreamingOnly(contentDto) && contentDto.updatedFlg;
}
private boolean isStreamingOnly(ContentDto contentDto) {
return ContentViewHelper.getInstance().isStreamingOnly(contentDto);
}
public boolean isStreamingEnable(ContentDto contentDto) {
int deliveryType = ABVDataCache.getInstance().serviceOption.getDeliveryType();
if (deliveryType == DeliveryType.DOWNLOAD || (deliveryType != DeliveryType.STREAMING && contentDto.deliveryType == DeliveryType.DOWNLOAD)) {
return false;
}
return !(!contentDto.updatedFlg && contentDto.downloadedFlg);
}
public boolean isStreamingPriority(ContentDto contentDto) {
if (isStreamingOnly(contentDto)) { // ストリーミングのみの時true
return true;
}
if (!isStreamingEnable(contentDto)) { // ダウンロードが優先の時true
return false;
}
// 選択が可能な場合、設定の優先に従って変更
return PreferenceUtil.getInt(mContext, DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT, "2") == DeliveryType.STREAMING;
return contentDto.updatedFlg;
}
public void downloadUnAuthorizedContentInfo(long contentId) {
......@@ -1173,13 +1084,10 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
if (meetingManager.isSubscribed() // 会議室参加者の場合: ストリーミング優先、リンクコンテンツ、その他タイプのとき不可Ha
&& (isStreamingPriority(contentDto) || contentDto.isLinkType() || contentDto.isOtherType())) {
&& (contentDto.isLinkType() || contentDto.isOtherType())) {
showToast(mContext.getString(R.string.msg_content_not_allowed_at_meeting));
return false;
} else {
if (isStreamingPriority(contentDto)) { // ストリーミングの場合OKで返す(会議室参加の場合はstartContentViewActivityで弾かれる)
return true;
}
handleDownload(contentId, contentDto); // DLを行ったのち開く
return false;
}
......
......@@ -44,20 +44,12 @@ public class ContentViewHelper {
} else if (linkContentDto.downloadedFlg) {
// ダウンロード済み
return LinkContentStatus.DownloadedContent;
} else if (isStreamingOnly(linkContentDto)) {
// Streamingコンテンツ
return LinkContentStatus.StreamingContent;
} else {
// コンテンツ詳細を表示
return LinkContentStatus.StartContentDownloadAndStart;
}
}
public boolean isStreamingOnly(ContentDto contentDto) {
int deliveryType = ABVDataCache.getInstance().serviceOption.getDeliveryType();
return deliveryType == DeliveryType.STREAMING || (deliveryType != DeliveryType.DOWNLOAD && contentDto.deliveryType == DeliveryType.STREAMING);
}
/**
* Panoコンテンツタイプのチェック
* @param contentId
......
......@@ -282,23 +282,6 @@ public class CheckOZDViewActivity extends ABVContentViewActivity {
// }
}
private void showPdfSendMailDialog(final DownloadedContentInfoJSON json) {
ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(this, getString(R.string.pdf_mail), getString(R.string.mail_submit));
alert.setNegativeButton(R.string.cancel, null);
alert.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (exportViewer(getSaveParam("pdf"))) {
sendPDF(json);
}
}
});
alert.show();
return;
}
private void sendPDF(DownloadedContentInfoJSON json) { // PDFファイルメールで送信
PDFFileProvider.expired = DateTimeUtil.add(new Date(), DateTimeUtil.DateUnit.Minute, 60);
......
......@@ -781,7 +781,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
mBtnMeetingRoomSetting.setVisibility(View.GONE);
}
if (Options.getInstance(this).getViewerMenuExit() == 1 && !(isProjectPdf())) {
if (!isProjectPdf()) {
mExitBtn.setVisibility(View.VISIBLE);
}
}
......@@ -1008,7 +1008,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
});
if (Options.getInstance(this).getViewerMenuExit() == 0 || isProjectPdf()) {
if (isProjectPdf()) {
mExitBtn.setVisibility(View.GONE);
}
......@@ -1032,7 +1032,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
ImageButton indexBtn = (ImageButton) mToolBar.findViewById(R.id.btn_index_list);
if ((Options.getInstance(this).getViewerMenuBookmark() == 1 || Options.getInstance(this).getViewerMenuIndex() == 1) && !(isProjectPdf())) {
if (!isProjectPdf()) {
indexBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
......@@ -1044,10 +1044,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
final ArrayList<String> menuNameList = new ArrayList<>();
if (Options.getInstance(ContentViewActivity.this).getViewerMenuBookmark() == 1) {
menuNameList.add(getRString(R.string.bookmark));
}
if (Options.getInstance(ContentViewActivity.this).getViewerMenuIndex() == 1 && mContentJSON.isPdf()) {
menuNameList.add(getRString(R.string.bookmark));
if (mContentJSON.isPdf()) {
menuNameList.add(getRString(R.string.index));
}
......@@ -1127,7 +1125,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
// 検索
ImageButton search = (ImageButton) mToolBar.findViewById(R.id.btn_search);
if (Options.getInstance(this).getViewerMenuSearch() == 1 && !(isProjectPdf())) {
if (!isProjectPdf()) {
search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -1162,7 +1160,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
final long bookContentId = getContentId();
final ImageButton bookmark = (ImageButton) mToolBar.findViewById(R.id.btn_bookmark);
if (Options.getInstance(this).getViewerMenuBookmark() == 1 && !(isProjectPdf())) {
if (!isProjectPdf()) {
bookmark.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -1362,47 +1360,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
}
private void showPdfSendMailDialog(final DownloadedContentInfoJSON json) {
String fileName = mContentJSON.getPdfFileName();
String filepath = mContentDir + "/" + fileName;
File pdfFile = new File(filepath);
final Uri fileUri = Uri.parse("content://" + getPackageName() + ".pdffileprovider/" + contentId + "/" + fileName);
ABookAlertDialog messageDialog;
long L = pdfFile.length();
if (L > 20971520) {
//20메가 보다 큰 경우 송신 못한다고 메일 보냄
messageDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.pdf_mail), getString(R.string.mail_size_over));
messageDialog.setPositiveButton(R.string.ok, null);
} else {
//다 통과... 이제 보낼껀지 체크하는 팝업
messageDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.pdf_mail), getString(R.string.mail_submit));
messageDialog.setNegativeButton(R.string.cancel, null);
messageDialog.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendPDF(json, fileUri);
}
});
}
messageDialog.show();
return;
}
private void sendPDF(DownloadedContentInfoJSON json, Uri fileUri){
PDFFileProvider.expired = DateTimeUtil.add(new Date(), DateUnit.Minute, 60);
Intent it = new Intent(Intent.ACTION_SEND);
it.setType("plain/text");
it.putExtra(Intent.EXTRA_SUBJECT, json.contentName);
it.putExtra(Intent.EXTRA_TEXT, json.contentName + getResources().getString(R.string.send_to));
it.putExtra(Intent.EXTRA_STREAM, fileUri);
startActivity(it);
}
private void setMarkingViewVisibility(boolean visible){
for (MarkingView markingView : mMarkingViewList) {
if (visible) {
......@@ -2720,9 +2677,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
ActivityHandlingHelper.getInstance().startHTMLWebActivity(this, null, htmlFilePath, getContentId(), WEBVIEW, pageNumber, actionInfoJSON.getObjectId(), objectLogId, readingLogId);
break;
case ActionInfoJSON.CONTENTLINK_ACTION:
if (ABVDataCache.getInstance().serviceOption.isPayment()) { // 決済ありの時は無視
break;
}
//コンテンツリンクに紐づいたAction Buttonのイベント
long linkContentId = actionInfoJSON.getContentId();
......@@ -2738,7 +2692,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
break;
}
}
linkDownloadChecked(linkContentId, (int) actionInfoJSON.getPageNo());
try {
if (ActivityHandlingHelper.getInstance().checkContent(linkContentId, (int) actionInfoJSON.getPageNo())) { // コンテンツをチェックし、なければDL後開く
if (isLinkedContent) {
......@@ -3775,8 +3728,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
} else {
ActivityHandlingHelper.getInstance().startHTMLWebActivity(this, null, linkurl, getContentId(), WEBVIEW, pageNumber, objectId, objectLogId, readingLogId);
}
}
else {
} else {
Intent i = new Intent(Intent.ACTION_VIEW);
if (StringUtil.isNullOrEmpty(linkurl)) {
linkurl = "http://";
......@@ -4906,76 +4858,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
//2012 12 17 Contents link by jeonghun
private void linkDownloadChecked(final long contentId, int page) {
Logger.i(TAG, "linkDownloadChecked targetContentId=" + contentId + " targetPage=" + page);
int result = ContentViewHelper.getInstance().linkDownloadChecked(contentId, page);
switch (result) {
case LinkContentStatus.NoExist:
// コンテンツが存在しない
ABookAlertDialog linknonServerDialog = AlertDialogUtil.createAlertDialog(this, R.string.content_link);
linknonServerDialog.setMessage(R.string.link_new_nonexits);
linknonServerDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
showAlertDialog(linknonServerDialog);
break;
case LinkContentStatus.BeforeReleaseDate:
{
// 公開日前
ABookAlertDialog linkBeforeReleaseDateDialog = AlertDialogUtil.createAlertDialog(this, R.string.content_link);
linkBeforeReleaseDateDialog.setMessage(R.string.reader_content_download_404);
linkBeforeReleaseDateDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
showAlertDialog(linkBeforeReleaseDateDialog);
}
break;
case LinkContentStatus.DownloadedContent:
// コンテンツがダウンロード済み
mActivityFinishFlg = true;
allReset();
if (isEnquete) {
isEnquete = false;
mMainLayout.removeView(enqueteLayout);
}
//戻る用のコンテンツIDをセット
getABVUIDataCache().setReturnContentIdList(getContentId(), getCurrentPageNumber());
Intent intent = new Intent();
intent.putExtra("page", page - 1);
Logger.d(TAG, "next page : %s", (page - 1));
if (mProjectId != null) {
intent.putExtra(ABookKeys.PROJECT_ID, mProjectId);
}
startContentViewActivity(intent, contentId);
break;
case LinkContentStatus.StreamingContent:
Intent streamingIntent = new Intent();
streamingIntent.putExtra("page", page - 1);
startStreamingActivity(contentId, streamingIntent);
break;
case LinkContentStatus.StartContentDownloadAndStart:
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().startContentActivityForLinkedConent(mProjectId, contentId, page);
} else {
ActivityHandlingHelper.getInstance().startContentActivity(contentId, page);
}
//戻る用のコンテンツIDをセット
getABVUIDataCache().setReturnContentIdList(contentId, page);
break;
}
}
/**
* コンテンツリンク中でコンテンツがない場合、ダウンロードするように
* checkContentをもう一度呼び出す
......
......@@ -82,8 +82,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
private boolean isPageFinished;
private WebView webView;
private boolean isStreaming;
private Double latitude;
private Double longitude;
private JsInf jsInf = new JsInf();
......@@ -105,8 +104,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
// ***** 引数の取得
Intent intent = getIntent();
isStreaming = intent.getBooleanExtra(IS_STREAMING, false);
if (objectId != -1 || ABVEnvironment.getInstance().disableLogSend || isStreaming) {
if (objectId != -1 || ABVEnvironment.getInstance().disableLogSend) {
// アクションとして起動された場合, Streaming表示の場合ログは記録しない
readingLogFlg = false;
}
......@@ -130,35 +128,25 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
this.sendResult = intent.getIntExtra("sendResult", -1);// 1:結果送信
// ***** WebViewセット
if (isStreaming) {
findViewById(R.id.webView2).setVisibility(View.GONE);
FrameLayout layout = (FrameLayout) findViewById(R.id.streamingLayout);
layout.setVisibility(View.VISIBLE);
webView = new HTML5WebView(this);
layout.addView(((HTML5WebView)webView).getBrowserLayout(), new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
removeNewFlag();
}
else {
webView = (WebView) findViewById(R.id.webView3);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
// webView.setWebViewClient(new WebViewClient());
// //ブラウザの描画領域を対象としたイベントをフック
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); // 画面の横幅にページの横幅を合わせる
//noinspection deprecation(API18から非推奨になった。無視)
settings.setPluginState(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);
// webView.loadDataWithBaseURL("", url2, "text/html", "UTF-8", "");
}
webView = (WebView) findViewById(R.id.webView3);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
// webView.setWebViewClient(new WebViewClient());
// //ブラウザの描画領域を対象としたイベントをフック
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); // 画面の横幅にページの横幅を合わせる
//noinspection deprecation(API18から非推奨になった。無視)
settings.setPluginState(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);
// webView.loadDataWithBaseURL("", url2, "text/html", "UTF-8", "");
final RelativeLayout fl = (RelativeLayout) findViewById(R.id.frameTopbar);
......@@ -167,12 +155,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isStreaming) {
callExistsSendLog();
}
else {
finishActivity();
}
finishActivity();
}
});
......@@ -262,18 +245,17 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
}
});
if (!isStreaming) {
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
setVisbilityProgress(true);
if (newProgress >= 100) {
setVisbilityProgress(false);
}
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
setVisbilityProgress(true);
if (newProgress >= 100) {
setVisbilityProgress(false);
}
});
}
}
});
webView.setWebViewClient(new WebViewClient() {
//오서링 설문 지정시 해당 설문으로 이동수정
@Override
......@@ -310,9 +292,6 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
if (mContentType.equals(ContentJSON.KEY_EXAM_TYPE) && sendResult == 0) {
callChangeButton();
}
if (isStreaming) {
callExistsSetLocation(); // setLocationメソッドがjsにあるかどうかを調べてあれば呼び出す
}
}
@Override
......@@ -339,112 +318,82 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (isStreaming && url.startsWith("abook")) {
final Uri uri = Uri.parse(url);
if (url.startsWith("abooksendlog://")) { // ログ送信完了
finishActivity();
}
else if (url.startsWith("abookopenfinish://")) { // ページロード完了(Androidでは使用せず)
}
else if (url.startsWith("abookpagemove://")) { // ストリーミングコンテンツ・ページ遷移
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentDao.updateLastViewedPage(Long.parseLong(uri.getQueryParameter("contentId")), Integer.parseInt(uri.getQueryParameter("page")));
}
});
}
else if (url.startsWith("abookopen://")) { // ストリーミングコンテンツ・コンテンツ間リンク
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentDao.updateContentReadingDate(new Date(), Long.parseLong(uri.getQueryParameter("contentId")));
}
});
}
return true;
} else {
boolean isGotoNextScreen = true;////試験の場合:オフライン時 結果送信する場合且つオフライン時結果送信しない場合:結果画面に進ままない。
boolean show_result = true; //試験の場合結果採点表示
boolean send_result = true; //試験の場合:結果送信
boolean isGotoNextScreen = true;////試験の場合:オフライン時 結果送信する場合且つオフライン時結果送信しない場合:結果画面に進ままない。
boolean show_result = true; //試験の場合結果採点表示
boolean send_result = true; //試験の場合:結果送信
//試験の場合:結果画面非表示設定した場合:別の画面に呼び出す
if (mContentType.equals(ContentJSON.KEY_EXAM_TYPE) && showResult == 0) {
show_result = false;
}
//試験の場合:結果画面非表示設定した場合:別の画面に呼び出す
if (mContentType.equals(ContentJSON.KEY_EXAM_TYPE) && showResult == 0) {
show_result = false;
}
//試験の場合:結果送信しない設定した場合
if (mContentType.equals(ContentJSON.KEY_EXAM_TYPE) && sendResult == 0) {
send_result = false;
}
//試験の場合:結果送信しない設定した場合
if (mContentType.equals(ContentJSON.KEY_EXAM_TYPE) && sendResult == 0) {
send_result = false;
}
if (url.startsWith("abook-api")) {
if (ContentViewActivity.enqueteMap.containsKey(abEnqueteId)) {
//hashmap에 해당 앙케이트 아이디의 값 삭제
ContentViewActivity.enqueteMap.remove(abEnqueteId);
}
Uri uri = Uri.parse(url);
String param = uri.getQuery();
Timestamp ts = DateTimeUtil.getCurrentTimestamp();
boolean enResult;
EnqueteLogic enqueteLogic = AbstractLogic.getLogic(EnqueteLogic.class);
EnqueteDto dto = new EnqueteDto();
dto.abObjectId = abObjectId;
dto.abEnqueteId = abEnqueteId;
dto.contentId = mContentId;
dto.param = param;
dto.replyDateStr = ts;
if (send_result) {
try {
//앙케이트 결과 값을 서버에 송신한다.
//cs 를 넘겨받아서 처리
enResult = enqueteLogic.enqueteReply(dto.contentId, dto.abObjectId, ts, dto.param);
//성공시 reply_flg 값을 true
dto.replyFlg = enResult;
} catch (NetworkDisconnectedException ne) {
dto.replyFlg = false;
Logger.e(TAG, "enqueteReply error", ne);
//オフライン時試験結果送信しないサービスオプション設定した場合:アラート出す。次の画面に移動しない
if (mContentType.equals(ContentJSON.KEY_EXAM_TYPE) && !ABVDataCache.getInstance().serviceOption.isTransmitExamAtOffline()) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.exam_message, Toast.LENGTH_LONG);
show_result = false;
isGotoNextScreen = false;
}
} catch (Exception e) {
dto.replyFlg = false;
Logger.e(TAG, "enqueteReply error", e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.ERROR, Toast.LENGTH_LONG);
if (url.startsWith("abook-api")) {
if (ContentViewActivity.enqueteMap.containsKey(abEnqueteId)) {
//hashmap에 해당 앙케이트 아이디의 값 삭제
ContentViewActivity.enqueteMap.remove(abEnqueteId);
}
Uri uri = Uri.parse(url);
String param = uri.getQuery();
Timestamp ts = DateTimeUtil.getCurrentTimestamp();
boolean enResult;
EnqueteLogic enqueteLogic = AbstractLogic.getLogic(EnqueteLogic.class);
EnqueteDto dto = new EnqueteDto();
dto.abObjectId = abObjectId;
dto.abEnqueteId = abEnqueteId;
dto.contentId = mContentId;
dto.param = param;
dto.replyDateStr = ts;
if (send_result) {
try {
//앙케이트 결과 값을 서버에 송신한다.
//cs 를 넘겨받아서 처리
enResult = enqueteLogic.enqueteReply(dto.contentId, dto.abObjectId, ts, dto.param);
//성공시 reply_flg 값을 true
dto.replyFlg = enResult;
} catch (NetworkDisconnectedException ne) {
dto.replyFlg = false;
Logger.e(TAG, "enqueteReply error", ne);
//オフライン時試験結果送信しないサービスオプション設定した場合:アラート出す。次の画面に移動しない
if (mContentType.equals(ContentJSON.KEY_EXAM_TYPE) && !ABVDataCache.getInstance().serviceOption.isTransmitExamAtOffline()) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.exam_message, Toast.LENGTH_LONG);
show_result = false;
isGotoNextScreen = false;
}
} else {
//試験結果送信しない設定した場合且つ回答可能回数1回設定した場合:試験をやったことを確認
dto.replyFlg = true;
}
if (isGotoNextScreen) {
//アンケートの場合又は試験の場合:データベースに保存する。
enqueteLogic.insertEnquete(dto);
if (show_result) {
//앙케이트 결과 송신 후 showEnd 호출
webView.loadUrl("javascript:showEnd()");
} else {
webView.loadUrl("javascript:showMsgs()");
}
} catch (Exception e) {
dto.replyFlg = false;
Logger.e(TAG, "enqueteReply error", e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.ERROR, Toast.LENGTH_LONG);
}
} else {
//試験結果送信しない設定した場合且つ回答可能回数1回設定した場合:試験をやったことを確認
dto.replyFlg = true;
}
if (isGotoNextScreen) {
//アンケートの場合又は試験の場合:データベースに保存する。
enqueteLogic.insertEnquete(dto);
if (show_result) {
//앙케이트 결과 송신 후 showEnd 호출
webView.loadUrl("javascript:showEnd()");
} else {
webView.loadUrl("javascript:showMsgs()");
}
}
}
return true;
}
});
if (isStreaming) {
webView.addJavascriptInterface(jsInf, "android");
}
// webView.postUrl(url,EncodingUtils.getBytes("", "utf-8"));
Logger.d(TAG, "loadUrl: " + url);
webView.loadUrl(url);
......@@ -455,8 +404,6 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
@Override
public void onClick(View v) {
setFontSmall();
}
});
......@@ -497,12 +444,8 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
else {
webView.loadUrl(url + "&reload=true");
}
// webView.reload();
}
});
if (isStreaming) {
reloadButton.setVisibility(View.VISIBLE);
}
downloadButton = (ImageButton) findViewById(R.id.btn_download);
downloadButton.setOnClickListener(new View.OnClickListener() {
......@@ -568,46 +511,6 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
}
});
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (isStreaming && PreferenceUtil.get(this, DefPrefKey.PERMISSION_ACCESS_LOCATION, false)
&& AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()
&& getResources().getInteger(R.integer.usable_location_service) == 1) {
// 位置情報取得
LocationManagerUtil locationManagerUtil = new LocationManagerUtil(this, new LocationManagerUtil.LocationManagerUtilListener() {
@Override
public void onGetLocationFailed() {
Logger.w(TAG, "onGetLocationFailed");
}
@Override
public void onGetLocation(final Location location) {
latitude = location.getLatitude();
longitude = location.getLongitude();
Logger.v(TAG, "location latitude(%s), longitude(%s)", latitude, longitude);
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
while (!isPageFinished) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
if (webView != null) {
webView.loadUrl("javascript:setLocation(" + latitude + "," + longitude + ")");
}
}
});
}
});
}
});
locationManagerUtil.startLocationService();
}
if(isLinkedContent) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ContentJSON.KEY_ENQUETE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_EXAM_TYPE.equals(contentDto.contentType)) {
......@@ -730,13 +633,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (isStreaming) {
callExistsSendLog();
return true;
}
else {
finishActivity();
}
finishActivity();
} else {
return super.onKeyUp(keyCode, event);
}
......@@ -757,7 +654,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
public void onResume() {
Logger.i(TAG, "onResume");
super.onResume();
if (objectLogId != -1 && !isStreaming) {
if (objectLogId != -1) {
ContentLogUtil.getInstance().resumeObjectLog(getContentId(), objectLogId);
}
}
......@@ -766,7 +663,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
protected void onStop() {
super.onStop();
webView.stopLoading();
if (objectLogId != -1 && !isStreaming) {
if (objectLogId != -1) {
ContentLogUtil.getInstance().endObjectLog(getContentId(), objectLogId);
}
}
......
......@@ -43,14 +43,12 @@ 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.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.ContentCustomLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
......@@ -63,8 +61,6 @@ import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
//TODO: later 遠隔連動関連はContentView,NoPdfViewと共通しているので要集約
public class HTMLWebViewActivity extends ParentWebViewActivity {
......@@ -80,8 +76,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
private WebView webView;
private HTML5WebView html5WebView;
private boolean isStreaming;
private JsInf jsInf = new JsInf();
private ValueCallback<Uri[]> mUploadMessage;
@Override
......@@ -93,8 +87,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
commonOnCreate();
// ***** 引数の取得
Intent intent = getIntent();
isStreaming = intent.getBooleanExtra(IS_STREAMING, false);
if (objectId != -1 || ABVEnvironment.getInstance().disableLogSend || isStreaming) {
if (objectId != -1 || ABVEnvironment.getInstance().disableLogSend) {
// アクションとして起動された場合, Streaming表示の場合ログは記録しない
readingLogFlg = false;
}
......@@ -107,36 +100,29 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
// ***** WebViewセット
if (isStreaming) {
findViewById(R.id.webView2).setVisibility(View.GONE);
FrameLayout layout = (FrameLayout) findViewById(R.id.streamingLayout);
layout.setVisibility(View.VISIBLE);
html5WebView = new HTML5WebView(this);
layout.addView(((HTML5WebView)html5WebView).getBrowserLayout(), new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
removeNewFlag();
} else {
webView = (WebView) findViewById(R.id.webView2);
webView.setVisibility(View.VISIBLE);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
//webView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
// webView.setWebViewClient(new WebViewClient());
// //ブラウザの描画領域を対象としたイベントをフック
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); // 画面の横幅にページの横幅を合わせる
//noinspection deprecation(API18から非推奨になった。無視)
settings.setPluginState(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);
// webView.loadDataWithBaseURL("", url2, "text/html", "UTF-8", "");
settings.setAllowFileAccessFromFileURLs(true); //Android7利用で警告ダイヤログ表示問題対応
}
webView = (WebView) findViewById(R.id.webView2);
webView.setVisibility(View.VISIBLE);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
//webView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
// webView.setWebViewClient(new WebViewClient());
// //ブラウザの描画領域を対象としたイベントをフック
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); // 画面の横幅にページの横幅を合わせる
//noinspection deprecation(API18から非推奨になった。無視)
settings.setPluginState(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);
// webView.loadDataWithBaseURL("", url2, "text/html", "UTF-8", "");
settings.setAllowFileAccessFromFileURLs(true); //Android7利用で警告ダイヤログ表示問題対応
final RelativeLayout fl = (RelativeLayout) findViewById(R.id.frameTopbar);
......@@ -144,12 +130,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isStreaming) {
callExistsSendLog();
}
else {
finishActivity();
}
finishActivity();
}
});
boolean isFromHomeMenu = intent.getIntExtra("pageNumber", -1) == -1;
......@@ -214,14 +195,8 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
goToBack();
}
});
subMenuBtn.setVisibility(View.GONE);
if (isStreaming) {
btnWebBack.setVisibility(View.GONE);
btnWebForward.setVisibility(View.GONE);
}
btnWebClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -237,35 +212,33 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
});
if (!isStreaming) {
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
commonProgressChanged(newProgress);
}
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
commonProgressChanged(newProgress);
}
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
FileChooserParams fileChooserParams) {
boolean result = false;
if(fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.IMAGE) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
} else if(fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.VIDEO) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
FileChooserParams fileChooserParams) {
boolean result = false;
if (fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.IMAGE) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
} else if (fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.VIDEO) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
if (result) {
if(mUploadMessage != null){
mUploadMessage.onReceiveValue(null);
}
mUploadMessage = filePathCallback;
if (result) {
if (mUploadMessage != null) {
mUploadMessage.onReceiveValue(null);
}
Logger.i(TAG, "oepnFile acceptType : %s", fileChooserParams.getAcceptTypes()[0]);
return result;
mUploadMessage = filePathCallback;
}
});
}
Logger.i(TAG, "oepnFile acceptType : %s", fileChooserParams.getAcceptTypes()[0]);
return result;
}
});
webView.setWebViewClient(new WebViewClient() {
......@@ -340,12 +313,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
} else {
btnWebForward.setEnabled(false);
}
if (isStreaming) {
callExistsSetLocation(); // setLocationメソッドがjsにあるかどうかを調べてあれば呼び出す
}
else {
isPageFinished = true;
}
isPageFinished = true;
}
@Override
......@@ -354,63 +322,20 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
if (url.startsWith("abook")) {
final Uri uri = Uri.parse(url);
if (isStreaming) {
if (url.startsWith("abooksendlog://")) { // ログ送信完了
finishActivity();
}
else if (url.startsWith("abookopenfinish://")) { // ページロード完了(Androidでは使用せず)
}
else if (url.startsWith("abookpagemove://")) { // ストリーミングコンテンツ・ページ遷移
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentDao.updateLastViewedPage(Long.parseLong(uri.getQueryParameter("contentId")), Integer.parseInt(uri.getQueryParameter("page")));
}
});
}
else if (url.startsWith("abookopen://")) { // ストリーミングコンテンツ・コンテンツ間リンク
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentDao.updateContentReadingDate(new Date(), Long.parseLong(uri.getQueryParameter("contentId")));
}
});
}
} else {
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.startsWith(ABookKeys.SEND_CUSTOM_LOG)) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
if (readingLogId != -1) {
ContentCustomLogLogic customLogLogic = AbstractLogic.getLogic(ContentCustomLogLogic.class);
Date actionDate = DateTimeUtil.getCurrentDate();
actionDate = DateTimeUtil.formatDate(actionDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
String param1 = uri.getQueryParameter("param1");
String param2 = uri.getQueryParameter("param2");
String param3 = uri.getQueryParameter("param3");
String param4 = uri.getQueryParameter("param4");
String param5 = uri.getQueryParameter("param5");
customLogLogic.insertContentCustomLog(contentId, readingLogId, actionDate, param1, param2, param3, param4, param5);
}
}
});
} else if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
commonShouldOverrideUrlLoading(uri, null);
}
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
commonShouldOverrideUrlLoading(uri, null);
}
return true;
}
return false;
}
});
if (isStreaming || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
webView.addJavascriptInterface(jsInf, "android");
}
// webView.postUrl(url,EncodingUtils.getBytes("", "utf-8"));
Logger.d(TAG, "loadUrl: " + url);
webView.loadUrl(url);
......@@ -425,12 +350,8 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
else {
webView.loadUrl(url + "&reload=true");
}
// webView.reload();
}
});
if (isStreaming) {
reloadButton.setVisibility(View.VISIBLE);
}
downloadButton = (ImageButton) findViewById(R.id.btn_download);
downloadButton.setOnClickListener(new View.OnClickListener() {
......@@ -492,47 +413,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
});
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (isStreaming && PreferenceUtil.get(this, DefPrefKey.PERMISSION_ACCESS_LOCATION, false)
&& AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()
&& getResources().getInteger(R.integer.usable_location_service) == 1) {
// 位置情報取得
LocationManagerUtil locationManagerUtil = new LocationManagerUtil(this, new LocationManagerUtil.LocationManagerUtilListener() {
@Override
public void onGetLocationFailed() {
Logger.w(TAG, "onGetLocationFailed");
}
@Override
public void onGetLocation(final Location location) {
latitude = location.getLatitude();
longitude = location.getLongitude();
Logger.v(TAG, "location latitude(%s), longitude(%s)", latitude, longitude);
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
while (!isPageFinished) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
if (webView != null) {
webView.loadUrl("javascript:setLocation(" + latitude + "," + longitude + ")");
}
}
});
}
});
}
});
locationManagerUtil.startLocationService();
}
historyListBtn.setVisibility(View.GONE);
if(isLinkedContent) {
......@@ -673,16 +553,10 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
if (mProjectId != null && mProjectId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId);
}
if (isStreaming) {
callExistsSendLog();
return true;
}
else {
if(isLinkedContent) {
goToBack();
} else {
finishActivity();
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
} else {
return super.onKeyUp(keyCode, event);
......@@ -692,13 +566,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (isStreaming) {
if (html5WebView.inCustomView()) {
html5WebView.hideCustomView();
}
}
}
return super.onKeyDown(keyCode, event);
}
......@@ -720,7 +587,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
public void onResume() {
Logger.i(TAG, "onResume");
super.onResume();
if (objectLogId != -1 && !isStreaming) {
if (objectLogId != -1) {
ContentLogUtil.getInstance().resumeObjectLog(getContentId(), objectLogId);
}
}
......@@ -729,7 +596,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
protected void onStop() {
super.onStop();
webView.stopLoading();
if (objectLogId != -1 && !isStreaming) {
if (objectLogId != -1) {
ContentLogUtil.getInstance().endObjectLog(getContentId(), objectLogId);
}
}
......
......@@ -39,14 +39,12 @@ 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.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.ContentCustomLogLogic;
import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
......@@ -58,8 +56,6 @@ import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* Created by leej on 2018/04/17.
......@@ -77,7 +73,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
private XWalkView webView;
private HTML5WebView html5WebView;
private boolean isStreaming;
private HTMLXWalkWebViewActivity.JsInf jsInf = new HTMLXWalkWebViewActivity.JsInf();
private Integer lastPageNo = 0;
......@@ -93,8 +88,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
commonOnCreate();
// ***** 引数の取得
Intent intent = getIntent();
isStreaming = intent.getBooleanExtra(IS_STREAMING, false);
if (objectId != -1 || ABVEnvironment.getInstance().disableLogSend || isStreaming) {
if (objectId != -1 || ABVEnvironment.getInstance().disableLogSend) {
// アクションとして起動された場合, Streaming表示の場合ログは記録しない
readingLogFlg = false;
}
......@@ -108,35 +102,26 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
// ***** WebViewセット
if (isStreaming) { // TODO: XWalkViewはframeLayoutのため互換性がないため要修正
FrameLayout layout = (FrameLayout) findViewById(R.id.streamingLayout);
layout.setVisibility(View.VISIBLE);
html5WebView = new HTML5WebView(this);
layout.addView(((HTML5WebView)html5WebView).getBrowserLayout(), new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
removeNewFlag();
}
else {
webView = new XWalkView(this);
xWalkLayout = (FrameLayout) findViewById(R.id.xWalkLayout);
xWalkLayout.setVisibility(View.VISIBLE);
xWalkLayout.addView(webView, new ViewGroup.LayoutParams(WC, WC));
// webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
webView.setVerticalFadingEdgeEnabled(false);
webView.clearCache(true);
// //ブラウザの描画領域を対象としたイベントをフック
XWalkSettings 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.setDomStorageEnabled(true); // WebStorage有効化
settings.setCacheMode(XWalkSettings.LOAD_NO_CACHE);
//XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); //デバッグモード(chromeからinspect可)
}
webView = new XWalkView(this);
xWalkLayout = (FrameLayout) findViewById(R.id.xWalkLayout);
xWalkLayout.setVisibility(View.VISIBLE);
xWalkLayout.addView(webView, new ViewGroup.LayoutParams(WC, WC));
webView.setVerticalFadingEdgeEnabled(false);
webView.clearCache(true);
// //ブラウザの描画領域を対象としたイベントをフック
XWalkSettings 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.setDomStorageEnabled(true); // WebStorage有効化
settings.setCacheMode(XWalkSettings.LOAD_NO_CACHE);
//XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); //デバッグモード(chromeからinspect可)
final RelativeLayout fl = (RelativeLayout) findViewById(R.id.frameTopbar);
......@@ -144,12 +129,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isStreaming) {
callExistsSendLog();
}
else {
finishActivity();
}
finishActivity();
}
});
closeButton.setVisibility(View.VISIBLE);
......@@ -220,10 +200,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
final Button btnWebBack = (Button) findViewById(R.id.btnWebBack);
final Button btnWebForward = (Button) findViewById(R.id.btnWebForward);
if (isStreaming) {
btnWebBack.setVisibility(View.GONE);
btnWebForward.setVisibility(View.GONE);
}
btnWebClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -238,49 +214,45 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
}
});
webView.setUIClient(new XWalkUIClient(webView) {
public void onProgressChanged(WebView view, int newProgress) {
commonProgressChanged(newProgress);
}
if (!isStreaming) {
webView.setUIClient(new XWalkUIClient(webView) {
public void onProgressChanged(WebView view, int newProgress) {
commonProgressChanged(newProgress);
@Override
public void openFileChooser(XWalkView view, ValueCallback<Uri> uploadFile,
String acceptType, String capture) {
super.openFileChooser(view, uploadFile, acceptType, capture);
Logger.d(TAG, "*********************commonOpenFileChooser");
boolean result = false;
if (acceptType.toLowerCase().indexOf(ABookKeys.IMAGE) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
} else if (acceptType.toLowerCase().indexOf(ABookKeys.VIDEO) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
@Override
public void openFileChooser(XWalkView view, ValueCallback<Uri> uploadFile,
String acceptType, String capture) {
super.openFileChooser(view, uploadFile, acceptType, capture);
Logger.d(TAG, "*********************commonOpenFileChooser");
boolean result = false;
if(acceptType.toLowerCase().indexOf(ABookKeys.IMAGE) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
} else if(acceptType.toLowerCase().indexOf(ABookKeys.VIDEO) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
mUploadMessage = uploadFile;
if (result) {
if (mUploadMessage != null) {
mUploadMessage.onReceiveValue(null);
}
mUploadMessage = uploadFile;
if (result) {
if(mUploadMessage != null){
mUploadMessage.onReceiveValue(null);
}
} else {
//すぐ処理すると、もう一度File追加タップしても反応しない問題の対応のため、1秒後に処理するように修正
handler.postDelayed(new Runnable() {
@Override
public void run() {
if(mUploadMessage != null){
mUploadMessage.onReceiveValue(null);
}
mUploadMessage = null;
} else {
//すぐ処理すると、もう一度File追加タップしても反応しない問題の対応のため、1秒後に処理するように修正
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (mUploadMessage != null) {
mUploadMessage.onReceiveValue(null);
}
}, 500);
super.openFileChooser(view, uploadFile, acceptType, capture);
}
Logger.i(TAG, "oepnFile acceptType : %s, capture : %s", acceptType, capture);
mUploadMessage = null;
}
}, 500);
super.openFileChooser(view, uploadFile, acceptType, capture);
}
});
}
Logger.i(TAG, "oepnFile acceptType : %s, capture : %s", acceptType, capture);
}
});
webView.setResourceClient(new XWalkResourceClient(webView) {
@Override
public void onReceivedResponseHeaders (XWalkView view, XWalkWebResourceRequest request, XWalkWebResourceResponse response) {
String uri = request.getUrl().toString();
......@@ -316,13 +288,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
});
}
if (isStreaming) {
callExistsSetLocation(); // setLocationメソッドがjsにあるかどうかを調べてあれば呼び出す
}
else {
isPageFinished = true;
}
isPageFinished = true;
}
@Override
......@@ -331,120 +297,78 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
if (url.startsWith(ABookKeys.ABOOK)) {
final Uri uri = Uri.parse(url);
if (isStreaming) {
if (url.startsWith("abooksendlog://")) { // ログ送信完了
finishActivity();
}
else if (url.startsWith("abookopenfinish://")) { // ページロード完了(Androidでは使用せず)
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.startsWith(ABookKeys.MOVEPAGE) || url.startsWith(ABookKeys.CONTENTLINK) || url.startsWith(ABookKeys.DETAILLOG)) {
Map<String, String> param = new HashMap<String, String>();
for (String key : uri.getQueryParameterNames()) {
param.put(key, uri.getQueryParameter(key));
}
else if (url.startsWith("abookpagemove://")) { // ストリーミングコンテンツ・ページ遷移
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentDao.updateLastViewedPage(Long.parseLong(uri.getQueryParameter("contentId")), Integer.parseInt(uri.getQueryParameter("page")));
param.put(ABookKeys.URI, url);
// プロジェクト関連資料なのかをチェック
if (url.startsWith(ABookKeys.CONTENTLINK)) {
Long dstContentId = Long.valueOf(param.get("contentId"));
if (ActivityHandlingHelper.getInstance().isExistCommonContent(contentId)) {
if (!ActivityHandlingHelper.getInstance().isExistCommonContent(dstContentId)) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_not_common_content, Toast.LENGTH_SHORT);
return true;
}
});
}
else if (url.startsWith("abookopen://")) { // ストリーミングコンテンツ・コンテンツ間リンク
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentDao.updateContentReadingDate(new Date(), Long.parseLong(uri.getQueryParameter("contentId")));
} else if (ActivityHandlingHelper.getInstance().isExistRelatedContent(contentId, mProjectId)) {
if (!ActivityHandlingHelper.getInstance().isExistRelatedContent(dstContentId, mProjectId)) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_not_related_content, Toast.LENGTH_SHORT);
return true;
}
});
}
}
} else {
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.startsWith(ABookKeys.SEND_CUSTOM_LOG)) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
if (readingLogId != -1) {
ContentCustomLogLogic customLogLogic = AbstractLogic.getLogic(ContentCustomLogLogic.class);
Date actionDate = DateTimeUtil.getCurrentDate();
actionDate = DateTimeUtil.formatDate(actionDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
String param1 = uri.getQueryParameter("param1");
String param2 = uri.getQueryParameter("param2");
String param3 = uri.getQueryParameter("param3");
String param4 = uri.getQueryParameter("param4");
String param5 = uri.getQueryParameter("param5");
customLogLogic.insertContentCustomLog(contentId, readingLogId, actionDate, param1, param2, param3, param4, param5);
}
String ret = doParameter(param, getApplicationContext(), contentId, lastPageNo, readingLogId, lastPageStartDate, new Callback() {
@Override
public Object callback(Object ret) {
Map<String, Object> map = (Map<String, Object>) ret;
if (map.containsKey(ABookKeys.PARAM_LAST_PAGE_NUMBER)) {
lastPageNo = (int) map.get(ABookKeys.PARAM_LAST_PAGE_NUMBER);
}
});
}
else if (url.startsWith(ABookKeys.MOVEPAGE) || url.startsWith(ABookKeys.CONTENTLINK) || url.startsWith(ABookKeys.DETAILLOG)){
Map<String, String> param = new HashMap<String, String>();
for (String key : uri.getQueryParameterNames()) {
param.put(key, uri.getQueryParameter(key));
}
param.put(ABookKeys.URI, url);
// プロジェクト関連資料なのかをチェック
if ( url.startsWith(ABookKeys.CONTENTLINK)) {
Long dstContentId = Long.valueOf(param.get("contentId"));
if (ActivityHandlingHelper.getInstance().isExistCommonContent(contentId)) {
if (!ActivityHandlingHelper.getInstance().isExistCommonContent(dstContentId)) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_not_common_content, Toast.LENGTH_SHORT);
return true;
}
} else if (ActivityHandlingHelper.getInstance().isExistRelatedContent(contentId, mProjectId)) {
if (!ActivityHandlingHelper.getInstance().isExistRelatedContent(dstContentId, mProjectId)) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_not_related_content, Toast.LENGTH_SHORT);
return true;
}
if (map.containsKey(ABookKeys.PARAM_LAST_PAGE_START_DATE)) {
lastPageStartDate = (Date) map.get(ABookKeys.PARAM_LAST_PAGE_START_DATE);
}
}
String ret = doParameter(param, getApplicationContext(), contentId, lastPageNo, readingLogId, lastPageStartDate, new Callback() {
@Override
public Object callback(Object ret) {
Map<String, Object> map = (Map<String, Object>) ret;
if (map.containsKey(ABookKeys.PARAM_LAST_PAGE_NUMBER)) {
lastPageNo = (int) map.get(ABookKeys.PARAM_LAST_PAGE_NUMBER);
}
if (map.containsKey(ABookKeys.PARAM_LAST_PAGE_START_DATE)) {
lastPageStartDate = (Date) map.get(ABookKeys.PARAM_LAST_PAGE_START_DATE);
}
if (map.containsKey(ABookKeys.PARAM_READING_LOG_ID)) {
readingLogId = (Integer) map.get(ABookKeys.PARAM_READING_LOG_ID);
}
return null;
if (map.containsKey(ABookKeys.PARAM_READING_LOG_ID)) {
readingLogId = (Integer) map.get(ABookKeys.PARAM_READING_LOG_ID);
}
});
if (ret != null && !ret.startsWith(ABookKeys.OK)) {
showSimpleAlertDialog(getRString(R.string.error), ret);
}
} else if (url.startsWith(ABookKeys.GETITS_OPEN_SHARE)) {
Map<String, String> param = new HashMap<String, String>();
for (String key : uri.getQueryParameterNames()) {
param.put(key, uri.getQueryParameter(key));
}
String shareUrl = null;
if (param.containsKey(ABookKeys.PARAM_SHARE_URL)) {
shareUrl = (String) param.get(ABookKeys.PARAM_SHARE_URL);
return null;
}
if (beaconDialog != null && beaconDialog.isShowing()) {
Logger.d(TAG, "Already Open Beacon Dialog");
return true;
}
beaconDialog = showBeacon(contentId, shareUrl, -1, webView);
if (beaconDialog == null) {
Logger.d(TAG, "beaconDialog is null");
return true;
}
beaconDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
javaScriptSignageCmd(ABookKeys.CMD_GETITS_CLOSE_SHARE, webView);
dialog.dismiss();
}
});
Logger.v(TAG, "Beacon Dialog is open");
} else if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
commonShouldOverrideUrlLoading(uri, null);
});
if (ret != null && !ret.startsWith(ABookKeys.OK)) {
showSimpleAlertDialog(getRString(R.string.error), ret);
}
} else if (url.startsWith(ABookKeys.GETITS_OPEN_SHARE)) {
Map<String, String> param = new HashMap<String, String>();
for (String key : uri.getQueryParameterNames()) {
param.put(key, uri.getQueryParameter(key));
}
String shareUrl = null;
if (param.containsKey(ABookKeys.PARAM_SHARE_URL)) {
shareUrl = (String) param.get(ABookKeys.PARAM_SHARE_URL);
}
if (beaconDialog != null && beaconDialog.isShowing()) {
Logger.d(TAG, "Already Open Beacon Dialog");
return true;
}
beaconDialog = showBeacon(contentId, shareUrl, -1, webView);
if (beaconDialog == null) {
Logger.d(TAG, "beaconDialog is null");
return true;
}
beaconDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
javaScriptSignageCmd(ABookKeys.CMD_GETITS_CLOSE_SHARE, webView);
dialog.dismiss();
}
});
Logger.v(TAG, "Beacon Dialog is open");
} else if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
commonShouldOverrideUrlLoading(uri, null);
}
return true;
} else if (url.startsWith(ABookKeys.PING)) {
......@@ -453,7 +377,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
return false;
}
});
if (isStreaming || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
webView.addJavascriptInterface(jsInf, "android");
}
// webView.postUrl(url,EncodingUtils.getBytes("", "utf-8"));
......@@ -471,12 +395,8 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
else {
webView.loadUrl(url + "&reload=true");
}
// webView.reload();
}
});
if (isStreaming) {
reloadButton.setVisibility(View.VISIBLE);
}
downloadButton = (ImageButton) findViewById(R.id.btn_download);
downloadButton.setOnClickListener(new View.OnClickListener() {
......@@ -538,12 +458,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
configureRemote();
}
});
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (isStreaming && PreferenceUtil.get(this, AppDefType.DefPrefKey.PERMISSION_ACCESS_LOCATION, false)
&& AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()
&& getResources().getInteger(R.integer.usable_location_service) == 1) {
setLocation(false, true);
}
historyListBtn.setVisibility(View.GONE);
if(isLinkedContent) {
......@@ -684,16 +599,10 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
if (mProjectId != null && mProjectId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId);
}
if (isStreaming) {
callExistsSendLog();
return true;
}
else {
if(isLinkedContent) {
goToBack();
} else {
finishActivity();
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
} else {
return super.onKeyUp(keyCode, event);
......@@ -703,13 +612,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (isStreaming) {
if (html5WebView.inCustomView()) {
html5WebView.hideCustomView();
}
}
}
return super.onKeyDown(keyCode, event);
}
@Override
......@@ -727,7 +629,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
public void onResume() {
Logger.i(TAG, "onResume");
super.onResume();
if (objectLogId != -1 && !isStreaming) {
if (objectLogId != -1) {
ContentLogUtil.getInstance().resumeObjectLog(getContentId(), objectLogId);
}
}
......@@ -736,12 +638,13 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
protected void onStop() {
super.onStop();
webView.stopLoading();
if (objectLogId != -1 && !isStreaming) {
if (objectLogId != -1) {
ContentLogUtil.getInstance().endObjectLog(getContentId(), objectLogId);
}
if (objectLogId == -1 && lastPageStartDate != null) { // 360の場合
ContentLogUtil.getInstance().endContentPageReadLog(contentId, lastPageNo, readingLogId);
AbstractLogic.getLogic(ContentReadingLogLogic.class).endContentReadLog(contentId);
} else {
if (lastPageStartDate != null) { // 360の場合
ContentLogUtil.getInstance().endContentPageReadLog(contentId, lastPageNo, readingLogId);
AbstractLogic.getLogic(ContentReadingLogLogic.class).endContentReadLog(contentId);
}
}
}
......
......@@ -731,7 +731,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
@Override
public void onLongPress(MotionEvent e) {
if (isProjectPdf || Options.getInstance(mContext).getViewerMenuMemo() == 0) {
if (isProjectPdf) {
return;
}
......
......@@ -112,10 +112,6 @@ login_mode=2
#login_modeが0、1の場合のアカウントパス
account_path=agtcatalog
#ロケーション切り替え 2014/02/11 Ver1.1
#0:表示しない(全部の固定)、1:表示する
location_mode=1
#Setting Menu
#アカウント
setting_menu_account=1
......@@ -132,30 +128,6 @@ setting_menu_url_path=1
#ログインID 1:表示 0:非表示
setting_menu_loginId=1
#Viewer Menu
#戻る
viewer_menu_exit=1
#履歴
viewer_menu_history=1
#インデックス
viewer_menu_index=1
#検索
viewer_menu_search=1
#メモ
viewer_menu_memo=1
#マーキング
viewer_menu_marking=1
#しおり
viewer_menu_bookmark=1
#Location Service
#位置情報取得
usable_location_service=1
#Content Search
#タグ検索
usable_content_tag_search=1
#GCM
push_message=1
......@@ -163,17 +135,6 @@ push_message=1
#0:非表示 1:表示 1.3.1
check_app_update=1
#1.5.3 小田急
#自動ダウンロードサービスチェック時間設定
#0: 設定しない、1:設定する 1.5.3
download_service_check=0
#自動ダウンロード開始時間設定 1.5.3
download_service_start_time=15:23
#自動ダウンロードチェックの幅(分)1.5.3
download_service_check_interval=1
#指定した時間になった時Randomタイムで自動ダウンロード開始じかんが変わる
set_random_time=25
#ユーザ切り替え時全社グループのコンテンツを削除しない
#0:全てのコンテンツ削除 1:全社のコンテンツ削除しない 1.5.3
not_delete_all_contents=0
......@@ -182,6 +143,4 @@ BLJAR_NAME=ABVJE_BL.jar
#store用の場合、armv7,x86両方ビルド
#storeではない場合、armv7のみビルド
isStoreProduct=false
edition_type=5
\ No newline at end of file
isStoreProduct=false
\ No newline at end of file
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