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}")
......
......@@ -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);
//何も処理しない
}
}
}
......@@ -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>
* 正しい場合、メイン画面を表示する。
*/
......
......@@ -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