Commit 8c2bdcbe by Lee Jaebin

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

parent 68f613b8
package jp.agentec.abook.abv.bl.acms.type;
public interface LoginMode {
int NO_AUTH = 0; // 認証なし
int ID_PASS = 1; // ID、パスワード
int PATH_ID_PASS = 2; // 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 {
//abvFunctionOptions
resValue("integer", "login_mode", "${login_mode}")
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", "check_app_update", "${check_app_update}")
resValue("integer", "not_delete_all_contents", "${not_delete_all_contents}")
......
......@@ -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
protected void onUserLeaveHint() {
super.onUserLeaveHint();
......@@ -221,10 +209,6 @@ public abstract class ABVActivity extends Activity {
this.mAlertDialog.show();
}
private boolean isCurrent() {
return Thread.currentThread().equals(getMainLooper().getThread());
}
private void closeAlertDialog() {
if (mAlertDialog != null && mAlertDialog.isShowing()) {
mAlertDialog.dismiss();
......@@ -288,7 +272,7 @@ public abstract class ABVActivity extends Activity {
setFixedOrientation(false);
}
protected boolean isRotatable() {
try {
// OSの設定で回転ONで、かつ設定で回転固定にしていない場合
......@@ -505,124 +489,103 @@ public abstract class ABVActivity extends Activity {
*/
protected boolean checkValidAuthTime() {
boolean result = false;
// Logger.d("LoginTimeOutCheck","LoginTimeOutCheck");
if (requireAuthentication()) {
try {
// サービスオプションチェック
if (AbstractLogic.getLogic(ContractLogic.class).getForceLoginPeriodically()) {
long leavedAppTime = getUserPref(UserPrefKey.LEAVE_APP, -1L);
if (leavedAppTime != -1) {
Date leavedAppDate = new Date(leavedAppTime);
Date currentDate = new Date(System.currentTimeMillis());
if (currentDate.after(DateTimeUtil.add(leavedAppDate, DateUnit.Day, ABVEnvironment.LastLoginExpiryDate))) {
callLoginActivity(false, true, false);
result = true;
}
try {
// サービスオプションチェック
if (AbstractLogic.getLogic(ContractLogic.class).getForceLoginPeriodically()) {
long leavedAppTime = getUserPref(UserPrefKey.LEAVE_APP, -1L);
if (leavedAppTime != -1) {
Date leavedAppDate = new Date(leavedAppTime);
Date currentDate = new Date(System.currentTimeMillis());
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;
}
// 一定期間経過後強制ログアウトチェック
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) {
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()) {
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 (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);
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);
}
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) {
ABookAlertDialog passwordChangeDialog = AlertDialogUtil.createAlertDialog(this, title);
View passwordChangeView = null;
......@@ -766,7 +729,7 @@ public abstract class ABVActivity extends Activity {
/**
* * 画面の回転を現在の向きで固定・解除する
*
*
* @param flg
* true:回転固定 false:回転可能
*/
......@@ -790,7 +753,7 @@ public abstract class ABVActivity extends Activity {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
protected void setPortraitIfNormal() {
if(isNormalSize()){
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
......@@ -853,21 +816,6 @@ public abstract class ABVActivity extends Activity {
}, 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() {
return isVisible;
}
......@@ -912,7 +860,7 @@ public abstract class ABVActivity extends Activity {
* CMSのアドレスをロードする
*/
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();
if (acmsDto != null) {
ABVEnvironment.getInstance().acmsAddress = acmsDto.acmsAddress;
......
......@@ -116,14 +116,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
protected GroupLogic groupLogic = AbstractLogic.getLogic(GroupLogic.class);
protected MemoLogic memoLogic = AbstractLogic.getLogic(MemoLogic.class);
protected BookmarkLogic bookmarkLogic = AbstractLogic.getLogic(BookmarkLogic.class);
protected CategoryLogic categoryLogic = AbstractLogic.getLogic(CategoryLogic.class);
protected ContentDownloader contentDownloader = ContentDownloader.getInstance();
protected ContentRefresher contentRefresher = ContentRefresher.getInstance();
protected String dateFormat;
private ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用
protected ImageButton btnDownload;
......@@ -169,7 +166,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
try {
// 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合は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);
} else {
AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByMacAdress(fcmToken);
......@@ -206,9 +203,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
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
......@@ -300,19 +294,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
*/
private boolean checkPanoContent(long contentId) {
int ret = ContentViewHelper.getInstance().check360Content(contentId);
if (ret == 0) {
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;
return ret == 0 ? false : true;
}
private void contentViewActivityMoveWithContentAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) {
......@@ -326,12 +308,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
showContentMessageDialog(intent, contentId, contentDto.alertMessage, ABVNavi);
break;
case AlertMessageLevel.PASSWORD :
// 認証なしの場合、パスワードチェックは行わない
if (requireAuthentication()) {
showPasswordCheckDialog(intent, contentId, null, ABVNavi);
} else {
contentViewActivityMoveWithAccessLocationAlert(intent, contentId, NaviConsts.Right);
}
showPasswordCheckDialog(intent, contentId, null, ABVNavi);
break;
}
}
......@@ -480,21 +457,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override
public void onAuthenticationFailed() {
if (requireAuthentication()) {
handleErrorMessageToast(ErrorCode.S_E_ACMS_1403);
} 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);
}
handleErrorMessageToast(ErrorCode.S_E_ACMS_1403);
callLoginActivity(true, false, false);
}
@Override
......@@ -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 void startContentViewActivity(long contentId) {
......@@ -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);
}
/**
* 共有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) {
ErrorCode error;
......@@ -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 ヘルプ表示種類
*/
......
......@@ -96,16 +96,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected final static int ABOOK_CHECK_SELECT_SCENE = 105;
protected long contentId;// 表示中のコンテンツID
protected long linkOriginalContentId;// リンク元コンテンツのコンテンツID
protected int linkOriginalContentPageNo;// リンク元コンテンツのスタートページ
protected int siteId; // Reader サイトID
protected long objectId; // オブジェクトID(オブジェクト用のActivityのときのみ使用)
protected int objectPageNumber; // オブジェクトが配置されているページ番号(オブジェクト用のActivityのときのみ使用)
protected MeetingManager meetingManager; // 遠隔連動
protected boolean mActivityFinishFlg = false;
protected String mContentDir;
protected String contentType;
// protected String backHomeClass;
protected ABVPopupListWindow mShowedPopupWindow = null;
protected int readingLogId;
protected String path; // PanoViewController
......@@ -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();
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 {
}
super.onDestroy();
if (meetingManager.isSendable()) {
if (objectId == -1) {
// meetingManager.sendWs(MeetingManager.CMD_TOBOOKSHELF, contentId, 0, null, null);
}
else {
meetingManager.sendWs(MeetingManager.CMD_CLOSEPOPUP, contentId, objectPageNumber, objectId, null);
}
}
if (meetingManager.isSendable() && objectId != -1) {
meetingManager.sendWs(MeetingManager.CMD_CLOSEPOPUP, contentId, objectPageNumber, objectId, null);
}
if (meetingManager.isSubscribed()) {
ActivityHandlingHelper.getInstance().refreshMeetingListActivity();
}
if (objectId == -1) {
ActivityHandlingHelper.getInstance().removeContentViewActivity(this);
}
else {
} else {
ActivityHandlingHelper.getInstance().removeObjectViewActivity(this);
}
......@@ -429,11 +412,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mShowedPopupWindow.showAsDropDown(anchor);
}
// protected void exitActivity() {
// // activity終了処理
// // 各自必要な場合に実装する
// }
protected void releaseInit() {
// Activity終了時に初期化が必要な処理を作成
// 各自必要な場合に実装する
......@@ -633,7 +611,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
/**
* 戻る用コンテンツIDリストを取得
*/
public List<long[]> getReturnContentIdList () {
public List<long[]> getReturnContentIdList() {
return getABVUIDataCache().getReturnContentIdList();
}
......@@ -642,11 +620,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
*/
public void moveToBack() {
//戻る用コンテンツIDの数
int listSize = getABVUIDataCache().getReturnContentIdList().size();
int listSize = getReturnContentIdList().size();
if (listSize == 0) {
finish();
} else {
long[] contentInfo = getABVUIDataCache().getReturnContentIdList().get(listSize - 1);
long[] contentInfo = getReturnContentIdList().get(listSize - 1);
// 直前のコンテンツが360コンテンツか確認⇒画面遷移ではなくfinish()で廃棄することで戻る
if (ActivityHandlingHelper.getInstance().hasPreviousPanoContentId(contentInfo[0])) {
finish();
......@@ -656,7 +634,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (this instanceof HTMLXWalkWebViewActivity) {
return;
}
getABVUIDataCache().getReturnContentIdList().remove(listSize - 1);
getReturnContentIdList().remove(listSize - 1);
}
}
......
......@@ -151,37 +151,15 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
} catch (final NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException", e);
if (getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { // 汎用版の場合
closeProgressPopup();
handler.post(new Runnable() {
@Override
public void run() {
showErrorDialog(e);
}
});
}
else {
showErrorDialog(e);
}
showErrorDialog(e);
} catch (final Exception e) {
Logger.e(TAG, "noAuthenticatedShowMain error.", e);
if (getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { // 汎用版の場合
closeProgressPopup();
handler.post(new Runnable() {
@Override
public void run() {
showErrorDialog(e);
}
});
}
else {
runOnUiThread(new Runnable() {
@Override
public void run() {
showErrorDialog(e);
}
});
}
runOnUiThread(new Runnable() {
@Override
public void run() {
showErrorDialog(e);
}
});
}
}
......@@ -229,9 +207,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
@Override
public void onAnimationEnd(Animation animation) {
v.setVisibility(View.INVISIBLE);
if (!requireAuthentication()) { // 認証なしの場合このタイミングでプログレスを閉じる。
closeProgressPopup();
}
showMain();
}
});
......@@ -361,16 +336,12 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
final ABVEnvironment abvEnvironment = ABVEnvironment.getInstance();
AppLastVersionParameters param;
// 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する
if (!requireAuthentication() && !getUserPref(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 {
if (ABVEnvironment.getInstance().deviceIdType == Constant.DeviceIdType.MAC_ADDRESS) {
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);
}
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);
Logger.d(TAG, "Last Version=%s, Current Version=%s", version, ABVEnvironment.getInstance().appVersion);
if (version != null && version.length() > 0) {
......@@ -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対応
* @param uri
......
......@@ -106,44 +106,34 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity {
UserAuthenticateLogic logic = AbstractLogic.getLogic(UserAuthenticateLogic.class);
MemberInfoDto memberInfo = logic.getMemberInfo();
if (getRInteger(R.integer.login_mode) == LoginMode.NO_AUTH) { // Adモードの時はログイン画面を表示する
// 認証なしログインの場合
finishActivityFlag = false;
//noinspection VariableNotUsedInsideIf
if (memberInfo == null) {
noAuthenticatedLogin(false, null);
} else {
startLogoAnimation();
}
loadAddressIfSaasGeneral();
// 通常ログインの場合
if (memberInfo == null) {
// ログイン画面へ遷移する
callLoginActivity(false, false, false);
} else {
loadAddressIfSaasGeneral();
// 通常ログインの場合
if (memberInfo == null) {
// ログイン画面へ遷移する
callLoginActivity(false, false, false);
} else {
// 一定期間経過後強制ログアウトチェック
if (!checkForceOfflineLogout()) {
// 最後のログインから90日のチェック
if (!checkValidAuthTime()) {
// キャンセルした場合のイベントリスナ
OnClickListener cancelListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startLogoAnimation();
}
};
// パスワード定期変更チェック
if (checkRequiredChangePassword(cancelListener)) {
finishActivityFlag = false;
} else {
finishActivityFlag = false;
// 一定期間経過後強制ログアウトチェック
if (!checkForceOfflineLogout()) {
// 最後のログインから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();
}
}
}
}
} catch (Exception e) {
Logger.e("ABVException Login", e);
Intent intent = new Intent();
......
......@@ -123,13 +123,6 @@ public interface AppDefType {
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 {
}
@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() {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
......
package jp.agentec.abook.abv.ui.common.appinfo.options;
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ツールバー:テキストコピー
* @return 0:非表示、1:表示
......
......@@ -92,7 +92,7 @@ public class Initializer {
int logLevel = i(R.integer.log_level);
boolean isDebugMode = LogLevel.level(logLevel).level() <= LogLevel.debug.level();
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.downloadServerAddress = StringUtil.addSlashToUrlString(s(R.string.download_server_address));
env.websocketServerHttpUrl = s(R.string.websocket_server_http_url);
......@@ -106,7 +106,6 @@ public class Initializer {
env.setLogLevel(LogLevel.level(logLevel));
env.mainFolderName = s(R.string.top);
env.rootDirectory = context.getFilesDir().getPath();
// env.rootDirectory = android.os.Environment.getExternalStorageDirectory().getPath();
Logger.d(TAG, "setRootDirectory=" + env.rootDirectory);
env.networkAdapter = network;
......@@ -115,19 +114,15 @@ public class Initializer {
// 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する
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)){
env.deviceId = DeviceInfo.getDeviceUUID(context);
env.encryptKey = DeviceInfo.getEncryptKeyByUUID(context);
env.deviceIdType = Constant.DeviceIdType.UUID;
} else { // Wifiがオンになっていない場合アラートを表示できないので最初の設定はログイン前に行う。例外が発生しても無視。
try {
env.deviceId = DeviceInfo.getDeviceId(context, isDebugMode);
env.encryptKey = DeviceInfo.getEncryptKey(context, isDebugMode);
env.deviceIdType = DeviceInfo.getDeviceIdType(context, isDebugMode);
} catch (ABVException e) {
Logger.w(TAG, "getWiFiMacAddress failed. " + e.toString()); // ignore
}
// Wifiがオンになっていない場合アラートを表示できないので最初の設定はログイン前に行う。例外が発生しても無視。
try {
env.deviceId = DeviceInfo.getDeviceId(context, isDebugMode);
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.cacheDirectory = context.getCacheDir().getPath();
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 {
private void setAccountSetting() {
PreferenceGroup accountSettings = (PreferenceGroup) findPreference(ACCOUNT_SET);
if (Options.getInstance(getActivity()).getSettingMenuAccount() == 0) {
remove(accountSettings);
} else if(getResources().getInteger(R.integer.login_mode) == LoginMode.NO_AUTH||getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) {
remove(accountSettings, LOGOUT);
remove(accountSettings, PASSWORD_CHANGE);
remove(accountSettings, ACCOUNT_PATH);
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 logout = (PreferenceScreen) findPreference(LOGOUT);
logout.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showLogoutAlert();
return true;
}
});
PreferenceScreen passwordChange = (PreferenceScreen) findPreference(PASSWORD_CHANGE);
MemberInfoDto dto = ABVDataCache.getInstance().getMemberInfo();
// アカウント関連の設定
//ドトールの場合:事業者とログインID非表示
if (getResources().getInteger(R.integer.setting_menu_loginId) == 1) {
setSummary(LOGINID, dto.loginId);
} else {
remove(accountSettings, LOGINID);
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;
}
});
if (getResources().getInteger(R.integer.setting_menu_url_path) == 1) {
setSummary(ACCOUNT_PATH, AbstractLogic.getLogic(ContractLogic.class).getUrlPath());
} else {
remove(accountSettings, ACCOUNT_PATH);
}
setSummary(LAST_LOGIN, DateTimeUtil.toString(dto.lastLoginDate, DateTimeFormat.yyyyMMddHHmmss_slash));
}
MemberInfoDto dto = ABVDataCache.getInstance().getMemberInfo();
// アカウント関連の設定
//ドトールの場合:事業者とログインID非表示
setSummary(LOGINID, dto.loginId);
setSummary(ACCOUNT_PATH, AbstractLogic.getLogic(ContractLogic.class).getUrlPath());
setSummary(LAST_LOGIN, DateTimeUtil.toString(dto.lastLoginDate, DateTimeFormat.yyyyMMddHHmmss_slash));
}
private void showLogoutAlert() {
......@@ -268,12 +229,8 @@ public class ABookSettingFragment extends PreferenceFragment {
private void setLogInfoSetting() {
PreferenceGroup logInfo = (PreferenceGroup) findPreference(LOG_INFO);
if (Options.getInstance(getActivity()).getSettingMenuLogInfo() == 1) {
// ログExport
configureExportLog();
} else {
remove(logInfo);
}
// ログExport
configureExportLog();
}
private void configureExportLog() {
......@@ -294,72 +251,68 @@ public class ABookSettingFragment extends PreferenceFragment {
private void setAppInfoSetting() {
PreferenceGroup appInfo = (PreferenceGroup) findPreference(APP_INFO);
if (Options.getInstance(getActivity()).getSettingMenuAppInfo() == 1) {
// ABookについて
Preference aboutABook = findPreference(ABOUT_A_BOOK);
aboutABook.setTitle(getResources().getString(R.string.about_app));
aboutABook.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showAboutABookDialog();
return true;
}
});
// ライセンス情報
Preference licenseInfo = findPreference(LICENSE_INFO);
licenseInfo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showLicenseDialog();
return true;
}
});
// ABookについて
Preference aboutABook = findPreference(ABOUT_A_BOOK);
aboutABook.setTitle(getResources().getString(R.string.about_app));
aboutABook.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showAboutABookDialog();
return true;
}
});
// アップデート確認
Preference checkAppUpdate = findPreference(CHECK_APP_UPDATE);
if (getResources().getInteger(R.integer.check_app_update) == 1) {
checkAppUpdate.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
//パーミッションチェック
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 licenseInfo = findPreference(LICENSE_INFO);
licenseInfo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showLicenseDialog();
return true;
}
});
Preference abookCheckManual = findPreference(ABOOK_CHECK_MANUAL);
abookCheckManual.setTitle(getResources().getString(R.string.project_manual));
abookCheckManual.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
// アップデート確認
Preference checkAppUpdate = findPreference(CHECK_APP_UPDATE);
if (getResources().getInteger(R.integer.check_app_update) == 1) {
checkAppUpdate.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);
//パーミッションチェック
ABookPermissionHelper helper = new ABookPermissionHelper(getActivity(), Constant.ABookPermissionType.ReadExternalStorage, null);
if (helper.checkMultiPermissions(true)) {
showCheckAppDialog();
} else {
Logger.w(TAG, "ReadExternalStorage checkMultiPermissions false");
}
} catch (Exception e) {
Logger.e(TAG, e);
}
return true;
}
});
} 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() {
......@@ -448,15 +401,13 @@ public class ABookSettingFragment extends PreferenceFragment {
SharedPreferences pre = PreferenceUtil.getUserPreference(getActivity());
// 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合は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 {
if (ABVEnvironment.getInstance().deviceIdType == Constant.DeviceIdType.MAC_ADDRESS) {
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);
}
param = new AppLastVersionParameters(dataCache.getMemberInfo().sid, abvEnvironment.appVersion, String.valueOf(ABVEnvironment.AppId), abvEnvironment.deviceId, null);
}
Logger.d(TAG, "[showCheckAppDialog]:1");
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);
......@@ -490,7 +441,9 @@ public class ABookSettingFragment extends PreferenceFragment {
childs[0].delete();
}
request.setDestinationUri(Uri.fromFile(file));
downloadManager.enqueue(request);
if (downloadManager != null) {
downloadManager.enqueue(request);
}
getActivity().registerReceiver(new OnAppDownloadReceiver(), new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
......
......@@ -124,25 +124,11 @@ public class LoginActivity extends ABVLoginActivity {
mEdtUrlPath.setVisibility(View.GONE);
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とはセットで有無が合っている前提
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() {
@Override
......@@ -315,12 +301,6 @@ public class LoginActivity extends ABVLoginActivity {
}
if (validate()) {
if (getRInteger(R.integer.login_mode) == LoginMode.SITE_PATH) {
// Saas環境用認証なしで初回ログインの場合、任意のID&PWDを生成してサーバへ登録する
threadSaasLogin();
return;
}
boolean agree_macInfor;
agree_macInfor = getUserPref(UserPrefKey.AGREE_MACINFO, false);
// Macアドレスに既に同意している場合、ログイン
......@@ -365,20 +345,6 @@ public class LoginActivity extends ABVLoginActivity {
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;
}
......@@ -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>
* 正しい場合、メイン画面を表示する。
*/
......
......@@ -217,9 +217,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
private float mMinDistance;// Scroll移動距離チェック時の最小移動距離値
private float mScrollDistance; // 実際にスクロールかけた移動距離
// private float mDisplayScale; // iPad用としてオーサリングされた座標やサイズをAndroid用に変換するためのスケール
private int mAllPageCount = 1; // 全ページ数
private Dialog mSearchDialog; // 検索ボックス
......@@ -1275,55 +1272,50 @@ public class ContentViewActivity extends ABVContentViewActivity {
params.width = 0;
}
} else {
subMenuBtn.setVisibility(View.GONE);
}
subMenuBtn.setVisibility(View.GONE);
}
slide = (ToggleButton) mToolBar.findViewById(R.id.tbtn_slide);
if (!(isProjectPdf())) {
slide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@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);
mBtnRemoteStart = (ImageButton) mToolBar.findViewById(R.id.btn_remote_start);
tbtnMarking = (ToggleButton) mToolBar.findViewById(R.id.tbtn_marking);
if (!(isProjectPdf())) {
tbtnMarking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked) {
PreferenceUtil.put(ContentViewActivity.this, DefPrefKey.DISPLAY_MARKING, isChecked);
setMarkingViewVisibility(isChecked);
}
});
} else {
tbtnMarking.setVisibility(View.GONE);
}
if (isProjectPdf()) {
slide.setVisibility(View.GONE);
tbtnMarking.setVisibility(View.GONE);
mBtnRemoteStart.setVisibility(View.GONE);
} else {
slide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@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);
}
}
});
mBtnRemoteStart = (ImageButton) mToolBar.findViewById(R.id.btn_remote_start);
if (!(isProjectPdf())) {
mBtnRemoteStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
meetingManager.setPaused(false);
mPageNumberLayout.setVisibility(View.INVISIBLE);
configureRemote();
for (MarkingView markingView : mMarkingViewList) {
markingView.reLoad();
}
}
});
} else {
mBtnRemoteStart.setVisibility(View.GONE);
}
tbtnMarking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked) {
PreferenceUtil.put(ContentViewActivity.this, DefPrefKey.DISPLAY_MARKING, isChecked);
setMarkingViewVisibility(isChecked);
}
});
mBtnRemoteStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
meetingManager.setPaused(false);
mPageNumberLayout.setVisibility(View.INVISIBLE);
configureRemote();
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, ViewGroup.LayoutParams.WRAP_CONTENT);
......@@ -1440,14 +1432,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
private void allReset() {
stopSound();
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);
}
......@@ -1525,7 +1509,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (mProjectId != null && mProjectId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId);
}
if (isVideoMax) {
videoMaxToDefault();
} else if (isMarking) {
......@@ -1549,7 +1532,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
} else {
moveToBack();
}
}
return false;
}
......@@ -1558,16 +1540,12 @@ public class ContentViewActivity extends ABVContentViewActivity {
@Override
protected void onStop() {
Logger.d(TAG, "onStop");
// ページ別ログ
if (!DeviceInfo.isForegrdound(getApplicationContext())) {
ContentLogUtil.getInstance().pauseContentPageReadLog(contentId, mCurrentPageNumber, readingLogId);
}
if (!DeviceInfo.isForegrdound(getApplicationContext())) {
ContentLogUtil.getInstance().pauseContentPageReadLog(contentId, mCurrentPageNumber, readingLogId);
}
super.onStop();
Logger.d(TAG, "onStop");
// allReset();
// super.onViewerStop(mContentId); 確認?
}
@Override
......@@ -3016,10 +2994,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
Logger.e(TAG, "[OutOfMemoryError]", e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.OUT_OF_MEMORY, Toast.LENGTH_SHORT);
}
//noinspection deprecation(API16から非推奨になった。無視)
imgButton.setBackgroundDrawable(bitmapDrawable); //半透明表示
// imgButton.setImageURI(Uri.parse(imagefile)); //Image File
// imgButton.setImageDrawable(bitmapDrawable);
contentPageView.addView(imgButton, param);
// Target抽出(TargetIDを基に差し替えイメージをチェック)
......@@ -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) {
if (!playTapSoundFlg || !preSoundFilePath.equals(soundFilePath)) {
......@@ -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画面表示
* @param pageNumber
......@@ -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
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Uri[] result = null;
......@@ -3792,7 +3731,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
mUploadMessage.onReceiveValue(result);
break;
}
mUploadMessage = null;
}
......@@ -3940,10 +3878,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
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);
if (pageText != null) {
String pageText1 = pageText.replaceAll("(\r\n|\n)", "<br />");
......@@ -4213,21 +4147,11 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
else if (obj instanceof FullVideoView) { // 全画面動画の場合
performRemoteFullVideo((FullVideoView)obj, type, playTime);
// View targetView = objectIdButtonMap.get(remoteObjectId);
// 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 {
} else {
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);
if (alpha != null) {
enqueteLayout.setAlpha((int) (alpha * 255));
......@@ -4252,18 +4176,14 @@ public class ContentViewActivity extends ABVContentViewActivity {
enqueteLayout.left();
}
}
}
else if (cmd.equals(MeetingManager.CMD_MARKING)) { // マーキング描画
} else if (cmd.equals(MeetingManager.CMD_MARKING)) { // マーキング描画
peformRemoteMarking(json);
}
else if (cmd.equals(MeetingManager.CMD_CLOSEPOPUP)) { // 各種閉じる
} else if (cmd.equals(MeetingManager.CMD_CLOSEPOPUP)) { // 各種閉じる
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);
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 y = JsonUtil.getFloat(json, MeetingManager.Y);
if (x != null && y != null) {
......@@ -4282,8 +4202,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
matrix.postTranslate(x * zoomLayout.getAuthoringScale() + margin.left, y * zoomLayout.getAuthoringScale() + margin.top);
zoomLayout.setZoomMatrix(matrix);
}
}
else {
} else {
Logger.e(TAG, "Not Implemented Command. " + cmd);
}
}
......@@ -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
public int getCurrentPageNumber() {
return mCurrentPageNumber;
......@@ -5030,20 +4938,25 @@ public class ContentViewActivity extends ABVContentViewActivity {
projectTaskLayout.taskWebViewLoadUrl(url);
}
@Override
/**
* PDFプロジェクトのアクション制御メソッド
* @param checkParam
* @param projectTaskDto
*/
@Override
protected void onActionProjectPdfWebView(final Map<String, String> checkParam, ProjectTaskDto projectTaskDto) {
String cmd = checkParam.get(ABookKeys.CMD);
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
case ABookKeys.CMD_INSERT_TASK_REPORT:
case ABookKeys.CMD_UPDATE_TASK_REPORT:
case ABookKeys.CMD_DELETE_TASK_REPORT:
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS: // 作業指示の登録
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS: // 作業指示の更新
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS: // 作業指示の削除
case ABookKeys.CMD_INSERT_TASK_REPORT: // 作業報告の登録
case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新
case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除
getTaskHotspotJSON();
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS:
case ABookKeys.CMD_CANCEL_TASK_REPORT:
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS: // 作業指示のキャンセル
case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル
if(projectTaskDto != null) {
updateProjectTaskPosition(projectTaskDto.pdfX, projectTaskDto.pdfY);
}
......@@ -5095,6 +5008,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
return projectTaskLayout.convertToAuthoringPoint(x, y);
}
// 作業のホットスポットJSONを取得
private void getTaskHotspotJSON() {
try {
String contentPath = ABVEnvironment.getInstance().getTaskPdfDirName(ContentFileExtractor.getInstance().getContentCacheDirWithExtract(projectDto.contentId));
......
......@@ -2,7 +2,6 @@ package jp.agentec.abook.abv.ui.viewer.activity;
import java.sql.Timestamp;
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.common.ABVEnvironment;
......@@ -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.EnqueteDto;
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.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.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.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.DateTimeUtil;
import org.itri.html5webview.HTML5WebView;
import android.content.Intent;
import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
......@@ -53,7 +45,6 @@ import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
......@@ -79,12 +70,12 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
private ImageButton downloadButton;
private int objectLogId;
private boolean isPageFinished;
private boolean mPageFinishedFlg;
private WebView webView;
private Double latitude;
private Double longitude;
private Double mLatitude;
private Double mLongitude;
private JsInf jsInf = new JsInf();
private boolean pageStart;
......@@ -438,8 +429,8 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
@Override
public void onClick(View v) {
Logger.d(TAG, "ReloadUrl");
if (latitude != null && longitude != null) {
webView.loadUrl(url + "&reload=true&latitude=" + latitude + "&longitude=" + longitude);
if (mLatitude != null && mLongitude != null) {
webView.loadUrl(url + "&reload=true&mLatitude=" + mLatitude + "&mLongitude=" + mLongitude);
}
else {
webView.loadUrl(url + "&reload=true");
......@@ -552,7 +543,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
public void existSetLocation(String ret) {
Logger.d(TAG, "existSetLocation=%s", ret);
if (ret != null && ret.equals("true")) { // setLocationメソッドが存在する場合、ページ読み込み完了とみなす
isPageFinished = true;
mPageFinishedFlg = true;
}
else { // 存在しない場合、ページ読み込み未完了とみなし1秒後に再度呼出しを繰り返す
handler.postDelayed(new Runnable() {
......@@ -597,7 +588,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
if (isPageFinished) {
if (mPageFinishedFlg) {
break;
}
try {
......
package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.Intent;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
......@@ -21,7 +20,6 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.Toast;
......@@ -30,7 +28,6 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.itri.html5webview.HTML5WebView;
import java.io.IOException;
import java.util.ArrayList;
......@@ -75,7 +72,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
private int objectLogId;
private WebView webView;
private HTML5WebView html5WebView;
private JsInf jsInf = new JsInf();
private ValueCallback<Uri[]> mUploadMessage;
@Override
......
......@@ -18,7 +18,6 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.Toast;
import org.itri.html5webview.HTML5WebView;
import org.xwalk.core.XWalkNavigationHistory;
import org.xwalk.core.XWalkResourceClient;
import org.xwalk.core.XWalkSettings;
......@@ -69,9 +68,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
private ImageButton reloadButton;
private ImageButton downloadButton;
private int objectLogId;
private XWalkView webView;
private HTML5WebView html5WebView;
private HTMLXWalkWebViewActivity.JsInf jsInf = new HTMLXWalkWebViewActivity.JsInf();
......
......@@ -46,8 +46,6 @@ import jp.agentec.adf.util.FileUtil;
public class ParentWebViewActivity extends ABVContentViewActivity {
private static final String TAG = "ParentWebViewActivity";
protected ABVUIActivity mUIActivity;
private LinearLayout historyLayout;
private ImageButton addSceneButton;
......@@ -62,10 +60,6 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
protected Button btnWebForward;
private ProgressBar m_progress;
private Double reportLatitude;
private Double reportLongitude;
protected void commonOnCreate() {
historyLayout = (LinearLayout) findViewById(R.id.historyLayout);
addSceneButton = (ImageButton) findViewById(R.id.btn_add_scene);
......@@ -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) {
if (uri.contains("vtour") || uri.contains("authByCheck")) {
if(statusCode >= 400) {
......
......@@ -104,10 +104,8 @@ public class PreviewActivity extends ABVContentViewActivity {
mFlipperLayout[i].setGravity(Gravity.CENTER);
LinearLayout.LayoutParams paramFlipperLayout = new LinearLayout.LayoutParams(matchParent, matchParent);
mViewFlipper.addView(mFlipperLayout[i], paramFlipperLayout);
// float tmpDensity = getResources().getDisplayMetrics().density;
// 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);
LinearLayout.LayoutParams paramThumbnail = new LinearLayout.LayoutParams(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);
mLayoutThumbnail.addView(imgBtn[i], paramThumbnail);
setBtnClick(imgBtn[i], i);
}
......@@ -231,7 +229,6 @@ public class PreviewActivity extends ABVContentViewActivity {
flipperImageView.setScaleType(ScaleType.FIT_CENTER); //CENTER_INSIDE
flipperImageView.setAdjustViewBounds(true);
flipperImageView.setImageURI(Uri.parse(mFilePath[index]));
// int WC = LinearLayout.LayoutParams.WRAP_CONTENT;
int MP = ViewGroup.LayoutParams.MATCH_PARENT;
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(MP, MP);
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
repeat_default=true
#Setting Info(設定画面のABookについての設定情報)
version_name=1.9.401
version_name=1.0.0
release_date=2019/01/30
copy_right=2016 AGENTEC Co.,Ltd. All rights reserved.
hope_page=http://www.agentec.jp
......@@ -112,22 +112,6 @@ login_mode=2
#login_modeが0、1の場合のアカウントパス
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
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