Commit 1e0ec13b by Lee Jaebin

ソース分離(ABookCheckフラグ削除、バックアップ・リストア機能削除、必要ない設定項目削除)

parent 60051bac
......@@ -231,10 +231,6 @@ public class ABVEnvironment {
return logLevel;
}
public boolean isABookCheck() {
return editionType == Constant.editionType.CHECK;
}
///////////////////////////////////////     以下ファイルパス関係     ///////////////////////////////////////
......
......@@ -144,8 +144,4 @@ public class Constant {
int Camera = 2;
int Audio =3;
}
public interface editionType {
int CHECK = 5;
}
}
......@@ -356,10 +356,6 @@ public class ABVDataCache {
return !isServiceOptionEnable(ServiceOptionId.CatalogEdition) && !isServiceOptionEnable(ServiceOptionId.Publisher);
}
public boolean isABookCheck() {
return isServiceOptionEnable(ServiceOptionId.ABookCheck);
}
public boolean isReportGPS() {
return isServiceOptionEnable(ServiceOptionId.REPORT_GPS);
}
......
......@@ -98,7 +98,6 @@ public class ABVDataOpenHelper {
iTableScripts.add(new TEnquete());
iTableScripts.add(new TSubscriptionHistory());
if (ABVEnvironment.getInstance().isABookCheck()) {
iTableScripts.add(new MWorkerGroup());
iTableScripts.add(new TProject());
iTableScripts.add(new RProjectContent());
......@@ -110,7 +109,7 @@ public class ABVDataOpenHelper {
iTableScripts.add(new TTaskReportItems());
iTableScripts.add(new TPushMessage());
iTableScripts.add(new TInspectTaskReport());
}
return iTableScripts;
}
......
......@@ -744,9 +744,7 @@ public class ContentDao extends AbstractDao {
delete("r_content_category", "content_id=?", keyValues);
delete("r_content_group", "content_id=?", keyValues);
delete("t_interactive_info", "dst_content_id=?", keyValues);
if (ABVEnvironment.getInstance().isABookCheck()) {
delete("r_project_content", "content_id=?", keyValues);
}
delete("t_content", "content_id=?", keyValues);
} else {
// 削除したコンテンツは自動ダウンロード禁止フラグをtrueにする
......
......@@ -101,10 +101,9 @@ public class ContentFileExtractor {
extractResourceZipFile(contentId, contentPath, contentDir);
doContentResourceFile(contentId, contentDir);
if (contentDto.isPanoImage() || ABVDataCache.getInstance().serviceOption.isABookCheck()) { // pano imageの場合キャッシュに解凍
String cacheDir = getContentCacheDirWithExtract(contentId);
Logger.i(TAG, "extract content files to cache dir. contentId=%s, cacheDir=%s", contentId, cacheDir);
}
}
private void extractResourceZipFile(long contentId, String contentPath, File contentDir) throws ZipException, NoSuchAlgorithmException, IOException, ABVException {
......@@ -121,7 +120,6 @@ public class ContentFileExtractor {
}
};
if (ABVDataCache.getInstance().serviceOption.isABookCheck()) {
File panoImageFile = new File(ABVEnvironment.getInstance().getPanoImageName(contentPath));
//存在チェック
if (panoImageFile.exists()) {
......@@ -132,7 +130,7 @@ public class ContentFileExtractor {
File[] zipFiles = panoImageDir.listFiles(fileFilter);
if (zipFiles != null) {
for(File zipFile : zipFiles) {
for (File zipFile : zipFiles) {
String folderPath = zipFile.getPath().replace(".zip", "");
extractZipFile(contentId, zipFile.getPath(), folderPath);
}
......@@ -150,7 +148,7 @@ public class ContentFileExtractor {
File[] zipFiles = panoImageDir.listFiles(fileFilter);
if (zipFiles != null) {
for(File zipFile : zipFiles) {
for (File zipFile : zipFiles) {
String folderPath = zipFile.getPath().replace(".zip", "");
extractZipFile(contentId, zipFile.getPath(), folderPath);
}
......@@ -167,13 +165,13 @@ public class ContentFileExtractor {
File[] zipFiles = taskListDir.listFiles(fileFilter);
if (zipFiles != null) {
for(File zipFile : zipFiles) {
for (File zipFile : zipFiles) {
String folderPath = zipFile.getPath().replace(".zip", "");
extractZipFile(contentId, zipFile.getPath(), folderPath);
}
}
}
}
// それ以外のzip
ContentDto contentDto = contentDao.getContent(contentId);
......
......@@ -374,7 +374,6 @@ public class ContentRefresher {
}
if (contentDownloadListener != null) {
if (ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
if (!isRefreshing() && e == null) {
// 新着処理が終わったら以下の処理が実行
try {
......@@ -385,7 +384,6 @@ public class ContentRefresher {
e = e1;
}
}
}
contentDownloadListener.onRefreshedContent(e == null, contentId, e);
}
}
......
package jp.agentec.abook.abv.bl.logic;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Calendar;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.GetBackupFileListJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetBackupFileParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UploadBackupFileParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Constant.BackupFileName;
import jp.agentec.abook.abv.bl.common.Constant.BackupFileType;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentMemoDao;
import jp.agentec.abook.abv.bl.dto.ContentMemoDto;
import jp.agentec.adf.util.FileUtil;
import org.json.adf.JSONObject;
public class BackupRestoreLogic extends AbstractLogic {
private static final String TAG = "BackupRestoreLogic";
private ContentMemoDao contentMemoDao = AbstractDao.getDao(ContentMemoDao.class);
public GetBackupFileListJSON getBackupFileList() throws AcmsException, NetworkDisconnectedException {
AcmsClient acms = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
AcmsParameters BFparam = new AcmsParameters(cache.getMemberInfo().sid);
return acms.getBackupFileList(BFparam);
}
public boolean getBackupFile(String fileType) throws MalformedURLException {
boolean result;
AcmsClient acms;
String path = ABVEnvironment.getInstance().getBackupFileDirectoryPath();
File pathDirectory = new File(path);
if (!pathDirectory.exists()) {
pathDirectory.mkdir();
}
acms = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
GetBackupFileParameters BFparam= new GetBackupFileParameters(cache.getMemberInfo().sid, fileType);
if (fileType.equals(BackupFileType.Memo)) {
path = path + "/" + BackupFileName.Memo;
}else if (fileType.equals(BackupFileType.Marking)) {
path = path + "/" + BackupFileName.Marking;
}else if (fileType.equals(BackupFileType.Bookmark)) {
path = path + "/" + BackupFileName.Bookmark;
}
File checkFile = new File(path);
if (checkFile.exists()) {
checkFile.delete();
}
result = acms.getBackupFile(BFparam,path);
return result;
}
public boolean uploadBackupFile(File fileList) throws AcmsException, NetworkDisconnectedException, IOException{
AcmsClient acms = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
UploadBackupFileParameters UBparam= new UploadBackupFileParameters(cache.getMemberInfo().sid, fileList);
String list = acms.uploadBackupFile(UBparam);
return list.equals("success");
}
public String notifyBackupStart(String fileType) throws AcmsException, NetworkDisconnectedException{
AcmsClient acms = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
GetBackupFileParameters nbp = new GetBackupFileParameters(cache.getMemberInfo().sid, fileType);
return acms.notifyBackupStart(nbp);
}
public String notifyBackupFinish(String fileType) throws AcmsException, NetworkDisconnectedException{
AcmsClient acms = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
GetBackupFileParameters nbp = new GetBackupFileParameters(cache.getMemberInfo().sid, fileType);
return acms.notifyBackupFinish(nbp);
}
public boolean[] isRestoreItem(GetBackupFileListJSON json) {
boolean[] restoreItem = new boolean[3];
if (json.fileList == null) {
return restoreItem;
}
for (int i=0; i<json.fileList.length(); i++) {
JSONObject jitem = (JSONObject)json.fileList.get(i);
String fileName = jitem.getString("filename");
if (fileName.equals(BackupFileName.Memo)) {
restoreItem[0] = true;
}else if (fileName.equals(BackupFileName.Marking)) {
restoreItem[1] = true;
}else if (fileName.equals(BackupFileName.Bookmark)) {
restoreItem[2] = true;
}
}
return restoreItem;
}
public void deleteBackupFile() {
String path = ABVEnvironment.getInstance().getBackupFileDirectoryPath();
File dir = new File(path);
if (dir.exists()) {
File[] files = dir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
files[i].delete();
}
}
}
}
public void restoreMemo(ContentMemoDto dto) {
contentMemoDao.restoreMemo(dto);
}
public void setBackupRestoreTime(String type, int type2) {
//type : 백업/복구
//type2 : 1=완료 2=부분완료
String path= ABVEnvironment.getInstance().getBackupTimeDirectoryPath()+"/time";
File pathDirectory = new File(path);
if (!pathDirectory.exists()) {
pathDirectory.mkdir();
}
String backupTimepath = path + "/backupTime.txt";
String restoreTimepath = path + "/restoreTime.txt";
String backupTimepath2 = path + "/backupTime2.txt";
String restoreTimepath2 = path + "/restoreTime2.txt";
String time;
Calendar cal = Calendar.getInstance();
String dateToString;
String timeToString;
dateToString = String.format("%04d/%02d/%02d", cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH));
timeToString = String.format("%02d:%02d", cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE));
time = dateToString + " " + timeToString;
String timeType;
if (type2==1) {
timeType = BackupFileType.Memo;
}else{
timeType = BackupFileType.Marking;
}
File file = null;
File file2 = null;
if (type.equals("backup")) {
file = new File(backupTimepath);
file2= new File(backupTimepath2);
} else if (type.equals("restore")) {
file = new File(restoreTimepath);
file2= new File(restoreTimepath2);
}
FileWriter filewriter = null;
try {
if (file != null) {
filewriter = new FileWriter(file);
filewriter.write(time);
filewriter.flush();
filewriter.close();
filewriter = new FileWriter(file2);
filewriter.write(timeType);
}
} catch (Exception e) {
Logger.e(TAG, e.toString()); // FIXME: 例外処理
} finally {
if (filewriter != null) {
try {
filewriter.flush();
filewriter.close();
} catch (Exception e) {
}
}
}
}
public ArrayList<String> getBackupRestoreTime(String type) throws IOException{
String path = ABVEnvironment.getInstance().getBackupTimeDirectoryPath()+"/time";
String backupTimePath = path + "/backupTime.txt";
String restoreTimePath = path + "/restoreTime.txt";
String backupTimePath2 = path + "/backupTime2.txt";
String restoreTimePath2 = path + "/restoreTime2.txt";
File file;
File file2;
String time;
String time2;
if (type.equals("backup")) {
file = new File(backupTimePath);
file2= new File(backupTimePath2);
} else {
file = new File(restoreTimePath);
file2= new File(restoreTimePath2);
}
time = FileUtil.readTextFile(file.getPath());
time2 = FileUtil.readTextFile(file2.getPath());
ArrayList<String> returnTime = new ArrayList<String>();
returnTime.add(time);
returnTime.add(time2);
return returnTime;
}
public void deleteBackupRestoreTime() {
String path = ABVEnvironment.getInstance().getBackupTimeDirectoryPath()+"/time";
File dir = new File(path);
if (dir.exists()) {
File[] files = dir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
files[i].delete();
}
}
}
}
}
......@@ -57,15 +57,9 @@ android {
resValue("integer", "login_mode", "${login_mode}")
resValue("string", "account_path", "${account_path}")
resValue("integer", "location_mode", "${location_mode}")
resValue("integer", "view_mode_type", "${view_mode_type}")
resValue("integer", "filer_favorite", "${filer_favorite}")
resValue("integer", "filer_content_type", "${filer_content_type}")
resValue("integer", "setting_menu_general", "${setting_menu_general}")
resValue("integer", "setting_menu_viewer", "${setting_menu_viewer}")
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_backup", "${setting_menu_backup}")
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}")
......@@ -74,9 +68,6 @@ android {
resValue("integer", "viewer_menu_history", "${viewer_menu_history}")
resValue("integer", "viewer_menu_index", "${viewer_menu_index}")
resValue("integer", "viewer_menu_search", "${viewer_menu_search}")
resValue("integer", "viewer_menu_share", "${viewer_menu_share}")
resValue("integer", "viewer_menu_pdf_send_mail", "${viewer_menu_pdf_send_mail}")
resValue("integer", "viewer_menu_cursor", "${viewer_menu_cursor}")
resValue("integer", "viewer_menu_memo", "${viewer_menu_memo}")
resValue("integer", "viewer_menu_marking", "${viewer_menu_marking}")
resValue("integer", "viewer_menu_bookmark", "${viewer_menu_bookmark}")
......
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="@string/general_settings" android:key="general_settings" >
<CheckBoxPreference
android:defaultValue="true"
android:key="wifiAlertEnable"
android:summary="@string/wifi_alert_summary"
android:title="@string/wifi_alert" />
<CheckBoxPreference
android:defaultValue="false"
android:key="permissionAccessLocation"
android:summary="@string/location_info_summary"
android:title="@string/location_info" />
<CheckBoxPreference
android:defaultValue="false"
android:key="autoDownload"
android:summary="@string/auto_download_summary"
android:title="@string/auto_download" />
<ListPreference
android:defaultValue="0"
android:key="tapActionOnUpdate"
android:summary="@string/tap_action_on_update_summary"
android:title="@string/tap_action_on_update"
android:dialogTitle="@string/tap_action_on_update"
android:entries="@array/tap_action_on_update"
android:entryValues="@array/tap_action_on_update_values" />
<ListPreference
android:defaultValue="2"
android:key="tapActionOnDeliverySelect"
android:summary="@string/tap_action_on_delivery_select_summary"
android:title="@string/tap_action_on_delivery_select"
android:dialogTitle="@string/tap_action_on_delivery_select"
android:entries="@array/tap_action_on_delivery_select"
android:entryValues="@array/tap_action_on_delivery_select_values" />
<PreferenceScreen
android:key="pushMessage"
android:title="@string/push_message_setting" >
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/viewer_setting" android:key="viewer_setting" >
<CheckBoxPreference
android:defaultValue="@bool/repeat_default"
android:key="repeatablePlay"
android:summary="@string/repeat_summary"
android:title="@string/repeat" />
<CheckBoxPreference
android:defaultValue="false"
android:key="cursorEnable"
android:summary="@string/cursor_summary"
android:title="@string/cursor" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/meetingroom_setting" android:key="meetingroom_setting" >
<CheckBoxPreference
android:defaultValue="false"
android:key="chairmanMarkingShareFlag"
android:summary="@string/chairman_marking_share_summary"
android:title="@string/chairman_marking_share" />
<CheckBoxPreference
android:defaultValue="false"
android:key="meetingMarkingAutoSaveFlag"
android:summary="@string/marking_share_auto_save_summary"
android:title="@string/marking_share_auto_save" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/account" android:key="account_set">
<PreferenceScreen
android:key="accountPath"
......@@ -89,22 +28,6 @@
android:title="@string/logout" >
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/data_mgt" android:key="data_set">
<PreferenceScreen
android:key="backup"
android:summary="@string/last_operation_date_default"
android:title="@string/backup" >
</PreferenceScreen>
<PreferenceScreen
android:key="restore"
android:summary="@string/last_operation_date_default"
android:title="@string/restore" >
</PreferenceScreen>
<PreferenceScreen
android:key="restore_purchase_history"
android:title="@string/restore_purchase_history" >
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/log_info" android:key="log_info">
<CheckBoxPreference
android:defaultValue="true"
......
package jp.agentec.abook.abv.cl.helper;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Constant.BackupFileName;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.ContentMarkingDao;
import jp.agentec.abook.abv.bl.data.dao.ContentMemoDao;
import jp.agentec.abook.abv.bl.dto.ContentBookmarkDto;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentMarkingDto;
import jp.agentec.abook.abv.bl.dto.ContentMemoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.BackupRestoreLogic;
import jp.agentec.abook.abv.bl.logic.BookmarkLogic;
import jp.agentec.abook.abv.bl.logic.MarkingLogic;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
/**
* 백업 파일 작업을 하는 클래스입니다.
*
* @author chae
*
*/
public class BackupFileHelper {
private static final String TAG = "BackupFileHelper";
private SimpleDateFormat sdf;
private BackupRestoreLogic backupRestoreLogic;
private BookmarkLogic bookmarkLogic;
private ContentDao contentDao;
private ContentMarkingDao contentMarkingDao;
private ContentMemoDao contentMemoDao;
@SuppressLint("SimpleDateFormat")
public BackupFileHelper() {
sdf = new SimpleDateFormat(DateTimeFormat.yyyyMMddHHmmssSSS_TZ);
backupRestoreLogic = AbstractLogic.getLogic(BackupRestoreLogic.class);
bookmarkLogic = AbstractLogic.getLogic(BookmarkLogic.class);
contentDao = AbstractDao.getDao(ContentDao.class);
contentMemoDao = AbstractDao.getDao(ContentMemoDao.class);
contentMarkingDao = AbstractDao.getDao(ContentMarkingDao.class);
}
public int backupFileGenerate(boolean backupList[]) {
//backupList> 0:메모, 1:마킹, 2: 북마크
int backupCount = 0;
try {
String path = ABVEnvironment.getInstance().getBackupFileDirectoryPath();
//메모 백업 파일 생성
if (backupList[0]) {
List<ContentMemoDto> memoList = contentMemoDao.getAllMemoList();
JSONObject memoJson = makeJsonMemo(memoList);
Logger.d(TAG, "메모 리스트 값 확인 : %s", memoList);
makeJsonFile(memoJson, path, BackupFileName.Memo);
backupCount += 1;
}
//마킹 백업 파일 생성
if (backupList[1]) {
List<ContentMarkingDto> markingList = contentMarkingDao.getAllMarkingList();
JSONObject markingJson = makeJsonMarking(markingList);
Logger.d(TAG, "마킹 리스트 값 확인 : %s", markingList);
makeJsonFile(markingJson, path, BackupFileName.Marking);
backupCount += 1;
}
//북마크 백업 파일 생성
if (backupList[2]) {
List<ContentBookmarkDto> bookmarkList = bookmarkLogic.getContentBookmark();
JSONObject bookmarkJson = makeJsonBookmark(bookmarkList);
makeJsonFile(bookmarkJson, path, BackupFileName.Bookmark);
backupCount += 1;
}
} catch (Exception e) {
Logger.e(TAG, e.toString());
}
return backupCount;
}
private File makeJsonFile(JSONObject json_obj, String path, String fileName) throws IOException {
File file = new File(path, fileName);
Logger.d(TAG, "백업 경로 : %s", file);
FileWriter fileWriter;
fileWriter = new FileWriter(file);
fileWriter.write(json_obj.toString());
Logger.d(TAG, "백업 파일 %s", fileWriter);
try {
fileWriter.flush();
fileWriter.close();
} catch (Exception e) {
Logger.e(TAG, e.toString());
}
return file;
}
private JSONObject makeJsonMemo(List<ContentMemoDto> memoList) {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObj = new JSONObject();
for (ContentMemoDto memo : memoList) {
JSONObject json = new JSONObject();
json.put("contentid", memo.contentId);
json.put("memoid", memo.memoId);
json.put("pageNo", memo.pageNum + 1);
json.put("posX", memo.axisX);
json.put("posY", memo.axisY);
json.put("Text", memo.memo);
json.put("registerDate", sdf.format(memo.updateDate));
jsonArray.put(json);
}
jsonObj.put("type", "1");
jsonObj.put("data", jsonArray);
return jsonObj;
}
private JSONObject makeJsonMarking(List<ContentMarkingDto> markingList) {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObj = new JSONObject();
for (ContentMarkingDto marking : markingList) {
String markingPath = AbstractLogic.getLogic(MarkingLogic.class).getMarkingFilePath(marking.contentId, marking.fileName);
String encodeString = encodeToBase64(markingPath);
JSONObject json = new JSONObject();
json.put("contentid", marking.contentId);
json.put("markingid", marking.markingId);
json.put("pageNo", marking.pageNum + 1);
json.put("content", encodeString);
json.put("registerDate", sdf.format(marking.updateDate));
jsonArray.put(json);
}
jsonObj.put("data", jsonArray);
jsonObj.put("type", "2");
return jsonObj;
}
private JSONObject makeJsonBookmark(List<ContentBookmarkDto> bookmarkList) {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObj = new JSONObject();
for (int i = 0; i < bookmarkList.size(); i++) {
ContentDto dto = contentDao.getContent(bookmarkList.get(i).contentId);
JSONObject json = new JSONObject();
json.put("contentid", bookmarkList.get(i).contentId);
json.put("pageNo", bookmarkList.get(i).pageNum + 1);
json.put("contentTitle", bookmarkList.get(i).contentName);
json.put("contentTitleKana", dto.contentNameKana);
json.put("registerDate", sdf.format(bookmarkList.get(i).updateDate));
jsonArray.put(json);
}
jsonObj.put("type", "3");
jsonObj.put("data", jsonArray);
return jsonObj;
}
public String encodeToBase64(String imagePath) {
String imageString = "data:image/png;base64,";
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
byte[] b = baos.toByteArray();
imageString += Base64.encodeToString(b, Base64.NO_WRAP);
try {
baos.close();
} catch (Exception e) {
}
return imageString;
}
public boolean restoreBackupFile(int fileType, String fileName) {
String path = ABVEnvironment.getInstance().getBackupFileDirectoryPath();
File file = new File(path, fileName);
//메모 : 1, 마킹 : 2, 북마크 4
Logger.d(TAG, "복원할 파일 타입 : %s", fileType);
Logger.d(TAG, "복원할 파일 패스 : %s", file.getPath());
try {
String jString = FileUtil.readTextFile(file.getPath());
JSONObject jobject = new JSONObject(jString);
JSONArray jarray = jobject.getJSONArray("data");
if (fileType == 1) {
restoreMemo(jarray);
} else if (fileType == 2) {
restoreMarking(jarray);
} else if (fileType == 4) {
restoreBookmark(jarray);
}
} catch (Exception e) {
Logger.e(TAG, e.toString());
return false;
}
return true;
}
private void restoreMemo(JSONArray jarray) {
//메모 복원
//복원할 메모 복원 유무 확인 후 리스트 생성
for (int i = 0; i < jarray.length(); i++) {
JSONObject jItem = (JSONObject) jarray.get(i);
Long contentId = jItem.getLong("contentid");
ContentDto contentDto = contentDao.getContent(contentId);
// 存在しないコンテンツまたはダウンロード済みでないコンテンツはリストアしない
if (contentDto == null || !contentDto.downloadedFlg) {
continue;
}
ContentMemoDto memoDto = new ContentMemoDto();
memoDto.contentId = contentId;
memoDto.pageNum = jItem.getInt("pageNo") - 1;
memoDto.axisX = jItem.getInt("posX");
memoDto.axisY = jItem.getInt("posY");
memoDto.memo = jItem.getString("Text");
memoDto.memoId = jItem.getString("memoid");
memoDto.updateDate = DateTimeUtil.toDate(jItem.getString("registerDate"), "UTC", DateTimeFormat.yyyyMMddHHmmssSSS_TZ);
backupRestoreLogic.restoreMemo(memoDto);
}
}
private void restoreMarking(JSONArray jarray) throws IOException {
//마킹 복원
for (int i = 0; i < jarray.length(); i++) {
JSONObject jItem = (JSONObject) jarray.get(i);
Long contentId = jItem.getLong("contentid");
ContentDto contentDto = contentDao.getContent(contentId);
// 存在しないコンテンツまたはダウンロード済みでないコンテンツはリストアしない
if (contentDto == null || !contentDto.downloadedFlg) {
continue;
}
ContentMarkingDto markingDto = new ContentMarkingDto();
markingDto.contentId = contentId;
markingDto.pageNum = jItem.getInt("pageNo") - 1;
markingDto.markingId = jItem.getString("markingid");
markingDto.fileName = markingDto.pageNum + ".png";
Date registerDate = DateTimeUtil.toDate(jItem.getString("registerDate"), "UTC", DateTimeFormat.yyyyMMddHHmmssSSS_TZ);
markingDto.updateDate = registerDate;
String imageString = jItem.getString("content");
ContentMarkingDto checkDto = contentMarkingDao.getMarking(markingDto.contentId, markingDto.pageNum);
String outputPath = ABVEnvironment.getInstance().getContentMarkingDirectory(markingDto.contentId, false).getAbsolutePath() + "/" + markingDto.fileName;
if (checkDto != null) {
// マーキング対象の修正日付がローカルの日付より最新の場合にのみ上書きする
Logger.v(TAG, "[restoreBackupFile]registerDate=" + registerDate);
Logger.v(TAG, "[restoreBackupFile]checkDto.updateDate=" + checkDto.updateDate);
if (checkDto.updateDate.before(registerDate)) {
contentMarkingDao.updateMarking(markingDto);
decodeToImage(imageString, outputPath);
}
} else {
decodeToImage(imageString, outputPath);
markingDto.insertDate = registerDate;
contentMarkingDao.insertMarking(markingDto);
}
}
}
private void decodeToImage(String imageString, String outputPath) throws IOException {
FileUtil.delete(outputPath);
String imageString2 = imageString.replace("data:image/png;base64,", "");
byte[] decodedByte = Base64.decode(imageString2, 0);
FileOutputStream fos;
fos = new FileOutputStream(outputPath);
fos.write(decodedByte);
try {
fos.close();
} catch (Exception e) {
Logger.e(TAG, e.toString());
}
}
private void restoreBookmark(JSONArray jarray) {
//북마크 복원
for (int i = 0; i < jarray.length(); i++) {
JSONObject jItem = (JSONObject) jarray.get(i);
Long contentId = jItem.getLong("contentid");
ContentDto contentDto = contentDao.getContent(contentId);
// 存在しないコンテンツまたはダウンロード済みでないコンテンツはリストアしない
if (contentDto == null || !contentDto.downloadedFlg) {
continue;
}
ContentBookmarkDto bookmarkDto = new ContentBookmarkDto();
bookmarkDto.contentId = contentId;
bookmarkDto.pageNum = jItem.getInt("pageNo") - 1;
bookmarkDto.contentName = jItem.getString("contentTitle");
if (!bookmarkLogic.isExsitContentBookmark(bookmarkDto.contentId, bookmarkDto.pageNum)) {
bookmarkLogic.insertContentBookmark(bookmarkDto);
}
}
}
}
......@@ -47,11 +47,9 @@ public class ABVApplication extends MultiDexApplication {
exceptionHandler.init(this);
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
if (ABVEnvironment.getInstance().isABookCheck()) {
//添付ファイル臨時保存場所削除
FileUtil.delete(ABVEnvironment.getInstance().getCacheTempAttachedImageDirPath());
}
}
@Override
public void onTerminate() { // 呼ばれることはないので意味がないが
......
......@@ -158,7 +158,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
isLinkedContent = intent.getBooleanExtra("isLinkedContent", false);
mProjectId = intent.getLongExtra(ABookKeys.PROJECT_ID, -1);
if (ABVEnvironment.getInstance().isABookCheck() && !isLinkedContent) {
if (!isLinkedContent) {
projectDto = AbstractLogic.getLogic(ProjectLogic.class).getProject(mProjectId);
mXWalkOpenType = intent.getIntExtra(Constant.ABookCheck.XWALK_OPEN_TYPE, -1);
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
......@@ -222,11 +222,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
showUpdateContentAlert(contentId);
}
protected boolean isShowFavoriteItem() {
ContentDto contentDto = contentDao.getContent(contentId);
return Options.getInstance(ABVContentViewActivity.this).getFilerFavorite() == 1 && !contentDto.isUnAuthorizedContent;
}
private void showUpdateContentAlert(long contentId) {
if (meetingManager.isConnected()) {
ContentDto contentDto = contentDao.getContent(contentId);
......@@ -325,16 +320,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
ActivityHandlingHelper.getInstance().removeObjectViewActivity(this);
}
/**
* Checkの場合、リストに戻る時、interrupt=trueで
* コンテンツダウンロード中止になるので、kickTask()を実行しない。
* 代わりに「ContentRefresher.RefreshContentWorker.contentDownloader.kickTask()」で実行される
*/
if (!ABVEnvironment.getInstance().isABookCheck()) {
// 待機中のダウンロードがあれば開始する。
ContentDownloader.getInstance().kickTask();
}
//キャッシュを使用しない場合、ディレクトリが残っていれば削除
if (!getRBoolean(R.bool.use_cache) && objectId == -1) {
ContentFileExtractor.getInstance().removeContentCash(contentId);
......@@ -634,7 +619,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (this instanceof NoPdfViewActivity) {
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
goToBack();
} else {
this.finish();
......@@ -1234,7 +1219,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
protected boolean isProjectPdf() {
return ABVEnvironment.getInstance().isABookCheck() && isProjectPdf;
return isProjectPdf;
}
public boolean isDirector() {
......
......@@ -25,21 +25,6 @@ public class ABVFunctionOptions extends AbstractOptions {
}
@Override
public int getFilerFavorite() {
return context.getResources().getInteger(R.integer.filer_favorite);
}
@Override
public int getSettingMenuGeneral() {
return context.getResources().getInteger(R.integer.setting_menu_general);
}
@Override
public int getSettingMenuViewer() {
return context.getResources().getInteger(R.integer.setting_menu_viewer);
}
@Override
public int getSettingMenuAccount() {
return context.getResources().getInteger(R.integer.setting_menu_account);
}
......@@ -60,15 +45,6 @@ public class ABVFunctionOptions extends AbstractOptions {
}
@Override
public int getSettingMenuBackup() {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Backup)) {
return context.getResources().getInteger(R.integer.setting_menu_backup);
} else {
return 0;
}
}
@Override
public int getSettingMenuLogInfo() {
return context.getResources().getInteger(R.integer.setting_menu_log_info);
}
......@@ -79,11 +55,6 @@ public class ABVFunctionOptions extends AbstractOptions {
}
@Override
public int getViewerMenuHistory() {
return context.getResources().getInteger(R.integer.viewer_menu_history);
}
@Override
public int getViewerMenuIndex() {
return context.getResources().getInteger(R.integer.viewer_menu_index);
}
......@@ -94,34 +65,11 @@ public class ABVFunctionOptions extends AbstractOptions {
}
@Override
public int getViewerMenuShare(long contentId) {
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return getContentShareVisibility(contentId);
} else {
return context.getResources().getInteger(R.integer.viewer_menu_share);
}
}
@Override
public int getViewerMenuPdfSendMail(long contentId) {
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return getPdfSendMailVisibility(contentId);
} else {
return context.getResources().getInteger(R.integer.viewer_menu_pdf_send_mail);
}
}
@Override
public int getViewerMenuTextcopy() {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
@Override
public int getViewerMenuCursor() {
return context.getResources().getInteger(R.integer.viewer_menu_cursor);
}
@Override
public int getViewerMenuMemo() {
return context.getResources().getInteger(R.integer.viewer_menu_memo);
}
......
......@@ -18,21 +18,6 @@ public class DefaultOptions extends AbstractOptions {
}
@Override
public int getFilerFavorite() {
return 0;
}
@Override
public int getSettingMenuGeneral() {
return 0;
}
@Override
public int getSettingMenuViewer() {
return 1;
}
@Override
public int getSettingMenuAccount() {
return 1;
}
......@@ -53,11 +38,6 @@ public class DefaultOptions extends AbstractOptions {
}
@Override
public int getSettingMenuBackup() {
return 0;
}
@Override
public int getSettingMenuLogInfo() {
return 1;
}
......@@ -68,11 +48,6 @@ public class DefaultOptions extends AbstractOptions {
}
@Override
public int getViewerMenuHistory() {
return 1;
}
@Override
public int getViewerMenuIndex() {
return 0;
}
......@@ -83,26 +58,11 @@ public class DefaultOptions extends AbstractOptions {
}
@Override
public int getViewerMenuShare(long contentId) {
return getContentShareVisibility(contentId);
}
@Override
public int getViewerMenuPdfSendMail(long contentId) {
return 0;
}
@Override
public int getViewerMenuTextcopy() {
return 0;
}
@Override
public int getViewerMenuCursor() {
return 0;
}
@Override
public int getViewerMenuMemo() {
return 0;
}
......
......@@ -8,24 +8,6 @@ public interface IOptions {
int getLocationMode();
/**
* 絞り込み:お気に入り
* @return 0:非表示 1:表示
*/
int getFilerFavorite();
/**
* 設定:一般
* @return 0:非表示 1:表示
*/
int getSettingMenuGeneral();
/**
* 設定:ビューア
* @return 0:非表示 1:表示
*/
int getSettingMenuViewer();
/**
* 設定:アカウント
* @return 0:非表示 1:表示
*/
......@@ -50,12 +32,6 @@ public interface IOptions {
int getSettingMenuPasswordChange();
/**
* 設定:バックアップ
* @return 0:非表示 1:表示
*/
int getSettingMenuBackup();
/**
* 設定:ログ情報
* @return 0:非表示 1:表示
*/
......@@ -74,12 +50,6 @@ public interface IOptions {
int getViewerMenuExit();
/**
* Viewerツールバー:履歴
* @return 0:非表示、1:表示
*/
int getViewerMenuHistory();
/**
* Viewerツールバー:インデックス
* @return 0:非表示、1:表示
*/
......@@ -92,30 +62,12 @@ public interface IOptions {
int getViewerMenuSearch();
/**
* Viewerツールバー:共有
* @return 0:非表示、1:表示
*/
int getViewerMenuShare(long contentId);
/**
* Viewerツールバー:共有
* @return 0:非表示、1:表示
*/
int getViewerMenuPdfSendMail(long contentId);
/**
* Viewerツールバー:テキストコピー
* @return 0:非表示、1:表示
*/
int getViewerMenuTextcopy();
/**
* Viewerツールバー:カーソル
* @return 0:非表示、1:表示
*/
int getViewerMenuCursor();
/**
* Viewer:メモ
* @return
*/
......
......@@ -20,21 +20,6 @@ public class LargeOptions extends AbstractOptions {
}
@Override
public int getFilerFavorite() {
return 1;
}
@Override
public int getSettingMenuGeneral() {
return 1;
}
@Override
public int getSettingMenuViewer() {
return 1;
}
@Override
public int getSettingMenuAccount() {
return 1;
}
......@@ -55,15 +40,6 @@ public class LargeOptions extends AbstractOptions {
}
@Override
public int getSettingMenuBackup() {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Backup)) {
return 1;
} else {
return 0;
}
}
@Override
public int getSettingMenuLogInfo() {
return 1;
}
......@@ -74,11 +50,6 @@ public class LargeOptions extends AbstractOptions {
}
@Override
public int getViewerMenuHistory() {
return 1;
}
@Override
public int getViewerMenuIndex() {
return 1;
}
......@@ -89,26 +60,11 @@ public class LargeOptions extends AbstractOptions {
}
@Override
public int getViewerMenuShare(long contentId) {
return getContentShareVisibility(contentId);
}
@Override
public int getViewerMenuPdfSendMail(long contentId) {
return getPdfSendMailVisibility(contentId);
}
@Override
public int getViewerMenuTextcopy() {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
@Override
public int getViewerMenuCursor() {
return 0;
}
@Override
public int getViewerMenuMemo() {
return 1;
}
......
......@@ -20,21 +20,6 @@ public class MidOptions extends AbstractOptions {
}
@Override
public int getFilerFavorite() {
return 0;
}
@Override
public int getSettingMenuGeneral() {
return 1;
}
@Override
public int getSettingMenuViewer() {
return 1;
}
@Override
public int getSettingMenuAccount() {
return 1;
}
......@@ -55,15 +40,6 @@ public class MidOptions extends AbstractOptions {
}
@Override
public int getSettingMenuBackup() {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Backup)) {
return 1;
} else {
return 0;
}
}
@Override
public int getSettingMenuLogInfo() {
return 1;
}
......@@ -74,11 +50,6 @@ public class MidOptions extends AbstractOptions {
}
@Override
public int getViewerMenuHistory() {
return 1;
}
@Override
public int getViewerMenuIndex() {
return 0;
}
......@@ -89,26 +60,11 @@ public class MidOptions extends AbstractOptions {
}
@Override
public int getViewerMenuShare(long contentId) {
return getContentShareVisibility(contentId);
}
@Override
public int getViewerMenuPdfSendMail(long contentId) {
return getPdfSendMailVisibility(contentId);
}
@Override
public int getViewerMenuTextcopy() {
return 0;
}
@Override
public int getViewerMenuCursor() {
return 0;
}
@Override
public int getViewerMenuMemo() {
return 0;
}
......
......@@ -38,7 +38,6 @@ public class ABookSettingActivity extends PreferenceActivity {
backToHome();
}
});
if (ABVEnvironment.getInstance().isABookCheck()) {
//操作説明書コピー(バージョン変更もあるので毎回コピー)
try {
ContentFileExtractor.getInstance().removeContentCash(0L);
......@@ -48,8 +47,6 @@ public class ABookSettingActivity extends PreferenceActivity {
} catch (IOException e) {
Logger.e(TAG, "copyGuidePDFFile Exception = " + e);
}
}
}
@Override
......
......@@ -16,9 +16,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
......@@ -32,11 +30,8 @@ import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.GetBackupFileListJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AppLastVersionParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.acms.type.LoginMode;
......@@ -44,21 +39,14 @@ import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.BackupFileType;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.download.ContentDownloader;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ServiceOptionDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.BackupRestoreLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.SubscriptionHistoryLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.environment.NetworkAdapter;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.cl.util.RawResourceUtil;
......@@ -70,28 +58,19 @@ import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.PrefName;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.options.Options;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.helper.ProgressDialogHelper;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.ClipboardUtil;
import jp.agentec.abook.abv.ui.home.dialog.BackupDialog;
import jp.agentec.abook.abv.ui.home.dialog.RestoreDialog;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ABookSettingFragment extends PreferenceFragment {
private static final String TAG = "ABookSettingActivity";
// Preferenceグループ
private static final String GENERAL_SETTINGS = "general_settings";
private static final String VIEWER_SETTING = "viewer_setting";
private static final String MEETINGROOM_SETTING = "meetingroom_setting";
private static final String ACCOUNT_SET = "account_set";
private static final String DATA_SET = "data_set";
private static final String LOG_INFO = "log_info";
private static final String APP_INFO = "app_info";
......@@ -124,7 +103,6 @@ public class ABookSettingFragment extends PreferenceFragment {
protected Handler handler = new Handler();
protected AlertDialog alertDialog = null;
private BackupRestoreLogic brLogic = AbstractLogic.getLogic(BackupRestoreLogic.class);
private SharedPreferences pref;
@Override
......@@ -132,7 +110,6 @@ public class ABookSettingFragment extends PreferenceFragment {
super.onCreate(savedInstanceState);
handler = new Handler();
brLogic = AbstractLogic.getLogic(BackupRestoreLogic.class);
pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
// 自動DLの初期値を設定する(レイアウトをセットした時点でPreferenceが保存されてしまうのでその前の段階で行う)
......@@ -143,23 +120,12 @@ public class ABookSettingFragment extends PreferenceFragment {
}
}
addPreferencesFromResource(R.xml.pref);
// 一般設定
setGeneralSetting();
// ビューア画面の設定
setViewerSetting();
// 会議室設定
setMeetingRoomSetting();
// データ管理
setDataSetting();
// アカウント
setAccountSetting();
// ログ情報
setLogInfoSetting();
// アプリ情報
setAppInfoSetting();
if (ABVEnvironment.getInstance().isABookCheck()) {
removeCheckEdition();
}
}
@Override
......@@ -178,92 +144,6 @@ public class ABookSettingFragment extends PreferenceFragment {
super.onStart();
}
private void setGeneralSetting() {
PreferenceGroup generalSettings = (PreferenceGroup) findPreference(GENERAL_SETTINGS);
if (Options.getInstance(getActivity()).getSettingMenuGeneral() == 1) {
// 位置情報アクセス許可
Preference permissionAccessLocation = findPref(DefPrefKey.PERMISSION_ACCESS_LOCATION);
if (!AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()) {
generalSettings.removePreference(permissionAccessLocation);
if (PreferenceUtil.userPrefContains(getActivity(), DefPrefKey.PERMISSION_ACCESS_LOCATION)) { // prefからも削除する
PreferenceUtil.removeUserPref(getActivity(), DefPrefKey.PERMISSION_ACCESS_LOCATION);
}
}
// 自動DL
Preference autoDownloadPref = getPreferenceManager().findPreference(DefPrefKey.AUTO_DOWNLOAD);
autoDownloadPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (!(Boolean) newValue) {
Logger.v(TAG, "disable auto download."); // オフにした場合全停止する
ProgressDialogHelper.showProgressPopup(getActivity(), true);
ContentDownloader.getInstance().cancelExeptDownloading();
ProgressDialogHelper.closeProgressPopup();
}
return true;
}
});
if (!ABVDataCache.getInstance().serviceOption.isAutoDownloadOptionEnable() || getResources().getInteger(R.integer.download_service_check) == 1) {
generalSettings.removePreference(autoDownloadPref);
if (contains(DefPrefKey.AUTO_DOWNLOAD)) { // prefからも削除する
delete(DefPrefKey.AUTO_DOWNLOAD);
}
}
// プッシュメッセージ受信設定
Preference pushMessage = getPreferenceManager().findPreference(DefPrefKey.PUSH_MESSAGE);
generalSettings.removePreference(pushMessage);
if (contains(DefPrefKey.PUSH_MESSAGE)) { // prefからも削除する
delete(DefPrefKey.PUSH_MESSAGE);
}
// UPDATEフラグ時のタップ動作
final ListPreference updatePreference = (ListPreference) findPref(DefPrefKey.TAP_ACTION_ON_UPDATE);
final String[] updateValues = getResources().getStringArray(R.array.tap_action_on_update);
updatePreference.setSummary(getString(R.string.tap_action_on_update_summary) + updateValues[PreferenceUtil.getInt(getActivity(), DefPrefKey.TAP_ACTION_ON_UPDATE, "0")]);
updatePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
// 変更された値をサマリに表示
int selectedIndex = Integer.parseInt(newValue.toString());
ABVToastUtil.showMakeText(getActivity(), String.format(getString(R.string.modify_complete), updateValues[selectedIndex]), Toast.LENGTH_SHORT);
updatePreference.setSummary(getString(R.string.tap_action_on_update_summary) + updateValues[selectedIndex]);
return true;
}
});
// 配信タイプを選べるときの動作
final ListPreference deliveryPreference = (ListPreference) findPref(DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT);
if (ABVDataCache.getInstance().serviceOption.isDeliveryTypeSelectable()) {
final String[] deliveryValues = getResources().getStringArray(R.array.tap_action_on_delivery_select);
deliveryPreference.setSummary(getString(R.string.tap_action_on_update_summary) + deliveryValues[PreferenceUtil.getInt(getActivity(), DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT, "2")]);
deliveryPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
// 変更された値をサマリに表示
int selectedIndex = Integer.parseInt(newValue.toString());
ABVToastUtil.showMakeText(getActivity(), String.format(getString(R.string.modify_complete), deliveryValues[selectedIndex]), Toast.LENGTH_SHORT);
deliveryPreference.setSummary(getString(R.string.tap_action_on_delivery_select_summary) + deliveryValues[selectedIndex]);
return true;
}
});
}
else {
generalSettings.removePreference(deliveryPreference);
if (contains(DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT)) { // prefからも削除する
delete(DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT);
}
}
} else {
remove(generalSettings);
}
}
private boolean contains(String key) {
return pref.contains(key);
}
......@@ -294,50 +174,6 @@ public class ABookSettingFragment extends PreferenceFragment {
getPreferenceScreen().removePreference(prefGroup);
}
private void setViewerSetting() {
PreferenceGroup viewerSettings = (PreferenceGroup) findPreference(VIEWER_SETTING);
if (Options.getInstance(getActivity()).getSettingMenuViewer() == 0) {
remove(viewerSettings);
put(DefPrefKey.REPEATABLE_PLAY, getResources().getBoolean(R.bool.repeat_default));
} else {
if (Options.getInstance(getActivity()).getViewerMenuCursor() == 0) {
remove(viewerSettings, DefPrefKey.CURSOR_ENABLE);
}
}
// TODO later 次フェーズで対応 Jang 2013/10/09
// String key = getString(R.string.keyImageChangeEffect);
// final ListPreference listPreference = (ListPreference) findPreference(key);
// int index = Integer.parseInt(listPreference.getSharedPreferences().getString(key, "0"));
// final String[] values = getResources().getStringArray(R.array.image_change_effect);
// // 選択値を設定
// listPreference.setSummary(values[index]);
//
// listPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
// @Override
// public boolean onPreferenceChange(Preference preference, Object newValue) {
// // 変更された値をサマリに表示
// int selectedIndex = Integer.parseInt(newValue.toString());
// ABVToastUtil.showMakeText(getActivity(), "Changed to " + values[selectedIndex], Toast.LENGTH_SHORT);
// listPreference.setSummary(values[selectedIndex]);
// return true;
// }
// });
}
/**
* 会議室設定
*/
private void setMeetingRoomSetting() {
PreferenceGroup meetingRoomSettings = (PreferenceGroup) findPreference(MEETINGROOM_SETTING);
// 連動操作サービスオプションによる表示切り替え
if (!AbstractLogic.getLogic(ContractLogic.class).getViewerSync() || !AbstractLogic.getLogic(ContractLogic.class).getMarking()) {
remove(meetingRoomSettings);
}
}
private void setAccountSetting() {
PreferenceGroup accountSettings = (PreferenceGroup) findPreference(ACCOUNT_SET);
if (Options.getInstance(getActivity()).getSettingMenuAccount() == 0) {
......@@ -466,148 +302,6 @@ public class ABookSettingFragment extends PreferenceFragment {
}
private void setDataSetting() {
PreferenceGroup dataSet = (PreferenceGroup) findPreference(DATA_SET);
if (Options.getInstance(getActivity()).getSettingMenuBackup() == 1 || ABVDataCache.getInstance().serviceOption.isAutoSubscriptionAll()) {
// データ管理関連の設定
if (Options.getInstance(getActivity()).getSettingMenuBackup() == 1) {
try {
setDataManager();
} catch (IOException e) {
Logger.e(TAG, "setDataManager", e);
ABVToastUtil.showMakeText(getActivity(), R.string.STORAGE_ACCESS_ERROR, Toast.LENGTH_SHORT);
}
} else {
remove(dataSet, BACKUP);
remove(dataSet, RESTORE);
}
if (ABVDataCache.getInstance().serviceOption.isAutoSubscriptionAll()) {
findPreference(RESTORE_PURCHASE_HISTORY).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
restorePurchaseHistory();
ActivityHandlingHelper.getInstance().setRequireHomeReload(true);
return true;
}
});
} else {
remove(dataSet, RESTORE_PURCHASE_HISTORY);
}
} else {
remove(dataSet);
}
}
public void setDataManager() throws IOException {
PreferenceScreen backup = (PreferenceScreen) findPreference(BACKUP);
ArrayList<String> backupData = brLogic.getBackupRestoreTime(BACKUP);
if (backupData.get(0) != null) {
String backupTime = backupData.get(0);
if (backupData.get(1).equals(BackupFileType.Memo)) {
backup.setSummary(getResources().getString(R.string.done) + " : " + backupTime); // バックアップした時間を設定
} else {
backup.setSummary(getResources().getString(R.string.part_done) + " : " + backupTime); // バックアップした時間を設定
}
//부분완료가 없어졌기 때문에 이 부분은 일단 시간만 표시
backup.setSummary(backupTime); // バックアップした時間を設定
}
backup.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
showBackupDialog();
} catch (Exception e) {
Logger.e(TAG, "showBackupDialog", e);
ABVToastUtil.showMakeText(getActivity(), R.string.ERROR, Toast.LENGTH_SHORT);
}
return true;
}
});
PreferenceScreen restore = (PreferenceScreen) findPreference(RESTORE);
ArrayList<String> restoreData = brLogic.getBackupRestoreTime(RESTORE);
if (restoreData.get(0) != null) {
String restoreTime = restoreData.get(0);
if (restoreData.get(1).equals(BackupFileType.Memo)) {
restore.setSummary(getResources().getString(R.string.done) + " : " + restoreTime);
} else {
restore.setSummary(getResources().getString(R.string.part_done) + " : " + restoreTime);
}
}
restore.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
showRestoreDialog(getActivity());
} catch (Exception e) {
Logger.e(TAG, "showRestoreDialog", e);
ABVToastUtil.showMakeText(getActivity(), R.string.ERROR, Toast.LENGTH_SHORT);
}
return true;
}
});
}
protected void showBackupDialog() {
Logger.i(TAG, "showBackupDialog");
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(getActivity(), R.string.msg_network_offline, Toast.LENGTH_SHORT);
return;
}
new BackupDialog(this).show();
}
protected void showRestoreDialog(final Context context) throws AcmsException, NetworkDisconnectedException {
Logger.i(TAG, "showRestoreDialog");
final NetworkAdapter networkAdapter = NetworkAdapter.getInstance();
if (!networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(context, R.string.msg_network_offline, Toast.LENGTH_SHORT);
return;
}
//백업파일 리스트 가져오기
GetBackupFileListJSON backupFileListJson = brLogic.getBackupFileList();
new RestoreDialog(this, backupFileListJson).show();
}
/**
* 定期購読購入履歴を復元する
*/
private void restorePurchaseHistory() {
ProgressDialogHelper.showProgressPopup(getActivity(), true);
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
String msg = null;
try {
AbstractLogic.getLogic(SubscriptionHistoryLogic.class).restoreSubscriptionHistory(ContentDownloader.getInstance().account);
msg = String.format(getActivity().getString(R.string.complete_state), getActivity().getString(R.string.restore_purchase_history));
} catch (final AcmsException e) {
Logger.e(TAG, "restorePurchaseHistory failed.", e);
msg = ErrorMessage.getErrorMessage(getActivity(), e);
} catch (NetworkDisconnectedException e) {
msg = ErrorMessage.getErrorMessage(getActivity(), ErrorCode.NETWORK);
} finally {
if (msg != null) {
final String restoreMsg = msg;
handler.post(new Runnable() {
@Override
public void run() {
ABVToastUtil.showMakeText(getActivity(), restoreMsg, Toast.LENGTH_SHORT);
}
});
}
ProgressDialogHelper.closeProgressPopup();
}
}
});
}
private void setLogInfoSetting() {
PreferenceGroup logInfo = (PreferenceGroup) findPreference(LOG_INFO);
if (Options.getInstance(getActivity()).getSettingMenuLogInfo() == 1) {
......@@ -699,7 +393,6 @@ public class ABookSettingFragment extends PreferenceFragment {
}
Preference abookCheckManual = findPreference(ABOOK_CHECK_MANUAL);
if (ABVEnvironment.getInstance().isABookCheck()) {
abookCheckManual.setTitle(getResources().getString(R.string.project_manual));
abookCheckManual.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
......@@ -718,10 +411,6 @@ public class ABookSettingFragment extends PreferenceFragment {
}
});
} else {
appInfo.removePreference(abookCheckManual);
}
} else {
remove(appInfo);
}
}
......@@ -932,23 +621,4 @@ public class ABookSettingFragment extends PreferenceFragment {
Logger.d(TAG, "saveLeaveAppTime()");
PreferenceUtil.putUserPref(getActivity(), UserPrefKey.LEAVE_APP, System.currentTimeMillis());
}
private void removeCheckEdition() {
PreferenceGroup generalGroup= (PreferenceGroup)findPreference(GENERAL_SETTINGS);
if(generalGroup != null) {
remove(generalGroup);
}
PreferenceGroup viewerGroup= (PreferenceGroup)findPreference(VIEWER_SETTING);
if(viewerGroup != null) {
remove(viewerGroup);
}
PreferenceGroup meetingRoomGroup= (PreferenceGroup)findPreference(MEETINGROOM_SETTING);
if(meetingRoomGroup != null) {
remove(meetingRoomGroup);
}
PreferenceGroup dataSetGroup= (PreferenceGroup)findPreference(DATA_SET);
if(dataSetGroup != null) {
remove(dataSetGroup);
}
}
}
......@@ -609,26 +609,9 @@ public class GuideViewActivity extends ABVContentViewActivity {
private void unlimitViewer() {
overlapLayout.setVisibility(View.GONE);
// mBtnRemoteStart.setVisibility(View.GONE);
//
// if (meetingManager.isSubscribed()) {
// mBtnMeetingRoomSetting.setVisibility(View.GONE);
// }
// if (meetingManager.isSendable()) {
// if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
// mBtnMeetingRoomSetting.setVisibility(View.GONE);
// } else {
// mBtnMeetingRoomSetting.setVisibility(View.VISIBLE);
// }
// }
if (Options.getInstance(this).getViewerMenuExit() == 1) {
mExitBtn.setVisibility(View.VISIBLE);
}
//
// if (Options.getInstance(this).getViewerMenuHistory() == 1 && !(ABVEnvironment.getInstance().isABookCheck())) {
// mHistoryBtn.setVisibility(View.VISIBLE);
// }
}
private void initRemoteLayout() {
......@@ -721,9 +704,7 @@ public class GuideViewActivity extends ABVContentViewActivity {
}
});
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
meetingRoomSettingBtn.setVisibility(View.GONE);
}
ImageButton promoteBtn = (ImageButton) subscriberToolBar.findViewById(R.id.btn_promote);
promoteBtn.setOnClickListener(new View.OnClickListener() {
......
......@@ -23,7 +23,6 @@ import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.PasswordLockInfoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.BackupRestoreLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.ProjectLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
......@@ -698,7 +697,6 @@ public class LoginActivity extends ABVLoginActivity {
PreferenceUtil.clearUserPref(this);
memberInfoDao.deleteMemberInfo();
BackupRestoreLogic brLogic = AbstractLogic.getLogic(BackupRestoreLogic.class);
contentLogic.deleteContentMarkingData();
boolean isAllDelete =true;
if (getRInteger(R.integer.not_delete_all_contents) == 1) {
......@@ -707,7 +705,6 @@ public class LoginActivity extends ABVLoginActivity {
contentLogic.deleteAllContent(isAllDelete);
ProjectLogic projectLogic = AbstractLogic.getLogic(ProjectLogic.class);
projectLogic.deleteAllProject();
brLogic.deleteBackupRestoreTime();
memberInfoDao.deleteMemberContentInfo(isAllDelete);
// バグ対応:ユーザ切り替え時検索結果の履歴が削除する。
SearchHistoryDao searchHistoryDao = AbstractDao.getDao(SearchHistoryDao.class);
......@@ -728,12 +725,7 @@ public class LoginActivity extends ABVLoginActivity {
*/
private void changeUserInit2() {
memberInfoDao.deleteMemberInfo();
BackupRestoreLogic brLogic = AbstractLogic.getLogic(BackupRestoreLogic.class);
contentLogic.deleteContentMarkingData();
brLogic.deleteBackupRestoreTime();
memberInfoDao.deleteMemberMydataInfo();
}
......
package jp.agentec.abook.abv.ui.home.dialog;
import java.io.File;
import java.io.IOException;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.BackupRestoreLogic;
import jp.agentec.abook.abv.bl.logic.BookmarkLogic;
import jp.agentec.abook.abv.bl.logic.MarkingLogic;
import jp.agentec.abook.abv.bl.logic.MemoLogic;
import jp.agentec.abook.abv.cl.helper.BackupFileHelper;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.activity.ABookSettingFragment;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class BackupDialog extends Dialog {
private static final String TAG = "BackupDialog";
private ABookSettingFragment context;
private AsyncTask<Void, Integer, Integer> backupTask;
private boolean backup_start = false;
private BackupRestoreLogic brLogic;
private boolean isCanceled = false;
private boolean backupList[];
private Button btnStart;
private ProgressBar pb;
private TextView tvProText;
private TextView tvRateText;
private Button btnClose;
private CheckedTextView memo;
private CheckedTextView marking;
private CheckedTextView bookmark;
public BackupDialog(ABookSettingFragment context) {
super(context.getActivity());
this.context = context;
brLogic = AbstractLogic.getLogic(BackupRestoreLogic.class);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setCanceledOnTouchOutside(false);
setContentView(R.layout.ac_backup_dialog);
btnStart = (Button) findViewById(R.id.backup_btn);
pb = (ProgressBar) findViewById(R.id.progress_backup_download);
tvProText = (TextView) findViewById(R.id.backup_progress);
tvRateText = (TextView) findViewById(R.id.progress_backup_rate);
memo = (CheckedTextView) findViewById(R.id.item_memo);
marking = (CheckedTextView) findViewById(R.id.item_marking);
bookmark = (CheckedTextView) findViewById(R.id.item_bookmark);
btnClose = (Button) findViewById(R.id.btn_close);
btnClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
boolean memoExist = AbstractLogic.getLogic(MemoLogic.class).isMemoExist();
boolean markingExist = AbstractLogic.getLogic(MarkingLogic.class).isMarkingExist();
boolean bookmarkExist = AbstractLogic.getLogic(BookmarkLogic.class).isBookmarkExist();
if (memoExist) {
memo.setChecked(true);
memo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckedTextView check = (CheckedTextView) v;
check.toggle();
}
});
} else {
memo.setEnabled(false);
}
if (markingExist) {
marking.setChecked(true);
marking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckedTextView check = (CheckedTextView) v;
check.toggle();
}
});
} else {
marking.setEnabled(false);
}
if (bookmarkExist) {
bookmark.setChecked(true);
bookmark.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckedTextView check = (CheckedTextView) v;
check.toggle();
}
});
} else {
bookmark.setEnabled(false);
}
if (!memoExist && !markingExist && !bookmarkExist) {
btnStart.setEnabled(false);
} else {
btnStart.setOnClickListener(new View.OnClickListener() {
//백업 개시 버튼 이벤트
@Override
public void onClick(View v) {
backup_start = true;
backupList = new boolean[3];
//메모 , 마킹, 북마크 체크시
int sum = 0;
if (memo.isChecked()) {
sum += 1;
backupList[0] = true;
} else {
backupList[0] = false;
}
if (marking.isChecked()) {
sum += 2;
backupList[1] = true;
} else {
backupList[1] = false;
}
if (bookmark.isChecked()) {
sum += 4;
backupList[2] = true;
} else {
backupList[2] = false;
}
final String fileType = Integer.toString(sum);
if (fileType.equals("0")) {
ABVToastUtil.showMakeText(context.getActivity(), R.string.br_check_alert, Toast.LENGTH_SHORT);
return;
}
if (btnStart.getText().equals(context.getActivity().getResources().getString(R.string.commencement))) {
backupTask = new AsyncTask<Void, Integer, Integer>() {
Integer[] prog = new Integer[3];
@Override
protected void onPreExecute() {
prog[0] = 0;
prog[1] = 0;
prog[2] = 0;
pb.setProgress(0);
pb.incrementProgressBy(0);
isCanceled = false;
//프로그레스바 보임
pb.setVisibility(View.VISIBLE);
//버튼 텍스트 변경
btnStart.setText(R.string.backup_stop);
tvProText.setVisibility(View.VISIBLE);
tvRateText.setVisibility(View.VISIBLE);
tvProText.setText("");
tvRateText.setText("");
}
//백그라운드에서 동작할 일
@Override
protected Integer doInBackground(Void... params) {
try {
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
//네트워크가 연결 되었을 경우 백업 시작
switch (Integer.parseInt((fileType))) {
case 0:
backupTask.cancel(false);
break;
default:
BackupFileHelper bh = new BackupFileHelper();
//백업 개시
Logger.d("type 값 체크", "TYPE : " + fileType);
String result = brLogic.notifyBackupStart(fileType);
//백업 개시 후 서버 return 값이 true 일 경우 백업 파일 업로드
if (!result.equals("success")) {
//서버 retrurn : 백업 실패
//실패 오류 메시지를 표시
prog[2] = 2;
publishProgress(prog);
backupTask.cancel(false);
}
//백업 파일 생성
//메모, 마킹 갯수 확인 해서 return... 수정 필요
//백업결과, 메모갯수, 마킹갯수 순으로 리턴
//백업 결과 : 0 -> false, 1-> true
int backupCount = bh.backupFileGenerate(backupList);
final int totalCount = backupCount;
//파일 업로드
String path = ABVEnvironment.getInstance().getBackupFileDirectoryPath();
File filepath = new File(path);
File[] fileList = filepath.listFiles();
context.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
pb.setMax(totalCount);
}
});
boolean up_result;
int ingCount = 0;
prog[0] = totalCount;
prog[1] = ingCount;
publishProgress(prog);
for (int i = 0; i < totalCount && !isCanceled; i++) {
up_result = brLogic.uploadBackupFile(fileList[i]);
if (!up_result) {
//업로드 실패 오류 메시지 표시
//로컬 백업 파일 삭제
brLogic.deleteBackupFile();
prog[2] = 4;
publishProgress(prog);
break;
}
ingCount++;
prog[1] = ingCount;
publishProgress(prog);
Logger.d("isCanceled", "isCanceled : " + isCanceled);
}
//로컬 백업 파일을 삭제
brLogic.deleteBackupFile();
//서버에 완료 통지
String finishResult = brLogic.notifyBackupFinish(fileType);
if (!finishResult.equals("success")) {
//백업 완료 통지 실패
prog[2] = 5;
publishProgress(prog);
break;
}
}
} else {
Logger.d("네트워크 확인", "네트워크 연결 끊김");
//네트워크 연결되지 않음 오류메시지 표시
prog[2] = 1;
publishProgress(prog);
}
} catch (Exception e) {
Logger.e(TAG, "backupTask", e);
ABVToastUtil.showMakeText(context.getActivity(), R.string.ERROR, Toast.LENGTH_SHORT);
}
return prog[0];
}
// publishProgress() 메소드를 통해 호출. 진행사항을 표시
@Override
protected void onProgressUpdate(Integer... progress) {
if (progress[2] == 0) {
int total_count = progress[0];
int now_count = progress[1];
Logger.d("total_count", "Total_count : " + total_count);
Logger.d("now_count", "Now_count : " + now_count);
Logger.d("progress_bar max_count", "progress_bar max_count : " + pb.getMax());
pb.setProgress(now_count);
//백업 상태에 대한 텍스트 처리
if (isCanceled) {
tvProText.setText(context.getResources().getString(R.string.backup_pause) + " " + now_count + " / " + total_count);
} else {
tvProText.setText(context.getResources().getString(R.string.backup_ing) + " " + now_count + " / " + total_count);
}
//백업 %에 대한 텍스트 처리
if (total_count != 0) {
float max_count = ((float) now_count / (float) total_count) * 100;
Logger.d("MAX Count", "Max count : " + max_count);
String max_count2 = String.format("%.0f", max_count);
tvRateText.setText(max_count2 + " %");
}
} else {
switch (progress[2]) {
case 1:
ABVToastUtil.showMakeText(context.getActivity(), R.string.msg_network_offline, Toast.LENGTH_SHORT);
break;
case 2:
ABVToastUtil.showMakeText(context.getActivity(), R.string.backup_start_alert, Toast.LENGTH_SHORT);
break;
case 3:
ABVToastUtil.showMakeText(context.getActivity(), R.string.backup_file_alert, Toast.LENGTH_SHORT);
break;
case 4:
ABVToastUtil.showMakeText(context.getActivity(), R.string.backup_upload_alert, Toast.LENGTH_SHORT);
break;
case 5:
ABVToastUtil.showMakeText(context.getActivity(), R.string.backup_noti_alert, Toast.LENGTH_SHORT);
break;
case 6:
ABVToastUtil.showMakeText(context.getActivity(), R.string.backup_memo_alert, Toast.LENGTH_SHORT);
break;
case 7:
ABVToastUtil.showMakeText(context.getActivity(), R.string.backup_marking_alert, Toast.LENGTH_SHORT);
break;
case 8:
ABVToastUtil.showMakeText(context.getActivity(), R.string.backup_select_alert, Toast.LENGTH_SHORT);
break;
}
}
}
//작업 완료 직후에 호출되는 메소드
@Override
protected void onPostExecute(Integer total_count) {
backup_start = false;
btnStart.setText(R.string.commencement);
tvProText.setText(context.getResources().getString(R.string.backup_complete) + " " + total_count + " / " + total_count);
btnClose.setVisibility(View.VISIBLE);
try {
brLogic.setBackupRestoreTime("backup", 1);
context.setDataManager();
} catch (IOException e) {
Logger.e(TAG, "setDataManager", e);
ABVToastUtil.showMakeText(context.getActivity(), R.string.STORAGE_ACCESS_ERROR, Toast.LENGTH_SHORT);
}
}
//외부에서 강제로 취소할때 호출 되는 메소드
@Override
protected void onCancelled() {
isCanceled = true;
btnStart.setText(R.string.commencement);
btnClose.setVisibility(View.VISIBLE);
try {
brLogic.setBackupRestoreTime("backup", 2);
context.setDataManager();
} catch (Exception e) {
Logger.e(TAG, "setDataManager", e);
ABVToastUtil.showMakeText(context.getActivity(), R.string.STORAGE_ACCESS_ERROR, Toast.LENGTH_SHORT);
}
}
};
// TODO テスト失敗であるため、一時コメントアウト
// try {
// if (ABVEnvironment.getInstance().networkAdapter.getActiveNetworkType() == ConnectivityManager.TYPE_MOBILE
// && PreferenceManager.getDefaultSharedPreferences(context.getActivity()).getBoolean(context.getString(R.string.keyWiFiAlertEnable), true)) {
//
// ABookAlertDialog alertDialog = AlertDialogUtil.createABookAlertDialog(context.getActivity());
// alertDialog.setTitle(R.string.backup);
// alertDialog.setContentView(R.layout.item_check_box_alert);
// TextView message = (TextView) alertDialog.findViewById(R.id.message);
// message.setText(String.format(context.getString(R.string.C_E_SYSTEM_0006), context.getString(R.string.backup)));
//
// final CheckBox checkBox = (CheckBox) alertDialog.findViewById(R.id.check_box);
// alertDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// Editor editor = PreferenceManager.getDefaultSharedPreferences(context.getActivity()).edit();
// editor.putBoolean(context.getString(R.string.keyWiFiAlertEnable), !checkBox.isChecked());
// editor.commit();
// backupTask.execute();
// btnStart.setText(R.string.backup_stop);
// }
// });
//
// alertDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// }
// });
//
// TextView checkBoxMessage = (TextView) alertDialog.findViewById(R.id.check_box_message);
// checkBoxMessage.setText(context.getString(R.string.not_show_nexttime));
// checkBoxMessage.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// checkBox.setChecked(!checkBox.isChecked());
// }
// });
// context.showAlertDialog(alertDialog);
//
// } else {
// backupTask.execute();
// btnStart.setText(R.string.backup_stop);
// }
// } catch (NetworkDisconnectedException e1) {
// ABVToastUtil.showMakeText(context.getActivity(), R.string.NETWORK, Toast.LENGTH_SHORT);
// }
backupTask.execute();
btnStart.setText(R.string.backup_stop);
}
else if (btnStart.getText().equals(context.getResources().getString(R.string.backup_stop))) {
//일시정지 버튼 이벤트
getContext();
//팝업을 띄워서 선택 가능하게 해주자.
//OK 였을 경우 실제 취소 및 일부 완료 등의 처리
ABookAlertDialog backupCancelDialog = AlertDialogUtil.createAlertDialog(context.getActivity(), R.string.back);
backupCancelDialog.setMessage(R.string.backup_cancel_message);
backupCancelDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
if (backup_start == true && pb.getProgress() != pb.getMax()) {
isCanceled = true;
backupTask.cancel(false);
String proText = (String) tvProText.getText();
proText = proText.replace(context.getResources().getString(R.string.backup_ing), context.getResources().getString(R.string.backup_pause));
tvProText.setText(proText);
}
}
});
backupCancelDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
}
});
context.showAlertDialog(backupCancelDialog);
}
}
});
}
}
}
package jp.agentec.abook.abv.ui.home.dialog;
import java.io.IOException;
import jp.agentec.abook.abv.bl.acms.client.json.GetBackupFileListJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Constant.BackupFileName;
import jp.agentec.abook.abv.bl.common.Constant.BackupFileType;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.BackupRestoreLogic;
import jp.agentec.abook.abv.cl.helper.BackupFileHelper;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.activity.ABookSettingFragment;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class RestoreDialog extends Dialog {
private static final String TAG = "RestoreDialog";
private ABookSettingFragment context;
private BackupRestoreLogic brLogic;
private AsyncTask<Void, Integer, Integer[]> restoreTask;
private boolean restore_start = false;
private boolean isCanceled = false;
private GetBackupFileListJSON backupFileListJson;
private Button btnStart;
private ProgressBar progressBar;
private TextView tvProText;
private TextView tvRateText;
private Button btnClose;
private CheckedTextView memo;
private CheckedTextView marking;
private CheckedTextView bookmark;
public RestoreDialog(ABookSettingFragment context, GetBackupFileListJSON backupFileListJson) {
super(context.getActivity());
this.context = context;
this.backupFileListJson = backupFileListJson;
brLogic = AbstractLogic.getLogic(BackupRestoreLogic.class);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setCanceledOnTouchOutside(false);
setContentView(R.layout.ac_restore_dialog);
btnStart = (Button) findViewById(R.id.restore_btn);
progressBar = (ProgressBar) findViewById(R.id.progress_restore_download);
tvProText = (TextView) findViewById(R.id.restore_progress);
tvRateText = (TextView) findViewById(R.id.progress_restore_rate);
memo = (CheckedTextView) findViewById(R.id.item_memo);
marking = (CheckedTextView) findViewById(R.id.item_marking);
bookmark = (CheckedTextView) findViewById(R.id.item_bookmark);
btnClose = (Button) findViewById(R.id.btn_close);
btnClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
//복원 가능 여부 체크
boolean[] restoreList = brLogic.isRestoreItem(backupFileListJson);
if (restoreList[0]) {
memo.setChecked(true);
memo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckedTextView check = (CheckedTextView) v;
check.toggle();
}
});
}
if (restoreList[1]) {
marking.setChecked(true);
marking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckedTextView check = (CheckedTextView) v;
check.toggle();
}
});
}
if (restoreList[2]) {
bookmark.setChecked(true);
bookmark.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckedTextView check = (CheckedTextView) v;
check.toggle();
}
});
}
if (!restoreList[0] && !restoreList[1] && !restoreList[2]) {
btnStart.setEnabled(false);
} else {
btnStart.setOnClickListener(new View.OnClickListener() {
//복원 개시 버튼 이벤트
@Override
public void onClick(View v) {
restore_start = true;
//메모 , 마킹 둘 다 체크시
final String fileType;
final boolean checkList[] = new boolean[3];
//메모 , 마킹, 북마크 체크시
int sum = 0;
int checkCount = 0;
//메모 체크시
if (memo.isChecked()) {
sum += 1;
checkCount++;
checkList[0] = true;
} else {
checkList[0] = false;
}
//마킹 체크시
if (marking.isChecked()) {
sum += 2;
checkCount++;
checkList[1] = true;
} else {
checkList[1] = false;
}
//북마크 체크시
if (bookmark.isChecked()) {
sum += 4;
checkCount++;
checkList[2] = true;
} else {
checkList[2] = false;
}
fileType = Integer.toString(sum);
final int totalCount = checkCount;
if (fileType.equals("0")) {
ABVToastUtil.showMakeText(context.getActivity(), R.string.br_check_alert, Toast.LENGTH_SHORT);
return;
}
if (btnStart.getText().equals(context.getResources().getString(R.string.commencement))) {
restoreTask = new AsyncTask<Void, Integer, Integer[]>() {
Integer[] prog = new Integer[3];
Integer[] result = new Integer[3];
@Override
protected void onPreExecute() {
btnClose.setVisibility(View.INVISIBLE);
//prog [0] = progress 최대 값, [1] = progress 현재 값
prog[0] = 0;
prog[1] = 0;
prog[2] = 0;
progressBar.setProgress(0);
progressBar.incrementProgressBy(0);
isCanceled = false;
//프로그레스바 보임
progressBar.setVisibility(View.VISIBLE);
//버튼 텍스트 변경
btnStart.setText(R.string.restore_stop);
tvProText.setVisibility(View.VISIBLE);
tvRateText.setVisibility(View.VISIBLE);
tvProText.setText("");
tvRateText.setText("");
}
//백그라운드에서 동작할 일
@Override
protected Integer[] doInBackground(Void... params) {
try {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
Logger.d("네트워크 확인", "네트워크 연결 끊김");
//네트워크 연결되지 않음 오류메시지 표시
prog[2] = 1;
publishProgress(prog);
restoreTask.cancel(false);
}
//네트워크가 연결 되었을 경우 복원 시작
switch (Integer.parseInt((fileType))) {
case 0:
restoreTask.cancel(false);
break;
default:
BackupFileHelper bh = new BackupFileHelper();
context.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
//실제 복원 콘텐츠의 수
progressBar.setMax(totalCount);
}
});
int ingCount = 0;
prog[0] = totalCount;
prog[1] = ingCount;
publishProgress(prog);
//서버에서 백업 파일 다운로드
//실제 다운로드 후 처리할때 카운트 하도록...
for (int i = 0; i <= 2 && !isCanceled; i++) {
String type = "";
String fileName = "";
if (i == 0) {
type = BackupFileType.Memo;
fileName = BackupFileName.Memo;
} else if (i == 1) {
type = BackupFileType.Marking;
fileName = BackupFileName.Marking;
} else if (i == 2) {
type = BackupFileType.Bookmark;
fileName = BackupFileName.Bookmark;
}
if (checkList[i]) {
//복원파일 다운로드
if (brLogic.getBackupFile(type)) {
//다운로드 받은 복원파일을 DB 및 파일로 등록
if (bh.restoreBackupFile(Integer.parseInt(type), fileName)) {
ingCount++;
prog[1] = ingCount;
publishProgress(prog);
} else {
prog[2] = 6;
publishProgress(prog);
restoreTask.cancel(false);
break;
}
} else {
prog[2] = 6;
publishProgress(prog);
restoreTask.cancel(false);
break;
}
}
}
result[0] = totalCount;
}
} catch (Exception e) {
Logger.e(TAG, "restoreTask", e);
ABVToastUtil.showMakeText(context.getActivity(), R.string.ERROR, Toast.LENGTH_SHORT);
}
return result;
}
@Override
protected void onProgressUpdate(Integer... progress) {
if (progress[2] == 0) {
int totalCount = progress[0];
int now_count = progress[1];
Logger.d("total_count", "Total_count : " + totalCount);
Logger.d("now_count", "Now_count : " + now_count);
Logger.d("progress_bar max_count", "progress_bar max_count : " + progressBar.getMax());
progressBar.setProgress(now_count);
//복원 상태에 대한 텍스트 처리
if (isCanceled == false) {
tvProText.setText(context.getResources().getString(R.string.restore_ing) + " " + now_count + " / " + totalCount);
} else {
tvProText.setText(context.getResources().getString(R.string.restore_pause) + " " + now_count + " / " + totalCount);
}
//복원 %에 대한 텍스트 처리
if (!(totalCount == 0)) {
float max_count = ((float) now_count / (float) totalCount) * 100;
Logger.d("MAX Count", "Max count : " + max_count);
String max_count2 = String.format("%.0f", max_count);
tvRateText.setText(max_count2 + " %");
}
} else {
switch (progress[2]) {
case 1:
ABVToastUtil.showMakeText(context.getActivity(), R.string.msg_network_offline, Toast.LENGTH_SHORT);
break;
case 2:
ABVToastUtil.showMakeText(context.getActivity(), R.string.restore_none_list, Toast.LENGTH_SHORT);
break;
case 3:
ABVToastUtil.showMakeText(context.getActivity(), R.string.restore_none_list, Toast.LENGTH_SHORT);
break;
case 4:
ABVToastUtil.showMakeText(context.getActivity(), R.string.restore_none_memo, Toast.LENGTH_SHORT);
break;
case 5:
ABVToastUtil.showMakeText(context.getActivity(), R.string.restore_none_marking, Toast.LENGTH_SHORT);
break;
case 6:
ABVToastUtil.showMakeText(context.getActivity(), R.string.restore_fail_down, Toast.LENGTH_SHORT);
break;
}
}
}
//작업 완료 직후에 호출되는 메소드
@Override
protected void onPostExecute(Integer[] result) {
restore_start = false;
btnStart.setText(R.string.commencement);
tvProText.setText(context.getResources().getString(R.string.restore_complete) + " " + result[0] + " / " + result[0]);
btnClose.setVisibility(View.VISIBLE);
try {
brLogic.setBackupRestoreTime("restore", 1);
context.setDataManager();
} catch (IOException e) {
Logger.e(TAG, "setDataManager", e);
ABVToastUtil.showMakeText(context.getActivity(), R.string.STORAGE_ACCESS_ERROR, Toast.LENGTH_SHORT);
}
}
//외부에서 강제로 취소할때 호출 되는 메소드
@Override
protected void onCancelled() {
isCanceled = true;
restore_start = false;
//publishProgress(0);
btnStart.setText(R.string.commencement);
btnClose.setVisibility(View.VISIBLE);
try {
brLogic.setBackupRestoreTime("restore", 2);
context.setDataManager();
} catch (IOException e) {
Logger.e(TAG, "setDataManager", e);
ABVToastUtil.showMakeText(context.getActivity(), R.string.STORAGE_ACCESS_ERROR, Toast.LENGTH_SHORT);
}
}
};
// TODO テスト失敗であるため、一時コメントアウト
// try {
// if (ABVEnvironment.getInstance().networkAdapter.getActiveNetworkType() == ConnectivityManager.TYPE_MOBILE && PreferenceUtil.getBoolean(context.getActivity(), R.string.keyWiFiAlertEnable, true)) {
//
// ABookAlertDialog alertDialog = AlertDialogUtil.createABookAlertDialog(context.getActivity());
// alertDialog.setTitle(R.string.restore);
// alertDialog.setContentView(R.layout.item_check_box_alert);
//
// TextView message = (TextView) alertDialog.findViewById(R.id.message);
// message.setText(String.format(context.getString(R.string.C_E_SYSTEM_0006), context.getString(R.string.restore)));
//
// final CheckBox checkBox = (CheckBox) alertDialog.findViewById(R.id.check_box);
// alertDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// Editor editor = PreferenceManager.getDefaultSharedPreferences(context.getActivity()).edit();
// editor.putBoolean(context.getString(R.string.keyWiFiAlertEnable), !checkBox.isChecked());
// editor.commit();
// restoreTask.execute();
// btnStart.setText(R.string.backup_stop);
// }
// });
//
// alertDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// }
// });
//
// TextView checkBoxMessage = (TextView) alertDialog.findViewById(R.id.check_box_message);
// checkBoxMessage.setText(context.getString(R.string.not_show_nexttime));
// checkBoxMessage.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// checkBox.setChecked(!checkBox.isChecked());
// }
// });
//
// context.showAlertDialog(alertDialog);
// } else {
// restoreTask.execute();
// btnStart.setText(R.string.backup_stop);
// }
// } catch (NetworkDisconnectedException e) {
// ABVToastUtil.showMakeText(context.getActivity(), R.string.NETWORK, Toast.LENGTH_SHORT);
// }
restoreTask.execute();
btnStart.setText(R.string.restore_stop);
} else if (btnStart.getText().equals(context.getResources().getString(R.string.restore_stop))) {
//일시정지 버튼 이벤트
//팝업을 띄워서 선택 가능하게 해주자.
//OK 였을 경우 실제 취소 및 일부 완료 등의 처리
ABookAlertDialog restoreCancelDialog = AlertDialogUtil.createAlertDialog(context.getActivity(), R.string.restore);
restoreCancelDialog.setMessage(R.string.restore_cancel_message);
restoreCancelDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
if (restore_start == true && progressBar.getProgress() != progressBar.getMax()) {
isCanceled = true;
restoreTask.cancel(false);
btnStart.setText(R.string.commencement);
//복원 상태에 대한 텍스트 처리
String proText = (String) tvProText.getText();
proText = proText.replace(context.getResources().getString(R.string.restore_ing), context.getResources().getString(R.string.restore_pause));
tvProText.setText(proText);
}
}
});
restoreCancelDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
}
});
context.showAlertDialog(restoreCancelDialog);
}
}
});
}
}
}
......@@ -142,16 +142,15 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
boolean isLinkedContent = false;
Long projectId = null;
int pageNo = 0;
if (ABVEnvironment.getInstance().isABookCheck()) {
ABVAuthenticatedActivity activity = getCurrentActivity();
if (activity instanceof ABVContentViewActivity) {
projectId = ((ABVContentViewActivity) activity).mProjectId;
isLinkedContent = ((ABVContentViewActivity) activity).isLinkedContent;
pageNo = ((ABVContentViewActivity) activity).pageNo;
}
}
if (ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if (isLinkedContent) {
startContentActivityForLinkedConent(projectId, contentId, pageNo);
} else {
startContentActivity(contentId, page, new Intent());
......@@ -1090,13 +1089,11 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
private void handleUpdateDownload(final ContentZipDownloadNotification data) {
if (data.getDownloadStatus() == DownloadStatusType.Succeeded) {
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
if (!hasProjectListActivity()) { // ProjectListActivityがStackにない場合無視
Logger.w(TAG, "No ProjectListActivity. Ignore download notification.");
return;
}
}
showToast(mContext.getString(R.string.download_success));
handler.postDelayed(new Runnable() { // DLのステータスがDBに反映されれるよりも先に通知が来るため1秒delayさせる。
......
......@@ -540,7 +540,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
releaseInit();
finish();
if (ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
......@@ -777,24 +777,13 @@ public class ContentViewActivity extends ABVContentViewActivity {
overlapLayout.setVisibility(View.GONE);
mBtnRemoteStart.setVisibility(View.GONE);
if (meetingManager.isSubscribed()) {
if (meetingManager.isSubscribed() || meetingManager.isSendable()) {
mBtnMeetingRoomSetting.setVisibility(View.GONE);
}
if (meetingManager.isSendable()) {
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
mBtnMeetingRoomSetting.setVisibility(View.GONE);
} else {
mBtnMeetingRoomSetting.setVisibility(View.VISIBLE);
}
}
if (Options.getInstance(this).getViewerMenuExit() == 1 && !(isProjectPdf())) {
mExitBtn.setVisibility(View.VISIBLE);
}
if (Options.getInstance(this).getViewerMenuHistory() == 1 && !(ABVEnvironment.getInstance().isABookCheck())) {
mHistoryBtn.setVisibility(View.VISIBLE);
}
}
private void initRemoteLayout() {
......@@ -887,9 +876,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
});
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
meetingRoomSettingBtn.setVisibility(View.GONE);
}
ImageButton promoteBtn = (ImageButton) subscriberToolBar.findViewById(R.id.btn_promote);
promoteBtn.setOnClickListener(new View.OnClickListener() {
......@@ -1041,10 +1028,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
showHistoryList(v);
}
});
if (Options.getInstance(this).getViewerMenuHistory() == 0 || ABVEnvironment.getInstance().isABookCheck()) {
mHistoryBtn.setVisibility(View.GONE);
}
ImageButton indexBtn = (ImageButton) mToolBar.findViewById(R.id.btn_index_list);
......@@ -1137,13 +1121,9 @@ public class ContentViewActivity extends ABVContentViewActivity {
mShowedPopupWindow.showAsDropDown(v);
}
});
} else {
mBtnMeetingRoomSetting.setVisibility(View.GONE);
}
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
mBtnMeetingRoomSetting.setVisibility(View.GONE);
}
// 検索
ImageButton search = (ImageButton) mToolBar.findViewById(R.id.btn_search);
......@@ -1237,7 +1217,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
subMenuBtn = (ImageButton) mToolBar.findViewById(R.id.btn_sub_menu);
if(!(isProjectPdf())) {
if (Options.getInstance(this).getFilerFavorite() == 1 || (Options.getInstance(this).getViewerMenuTextcopy() == 1 && mContentJSON.isPdf()) || Options.getInstance(this).getViewerMenuCursor() == 1 || Options.getInstance(this).getViewerMenuShare(contentId) == 1 || Options.getInstance(this).getViewerMenuPdfSendMail(getContentId()) == 1) {
if (mContentJSON.isPdf()) {
subMenuBtn.setOnClickListener(new OnClickListener() {
@Override
......@@ -1249,27 +1229,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
mShowedPopupWindow.setWidth(getRDimensionSize(R.dimen.popup_size_large));
}
final int favoriteIndex;
final int textCopyIndex;
final int cursorIndex;
final int contentShare;
final int pdfSendMailIndex;
ArrayList<String> menuNameList = new ArrayList<>();
// お気に入り機能
int index = 0;
final boolean isExist = contentLogic.isExsitContentFavorite(getContentId());
if (isShowFavoriteItem()) {
if (isExist) {
menuNameList.add(getRString(R.string.remove_favorite_content));
} else {
menuNameList.add(getRString(R.string.add_favorite_content));
}
favoriteIndex = index++;
} else {
favoriteIndex = -1;
}
ArrayList<String> menuNameList = new ArrayList<>();
// テキストコピーが有効な場合のみ
if (Options.getInstance(ContentViewActivity.this).getViewerMenuTextcopy() == 1 && mContentJSON.isPdf()) {
......@@ -1280,47 +1243,16 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
// カーソル機能
if (Options.getInstance(ContentViewActivity.this).getViewerMenuCursor() == 1) {
String addText = isCursorModeEnable() ? "OFF" : "ON";
menuNameList.add(getRString(R.string.cursor) + addText);
cursorIndex = index++;
} else {
cursorIndex = -1;
}
// コンテンツ共有
if (Options.getInstance(ContentViewActivity.this).getViewerMenuShare(contentId) == 1) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ABVDataCache.getInstance().serviceOption.isBizEdition() || hasShareUrl(contentDto)) {
menuNameList.add(getRString(R.string.content_share));
contentShare = index++;
} else {
contentShare = -1;
}
} else {
contentShare = -1;
}
if (Options.getInstance(ContentViewActivity.this).getViewerMenuPdfSendMail(getContentId()) == 1) {
menuNameList.add(getRString(R.string.pdf_mail));
pdfSendMailIndex = index++;
} else {
pdfSendMailIndex = -1;
}
mShowedPopupWindow.setRepresentNames(menuNameList);
mShowedPopupWindow.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position == favoriteIndex) {
// お気に入り
contentLogic.setFavoriteContent(getContentId(), !isExist);
if (isExist) {
ABVToastUtil.showMakeText(getApplicationContext(), AndroidStringUtil.format(getApplicationContext(), R.string.favorite_delete_complete, R.string.favorite), Toast.LENGTH_SHORT);
} else {
ABVToastUtil.showMakeText(getApplicationContext(), AndroidStringUtil.format(getApplicationContext(), R.string.favorite_add_complete, R.string.favorite), Toast.LENGTH_SHORT);
}
} else if (position == textCopyIndex) {
if (position == textCopyIndex) {
// テキストコピー
showTextDialog(mCurrentPageNumber);
} else if (position == cursorIndex) {
......@@ -1332,25 +1264,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
slide.setChecked(true);
}
configureCursorMode();
} else if (position == pdfSendMailIndex) {
try {
ContractLogic cl = AbstractLogic.getLogic(ContractLogic.class);
DownloadedContentInfoJSON json = ContentFileUtil.getDownloadedContentInfoJSON(getContentId());
if (!cl.getPdfSendMail()) {
// サービスオプションがNの場合
ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(ContentViewActivity.this, getString(R.string.pdf_mail), getString(R.string.mail_no_service));
messageDialog.setNegativeButton(R.string.ok, null);
messageDialog.show();
} else if (!json.pdfSendMailFlg) {
ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(ContentViewActivity.this, getString(R.string.pdf_mail), getString(R.string.mail_no_content));
messageDialog.setNegativeButton(R.string.ok, null);
messageDialog.show();
} else {
showPdfSendMailDialog(json);
}
} catch (Exception e) {
Logger.e(TAG, "error", e);
}
}
mShowedPopupWindow.dismiss();
}
......@@ -1421,17 +1334,14 @@ public class ContentViewActivity extends ABVContentViewActivity {
mMainLayout.addView(mToolBar, param1);
if (!mContentJSON.isPdf()) { // PDF以外の場合お気に入り(カーソル、マーキング)のみの表示にする。(本来はボタンの生成自体が不要であるが)
// sendMail.setVisibility(View.GONE);
search.setVisibility(View.GONE);
// viewText.setVisibility(View.GONE);
}
if (isProjectPdf()) {
m_progress = (ProgressBar) mToolBar.findViewById(R.id.refresh_prog);
}
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ContentJSON.KEY_PDF_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_NONE_TYPE.equals(contentDto.contentType)
......@@ -1655,11 +1565,9 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Logger.d(TAG, "KeyEvent.KEYCODE_BACK");
if (ABVEnvironment.getInstance().isABookCheck() && mProjectId != null) {
if (mProjectId > -1) {
if (mProjectId != null && mProjectId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId);
}
}
if (isVideoMax) {
videoMaxToDefault();
......@@ -1679,7 +1587,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
allReset();
mActivityFinishFlg = true;
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
goToBack();
} else {
moveToBack();
......@@ -2815,12 +2723,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (ABVDataCache.getInstance().serviceOption.isPayment()) { // 決済ありの時は無視
break;
}
//コンテンツリンクに紐づいたAction Buttonのイベント
long linkContentId = actionInfoJSON.getContentId();
// プロジェクト関連資料なのかをチェック
if (ABVEnvironment.getInstance().isABookCheck()) {
if (ActivityHandlingHelper.getInstance().isExistCommonContent(getContentId())) {
if (!ActivityHandlingHelper.getInstance().isExistCommonContent(linkContentId)) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_not_common_content, Toast.LENGTH_SHORT);
......@@ -2832,9 +2738,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
break;
}
}
}
if (ABVEnvironment.getInstance().isABookCheck()) {
linkDownloadChecked(linkContentId, (int) actionInfoJSON.getPageNo());
try {
if (ActivityHandlingHelper.getInstance().checkContent(linkContentId, (int) actionInfoJSON.getPageNo())) { // コンテンツをチェックし、なければDL後開く
......@@ -2848,7 +2751,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
Logger.e(TAG, "startContentActivity failed.", e);
ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107);
}
}
break;
//ym.chae
......
......@@ -242,12 +242,9 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
} else {
historyListBtn.setVisibility(View.GONE);
subMenuBtn.setVisibility(View.GONE);
}
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
subMenuBtn.setVisibility(View.GONE);
}
final ImageButton btnWebClose = (ImageButton) findViewById(R.id.btnWebClose);
btnWebClose.setOnClickListener(new View.OnClickListener() {
......@@ -571,11 +568,6 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
}
});
if(!(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent)) {
configureRemote();
}
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (isStreaming && PreferenceUtil.get(this, DefPrefKey.PERMISSION_ACCESS_LOCATION, false)
&& AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()
......@@ -616,8 +608,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
locationManagerUtil.startLocationService();
}
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ContentJSON.KEY_ENQUETE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_EXAM_TYPE.equals(contentDto.contentType)) {
closeButton.setBackgroundResource(R.drawable.btn_first_back);
......@@ -631,6 +622,8 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
promoteBtn.setVisibility(View.GONE);
pauseBtn.setVisibility(View.GONE);
}
} else {
configureRemote();
}
}
......@@ -754,7 +747,7 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
setResult(RESULT_OK, new Intent());
finish();
if (objectId == -1) { // Enqueteコンテンツの場合で、KeyUpではない場合、全コンテンツActivityを終了
if(!(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent)) {
if(!isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
}
}
......@@ -784,9 +777,6 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
closeButton.setVisibility(View.INVISIBLE);
historyListBtn.setVisibility(View.INVISIBLE);
if (meetingManager.isPaused()) {
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
mBtnRemoteStart.setVisibility(View.VISIBLE);
pauseBtn.setVisibility(View.GONE);
exitMeetingBtn.setVisibility(View.GONE);
......@@ -804,9 +794,6 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
closeButton.setVisibility(View.VISIBLE);
if (objectId == -1) {
historyListBtn.setVisibility(View.VISIBLE);
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
}
else {
historyListBtn.setVisibility(View.GONE);
......@@ -834,10 +821,8 @@ public class EnqueteWebViewActivity extends ABVContentViewActivity {
}
});
}
if (ABVEnvironment.getInstance().isABookCheck()) {
historyListBtn.setVisibility(View.GONE);
}
}
@Override
public void onDownloadingContentZip(ContentZipDownloadNotification notification) { // Streaming表示でダウンロードが完了した場合
......
......@@ -215,9 +215,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
});
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
subMenuBtn.setVisibility(View.GONE);
}
if (isStreaming) {
btnWebBack.setVisibility(View.GONE);
......@@ -494,9 +492,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
});
if(!(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent)) {
configureRemote();
}
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (isStreaming && PreferenceUtil.get(this, DefPrefKey.PERMISSION_ACCESS_LOCATION, false)
......@@ -537,12 +533,9 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
});
locationManagerUtil.startLocationService();
}
if (ABVEnvironment.getInstance().isABookCheck()) {
historyListBtn.setVisibility(View.GONE);
}
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ContentJSON.KEY_MOVIE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_MUSIC_TYPE.equals(contentDto.contentType)
|| ContentJSON.KEY_PANO_IMAGE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_PANO_MOVIE_TYPE.equals(contentDto.contentType)
......@@ -572,6 +565,8 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
historyListBtn.setVisibility(View.GONE);
subMenuBtn.setVisibility(View.GONE);
}
} else {
configureRemote();
}
}
......@@ -675,19 +670,16 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (ABVEnvironment.getInstance().isABookCheck() && mProjectId != null) {
if (mProjectId > -1) {
if (mProjectId != null && mProjectId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId);
}
}
if (isStreaming) {
callExistsSendLog();
return true;
}
else {
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
goToBack();
// moveToBack();
} else {
finishActivity();
}
......@@ -715,7 +707,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
setResult(RESULT_OK, new Intent());
finish();
if (objectId == -1) { // HTMLコンテンツの場合で、KeyUpではない場合、全コンテンツActivityを終了
if (ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
......@@ -748,9 +740,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
closeButton.setVisibility(View.INVISIBLE);
historyListBtn.setVisibility(View.INVISIBLE);
if (meetingManager.isPaused()) {
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
mBtnRemoteStart.setVisibility(View.VISIBLE);
pauseBtn.setVisibility(View.GONE);
exitMeetingBtn.setVisibility(View.GONE);
......@@ -766,9 +755,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
closeButton.setVisibility(View.VISIBLE);
if (objectId == -1) {
historyListBtn.setVisibility(View.VISIBLE);
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
} else {
historyListBtn.setVisibility(View.GONE);
subMenuBtn.setVisibility(View.GONE);
......@@ -803,8 +789,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
Logger.i(TAG, "onDownloadingContentZip ...........................................>");
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
Logger.d(TAG, "onDownloadingContentZip ...........................................>");
if (notification.getDownloadStatus() == DownloadStatusType.Downloading) {
Logger.d(TAG, "onDownloadingContentZip .....................Downloading......................>");
ABVToastUtil.showMakeText(getApplicationContext(), R.string.reader_downloading, Toast.LENGTH_SHORT);
......@@ -815,9 +800,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
Logger.d(TAG, "onDownloadingContentZip .........................Succeeded..................>");
ABVToastUtil.showMakeText(getApplicationContext(), R.string.download_success, Toast.LENGTH_SHORT);
}
} else {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.download_success, Toast.LENGTH_SHORT);
}
downloadButton.setVisibility(View.GONE);
}
});
......
......@@ -216,9 +216,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
});
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
subMenuBtn.setVisibility(View.GONE);
}
final Button btnWebBack = (Button) findViewById(R.id.btnWebBack);
final Button btnWebForward = (Button) findViewById(R.id.btnWebForward);
......@@ -384,7 +382,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
param.put(ABookKeys.URI, url);
// プロジェクト関連資料なのかをチェック
if ( url.startsWith(ABookKeys.CONTENTLINK) && ABVEnvironment.getInstance().isABookCheck()) {
if ( url.startsWith(ABookKeys.CONTENTLINK)) {
Long dstContentId = Long.valueOf(param.get("contentId"));
if (ActivityHandlingHelper.getInstance().isExistCommonContent(contentId)) {
if (!ActivityHandlingHelper.getInstance().isExistCommonContent(dstContentId)) {
......@@ -540,23 +538,15 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
configureRemote();
}
});
if(!(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent)) {
configureRemote();
}
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (isStreaming && PreferenceUtil.get(this, AppDefType.DefPrefKey.PERMISSION_ACCESS_LOCATION, false)
&& AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()
&& getResources().getInteger(R.integer.usable_location_service) == 1) {
setLocation(false, true);
}
if (ABVEnvironment.getInstance().isABookCheck()) {
historyListBtn.setVisibility(View.GONE);
}
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ContentJSON.KEY_MOVIE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_MUSIC_TYPE.equals(contentDto.contentType)
|| ContentJSON.KEY_PANO_IMAGE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_PANO_MOVIE_TYPE.equals(contentDto.contentType)
......@@ -586,8 +576,9 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
historyListBtn.setVisibility(View.GONE);
subMenuBtn.setVisibility(View.GONE);
}
} else {
configureRemote();
}
}
private void removeNewFlag() {
......@@ -690,19 +681,16 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (ABVEnvironment.getInstance().isABookCheck() && mProjectId != null ) {
if (mProjectId > -1) {
if (mProjectId != null && mProjectId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_PROJECT_ID, mProjectId);
}
}
if (isStreaming) {
callExistsSendLog();
return true;
}
else {
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
goToBack();
// moveToBack();
} else {
finishActivity();
}
......@@ -728,7 +716,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
protected void finishActivity() {
setResult(RESULT_OK, new Intent());
finish();
if (ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
......@@ -763,15 +751,11 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
closeButton.setVisibility(View.INVISIBLE);
historyListBtn.setVisibility(View.INVISIBLE);
if (meetingManager.isPaused()) {
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
mBtnRemoteStart.setVisibility(View.VISIBLE);
pauseBtn.setVisibility(View.GONE);
exitMeetingBtn.setVisibility(View.GONE);
promoteBtn.setVisibility(View.GONE);
}
else {
} else {
subMenuBtn.setVisibility(View.GONE);
mBtnRemoteStart.setVisibility(View.GONE);
pauseBtn.setVisibility(View.VISIBLE);
......@@ -782,11 +766,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
closeButton.setVisibility(View.VISIBLE);
if (objectId == -1) {
historyListBtn.setVisibility(View.VISIBLE);
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
}
else {
} else {
historyListBtn.setVisibility(View.GONE);
subMenuBtn.setVisibility(View.GONE);
}
......
......@@ -68,9 +68,8 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
showHistoryList(v);
}
});
if (ABVEnvironment.getInstance().isABookCheck()) {
historyListBtn.setVisibility(View.INVISIBLE);
}
subMenuBtn = (ImageButton) findViewById(R.id.btn_sub_menu);
subMenuBtn.setOnClickListener(new OnClickListener() {
......@@ -84,30 +83,11 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
}
ArrayList<String> menuNameList = new ArrayList<>();
final boolean isExist = contentLogic.isExsitContentFavorite(getContentId());
final boolean isShowFavatite = isShowFavoriteItem();
if (isShowFavatite) {
if (isExist) {
menuNameList.add(getRString(R.string.remove_favorite_content));
} else {
menuNameList.add(getRString(R.string.add_favorite_content));
}
}
mShowedPopupWindow.setRepresentNames(menuNameList);
mShowedPopupWindow.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
// お気に入り
if (isShowFavatite) {
contentLogic.setFavoriteContent(getContentId(), !isExist);
break;
}
default:
break;
}
mShowedPopupWindow.dismiss();
}
});
......@@ -116,9 +96,7 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
}
});
if(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck()) {
subMenuBtn.setVisibility(View.GONE);
}
mBtnRemoteStart = (ImageButton) findViewById(R.id.btn_remote_start);
mBtnRemoteStart.setOnClickListener(new View.OnClickListener() {
......@@ -157,12 +135,7 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
}
});
if(!(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent)) {
configureRemote();
}
if(ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if(isLinkedContent) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ContentJSON.KEY_IMAGE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_MOVIE_TYPE.equals(contentDto.contentType)
|| ContentJSON.KEY_PANO_IMAGE_TYPE.equals(contentDto.contentType) || ContentJSON.KEY_PANO_MOVIE_TYPE.equals(contentDto.contentType)
......@@ -179,6 +152,8 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
promoteBtn.setVisibility(View.GONE);
pauseBtn.setVisibility(View.GONE);
}
} else {
configureRemote();
}
}
......@@ -188,13 +163,7 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
exitBtn.setVisibility(View.INVISIBLE);
historyListBtn.setVisibility(View.INVISIBLE);
if (meetingManager.isPaused()) {
if (Options.getInstance(this).getFilerFavorite() == 1) {
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
} else {
subMenuBtn.setVisibility(View.GONE);
}
mBtnRemoteStart.setVisibility(View.VISIBLE);
pauseBtn.setVisibility(View.GONE);
exitMeetingBtn.setVisibility(View.GONE);
......@@ -211,27 +180,19 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
else {
exitBtn.setVisibility(View.VISIBLE);
historyListBtn.setVisibility(View.VISIBLE);
if (Options.getInstance(this).getFilerFavorite() == 1) {
if(!(ABVDataCache.getInstance().serviceOption.isABookCheck() && ABVEnvironment.getInstance().isABookCheck())) {
subMenuBtn.setVisibility(View.VISIBLE);
}
} else {
subMenuBtn.setVisibility(View.GONE);
}
mBtnRemoteStart.setVisibility(View.GONE);
pauseBtn.setVisibility(View.GONE);
switchMeetingExitButton();
promoteBtn.setVisibility(View.GONE);
}
if (ABVEnvironment.getInstance().isABookCheck()) {
historyListBtn.setVisibility(View.INVISIBLE);
}
}
protected void finishActivity() {
Logger.d(TAG, "finishActivity");
finish();
if (ABVEnvironment.getInstance().isABookCheck() && isLinkedContent) {
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
......
......@@ -85,7 +85,7 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
btnLinkOriginalBack = (Button) findViewById(R.id.btn_link_original_back);
if (ABVEnvironment.getInstance().isABookCheck() && !isLinkedContent) {
if (!isLinkedContent) {
addSceneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......
......@@ -116,28 +116,13 @@ account_path=agtcatalog
#0:表示しない(全部の固定)、1:表示する
location_mode=1
#表示切り替え 2014/02/11 Ver1.1
#0:全部表示、1:サムネイル固定、2:パネル固定、3:リスト固定 (0:以外は「表示切替メニュー」を表示しない)
view_mode_type=0
#お気に入り
filer_favorite=0
#コンテンツタイプ
filer_content_type=1
#Setting Menu
#一般設定
setting_menu_general=1
#ビューア設定
setting_menu_viewer=1
#アカウント
setting_menu_account=1
#ログアウト
setting_menu_logout=1
#パスワード変更
setting_menu_password_change=1
#バックアップ/リストア
setting_menu_backup=1
#ログ情報
setting_menu_log_info=1
#アプリ情報
......@@ -156,12 +141,6 @@ viewer_menu_history=1
viewer_menu_index=1
#検索
viewer_menu_search=1
#共有
viewer_menu_share=1
#PDFメール送信
viewer_menu_pdf_send_mail=1
#カーソル
viewer_menu_cursor=1
#メモ
viewer_menu_memo=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