Commit 8c2bdcbe by Lee Jaebin

ソース分離(未使用クラス・メソッド削除、プロパティの整理)

parent 68f613b8
package jp.agentec.abook.abv.bl.acms.type; package jp.agentec.abook.abv.bl.acms.type;
public interface LoginMode { public interface LoginMode {
int NO_AUTH = 0; // 認証なし
int ID_PASS = 1; // ID、パスワード int ID_PASS = 1; // ID、パスワード
int PATH_ID_PASS = 2; // ACCONT_PATH、ID、パスワード int PATH_ID_PASS = 2; // ACCONT_PATH、ID、パスワード
int SITE_PATH_ID_PASS = 3; // SITE_ID、ACCONT_PATH、ID、パスワード int SITE_PATH_ID_PASS = 3; // SITE_ID、ACCONT_PATH、ID、パスワード
int SITE_PATH = 4; // 認証なし(SITE_ID、ACCONT_PATH)
} }
...@@ -56,13 +56,6 @@ android { ...@@ -56,13 +56,6 @@ android {
//abvFunctionOptions //abvFunctionOptions
resValue("integer", "login_mode", "${login_mode}") resValue("integer", "login_mode", "${login_mode}")
resValue("string", "account_path", "${account_path}") resValue("string", "account_path", "${account_path}")
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}")
resValue("integer", "setting_menu_log_info", "${setting_menu_log_info}")
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", "push_message", "${push_message}") resValue("integer", "push_message", "${push_message}")
resValue("integer", "check_app_update", "${check_app_update}") resValue("integer", "check_app_update", "${check_app_update}")
resValue("integer", "not_delete_all_contents", "${not_delete_all_contents}") resValue("integer", "not_delete_all_contents", "${not_delete_all_contents}")
......
...@@ -127,18 +127,6 @@ public abstract class ABVActivity extends Activity { ...@@ -127,18 +127,6 @@ public abstract class ABVActivity extends Activity {
} }
} }
/**
* Homeボタンを押した場合のイベント取得用Receiverを登録する
* イベント処理はonClickHomeButton()をオーバーライドして利用する
*/
protected void registerHomeButtonReceiver() {
Logger.i(TAG, "[registerHomeButtonReceiver]");
mHomeButtonReceiver = new HomeButtonReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
registerReceiver(mHomeButtonReceiver, filter);
}
@Override @Override
protected void onUserLeaveHint() { protected void onUserLeaveHint() {
super.onUserLeaveHint(); super.onUserLeaveHint();
...@@ -221,10 +209,6 @@ public abstract class ABVActivity extends Activity { ...@@ -221,10 +209,6 @@ public abstract class ABVActivity extends Activity {
this.mAlertDialog.show(); this.mAlertDialog.show();
} }
private boolean isCurrent() {
return Thread.currentThread().equals(getMainLooper().getThread());
}
private void closeAlertDialog() { private void closeAlertDialog() {
if (mAlertDialog != null && mAlertDialog.isShowing()) { if (mAlertDialog != null && mAlertDialog.isShowing()) {
mAlertDialog.dismiss(); mAlertDialog.dismiss();
...@@ -288,7 +272,7 @@ public abstract class ABVActivity extends Activity { ...@@ -288,7 +272,7 @@ public abstract class ABVActivity extends Activity {
setFixedOrientation(false); setFixedOrientation(false);
} }
protected boolean isRotatable() { protected boolean isRotatable() {
try { try {
// OSの設定で回転ONで、かつ設定で回転固定にしていない場合 // OSの設定で回転ONで、かつ設定で回転固定にしていない場合
...@@ -505,124 +489,103 @@ public abstract class ABVActivity extends Activity { ...@@ -505,124 +489,103 @@ public abstract class ABVActivity extends Activity {
*/ */
protected boolean checkValidAuthTime() { protected boolean checkValidAuthTime() {
boolean result = false; boolean result = false;
try {
// Logger.d("LoginTimeOutCheck","LoginTimeOutCheck"); // サービスオプションチェック
if (requireAuthentication()) { if (AbstractLogic.getLogic(ContractLogic.class).getForceLoginPeriodically()) {
try { long leavedAppTime = getUserPref(UserPrefKey.LEAVE_APP, -1L);
// サービスオプションチェック if (leavedAppTime != -1) {
if (AbstractLogic.getLogic(ContractLogic.class).getForceLoginPeriodically()) { Date leavedAppDate = new Date(leavedAppTime);
long leavedAppTime = getUserPref(UserPrefKey.LEAVE_APP, -1L); Date currentDate = new Date(System.currentTimeMillis());
if (leavedAppTime != -1) { if (currentDate.after(DateTimeUtil.add(leavedAppDate, DateUnit.Day, ABVEnvironment.LastLoginExpiryDate))) {
Date leavedAppDate = new Date(leavedAppTime); callLoginActivity(false, true, false);
Date currentDate = new Date(System.currentTimeMillis()); result = true;
if (currentDate.after(DateTimeUtil.add(leavedAppDate, DateUnit.Day, ABVEnvironment.LastLoginExpiryDate))) {
callLoginActivity(false, true, false);
result = true;
}
} }
} }
} catch (Exception e) {
result = false;
Logger.e("Exception LoginTimeOutCheck", e);
}
}
return result;
}
// 一定期間経過後強制ログアウトチェック
protected boolean checkForceOfflineLogout() {
boolean result = false;
ContractLogic contractLogic;
if (requireAuthentication()) {
contractLogic = AbstractLogic.getLogic(ContractLogic.class);
if (contractLogic.getForceOfflineLogout()) {
UserAuthenticateLogic service = AbstractLogic.getLogic(UserAuthenticateLogic.class);
Date serverDate;
try {
serverDate = service.getServerTime();
} catch (NetworkDisconnectedException e) {
// ネットワーク非接続状態の場合、ローカル時刻を入れる
serverDate = DateTimeUtil.getCurrentDate();
} catch (AcmsException e) {
Logger.e("Exception checkForceOfflineLogout", e);
return false;
}
Date lastCmsAccessDate = ABVDataCache.getInstance().getMemberInfo().lastCMSAccessDate;
Logger.d(TAG, "checkForceOfflineLogout():lastCmsAccessDate=" + lastCmsAccessDate);
if (lastCmsAccessDate != null && serverDate != null &&
serverDate.after(DateTimeUtil.add(lastCmsAccessDate, DateUnit.Day, contractLogic.getForceOfflineWait()))) {
callLoginActivity(false, false, true);
result = true;
}
} }
} catch (Exception e) {
result = false;
Logger.e("Exception LoginTimeOutCheck", e);
} }
return result; return result;
} }
// 一定期間経過後強制ログアウトチェック
protected boolean checkForceOfflineLogout() {
boolean result = false;
ContractLogic contractLogic;
contractLogic = AbstractLogic.getLogic(ContractLogic.class);
if (contractLogic.getForceOfflineLogout()) {
UserAuthenticateLogic service = AbstractLogic.getLogic(UserAuthenticateLogic.class);
Date serverDate;
try {
serverDate = service.getServerTime();
} catch (NetworkDisconnectedException e) {
// ネットワーク非接続状態の場合、ローカル時刻を入れる
serverDate = DateTimeUtil.getCurrentDate();
} catch (AcmsException e) {
Logger.e("Exception checkForceOfflineLogout", e);
return false;
}
Date lastCmsAccessDate = ABVDataCache.getInstance().getMemberInfo().lastCMSAccessDate;
Logger.d(TAG, "checkForceOfflineLogout():lastCmsAccessDate=" + lastCmsAccessDate);
if (lastCmsAccessDate != null && serverDate != null &&
serverDate.after(DateTimeUtil.add(lastCmsAccessDate, DateUnit.Day, contractLogic.getForceOfflineWait()))) {
callLoginActivity(false, false, true);
result = true;
}
}
return result;
}
// パスワード定期変更チェック // パスワード定期変更チェック
protected boolean checkRequiredChangePassword(final DialogInterface.OnClickListener cancelListener) { protected boolean checkRequiredChangePassword(final DialogInterface.OnClickListener cancelListener) {
boolean result = false; boolean result = false;
try {
// パスワード変更必要のチェックをサービスオプションの確認後に行うように修正
// ただし、チェックが必要になった場合、起動時のネットワークの遅延によるANRが発生する懸念はまだある
ContractLogic contractService = AbstractLogic.getLogic(ContractLogic.class);
ABookAlertDialog changePwDialog = AlertDialogUtil.createAlertDialog(this, R.string.pwd_change);
final SecurityPolicyType securityPolicyType = contractService.getForcePwChangePeriodically();
if (securityPolicyType == SecurityPolicyType.None) {
return false;
} else {
UserAuthenticateLogic service = AbstractLogic.getLogic(UserAuthenticateLogic.class);
if (service.requirePasswordChange() == RequirePasswordChangeCode.Required) {
if (securityPolicyType == SecurityPolicyType.Reminder) {
// 既に今日通知済みの場合またはパスワード変更画面では表示しない
if (!contractService.isTodayLastAnnounceChangePasswordDate() && !(this instanceof ChangePasswordActivity)) {
changePwDialog.setMessage(R.string.pwd_change_reminder_message);
changePwDialog.setNegativeButton(R.string.no, cancelListener);
} else {
changePwDialog = null;
}
} else if (securityPolicyType == SecurityPolicyType.Enforcement) {
changePwDialog.setMessage(R.string.pwd_change_reminder_enforcement_message);
changePwDialog.setCancelable(false);
} else {
changePwDialog = null;
}
if (requireAuthentication()) { if (changePwDialog != null) {
try { changePwDialog.setPositiveButton(R.string.pwd_change, new DialogInterface.OnClickListener() {
// パスワード変更必要のチェックをサービスオプションの確認後に行うように修正 @Override
// ただし、チェックが必要になった場合、起動時のネットワークの遅延によるANRが発生する懸念はまだある public void onClick(DialogInterface dialog, int whichButton) {
ContractLogic contractService = AbstractLogic.getLogic(ContractLogic.class); final String loginId = ABVDataCache.getInstance().getMemberInfo().loginId;
ABookAlertDialog changePwDialog = AlertDialogUtil.createAlertDialog(this, R.string.pwd_change); showChangePasswordDialog(R.string.pwd_change, securityPolicyType, loginId, null, cancelListener);
final SecurityPolicyType securityPolicyType = contractService.getForcePwChangePeriodically(); }
if (securityPolicyType == SecurityPolicyType.None) { });
return false; result = true;
} else { showAlertDialog(changePwDialog);
UserAuthenticateLogic service = AbstractLogic.getLogic(UserAuthenticateLogic.class); }
if (service.requirePasswordChange() == RequirePasswordChangeCode.Required) { }
if (securityPolicyType == SecurityPolicyType.Reminder) {
// 既に今日通知済みの場合またはパスワード変更画面では表示しない
if (!contractService.isTodayLastAnnounceChangePasswordDate() && !(this instanceof ChangePasswordActivity)) {
changePwDialog.setMessage(R.string.pwd_change_reminder_message);
changePwDialog.setNegativeButton(R.string.no, cancelListener);
} else {
changePwDialog = null;
}
} else if (securityPolicyType == SecurityPolicyType.Enforcement) {
changePwDialog.setMessage(R.string.pwd_change_reminder_enforcement_message);
changePwDialog.setCancelable(false);
} else {
changePwDialog = null;
}
if (changePwDialog != null) {
changePwDialog.setPositiveButton(R.string.pwd_change, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
final String loginId = ABVDataCache.getInstance().getMemberInfo().loginId;
showChangePasswordDialog(R.string.pwd_change, securityPolicyType, loginId, null, cancelListener);
}
});
result = true;
showAlertDialog(changePwDialog);
}
}
}
} catch (Exception e) {
result = false;
Logger.e(TAG, "checkRequiredChangePassword failed.", e);
} }
} catch (Exception e) {
result = false;
Logger.e(TAG, "checkRequiredChangePassword failed.", e);
} }
return result; return result;
} }
protected boolean requireAuthentication() {
boolean result = getResources().getInteger(R.integer.login_mode) != LoginMode.NO_AUTH && getResources().getInteger(R.integer.login_mode) != LoginMode.SITE_PATH;
return result ;
}
private void showChangePasswordDialog(final int title, final SecurityPolicyType securityPolicyType, final String loginId, final String password, final DialogInterface.OnClickListener cancelListener) { private void showChangePasswordDialog(final int title, final SecurityPolicyType securityPolicyType, final String loginId, final String password, final DialogInterface.OnClickListener cancelListener) {
ABookAlertDialog passwordChangeDialog = AlertDialogUtil.createAlertDialog(this, title); ABookAlertDialog passwordChangeDialog = AlertDialogUtil.createAlertDialog(this, title);
View passwordChangeView = null; View passwordChangeView = null;
...@@ -766,7 +729,7 @@ public abstract class ABVActivity extends Activity { ...@@ -766,7 +729,7 @@ public abstract class ABVActivity extends Activity {
/** /**
* * 画面の回転を現在の向きで固定・解除する * * 画面の回転を現在の向きで固定・解除する
* *
* @param flg * @param flg
* true:回転固定 false:回転可能 * true:回転固定 false:回転可能
*/ */
...@@ -790,7 +753,7 @@ public abstract class ABVActivity extends Activity { ...@@ -790,7 +753,7 @@ public abstract class ABVActivity extends Activity {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} }
} }
protected void setPortraitIfNormal() { protected void setPortraitIfNormal() {
if(isNormalSize()){ if(isNormalSize()){
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
...@@ -853,21 +816,6 @@ public abstract class ABVActivity extends Activity { ...@@ -853,21 +816,6 @@ public abstract class ABVActivity extends Activity {
}, 500); }, 500);
} }
/**
* Deviceに関連付けられているアカウント(Gmailアドレス)を返す
* (最初のものをそれとみなす)
* ※マニフェストにPermissionが必要
*
* @return
*/
protected String getPrimaryAccount() {
Account[] accounts = ((AccountManager) getSystemService(ACCOUNT_SERVICE)).getAccountsByType("com.google");
if(accounts.length > 0) {
return accounts[0].name;
}
return null;
}
public static boolean isVisible() { public static boolean isVisible() {
return isVisible; return isVisible;
} }
...@@ -912,7 +860,7 @@ public abstract class ABVActivity extends Activity { ...@@ -912,7 +860,7 @@ public abstract class ABVActivity extends Activity {
* CMSのアドレスをロードする * CMSのアドレスをロードする
*/ */
protected void loadAddressIfSaasGeneral() { protected void loadAddressIfSaasGeneral() {
if (getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH_ID_PASS || getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { // Saas汎用版の場合 if (getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH_ID_PASS) {
AcmsDto acmsDto = AbstractDao.getDao(AcmsDao.class).getAcms(); AcmsDto acmsDto = AbstractDao.getDao(AcmsDao.class).getAcms();
if (acmsDto != null) { if (acmsDto != null) {
ABVEnvironment.getInstance().acmsAddress = acmsDto.acmsAddress; ABVEnvironment.getInstance().acmsAddress = acmsDto.acmsAddress;
......
...@@ -116,14 +116,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -116,14 +116,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected ContentDao contentDao = AbstractDao.getDao(ContentDao.class); protected ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
protected GroupLogic groupLogic = AbstractLogic.getLogic(GroupLogic.class);
protected MemoLogic memoLogic = AbstractLogic.getLogic(MemoLogic.class); protected MemoLogic memoLogic = AbstractLogic.getLogic(MemoLogic.class);
protected BookmarkLogic bookmarkLogic = AbstractLogic.getLogic(BookmarkLogic.class); protected BookmarkLogic bookmarkLogic = AbstractLogic.getLogic(BookmarkLogic.class);
protected CategoryLogic categoryLogic = AbstractLogic.getLogic(CategoryLogic.class);
protected ContentDownloader contentDownloader = ContentDownloader.getInstance(); protected ContentDownloader contentDownloader = ContentDownloader.getInstance();
protected ContentRefresher contentRefresher = ContentRefresher.getInstance(); protected ContentRefresher contentRefresher = ContentRefresher.getInstance();
protected String dateFormat;
private ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用 private ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用
protected ImageButton btnDownload; protected ImageButton btnDownload;
...@@ -169,7 +166,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -169,7 +166,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
try { try {
// 既にMacAddress使用に同意している場合はMacAddressを使う // 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する // 認証なしの場合はUUIDを使用する
if (ABVEnvironment.getInstance().deviceIdType != Constant.DeviceIdType.MAC_ADDRESS || ((getRInteger(R.integer.login_mode) == LoginMode.NO_AUTH || getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH) && !PreferenceUtil.getUserPref(this, AppDefType.UserPrefKey.AGREE_MACINFO, false))) { if (ABVEnvironment.getInstance().deviceIdType != Constant.DeviceIdType.MAC_ADDRESS) {
AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByUUID(fcmToken); AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByUUID(fcmToken);
} else { } else {
AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByMacAdress(fcmToken); AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByMacAdress(fcmToken);
...@@ -206,9 +203,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -206,9 +203,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} }
contentDownloader.addContentDownloadListener(this); contentDownloader.addContentDownloadListener(this);
dateFormat = "yyyy'" + getResources().getString(R.string.date_format_year) + "'MM'" + getResources().getString(R.string.date_format_month) + "'dd'"
+ getResources().getString(R.string.date_format_day) + "'HH:mm:ss";
} }
@Override @Override
...@@ -300,19 +294,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -300,19 +294,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
*/ */
private boolean checkPanoContent(long contentId) { private boolean checkPanoContent(long contentId) {
int ret = ContentViewHelper.getInstance().check360Content(contentId); int ret = ContentViewHelper.getInstance().check360Content(contentId);
if (ret == 0) { return ret == 0 ? false : true;
return false;
}
// OS4.4以下
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return false;
}
// OS4.4で動画の場合
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && ret == 1) {
return false;
}
// OS 4.4でバーチャルツアー or OS5以上の場合
return true;
} }
private void contentViewActivityMoveWithContentAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) { private void contentViewActivityMoveWithContentAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) {
...@@ -326,12 +308,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -326,12 +308,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
showContentMessageDialog(intent, contentId, contentDto.alertMessage, ABVNavi); showContentMessageDialog(intent, contentId, contentDto.alertMessage, ABVNavi);
break; break;
case AlertMessageLevel.PASSWORD : case AlertMessageLevel.PASSWORD :
// 認証なしの場合、パスワードチェックは行わない showPasswordCheckDialog(intent, contentId, null, ABVNavi);
if (requireAuthentication()) {
showPasswordCheckDialog(intent, contentId, null, ABVNavi);
} else {
contentViewActivityMoveWithAccessLocationAlert(intent, contentId, NaviConsts.Right);
}
break; break;
} }
} }
...@@ -480,21 +457,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -480,21 +457,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override @Override
public void onAuthenticationFailed() { public void onAuthenticationFailed() {
if (requireAuthentication()) { handleErrorMessageToast(ErrorCode.S_E_ACMS_1403);
handleErrorMessageToast(ErrorCode.S_E_ACMS_1403); callLoginActivity(true, false, false);
} else {
handleErrorMessageToast(ErrorCode.L124);
}
if (requireAuthentication()) {
callLoginActivity(true, false, false);
} else {
// 認証なしなのに認証エラーが発生してしまった場合、ユーザ情報を削除してSplash画面を起動する(新規ユーザでログインされる)
AbstractDao.getDao(MemberInfoDao.class).deleteMemberInfo();
Intent intent = new Intent(this, SplashScreenActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
} }
@Override @Override
...@@ -734,29 +698,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -734,29 +698,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} }
} }
protected String handleException(final AcmsException e) {
String msg;
if (e.getHttpStatus() == 401) { // パスワードが不正な場合
msg = null;
}
else if (e.getLoginErrorMessage() != null) {
msg = e.getLoginErrorMessage();
}
else if (e.getMessage() != null) {
msg = e.getMessage();
}
else if (e.getHttpStatus() == 403) {
msg = ErrorMessage.getErrorMessage(this, R.string.reader_content_download_403);
}
else if (e.getHttpStatus() == 404) {
msg = ErrorMessage.getErrorMessage(this, R.string.reader_content_download_404);
}
else {
msg = ErrorMessage.getErrorMessage(this, e);
}
return msg;
}
public abstract boolean contentValidCheckAndDownload(long contentId); public abstract boolean contentValidCheckAndDownload(long contentId);
public void startContentViewActivity(long contentId) { public void startContentViewActivity(long contentId) {
...@@ -776,28 +717,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -776,28 +717,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
Logger.v(TAG, "[Size] display width=%s, height=%s", mDisplaySize.width, mDisplaySize.height); Logger.v(TAG, "[Size] display width=%s, height=%s", mDisplaySize.width, mDisplaySize.height);
} }
/**
* 共有URLがあるかどうか
*
* @param contentDto
* @return
*/
protected boolean hasShareUrl(ContentDto contentDto) {
String shareUrl = (contentDto.shortUrl != null)? contentDto.shortUrl: contentDto.shareUrl;
return shareUrl != null && shareUrl.matches("https?://([^/]+)/(.+)");
}
private void initializeContent(long contentId) throws IOException {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (contentDto.isPdf()) {
// PDFイメージ取得
PdfImageProvider.createPdfImage(this, mDisplaySize, contentId);
} else {
String cacheDir = ContentFileExtractor.getInstance().getContentCacheDirWithExtract(contentId);
Logger.i(TAG, "extract content files to cache dir. contentId=%s, cacheDir=%s", contentId, cacheDir);
}
}
private void handleError(final Exception e) { private void handleError(final Exception e) {
ErrorCode error; ErrorCode error;
...@@ -815,24 +734,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -815,24 +734,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} }
/** /**
* XWalkWebViewとSlideShowViewの共通処理のため、親クラスであるABVAuthenticatedActivityで定義
* javaScript実行処理PLY.recieveSignageCmd('cmd');
* @param cmd
* @param xWalkView
*/
public void javaScriptSignageCmd(final String cmd, final XWalkView xWalkView) {
Logger.v(TAG, "run javaScript for Signage : cmd=%s", cmd);
runOnUiThread(new Runnable() {
@Override
public void run() {
if (xWalkView != null) {
xWalkView.loadUrl("javascript:PLY.recieveSignageCmd('" + cmd + "')");
}
}
});
}
/**
* ヘルプ画面を表示 * ヘルプ画面を表示
* @param helpViewType ヘルプ表示種類 * @param helpViewType ヘルプ表示種類
*/ */
......
...@@ -96,16 +96,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -96,16 +96,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected final static int ABOOK_CHECK_SELECT_SCENE = 105; protected final static int ABOOK_CHECK_SELECT_SCENE = 105;
protected long contentId;// 表示中のコンテンツID protected long contentId;// 表示中のコンテンツID
protected long linkOriginalContentId;// リンク元コンテンツのコンテンツID
protected int linkOriginalContentPageNo;// リンク元コンテンツのスタートページ
protected int siteId; // Reader サイトID
protected long objectId; // オブジェクトID(オブジェクト用のActivityのときのみ使用) protected long objectId; // オブジェクトID(オブジェクト用のActivityのときのみ使用)
protected int objectPageNumber; // オブジェクトが配置されているページ番号(オブジェクト用のActivityのときのみ使用) protected int objectPageNumber; // オブジェクトが配置されているページ番号(オブジェクト用のActivityのときのみ使用)
protected MeetingManager meetingManager; // 遠隔連動 protected MeetingManager meetingManager; // 遠隔連動
protected boolean mActivityFinishFlg = false; protected boolean mActivityFinishFlg = false;
protected String mContentDir; protected String mContentDir;
protected String contentType; protected String contentType;
// protected String backHomeClass;
protected ABVPopupListWindow mShowedPopupWindow = null; protected ABVPopupListWindow mShowedPopupWindow = null;
protected int readingLogId; protected int readingLogId;
protected String path; // PanoViewController protected String path; // PanoViewController
...@@ -188,14 +184,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -188,14 +184,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
} }
SharedPreferences pref = getSharedPreferences(PrefName.AUTODOWNLOAD_INFO, MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean(AppDefType.AutoDownloadPrefKey.CONTENT_OPEN, true);
editor.commit();
// 遠隔連動 // 遠隔連動
meetingManager = MeetingManager.getInstance(); meetingManager = MeetingManager.getInstance();
if (meetingManager.isSendable() && objectId == -1 && !StringUtil.contains(contentType, new String[]{ContentJSON.KEY_PDF_TYPE, ContentJSON.KEY_NONE_TYPE})) { if (meetingManager.isSendable() && objectId == -1 && !StringUtil.contains(contentType, new String[]{ContentJSON.KEY_PDF_TYPE, ContentJSON.KEY_NONE_TYPE})) {
...@@ -300,22 +288,17 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -300,22 +288,17 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
super.onDestroy(); super.onDestroy();
if (meetingManager.isSendable()) { if (meetingManager.isSendable() && objectId != -1) {
if (objectId == -1) { meetingManager.sendWs(MeetingManager.CMD_CLOSEPOPUP, contentId, objectPageNumber, objectId, null);
// meetingManager.sendWs(MeetingManager.CMD_TOBOOKSHELF, contentId, 0, null, null); }
}
else {
meetingManager.sendWs(MeetingManager.CMD_CLOSEPOPUP, contentId, objectPageNumber, objectId, null);
}
}
if (meetingManager.isSubscribed()) { if (meetingManager.isSubscribed()) {
ActivityHandlingHelper.getInstance().refreshMeetingListActivity(); ActivityHandlingHelper.getInstance().refreshMeetingListActivity();
} }
if (objectId == -1) { if (objectId == -1) {
ActivityHandlingHelper.getInstance().removeContentViewActivity(this); ActivityHandlingHelper.getInstance().removeContentViewActivity(this);
} } else {
else {
ActivityHandlingHelper.getInstance().removeObjectViewActivity(this); ActivityHandlingHelper.getInstance().removeObjectViewActivity(this);
} }
...@@ -429,11 +412,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -429,11 +412,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mShowedPopupWindow.showAsDropDown(anchor); mShowedPopupWindow.showAsDropDown(anchor);
} }
// protected void exitActivity() {
// // activity終了処理
// // 各自必要な場合に実装する
// }
protected void releaseInit() { protected void releaseInit() {
// Activity終了時に初期化が必要な処理を作成 // Activity終了時に初期化が必要な処理を作成
// 各自必要な場合に実装する // 各自必要な場合に実装する
...@@ -633,7 +611,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -633,7 +611,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
/** /**
* 戻る用コンテンツIDリストを取得 * 戻る用コンテンツIDリストを取得
*/ */
public List<long[]> getReturnContentIdList () { public List<long[]> getReturnContentIdList() {
return getABVUIDataCache().getReturnContentIdList(); return getABVUIDataCache().getReturnContentIdList();
} }
...@@ -642,11 +620,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -642,11 +620,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
*/ */
public void moveToBack() { public void moveToBack() {
//戻る用コンテンツIDの数 //戻る用コンテンツIDの数
int listSize = getABVUIDataCache().getReturnContentIdList().size(); int listSize = getReturnContentIdList().size();
if (listSize == 0) { if (listSize == 0) {
finish(); finish();
} else { } else {
long[] contentInfo = getABVUIDataCache().getReturnContentIdList().get(listSize - 1); long[] contentInfo = getReturnContentIdList().get(listSize - 1);
// 直前のコンテンツが360コンテンツか確認⇒画面遷移ではなくfinish()で廃棄することで戻る // 直前のコンテンツが360コンテンツか確認⇒画面遷移ではなくfinish()で廃棄することで戻る
if (ActivityHandlingHelper.getInstance().hasPreviousPanoContentId(contentInfo[0])) { if (ActivityHandlingHelper.getInstance().hasPreviousPanoContentId(contentInfo[0])) {
finish(); finish();
...@@ -656,7 +634,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -656,7 +634,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (this instanceof HTMLXWalkWebViewActivity) { if (this instanceof HTMLXWalkWebViewActivity) {
return; return;
} }
getABVUIDataCache().getReturnContentIdList().remove(listSize - 1); getReturnContentIdList().remove(listSize - 1);
} }
} }
......
...@@ -151,37 +151,15 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity { ...@@ -151,37 +151,15 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
} catch (final NetworkDisconnectedException e) { } catch (final NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException", e); Logger.e(TAG, "NetworkDisconnectedException", e);
if (getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { // 汎用版の場合 showErrorDialog(e);
closeProgressPopup();
handler.post(new Runnable() {
@Override
public void run() {
showErrorDialog(e);
}
});
}
else {
showErrorDialog(e);
}
} catch (final Exception e) { } catch (final Exception e) {
Logger.e(TAG, "noAuthenticatedShowMain error.", e); Logger.e(TAG, "noAuthenticatedShowMain error.", e);
if (getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { // 汎用版の場合 runOnUiThread(new Runnable() {
closeProgressPopup(); @Override
handler.post(new Runnable() { public void run() {
@Override showErrorDialog(e);
public void run() { }
showErrorDialog(e); });
}
});
}
else {
runOnUiThread(new Runnable() {
@Override
public void run() {
showErrorDialog(e);
}
});
}
} }
} }
...@@ -229,9 +207,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity { ...@@ -229,9 +207,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
@Override @Override
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
v.setVisibility(View.INVISIBLE); v.setVisibility(View.INVISIBLE);
if (!requireAuthentication()) { // 認証なしの場合このタイミングでプログレスを閉じる。
closeProgressPopup();
}
showMain(); showMain();
} }
}); });
...@@ -361,16 +336,12 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity { ...@@ -361,16 +336,12 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
final ABVEnvironment abvEnvironment = ABVEnvironment.getInstance(); final ABVEnvironment abvEnvironment = ABVEnvironment.getInstance();
AppLastVersionParameters param; AppLastVersionParameters param;
// 既にMacAddress使用に同意している場合はMacAddressを使う // 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する if (ABVEnvironment.getInstance().deviceIdType == Constant.DeviceIdType.MAC_ADDRESS) {
if (!requireAuthentication() && !getUserPref(UserPrefKey.AGREE_MACINFO, false)) { param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), null, abvEnvironment.deviceId);
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), abvEnvironment.deviceId, null);
} else { } else {
if (ABVEnvironment.getInstance().deviceIdType == Constant.DeviceIdType.MAC_ADDRESS) { param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), abvEnvironment.deviceId, null);
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), null, abvEnvironment.deviceId);
} else {
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), abvEnvironment.deviceId, null);
}
} }
final String version = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).appLatestVersion(param); final String version = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).appLatestVersion(param);
Logger.d(TAG, "Last Version=%s, Current Version=%s", version, ABVEnvironment.getInstance().appVersion); Logger.d(TAG, "Last Version=%s, Current Version=%s", version, ABVEnvironment.getInstance().appVersion);
if (version != null && version.length() > 0) { if (version != null && version.length() > 0) {
...@@ -429,36 +400,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity { ...@@ -429,36 +400,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
} }
} }
private void showUploadAlertDialog(final Intent intent, final int titleResId, final String body) {
handler.post(new Runnable() {
@Override
public void run() {
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(mContext, getString(titleResId), body);
alertDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, int id) {
moveToHome(intent, alertDialog); // Homeに遷移
}
});
showAlertDialog(alertDialog);
}
});
}
private void moveToHome(final Intent intent, DialogInterface dialog) {
showProgressPopup();
dialog.dismiss();
handler.postDelayed(new Runnable() {
@Override
public void run() {
startActivity(intent); // HOME画面へ遷移
finish();
closeProgressPopup();
}
}, 1000);
}
/** /**
* カスタムURL対応 * カスタムURL対応
* @param uri * @param uri
......
...@@ -106,44 +106,34 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity { ...@@ -106,44 +106,34 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity {
UserAuthenticateLogic logic = AbstractLogic.getLogic(UserAuthenticateLogic.class); UserAuthenticateLogic logic = AbstractLogic.getLogic(UserAuthenticateLogic.class);
MemberInfoDto memberInfo = logic.getMemberInfo(); MemberInfoDto memberInfo = logic.getMemberInfo();
if (getRInteger(R.integer.login_mode) == LoginMode.NO_AUTH) { // Adモードの時はログイン画面を表示する loadAddressIfSaasGeneral();
// 認証なしログインの場合 // 通常ログインの場合
finishActivityFlag = false; if (memberInfo == null) {
//noinspection VariableNotUsedInsideIf // ログイン画面へ遷移する
if (memberInfo == null) { callLoginActivity(false, false, false);
noAuthenticatedLogin(false, null);
} else {
startLogoAnimation();
}
} else { } else {
loadAddressIfSaasGeneral(); // 一定期間経過後強制ログアウトチェック
// 通常ログインの場合 if (!checkForceOfflineLogout()) {
if (memberInfo == null) { // 最後のログインから90日のチェック
// ログイン画面へ遷移する if (!checkValidAuthTime()) {
callLoginActivity(false, false, false); // キャンセルした場合のイベントリスナ
} else { OnClickListener cancelListener = new OnClickListener() {
// 一定期間経過後強制ログアウトチェック @Override
if (!checkForceOfflineLogout()) { public void onClick(DialogInterface dialog, int which) {
// 最後のログインから90日のチェック
if (!checkValidAuthTime()) {
// キャンセルした場合のイベントリスナ
OnClickListener cancelListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startLogoAnimation();
}
};
// パスワード定期変更チェック
if (checkRequiredChangePassword(cancelListener)) {
finishActivityFlag = false;
} else {
finishActivityFlag = false;
startLogoAnimation(); startLogoAnimation();
} }
};
// パスワード定期変更チェック
if (checkRequiredChangePassword(cancelListener)) {
finishActivityFlag = false;
} else {
finishActivityFlag = false;
startLogoAnimation();
} }
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
Logger.e("ABVException Login", e); Logger.e("ABVException Login", e);
Intent intent = new Intent(); Intent intent = new Intent();
......
...@@ -123,13 +123,6 @@ public interface AppDefType { ...@@ -123,13 +123,6 @@ public interface AppDefType {
String SYNCED_PROJECT_ID = "syncedProjectId_%d";//一日一回情報更新が出来るように String SYNCED_PROJECT_ID = "syncedProjectId_%d";//一日一回情報更新が出来るように
} }
interface AutoDownloadPrefKey {
//自動ダウンロードサービス用
String AUTO_DOWNLOAD_STARTED_TIME = "autoDownloadStartedTime";
String AUTO_DOWNLOAD_WAITTING = "autoDownloadWaitting";
String CONTENT_OPEN = "contentOpen";
}
/** /**
* 表示するデータタイプ * 表示するデータタイプ
* 全て、クラウド、デバイス * 全て、クラウド、デバイス
......
...@@ -16,31 +16,6 @@ public class ABVFunctionOptions extends AbstractOptions { ...@@ -16,31 +16,6 @@ public class ABVFunctionOptions extends AbstractOptions {
} }
@Override @Override
public int getSettingMenuAccount() {
return context.getResources().getInteger(R.integer.setting_menu_account);
}
@Override
public int getSettingMenuAppInfo() {
return context.getResources().getInteger(R.integer.setting_menu_app_info);
}
@Override
public int getSettingMenuLogout() {
return context.getResources().getInteger(R.integer.setting_menu_logout);
}
@Override
public int getSettingMenuPasswordChange() {
return context.getResources().getInteger(R.integer.setting_menu_password_change);
}
@Override
public int getSettingMenuLogInfo() {
return context.getResources().getInteger(R.integer.setting_menu_log_info);
}
@Override
public int getViewerMenuTextcopy() { public int getViewerMenuTextcopy() {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0; return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
} }
......
package jp.agentec.abook.abv.ui.common.appinfo.options; package jp.agentec.abook.abv.ui.common.appinfo.options;
public interface IOptions { public interface IOptions {
/**
* 設定:アカウント
* @return 0:非表示 1:表示
*/
int getSettingMenuAccount();
/**
* 設定:アプリ情報
* @return 0:非表示 1:表示
*/
int getSettingMenuAppInfo();
/**
* ログアウト表示
* @return 0:非表示 1:表示
*/
int getSettingMenuLogout();
/**
* 設定:パスワード変更
* @return 0:非表示 1:表示
*/
int getSettingMenuPasswordChange();
/**
* 設定:ログ情報
* @return 0:非表示 1:表示
*/
int getSettingMenuLogInfo();
/** /**
* Viewerツールバー:テキストコピー * Viewerツールバー:テキストコピー
* @return 0:非表示、1:表示 * @return 0:非表示、1:表示
......
...@@ -92,7 +92,7 @@ public class Initializer { ...@@ -92,7 +92,7 @@ public class Initializer {
int logLevel = i(R.integer.log_level); int logLevel = i(R.integer.log_level);
boolean isDebugMode = LogLevel.level(logLevel).level() <= LogLevel.debug.level(); boolean isDebugMode = LogLevel.level(logLevel).level() <= LogLevel.debug.level();
env.appVersion = s(R.string.version_name); env.appVersion = s(R.string.version_name);
if (i(R.integer.login_mode) != LoginMode.SITE_PATH_ID_PASS && i(R.integer.login_mode) != LoginMode.SITE_PATH) { if (i(R.integer.login_mode) != LoginMode.SITE_PATH_ID_PASS) {
env.acmsAddress = StringUtil.addSlashToUrlString(s(R.string.acms_address)); env.acmsAddress = StringUtil.addSlashToUrlString(s(R.string.acms_address));
env.downloadServerAddress = StringUtil.addSlashToUrlString(s(R.string.download_server_address)); env.downloadServerAddress = StringUtil.addSlashToUrlString(s(R.string.download_server_address));
env.websocketServerHttpUrl = s(R.string.websocket_server_http_url); env.websocketServerHttpUrl = s(R.string.websocket_server_http_url);
...@@ -106,7 +106,6 @@ public class Initializer { ...@@ -106,7 +106,6 @@ public class Initializer {
env.setLogLevel(LogLevel.level(logLevel)); env.setLogLevel(LogLevel.level(logLevel));
env.mainFolderName = s(R.string.top); env.mainFolderName = s(R.string.top);
env.rootDirectory = context.getFilesDir().getPath(); env.rootDirectory = context.getFilesDir().getPath();
// env.rootDirectory = android.os.Environment.getExternalStorageDirectory().getPath();
Logger.d(TAG, "setRootDirectory=" + env.rootDirectory); Logger.d(TAG, "setRootDirectory=" + env.rootDirectory);
env.networkAdapter = network; env.networkAdapter = network;
...@@ -115,19 +114,15 @@ public class Initializer { ...@@ -115,19 +114,15 @@ public class Initializer {
// 既にMacAddress使用に同意している場合はMacAddressを使う // 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する // 認証なしの場合はUUIDを使用する
int loginMode = context.getResources().getInteger(R.integer.login_mode); int loginMode = context.getResources().getInteger(R.integer.login_mode);
if((loginMode == LoginMode.NO_AUTH||loginMode == LoginMode.SITE_PATH) && !PreferenceUtil.getUserPref(context, UserPrefKey.AGREE_MACINFO, false)){ // Wifiがオンになっていない場合アラートを表示できないので最初の設定はログイン前に行う。例外が発生しても無視。
env.deviceId = DeviceInfo.getDeviceUUID(context); try {
env.encryptKey = DeviceInfo.getEncryptKeyByUUID(context); env.deviceId = DeviceInfo.getDeviceId(context, isDebugMode);
env.deviceIdType = Constant.DeviceIdType.UUID; env.encryptKey = DeviceInfo.getEncryptKey(context, isDebugMode);
} else { // Wifiがオンになっていない場合アラートを表示できないので最初の設定はログイン前に行う。例外が発生しても無視。 env.deviceIdType = DeviceInfo.getDeviceIdType(context, isDebugMode);
try { } catch (ABVException e) {
env.deviceId = DeviceInfo.getDeviceId(context, isDebugMode); Logger.w(TAG, "getWiFiMacAddress failed. " + e.toString()); // ignore
env.encryptKey = DeviceInfo.getEncryptKey(context, isDebugMode);
env.deviceIdType = DeviceInfo.getDeviceIdType(context, isDebugMode);
} catch (ABVException e) {
Logger.w(TAG, "getWiFiMacAddress failed. " + e.toString()); // ignore
}
} }
env.screenSizeForAcmsParam = DeviceInfo.getScreenSizeForAcmsParam(context); env.screenSizeForAcmsParam = DeviceInfo.getScreenSizeForAcmsParam(context);
env.cacheDirectory = context.getCacheDir().getPath(); env.cacheDirectory = context.getCacheDir().getPath();
env.cacheSize = i(R.integer.cache_size); env.cacheSize = i(R.integer.cache_size);
......
package jp.agentec.abook.abv.ui.common.util;
import org.json.adf.JSONObject;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.URL;
import java.sql.Timestamp;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.adf.net.http.HttpRequestSender;
import jp.agentec.adf.net.http.HttpResponse;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.RuntimeUtil;
/**
* Created by leej on 2018/01/25.
*/
public class NtpUtil {
private static final String TAG = "NtpUtil";
public static void synchronizingNtpServerDate() {
synchronized (NtpUtil.class) {
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected() &&
DateTimeUtil.isAbnormalYear() && RuntimeUtil.deviceRootCheck()) {
try {
URL url = new URL("http://ntp-a1.nict.go.jp/cgi-bin/json");
HttpResponse response = HttpRequestSender.get(url);
Logger.d(TAG, "[synchronizingNtpServerDate]:url=%s, httpResponseCode=%s", url, response.httpResponseCode);
if (response.httpResponseCode == 200) {
JSONObject jsonObject = new JSONObject(response.httpResponseBody);
Long ntpTimeMillis = (long) ((Double) jsonObject.get("st") * 1000);
String cmd = "date " + DateTimeUtil.toString(new Timestamp(ntpTimeMillis), DateTimeFormat.MMddHHmmyyyyss__colon);
Logger.d(TAG, "Current Date=%s,Command=%s, NtpDate=%s", DateTimeUtil.toString(DateTimeUtil.getCurrentDate(), DateTimeFormat.yyyyMMddHHmmss_slash),
cmd, DateTimeUtil.toString(new Timestamp(ntpTimeMillis), DateTimeFormat.yyyyMMddHHmmss_slash));
runAsRoot(cmd);
}
} catch (IOException e) {
Logger.e(TAG, "synchronizingNtpServerDate error.", e);
}
}
}
}
/**
* Root化端末のコマンド実行
*
* @param cmd
* @throws IOException
*/
private static final void runAsRoot(String cmd) {
try {
Process process = Runtime.getRuntime().exec("su");
DataOutputStream dataOutputStream = new DataOutputStream(process.getOutputStream());
dataOutputStream.writeBytes(cmd+"\n");
dataOutputStream.writeBytes("exit\n");
dataOutputStream.flush();
} catch (IOException e) {
Logger.w(TAG, "runAsRoot error.", e);
//何も処理しない
}
}
}
...@@ -154,76 +154,37 @@ public class ABookSettingFragment extends PreferenceFragment { ...@@ -154,76 +154,37 @@ public class ABookSettingFragment extends PreferenceFragment {
private void setAccountSetting() { private void setAccountSetting() {
PreferenceGroup accountSettings = (PreferenceGroup) findPreference(ACCOUNT_SET); PreferenceGroup accountSettings = (PreferenceGroup) findPreference(ACCOUNT_SET);
if (Options.getInstance(getActivity()).getSettingMenuAccount() == 0) { PreferenceScreen logout = (PreferenceScreen) findPreference(LOGOUT);
remove(accountSettings); logout.setOnPreferenceClickListener(new OnPreferenceClickListener() {
} else if(getResources().getInteger(R.integer.login_mode) == LoginMode.NO_AUTH||getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { @Override
remove(accountSettings, LOGOUT); public boolean onPreferenceClick(Preference preference) {
remove(accountSettings, PASSWORD_CHANGE); showLogoutAlert();
remove(accountSettings, ACCOUNT_PATH); return true;
remove(accountSettings, LAST_LOGIN);
final String loginId = ABVEnvironment.getInstance().deviceId;
PreferenceScreen loginid = (PreferenceScreen) findPreference(LOGINID);
loginid.setTitle(R.string.device_id);
loginid.setSummary(loginId);
loginid.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
ClipboardUtil.setText(getActivity(), loginId);
ABVToastUtil.showMakeText(getActivity(), getActivity().getString(R.string.id_copy), Toast.LENGTH_SHORT);
return true;
}
});
} else {
PreferenceScreen logout = (PreferenceScreen) findPreference(LOGOUT);
if (Options.getInstance(getActivity()).getSettingMenuLogout() == 1) {
logout.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showLogoutAlert();
return true;
}
});
} else {
remove(accountSettings, LOGOUT);
}
PreferenceScreen passwordChange = (PreferenceScreen) findPreference(PASSWORD_CHANGE);
if (Options.getInstance(getActivity()).getSettingMenuPasswordChange() == 1) {
passwordChange.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
// パスワード変更画面
Intent intent = new Intent();
String className = ChangePasswordActivity.class.getName();
if (isNormalSize() == false) {
className += "Dialog";
}
intent.setClassName(getActivity().getPackageName(), className);
startActivity(intent);
return true;
}
});
} else {
remove(accountSettings, PASSWORD_CHANGE);
} }
});
PreferenceScreen passwordChange = (PreferenceScreen) findPreference(PASSWORD_CHANGE);
MemberInfoDto dto = ABVDataCache.getInstance().getMemberInfo(); passwordChange.setOnPreferenceClickListener(new OnPreferenceClickListener() {
// アカウント関連の設定 @Override
//ドトールの場合:事業者とログインID非表示 public boolean onPreferenceClick(Preference preference) {
if (getResources().getInteger(R.integer.setting_menu_loginId) == 1) { // パスワード変更画面
setSummary(LOGINID, dto.loginId); Intent intent = new Intent();
} else { String className = ChangePasswordActivity.class.getName();
remove(accountSettings, LOGINID); if (isNormalSize() == false) {
className += "Dialog";
}
intent.setClassName(getActivity().getPackageName(), className);
startActivity(intent);
return true;
} }
});
if (getResources().getInteger(R.integer.setting_menu_url_path) == 1) { MemberInfoDto dto = ABVDataCache.getInstance().getMemberInfo();
setSummary(ACCOUNT_PATH, AbstractLogic.getLogic(ContractLogic.class).getUrlPath()); // アカウント関連の設定
} else { //ドトールの場合:事業者とログインID非表示
remove(accountSettings, ACCOUNT_PATH); setSummary(LOGINID, dto.loginId);
} setSummary(ACCOUNT_PATH, AbstractLogic.getLogic(ContractLogic.class).getUrlPath());
setSummary(LAST_LOGIN, DateTimeUtil.toString(dto.lastLoginDate, DateTimeFormat.yyyyMMddHHmmss_slash)); setSummary(LAST_LOGIN, DateTimeUtil.toString(dto.lastLoginDate, DateTimeFormat.yyyyMMddHHmmss_slash));
}
} }
private void showLogoutAlert() { private void showLogoutAlert() {
...@@ -268,12 +229,8 @@ public class ABookSettingFragment extends PreferenceFragment { ...@@ -268,12 +229,8 @@ public class ABookSettingFragment extends PreferenceFragment {
private void setLogInfoSetting() { private void setLogInfoSetting() {
PreferenceGroup logInfo = (PreferenceGroup) findPreference(LOG_INFO); PreferenceGroup logInfo = (PreferenceGroup) findPreference(LOG_INFO);
if (Options.getInstance(getActivity()).getSettingMenuLogInfo() == 1) { // ログExport
// ログExport configureExportLog();
configureExportLog();
} else {
remove(logInfo);
}
} }
private void configureExportLog() { private void configureExportLog() {
...@@ -294,72 +251,68 @@ public class ABookSettingFragment extends PreferenceFragment { ...@@ -294,72 +251,68 @@ public class ABookSettingFragment extends PreferenceFragment {
private void setAppInfoSetting() { private void setAppInfoSetting() {
PreferenceGroup appInfo = (PreferenceGroup) findPreference(APP_INFO); PreferenceGroup appInfo = (PreferenceGroup) findPreference(APP_INFO);
if (Options.getInstance(getActivity()).getSettingMenuAppInfo() == 1) { // ABookについて
// ABookについて Preference aboutABook = findPreference(ABOUT_A_BOOK);
Preference aboutABook = findPreference(ABOUT_A_BOOK); aboutABook.setTitle(getResources().getString(R.string.about_app));
aboutABook.setTitle(getResources().getString(R.string.about_app)); aboutABook.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
aboutABook.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override
@Override public boolean onPreferenceClick(Preference preference) {
public boolean onPreferenceClick(Preference preference) { showAboutABookDialog();
showAboutABookDialog(); return true;
return true; }
} });
});
// ライセンス情報
Preference licenseInfo = findPreference(LICENSE_INFO);
licenseInfo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showLicenseDialog();
return true;
}
});
// アップデート確認 // ライセンス情報
Preference checkAppUpdate = findPreference(CHECK_APP_UPDATE); Preference licenseInfo = findPreference(LICENSE_INFO);
if (getResources().getInteger(R.integer.check_app_update) == 1) { licenseInfo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
checkAppUpdate.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override
@Override public boolean onPreferenceClick(Preference preference) {
public boolean onPreferenceClick(Preference preference) { showLicenseDialog();
try { return true;
//パーミッションチェック
ABookPermissionHelper helper = new ABookPermissionHelper(getActivity(), Constant.ABookPermissionType.ReadExternalStorage, null);
if (helper.checkMultiPermissions(true)) {
showCheckAppDialog();
} else {
Logger.w(TAG,"ReadExternalStorage checkMultiPermissions false");
}
} catch (Exception e) {
}
return true;
}
});
} else {
appInfo.removePreference(checkAppUpdate);
} }
});
Preference abookCheckManual = findPreference(ABOOK_CHECK_MANUAL); // アップデート確認
abookCheckManual.setTitle(getResources().getString(R.string.project_manual)); Preference checkAppUpdate = findPreference(CHECK_APP_UPDATE);
abookCheckManual.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { if (getResources().getInteger(R.integer.check_app_update) == 1) {
checkAppUpdate.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
try { try {
Intent intent = new Intent(); //パーミッションチェック
intent.putExtra(ABookKeys.CONTENT_ID, 0L); ABookPermissionHelper helper = new ABookPermissionHelper(getActivity(), Constant.ABookPermissionType.ReadExternalStorage, null);
intent.putExtra("FILEPATH", ABVEnvironment.getInstance().getContentCacheDirectoryPath(0L)); if (helper.checkMultiPermissions(true)) {
intent.putExtra("page", 0); showCheckAppDialog();
intent.setClass(getActivity(), GuideViewActivity.class); } else {
startActivity(intent); Logger.w(TAG, "ReadExternalStorage checkMultiPermissions false");
}
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG, e);
} }
return true; return true;
} }
}); });
} else { } else {
remove(appInfo); appInfo.removePreference(checkAppUpdate);
} }
Preference abookCheckManual = findPreference(ABOOK_CHECK_MANUAL);
abookCheckManual.setTitle(getResources().getString(R.string.project_manual));
abookCheckManual.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
Intent intent = new Intent();
intent.putExtra(ABookKeys.CONTENT_ID, 0L);
intent.putExtra("FILEPATH", ABVEnvironment.getInstance().getContentCacheDirectoryPath(0L));
intent.putExtra("page", 0);
intent.setClass(getActivity(), GuideViewActivity.class);
startActivity(intent);
} catch (Exception e) {
Logger.e(TAG, e);
}
return true;
}
});
} }
private void showLicenseDialog() { private void showLicenseDialog() {
...@@ -448,15 +401,13 @@ public class ABookSettingFragment extends PreferenceFragment { ...@@ -448,15 +401,13 @@ public class ABookSettingFragment extends PreferenceFragment {
SharedPreferences pre = PreferenceUtil.getUserPreference(getActivity()); SharedPreferences pre = PreferenceUtil.getUserPreference(getActivity());
// 既にMacAddress使用に同意している場合はMacAddressを使う // 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する // 認証なしの場合はUUIDを使用する
if ((getResources().getInteger(R.integer.login_mode) == LoginMode.NO_AUTH||getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) && !pre.getBoolean(UserPrefKey.AGREE_MACINFO, false)) {
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), abvEnvironment.deviceId, null); if (ABVEnvironment.getInstance().deviceIdType == Constant.DeviceIdType.MAC_ADDRESS) {
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), null, abvEnvironment.deviceId);
} else { } else {
if (ABVEnvironment.getInstance().deviceIdType == Constant.DeviceIdType.MAC_ADDRESS) { param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), abvEnvironment.deviceId, null);
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), null, abvEnvironment.deviceId);
} else {
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), abvEnvironment.deviceId, null);
}
} }
Logger.d(TAG, "[showCheckAppDialog]:1"); Logger.d(TAG, "[showCheckAppDialog]:1");
final String version = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).appLatestVersion(param); final String version = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).appLatestVersion(param);
Logger.d(TAG, "Last Version=%s, Current Version=%s", version, ABVEnvironment.getInstance().appVersion); Logger.d(TAG, "Last Version=%s, Current Version=%s", version, ABVEnvironment.getInstance().appVersion);
...@@ -490,7 +441,9 @@ public class ABookSettingFragment extends PreferenceFragment { ...@@ -490,7 +441,9 @@ public class ABookSettingFragment extends PreferenceFragment {
childs[0].delete(); childs[0].delete();
} }
request.setDestinationUri(Uri.fromFile(file)); request.setDestinationUri(Uri.fromFile(file));
downloadManager.enqueue(request); if (downloadManager != null) {
downloadManager.enqueue(request);
}
getActivity().registerReceiver(new OnAppDownloadReceiver(), new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); getActivity().registerReceiver(new OnAppDownloadReceiver(), new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
......
...@@ -124,25 +124,11 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -124,25 +124,11 @@ public class LoginActivity extends ABVLoginActivity {
mEdtUrlPath.setVisibility(View.GONE); mEdtUrlPath.setVisibility(View.GONE);
mEdtUrlPathGoneFlg = true; // TODO:このフラグ必要? mEdtUrlPathGoneFlg = true; // TODO:このフラグ必要?
} }
if (getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH_ID_PASS || getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { // Saas汎用版の場合 if (getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH_ID_PASS) {
if (StringUtil.isNullOrWhiteSpace(ABVEnvironment.getInstance().acmsAddress)) { // urlPathとはセットで有無が合っている前提 if (StringUtil.isNullOrWhiteSpace(ABVEnvironment.getInstance().acmsAddress)) { // urlPathとはセットで有無が合っている前提
mEdtSiteId.setVisibility(View.VISIBLE); mEdtSiteId.setVisibility(View.VISIBLE);
} }
} }
if (getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH) {
mEdtLoginId.setVisibility(View.GONE);
mEdtPassword.setVisibility(View.GONE);
mEdtUrlPath.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
tryLogin();
return true;
}
return false;
}
});
}
mEdtPassword.setOnKeyListener(new OnKeyListener() { mEdtPassword.setOnKeyListener(new OnKeyListener() {
@Override @Override
...@@ -315,12 +301,6 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -315,12 +301,6 @@ public class LoginActivity extends ABVLoginActivity {
} }
if (validate()) { if (validate()) {
if (getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH) {
// Saas環境用認証なしで初回ログインの場合、任意のID&PWDを生成してサーバへ登録する
threadSaasLogin();
return;
}
boolean agree_macInfor; boolean agree_macInfor;
agree_macInfor = getUserPref(UserPrefKey.AGREE_MACINFO, false); agree_macInfor = getUserPref(UserPrefKey.AGREE_MACINFO, false);
// Macアドレスに既に同意している場合、ログイン // Macアドレスに既に同意している場合、ログイン
...@@ -365,20 +345,6 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -365,20 +345,6 @@ public class LoginActivity extends ABVLoginActivity {
return false; return false;
} }
} }
if (getRInteger(R.integer.login_mode) != LoginMode.SITE_PATH) {
if (StringUtil.isNullOrWhiteSpace(mLoginId)) {
handleErrorMessageToast(ErrorCode.E001);
mEdtLoginId.requestFocus();
return false;
}
if (StringUtil.isNullOrWhiteSpace(mPassword)) {
handleErrorMessageToast(ErrorCode.E002);
mEdtPassword.requestFocus();
return false;
}
}
return true; return true;
} }
...@@ -431,25 +397,6 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -431,25 +397,6 @@ public class LoginActivity extends ABVLoginActivity {
} }
/** /**
* Saas用ログインスレッドの起動
*/
private void threadSaasLogin() {
showProgressPopup();
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
checkSiteId();
//noinspection VariableNotUsedInsideIf
if (ABVEnvironment.getInstance().acmsAddress == null) {
closeProgressPopup();
} else {
noAuthenticatedLogin(false, mUrlPath);
}
}
});
}
/**
* サーバと通信せずにパスワードのチェックを行う。<br> * サーバと通信せずにパスワードのチェックを行う。<br>
* 正しい場合、メイン画面を表示する。 * 正しい場合、メイン画面を表示する。
*/ */
......
...@@ -217,9 +217,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -217,9 +217,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
private float mMinDistance;// Scroll移動距離チェック時の最小移動距離値 private float mMinDistance;// Scroll移動距離チェック時の最小移動距離値
private float mScrollDistance; // 実際にスクロールかけた移動距離 private float mScrollDistance; // 実際にスクロールかけた移動距離
// private float mDisplayScale; // iPad用としてオーサリングされた座標やサイズをAndroid用に変換するためのスケール
private int mAllPageCount = 1; // 全ページ数 private int mAllPageCount = 1; // 全ページ数
private Dialog mSearchDialog; // 検索ボックス private Dialog mSearchDialog; // 検索ボックス
...@@ -1275,55 +1272,50 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -1275,55 +1272,50 @@ public class ContentViewActivity extends ABVContentViewActivity {
params.width = 0; params.width = 0;
} }
} else { } else {
subMenuBtn.setVisibility(View.GONE); subMenuBtn.setVisibility(View.GONE);
} }
slide = (ToggleButton) mToolBar.findViewById(R.id.tbtn_slide); slide = (ToggleButton) mToolBar.findViewById(R.id.tbtn_slide);
if (!(isProjectPdf())) { tbtnMarking = (ToggleButton) mToolBar.findViewById(R.id.tbtn_marking);
slide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { mBtnRemoteStart = (ImageButton) mToolBar.findViewById(R.id.btn_remote_start);
@Override
public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked) {
mPageScrollView.setFixFlag(!isChecked);
if (meetingManager.isSendable()) {
JSONObject json = new JSONObject();
json.put(MeetingManager.IS_CURSOR_MODE, !isChecked);
meetingManager.sendWs(MeetingManager.CMD_CURSORMODE, getContentId(), mCurrentPageNumber, null, json);
}
}
});
} else {
slide.setVisibility(View.GONE);
}
tbtnMarking = (ToggleButton) mToolBar.findViewById(R.id.tbtn_marking); if (isProjectPdf()) {
if (!(isProjectPdf())) { slide.setVisibility(View.GONE);
tbtnMarking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { tbtnMarking.setVisibility(View.GONE);
@Override mBtnRemoteStart.setVisibility(View.GONE);
public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked) { } else {
PreferenceUtil.put(ContentViewActivity.this, DefPrefKey.DISPLAY_MARKING, isChecked); slide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
setMarkingViewVisibility(isChecked); @Override
} public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked) {
}); mPageScrollView.setFixFlag(!isChecked);
} else { if (meetingManager.isSendable()) {
tbtnMarking.setVisibility(View.GONE); JSONObject json = new JSONObject();
} json.put(MeetingManager.IS_CURSOR_MODE, !isChecked);
meetingManager.sendWs(MeetingManager.CMD_CURSORMODE, getContentId(), mCurrentPageNumber, null, json);
}
}
});
mBtnRemoteStart = (ImageButton) mToolBar.findViewById(R.id.btn_remote_start); tbtnMarking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
if (!(isProjectPdf())) { @Override
mBtnRemoteStart.setOnClickListener(new View.OnClickListener() { public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked) {
@Override PreferenceUtil.put(ContentViewActivity.this, DefPrefKey.DISPLAY_MARKING, isChecked);
public void onClick(View v) { setMarkingViewVisibility(isChecked);
meetingManager.setPaused(false); }
mPageNumberLayout.setVisibility(View.INVISIBLE); });
configureRemote();
for (MarkingView markingView : mMarkingViewList) { mBtnRemoteStart.setOnClickListener(new View.OnClickListener() {
markingView.reLoad(); @Override
} public void onClick(View v) {
} meetingManager.setPaused(false);
}); mPageNumberLayout.setVisibility(View.INVISIBLE);
} else { configureRemote();
mBtnRemoteStart.setVisibility(View.GONE); for (MarkingView markingView : mMarkingViewList) {
} markingView.reLoad();
}
}
});
}
//RelativeLayout.LayoutParams param1 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, (int)(48 * tmpDensity + 0.5f)); //RelativeLayout.LayoutParams param1 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, (int)(48 * tmpDensity + 0.5f));
RelativeLayout.LayoutParams param1 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams param1 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
...@@ -1440,14 +1432,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -1440,14 +1432,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
private void allReset() { private void allReset() {
stopSound(); stopSound();
stopVideo(); stopVideo();
// 以下を実行すると、コンテンツ間リンクで戻ったとき動画で落ちるのでコメントアウト。TODO:問題なければ削除
// int listSize = mPageActionList.size();
// int index;
// for (int i = 0 ; i < listSize; i++) {
// index = listSize - 1 - i;
// mPageActionList.get(index).clear();
// mPageActionList.remove(index);
// }
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} }
...@@ -1525,7 +1509,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -1525,7 +1509,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (mProjectId != null && mProjectId > -1) { if (mProjectId != null && mProjectId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId); putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId);
} }
if (isVideoMax) { if (isVideoMax) {
videoMaxToDefault(); videoMaxToDefault();
} else if (isMarking) { } else if (isMarking) {
...@@ -1549,7 +1532,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -1549,7 +1532,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
} else { } else {
moveToBack(); moveToBack();
} }
} }
return false; return false;
} }
...@@ -1558,16 +1540,12 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -1558,16 +1540,12 @@ public class ContentViewActivity extends ABVContentViewActivity {
@Override @Override
protected void onStop() { protected void onStop() {
Logger.d(TAG, "onStop");
// ページ別ログ // ページ別ログ
if (!DeviceInfo.isForegrdound(getApplicationContext())) { if (!DeviceInfo.isForegrdound(getApplicationContext())) {
ContentLogUtil.getInstance().pauseContentPageReadLog(contentId, mCurrentPageNumber, readingLogId); ContentLogUtil.getInstance().pauseContentPageReadLog(contentId, mCurrentPageNumber, readingLogId);
} }
super.onStop(); super.onStop();
Logger.d(TAG, "onStop");
// allReset();
// super.onViewerStop(mContentId); 確認?
} }
@Override @Override
...@@ -3016,10 +2994,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3016,10 +2994,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
Logger.e(TAG, "[OutOfMemoryError]", e); Logger.e(TAG, "[OutOfMemoryError]", e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.OUT_OF_MEMORY, Toast.LENGTH_SHORT); ABVToastUtil.showMakeText(getApplicationContext(), R.string.OUT_OF_MEMORY, Toast.LENGTH_SHORT);
} }
//noinspection deprecation(API16から非推奨になった。無視)
imgButton.setBackgroundDrawable(bitmapDrawable); //半透明表示 imgButton.setBackgroundDrawable(bitmapDrawable); //半透明表示
// imgButton.setImageURI(Uri.parse(imagefile)); //Image File
// imgButton.setImageDrawable(bitmapDrawable);
contentPageView.addView(imgButton, param); contentPageView.addView(imgButton, param);
// Target抽出(TargetIDを基に差し替えイメージをチェック) // Target抽出(TargetIDを基に差し替えイメージをチェック)
...@@ -3537,12 +3512,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3537,12 +3512,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
} }
// private FileDescriptor getFileDataSource(String path) throws IOException {
// FileInputStream fis = new FileInputStream(path);
// FileDescriptor fd = fis.getFD();
// return fd;
// }
private void playTapSound(String soundFilePath, PageObjectJSON pageObject) { private void playTapSound(String soundFilePath, PageObjectJSON pageObject) {
if (!playTapSoundFlg || !preSoundFilePath.equals(soundFilePath)) { if (!playTapSoundFlg || !preSoundFilePath.equals(soundFilePath)) {
...@@ -3638,16 +3607,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3638,16 +3607,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
} }
// private void restartSound() {
// if (tapPlayer != null && !tapPlayer.isPlaying()) {
// tapPlayer.start();
// } else if (pageBGMPlayer != null && !pageBGMPlayer.isPlaying()) {
// pageBGMPlayer.start();
// } else if (contentBGMPlayer != null && !contentBGMPlayer.isPlaying()) {
// contentBGMPlayer.start();
// }
// }
/** /**
* VideoView画面表示 * VideoView画面表示
* @param pageNumber * @param pageNumber
...@@ -3724,26 +3683,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3724,26 +3683,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
} }
// /**
// * 表示する画像を指定してPreview画面表示
// * @param objectId
// */
// private void showPreview(List<String> imagefile, int potision, Long objectId) {
// //20120803 イメージがない場合移動しない
// if (isAnotherViewOpenFlg == false && !imagefile.isEmpty()) {
// isAnotherViewOpenFlg = true;
// Intent intent_ = new Intent(this, PreviewActivity.class);
// for (int i = 0; i < imagefile.size(); i++) {
// intent_.putExtra("FILEPATH" + (i + 1), imagefile.get(i));
// }
// intent_.putExtra("Position", potision);
// intent_.putExtra(KEY_CONTENT_ID, getContentId());
// intent_.putExtra("pageNumber", mCurrentPageNumber);
// intent_.putExtra("objectId", objectId);
// startActivityForResult(intent_, PREVIEW);
// }
// }
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) { public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Uri[] result = null; Uri[] result = null;
...@@ -3792,7 +3731,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3792,7 +3731,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
mUploadMessage.onReceiveValue(result); mUploadMessage.onReceiveValue(result);
break; break;
} }
mUploadMessage = null; mUploadMessage = null;
} }
...@@ -3940,10 +3878,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3940,10 +3878,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
final WebView webView = new WebView(this); final WebView webView = new WebView(this);
// final TextView pageText = new TextView(ContentViewActivity.this);
// pageText.setTextSize(20);
// pageText.setTextColor(ContentViewActivity.this.getResources().getColor(ABVColor.getTxtSelect()));
final String pageText = contentPageDao.getContentPageText(getContentId(), pagenum+1); final String pageText = contentPageDao.getContentPageText(getContentId(), pagenum+1);
if (pageText != null) { if (pageText != null) {
String pageText1 = pageText.replaceAll("(\r\n|\n)", "<br />"); String pageText1 = pageText.replaceAll("(\r\n|\n)", "<br />");
...@@ -4213,21 +4147,11 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -4213,21 +4147,11 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
else if (obj instanceof FullVideoView) { // 全画面動画の場合 else if (obj instanceof FullVideoView) { // 全画面動画の場合
performRemoteFullVideo((FullVideoView)obj, type, playTime); performRemoteFullVideo((FullVideoView)obj, type, playTime);
// View targetView = objectIdButtonMap.get(remoteObjectId); } else {
// if (targetView != null) { // 全画面動画の場合(起動のみ)
// Logger.v(TAG, "[performRemoteEvent] perform click. remoteObjectId=" + remoteObjectId);
// targetView.performClick(); // ボタンをクリック
// }
// else {
// Logger.e(TAG, "[performRemoteEvent] target video not found. remoteObjectId=" + remoteObjectId);
// }
}
else {
Logger.e(TAG, "[performRemoteEvent] target video not found. remoteObjectId=" + remoteObjectId); Logger.e(TAG, "[performRemoteEvent] target video not found. remoteObjectId=" + remoteObjectId);
} }
} }
} } else if (cmd.equals(MeetingManager.CMD_QUESTIONNAIREACTION)) { // アンケート
else if (cmd.equals(MeetingManager.CMD_QUESTIONNAIREACTION)) { // アンケート
Float alpha = JsonUtil.getFloat(json, MeetingManager.ALPHA); Float alpha = JsonUtil.getFloat(json, MeetingManager.ALPHA);
if (alpha != null) { if (alpha != null) {
enqueteLayout.setAlpha((int) (alpha * 255)); enqueteLayout.setAlpha((int) (alpha * 255));
...@@ -4252,18 +4176,14 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -4252,18 +4176,14 @@ public class ContentViewActivity extends ABVContentViewActivity {
enqueteLayout.left(); enqueteLayout.left();
} }
} }
} } else if (cmd.equals(MeetingManager.CMD_MARKING)) { // マーキング描画
else if (cmd.equals(MeetingManager.CMD_MARKING)) { // マーキング描画
peformRemoteMarking(json); peformRemoteMarking(json);
} } else if (cmd.equals(MeetingManager.CMD_CLOSEPOPUP)) { // 各種閉じる
else if (cmd.equals(MeetingManager.CMD_CLOSEPOPUP)) { // 各種閉じる
closePopup(remoteObjectId); closePopup(remoteObjectId);
} } else if (cmd.equals(MeetingManager.CMD_CURSORMODE)) { // カーソルモード切替
else if (cmd.equals(MeetingManager.CMD_CURSORMODE)) { // カーソルモード切替
Boolean isCursorMode = JsonUtil.getBoolean(json, MeetingManager.IS_CURSOR_MODE); Boolean isCursorMode = JsonUtil.getBoolean(json, MeetingManager.IS_CURSOR_MODE);
mMainLayout.setRemoteDraw(isCursorMode); mMainLayout.setRemoteDraw(isCursorMode);
} } else if (cmd.equals(MeetingManager.CMD_CURSOR)) { // カーソル移動
else if (cmd.equals(MeetingManager.CMD_CURSOR)) { // カーソル移動
Float x = JsonUtil.getFloat(json, MeetingManager.X); Float x = JsonUtil.getFloat(json, MeetingManager.X);
Float y = JsonUtil.getFloat(json, MeetingManager.Y); Float y = JsonUtil.getFloat(json, MeetingManager.Y);
if (x != null && y != null) { if (x != null && y != null) {
...@@ -4282,8 +4202,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -4282,8 +4202,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
matrix.postTranslate(x * zoomLayout.getAuthoringScale() + margin.left, y * zoomLayout.getAuthoringScale() + margin.top); matrix.postTranslate(x * zoomLayout.getAuthoringScale() + margin.left, y * zoomLayout.getAuthoringScale() + margin.top);
zoomLayout.setZoomMatrix(matrix); zoomLayout.setZoomMatrix(matrix);
} }
} } else {
else {
Logger.e(TAG, "Not Implemented Command. " + cmd); Logger.e(TAG, "Not Implemented Command. " + cmd);
} }
} }
...@@ -4871,17 +4790,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -4871,17 +4790,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
private void showEndToast() {
ABVToastUtil.showMakeText(ContentViewActivity.this, getString(R.string.end_alert), Toast.LENGTH_SHORT);
mEndFlg = true;
handler.postDelayed(new Runnable() {
@Override
public void run() {
mEndFlg = false;
}
}, 2000);
}
@Override @Override
public int getCurrentPageNumber() { public int getCurrentPageNumber() {
return mCurrentPageNumber; return mCurrentPageNumber;
...@@ -5030,20 +4938,25 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5030,20 +4938,25 @@ public class ContentViewActivity extends ABVContentViewActivity {
projectTaskLayout.taskWebViewLoadUrl(url); projectTaskLayout.taskWebViewLoadUrl(url);
} }
@Override /**
* PDFプロジェクトのアクション制御メソッド
* @param checkParam
* @param projectTaskDto
*/
@Override
protected void onActionProjectPdfWebView(final Map<String, String> checkParam, ProjectTaskDto projectTaskDto) { protected void onActionProjectPdfWebView(final Map<String, String> checkParam, ProjectTaskDto projectTaskDto) {
String cmd = checkParam.get(ABookKeys.CMD); String cmd = checkParam.get(ABookKeys.CMD);
switch (cmd) { switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS: case ABookKeys.CMD_INSERT_TASK_DIRECTIONS: // 作業指示の登録
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS: case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS: // 作業指示の更新
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS: case ABookKeys.CMD_DELETE_TASK_DIRECTIONS: // 作業指示の削除
case ABookKeys.CMD_INSERT_TASK_REPORT: case ABookKeys.CMD_INSERT_TASK_REPORT: // 作業報告の登録
case ABookKeys.CMD_UPDATE_TASK_REPORT: case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新
case ABookKeys.CMD_DELETE_TASK_REPORT: case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除
getTaskHotspotJSON(); getTaskHotspotJSON();
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS: case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS: // 作業指示のキャンセル
case ABookKeys.CMD_CANCEL_TASK_REPORT: case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル
if(projectTaskDto != null) { if(projectTaskDto != null) {
updateProjectTaskPosition(projectTaskDto.pdfX, projectTaskDto.pdfY); updateProjectTaskPosition(projectTaskDto.pdfX, projectTaskDto.pdfY);
} }
...@@ -5095,6 +5008,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5095,6 +5008,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
return projectTaskLayout.convertToAuthoringPoint(x, y); return projectTaskLayout.convertToAuthoringPoint(x, y);
} }
// 作業のホットスポットJSONを取得
private void getTaskHotspotJSON() { private void getTaskHotspotJSON() {
try { try {
String contentPath = ABVEnvironment.getInstance().getTaskPdfDirName(ContentFileExtractor.getInstance().getContentCacheDirWithExtract(projectDto.contentId)); String contentPath = ABVEnvironment.getInstance().getTaskPdfDirName(ContentFileExtractor.getInstance().getContentCacheDirWithExtract(projectDto.contentId));
......
...@@ -2,7 +2,6 @@ package jp.agentec.abook.abv.ui.viewer.activity; ...@@ -2,7 +2,6 @@ package jp.agentec.abook.abv.ui.viewer.activity;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON; import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
...@@ -17,23 +16,16 @@ import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification; ...@@ -17,23 +16,16 @@ import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContentDto; import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.EnqueteDto; import jp.agentec.abook.abv.bl.dto.EnqueteDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.EnqueteLogic; import jp.agentec.abook.abv.bl.logic.EnqueteLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil; import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity; import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil; import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
import org.itri.html5webview.HTML5WebView;
import android.content.Intent; import android.content.Intent;
import android.location.Location;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
...@@ -53,7 +45,6 @@ import android.webkit.WebViewClient; ...@@ -53,7 +45,6 @@ import android.webkit.WebViewClient;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button; import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
...@@ -79,12 +70,12 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity { ...@@ -79,12 +70,12 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
private ImageButton downloadButton; private ImageButton downloadButton;
private int objectLogId; private int objectLogId;
private boolean isPageFinished; private boolean mPageFinishedFlg;
private WebView webView; private WebView webView;
private Double latitude; private Double mLatitude;
private Double longitude; private Double mLongitude;
private JsInf jsInf = new JsInf(); private JsInf jsInf = new JsInf();
private boolean pageStart; private boolean pageStart;
...@@ -438,8 +429,8 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity { ...@@ -438,8 +429,8 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Logger.d(TAG, "ReloadUrl"); Logger.d(TAG, "ReloadUrl");
if (latitude != null && longitude != null) { if (mLatitude != null && mLongitude != null) {
webView.loadUrl(url + "&reload=true&latitude=" + latitude + "&longitude=" + longitude); webView.loadUrl(url + "&reload=true&mLatitude=" + mLatitude + "&mLongitude=" + mLongitude);
} }
else { else {
webView.loadUrl(url + "&reload=true"); webView.loadUrl(url + "&reload=true");
...@@ -552,7 +543,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity { ...@@ -552,7 +543,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
public void existSetLocation(String ret) { public void existSetLocation(String ret) {
Logger.d(TAG, "existSetLocation=%s", ret); Logger.d(TAG, "existSetLocation=%s", ret);
if (ret != null && ret.equals("true")) { // setLocationメソッドが存在する場合、ページ読み込み完了とみなす if (ret != null && ret.equals("true")) { // setLocationメソッドが存在する場合、ページ読み込み完了とみなす
isPageFinished = true; mPageFinishedFlg = true;
} }
else { // 存在しない場合、ページ読み込み未完了とみなし1秒後に再度呼出しを繰り返す else { // 存在しない場合、ページ読み込み未完了とみなし1秒後に再度呼出しを繰り返す
handler.postDelayed(new Runnable() { handler.postDelayed(new Runnable() {
...@@ -597,7 +588,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity { ...@@ -597,7 +588,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
@Override @Override
public void run() { public void run() {
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
if (isPageFinished) { if (mPageFinishedFlg) {
break; break;
} }
try { try {
......
package jp.agentec.abook.abv.ui.viewer.activity; package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.Intent; import android.content.Intent;
import android.location.Location;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.KeyEvent; import android.view.KeyEvent;
...@@ -21,7 +20,6 @@ import android.webkit.WebView; ...@@ -21,7 +20,6 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
...@@ -30,7 +28,6 @@ import org.apache.http.HttpResponse; ...@@ -30,7 +28,6 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.itri.html5webview.HTML5WebView;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -75,7 +72,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -75,7 +72,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
private int objectLogId; private int objectLogId;
private WebView webView; private WebView webView;
private HTML5WebView html5WebView;
private JsInf jsInf = new JsInf(); private JsInf jsInf = new JsInf();
private ValueCallback<Uri[]> mUploadMessage; private ValueCallback<Uri[]> mUploadMessage;
@Override @Override
......
...@@ -18,7 +18,6 @@ import android.widget.ImageButton; ...@@ -18,7 +18,6 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import org.itri.html5webview.HTML5WebView;
import org.xwalk.core.XWalkNavigationHistory; import org.xwalk.core.XWalkNavigationHistory;
import org.xwalk.core.XWalkResourceClient; import org.xwalk.core.XWalkResourceClient;
import org.xwalk.core.XWalkSettings; import org.xwalk.core.XWalkSettings;
...@@ -69,9 +68,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity { ...@@ -69,9 +68,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
private ImageButton reloadButton; private ImageButton reloadButton;
private ImageButton downloadButton; private ImageButton downloadButton;
private int objectLogId; private int objectLogId;
private XWalkView webView; private XWalkView webView;
private HTML5WebView html5WebView;
private HTMLXWalkWebViewActivity.JsInf jsInf = new HTMLXWalkWebViewActivity.JsInf(); private HTMLXWalkWebViewActivity.JsInf jsInf = new HTMLXWalkWebViewActivity.JsInf();
......
...@@ -46,8 +46,6 @@ import jp.agentec.adf.util.FileUtil; ...@@ -46,8 +46,6 @@ import jp.agentec.adf.util.FileUtil;
public class ParentWebViewActivity extends ABVContentViewActivity { public class ParentWebViewActivity extends ABVContentViewActivity {
private static final String TAG = "ParentWebViewActivity"; private static final String TAG = "ParentWebViewActivity";
protected ABVUIActivity mUIActivity;
private LinearLayout historyLayout; private LinearLayout historyLayout;
private ImageButton addSceneButton; private ImageButton addSceneButton;
...@@ -62,10 +60,6 @@ public class ParentWebViewActivity extends ABVContentViewActivity { ...@@ -62,10 +60,6 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
protected Button btnWebForward; protected Button btnWebForward;
private ProgressBar m_progress; private ProgressBar m_progress;
private Double reportLatitude;
private Double reportLongitude;
protected void commonOnCreate() { protected void commonOnCreate() {
historyLayout = (LinearLayout) findViewById(R.id.historyLayout); historyLayout = (LinearLayout) findViewById(R.id.historyLayout);
addSceneButton = (ImageButton) findViewById(R.id.btn_add_scene); addSceneButton = (ImageButton) findViewById(R.id.btn_add_scene);
...@@ -96,10 +90,6 @@ public class ParentWebViewActivity extends ABVContentViewActivity { ...@@ -96,10 +90,6 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
} }
} }
protected void commonOpenFileChooser (ValueCallback<Uri> uploadFile, String acceptType, String capture) {
}
protected void commonOnReceivedResponseHeaders(String uri, int statusCode) { protected void commonOnReceivedResponseHeaders(String uri, int statusCode) {
if (uri.contains("vtour") || uri.contains("authByCheck")) { if (uri.contains("vtour") || uri.contains("authByCheck")) {
if(statusCode >= 400) { if(statusCode >= 400) {
......
...@@ -104,10 +104,8 @@ public class PreviewActivity extends ABVContentViewActivity { ...@@ -104,10 +104,8 @@ public class PreviewActivity extends ABVContentViewActivity {
mFlipperLayout[i].setGravity(Gravity.CENTER); mFlipperLayout[i].setGravity(Gravity.CENTER);
LinearLayout.LayoutParams paramFlipperLayout = new LinearLayout.LayoutParams(matchParent, matchParent); LinearLayout.LayoutParams paramFlipperLayout = new LinearLayout.LayoutParams(matchParent, matchParent);
mViewFlipper.addView(mFlipperLayout[i], paramFlipperLayout); mViewFlipper.addView(mFlipperLayout[i], paramFlipperLayout);
// float tmpDensity = getResources().getDisplayMetrics().density; LinearLayout.LayoutParams paramThumbnail = new LinearLayout.LayoutParams(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);
// LinearLayout.LayoutParams paramThumbnail = new LinearLayout.LayoutParams((int)(THUMBNAIL_WIDTH * tmpDensity + 0.5f), (int)(THUMBNAIL_HEIGHT * tmpDensity + 0.5f));
LinearLayout.LayoutParams paramThumbnail = new LinearLayout.LayoutParams(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);
mLayoutThumbnail.addView(imgBtn[i], paramThumbnail); mLayoutThumbnail.addView(imgBtn[i], paramThumbnail);
setBtnClick(imgBtn[i], i); setBtnClick(imgBtn[i], i);
} }
...@@ -231,7 +229,6 @@ public class PreviewActivity extends ABVContentViewActivity { ...@@ -231,7 +229,6 @@ public class PreviewActivity extends ABVContentViewActivity {
flipperImageView.setScaleType(ScaleType.FIT_CENTER); //CENTER_INSIDE flipperImageView.setScaleType(ScaleType.FIT_CENTER); //CENTER_INSIDE
flipperImageView.setAdjustViewBounds(true); flipperImageView.setAdjustViewBounds(true);
flipperImageView.setImageURI(Uri.parse(mFilePath[index])); flipperImageView.setImageURI(Uri.parse(mFilePath[index]));
// int WC = LinearLayout.LayoutParams.WRAP_CONTENT;
int MP = ViewGroup.LayoutParams.MATCH_PARENT; int MP = ViewGroup.LayoutParams.MATCH_PARENT;
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(MP, MP); LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(MP, MP);
mFlipperLayout[index].removeAllViews(); mFlipperLayout[index].removeAllViews();
......
package org.itri.html5webview;
import jp.agentec.abook.abv.launcher.android.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.webkit.GeolocationPermissions;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.FrameLayout;
public class HTML5WebView extends WebView {
private Context mContext;
private MyWebChromeClient mWebChromeClient;
private View mCustomView;
private FrameLayout mCustomViewContainer;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private FrameLayout mContentView;
private FrameLayout mBrowserFrameLayout;
// private FrameLayout mLayout;
static final String LOGTAG = "HTML5WebView";
private void init(Context context) {
mContext = context;
Activity a = (Activity) mContext;
// mLayout = new FrameLayout(context);
mBrowserFrameLayout = (FrameLayout) LayoutInflater.from(a).inflate(R.layout.custom_screen, null);
mContentView = (FrameLayout) mBrowserFrameLayout.findViewById(R.id.main_content);
mCustomViewContainer = (FrameLayout) mBrowserFrameLayout.findViewById(R.id.fullscreen_custom_content);
// mLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS);
mWebChromeClient = new MyWebChromeClient();
setWebChromeClient(mWebChromeClient);
// Configure the webview
WebSettings s = getSettings();
s.setBuiltInZoomControls(true);
s.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
s.setUseWideViewPort(true);
s.setLoadWithOverviewMode(true);
//noinspection deprecation(API21から非推奨になった。無視)
s.setSavePassword(true);
s.setSaveFormData(true);
s.setJavaScriptEnabled(true);
// enable navigator.geolocation
// s.setGeolocationEnabled(true);
// s.setGeolocationDatabasePath("/data/data/org.itri.html5webview/databases/");
// enable Web Storage: localStorage, sessionStorage
s.setDomStorageEnabled(true);
mContentView.addView(this);
}
public HTML5WebView(Context context) {
super(context);
init(context);
}
public HTML5WebView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public HTML5WebView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
// public FrameLayout getLayout() {
// return mLayout;
// }
public FrameLayout getBrowserLayout() {
return mBrowserFrameLayout;
}
public boolean inCustomView() {
return (mCustomView != null);
}
public void hideCustomView() {
mWebChromeClient.onHideCustomView();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if ((mCustomView == null) && canGoBack()){
goBack();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
private class MyWebChromeClient extends WebChromeClient {
private Bitmap mDefaultVideoPoster;
private View mVideoProgressView;
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
//Log.i(LOGTAG, "here in on ShowCustomView");
HTML5WebView.this.setVisibility(View.GONE);
// if a view already exists then immediately terminate the new one
if (mCustomView == null) {
mCustomViewContainer.addView(view);
mCustomView = view;
mCustomViewCallback = callback;
mCustomViewContainer.setVisibility(View.VISIBLE);
} else {
callback.onCustomViewHidden();
return;
}
}
@Override
public void onHideCustomView() {
if (mCustomView == null) {
return;
}
// Hide the custom view.
mCustomView.setVisibility(View.GONE);
// Remove the custom view from its container.
mCustomViewContainer.removeView(mCustomView);
mCustomView = null;
mCustomViewContainer.setVisibility(View.GONE);
mCustomViewCallback.onCustomViewHidden();
HTML5WebView.this.setVisibility(View.VISIBLE);
//Log.i(LOGTAG, "set it to webVew");
}
@Override
public Bitmap getDefaultVideoPoster() {
//Log.i(LOGTAG, "here in on getDefaultVideoPoster");
if (mDefaultVideoPoster == null) {
mDefaultVideoPoster = BitmapFactory.decodeResource(
getResources(), R.drawable.play);
}
return mDefaultVideoPoster;
}
@Override
public View getVideoLoadingProgressView() {
//Log.i(LOGTAG, "here in on getVideoLoadingPregressView");
if (mVideoProgressView == null) {
LayoutInflater inflater = LayoutInflater.from(mContext);
mVideoProgressView = inflater.inflate(R.layout.video_loading_progress, null);
}
return mVideoProgressView;
}
@Override
public void onReceivedTitle(WebView view, String title) {
((Activity) mContext).setTitle(title);
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
((Activity) mContext).getWindow().setFeatureInt(Window.FEATURE_PROGRESS, newProgress*100);
}
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
}
}
// static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS =
// new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}
\ No newline at end of file
...@@ -86,7 +86,7 @@ is_check_invalid_passward_limit=true ...@@ -86,7 +86,7 @@ is_check_invalid_passward_limit=true
repeat_default=true repeat_default=true
#Setting Info(設定画面のABookについての設定情報) #Setting Info(設定画面のABookについての設定情報)
version_name=1.9.401 version_name=1.0.0
release_date=2019/01/30 release_date=2019/01/30
copy_right=2016 AGENTEC Co.,Ltd. All rights reserved. copy_right=2016 AGENTEC Co.,Ltd. All rights reserved.
hope_page=http://www.agentec.jp hope_page=http://www.agentec.jp
...@@ -112,22 +112,6 @@ login_mode=2 ...@@ -112,22 +112,6 @@ login_mode=2
#login_modeが0、1の場合のアカウントパス #login_modeが0、1の場合のアカウントパス
account_path=agtcatalog account_path=agtcatalog
#Setting Menu
#アカウント
setting_menu_account=1
#ログアウト
setting_menu_logout=1
#パスワード変更
setting_menu_password_change=1
#ログ情報
setting_menu_log_info=1
#アプリ情報
setting_menu_app_info=1
#事業者 1:表示 0:非表示
setting_menu_url_path=1
#ログインID 1:表示 0:非表示
setting_menu_loginId=1
#GCM #GCM
push_message=1 push_message=1
......
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