Commit 3e307bda by Lee Jaebin

ソース分離

parent 32ec4e3a
......@@ -146,10 +146,6 @@ public class Constant {
}
public interface editionType {
int BIZ = 1;
int SIGNAGE = 2;
int AD = 3;
int READER = 4;
int CHECK = 5;
}
}
......@@ -96,4 +96,25 @@ public class ABookKeys {
public static final int HTTP_STATUS_SUCCESS = 200;
public static final String HELP_VIEW_TYPE = "helpViewType";
public static final String ABOOK = "abook";
public static final String MOVEPAGE = "/abookmovepage";
public static final String DETAILLOG = "/abookdetaillog";
public static final String CONTENTLINK = "/abookcontentlink";
public static final String NEXTCONTENT = "/abooknextcontent";
public static final String SEND_CUSTOM_LOG = "/abooksendcustomlog";
public static final String GETITS_OPEN_SHARE = "/abookopengetitsshare";
public static final String PING = "/ping";
public static final String CMD_GETITS_OPEN_SHARE = "opengetitsshare";
public static final String CMD_GETITS_CLOSE_SHARE = "closegetitsshare";
public static final String PARAM_LAST_PAGE_NUMBER = "lastPageNo";
public static final String PARAM_LAST_PAGE_START_DATE = "lastPageStartDate";
public static final String PARAM_READING_LOG_ID = "readingLogId";
public static final String PARAM_SHARE_URL = "shareUrl";
public static final String URI = "uri";
public static final String CLOSE = "CLOSE";
public static final String OK = "OK";
}
......@@ -15,7 +15,7 @@ public class DatabaseVersions {
public static final int Plus_1_3_0 = 11; // 2014/01/27 ABook+1.3
public static final int Plus_1_4_0_OLD = 12; // 2014/04/1 ABook+1.4旧
public static final int Plus_1_4_0 = 20; // 2014/05/21 ABook+1.4
public static final int Plus_1_4_3 = 30; // 2014/05/21 ABook+1.4.3
public static final int Plus_1_4_3 = 30; // 2014/05/21 ABook+1.4.3
public static final int Plus_1_5_0 = 40; // 2014/07/25 ABook+1.5
public static final int Plus_1_5_2 = 50; // 2014/07/25 ABook+1.5.2
public static final int Plus_1_6_0 = 60; // 2014/12/01 ABook+1.6.0
......
......@@ -1082,7 +1082,7 @@ public class ContentDao extends AbstractDao {
sql.append(" ON tc.content_id = rcc.content_id ");
sql.append(" INNER JOIN m_category AS mc ");
sql.append(" ON rcc.category_relation_id = mc.category_relation_id ");
sql.append(" WHERE tc.common_content_flg = 1");
sql.append(" WHERE tc.common_content_flg = 1");
sql.append(" ORDER BY mc.category_id, tc.content_id DESC ");
return rawQueryGetDtoList(sql.toString(), null, ContentDto.class);
......
......@@ -95,10 +95,6 @@ public class ProjectContentDao extends AbstractDao {
}
}
public void deleteAll() {
delete("r_project_content", null, null);
}
/**
* リストを削除
* @param projectId
......
......@@ -36,7 +36,6 @@ public class ContractLogic extends AbstractLogic {
private static final String True = "Y";
private ServiceOptionDao serviceOptionDao = AbstractDao.getDao(ServiceOptionDao.class);
private AcmsDao acmsDao = AbstractDao.getDao(AcmsDao.class);
private ContractDao contractDao = AbstractDao.getDao(ContractDao.class);
/**
* {@link ContractLogic} クラスのインスタンスを初期化します。
......@@ -77,31 +76,6 @@ public class ContractLogic extends AbstractLogic {
}
/**
* ABookMaker専用 。
* @throws Exception
* @since 1.0.0
*/
public void insertServiceOption(List<ServiceOptionDto> list) {
if (list != null && list.size() > 0) {
try {
serviceOptionDao.beginTransaction();
serviceOptionDao.deleteServiceOptions();
serviceOptionDao.insertServiceOptions(list);
serviceOptionDao.commit();
cache.addServiceOptions(list);
} catch (Exception e) {
serviceOptionDao.rollback();
throw new RuntimeException(e);
} finally {
}
}
}
/**
* 権限喪失,非公開,削除時のDL済コンテンツ強制削除するかどうかを示します。
* @return 権限喪失,非公開,削除時のDL済コンテンツ強制削除する場合、trueを返します。
* @since 1.0.0
......@@ -448,80 +422,4 @@ public class ContractLogic extends AbstractLogic {
public static boolean getBooleanValue(String value) {
return True.equals(value);
}
public ContractDto getContractByContentId(long contentId) {
ContentIdConvDto contentIdConvDto = AbstractDao.getDao(ContentIdConvDao.class).getDto(contentId);
if (contentIdConvDto == null) {
Logger.e(TAG, "contentId not found in ContentIdConv" + contentId);
return null;
}
return contractDao.getDto(contentIdConvDto.siteId, contentIdConvDto.contractId);
}
/**
* 事業者のプッシュメッセージ設定を更新します<br>
* Repository Serverに更新情報を送信します
*
* @param repositoryFqdn
* @param registractionId
* @param contractDto
* @throws AcmsException
* @throws NetworkDisconnectedException
*/
public void updateReceivePushMessage(String repositoryFqdn, String registractionId, ContractDto contractDto) throws AcmsException, NetworkDisconnectedException {
try {
contractDao.beginTransaction();
contractDto.userUpdateDate = DateTimeUtil.getCurrentDate();
contractDao.update(contractDto);
// プッシュメッセージを受信する事業者の情報を送信する
List<ContractDto> permitContractList = contractDao.findByReceivePushMessage(ReceivePushMessage.PERMIT);
RepoClient.getInstance().sendReaderUserAccount(repositoryFqdn, registractionId, permitContractList);
contractDao.commit();
} catch (AcmsException e) {
contractDao.rollback();
throw e;
} catch (NetworkDisconnectedException e) {
contractDao.rollback();
throw e;
}
}
/**
* 事業者のプッシュメッセージ設定を更新します<br>
* Repository Serverに更新情報を送信します
*
* @param repositoryFqdn
* @param registractionId
* @param contractDtoList
* @throws AcmsException
* @throws NetworkDisconnectedException
*/
public void updateReceivePushMessage(String repositoryFqdn, String registractionId, List<ContractDto> contractDtoList) throws AcmsException, NetworkDisconnectedException {
try {
ArrayList<ContractDto> permitContractList = new ArrayList<ContractDto>();
for (ContractDto contractDto : contractDtoList) {
if (contractDto.receivePushMessage == ReceivePushMessage.PERMIT) {
permitContractList.add(contractDto);
}
}
// プッシュメッセージを受信する事業者の情報を送信する
RepoClient.getInstance().sendReaderUserAccount(repositoryFqdn, registractionId, permitContractList);
contractDao.beginTransaction();
for (ContractDto contractDto : contractDtoList) {
contractDto.userUpdateDate = DateTimeUtil.getCurrentDate();
contractDao.update(contractDto);
}
contractDao.commit();
} catch (AcmsException e) {
contractDao.rollback();
throw e;
} catch (NetworkDisconnectedException e) {
contractDao.rollback();
throw e;
}
}
}
......@@ -192,64 +192,10 @@ public class ProjectLogic extends AbstractLogic {
}
mPushMessageDao.delete(deleteProjectDto.projectId);
mProjectDao.delete(deleteProjectDto);
if (deleteProjectDto.contentId != null) {
ContentDto contentDto = mContentDao.getContent(deleteProjectDto.contentId);
if (contentDto != null) {
AbstractLogic.getLogic(ContentLogic.class).deleteContent(contentDto, true);
}
}
String projectTaskDirPath = ABVEnvironment.getInstance().getProjectDirFile(deleteProjectDto.projectId);
FileUtil.delete(projectTaskDirPath);
}
// for (ProjectDto serverProjectDto : serverProjects) {
//
//
// int localProjectIndex = localProjects.indexOf(serverProjectDto);
// if (localProjectIndex >= 0) {
// ProjectDto localDto = localProjects.get(localProjectIndex);
// if (!serverProjectDto.equalsLastEdit(localDto)) {
// serverProjectDto.needSyncFlg = true;
// mProjectContentDao.deleteProjectContent(serverProjectDto.projectId);
// for (ProjectContentDto projectContentDto : serverProjectDto.projectContentDtoList) {
// mProjectContentDao.insertProjectContent(projectContentDto);
// }
// mProjectDao.update(serverProjectDto);
// }
// localProjects.remove(localDto);
// } else {
// // プロジェクトの登録
// serverProjectDto.needSyncFlg = true;
// mProjectDao.insert(serverProjectDto);
// // 関連資料の登録
// for (ProjectContentDto projectContentDto : serverProjectDto.projectContentDtoList) {
// mProjectContentDao.insertProjectContent(projectContentDto);
// }
// }
//
// for (PushMessageDto dto : serverProjectDto.pushMessageList) {
// mPushMessageDao.insert(dto);
// }
// }
//
// // サーバーから取得したプロジェクト情報がローカルに存在しないので削除する
// for (ProjectDto localProjectDto : localProjects) {
// List<TaskDto> taskDtoList = mTaskDao.selectAllTaskByProjectId(localProjectDto.projectId);
// for(TaskDto taskDto : taskDtoList) {
// mTaskDao.delete(taskDto);
// }
// mPushMessageDao.delete(localProjectDto.projectId);
// mProjectDao.delete(localProjectDto);
// if (localProjectDto.contentId != null) {
// ContentDto contentDto = mContentDao.getContent(localProjectDto.contentId);
// if (contentDto != null) {
// AbstractLogic.getLogic(ContentLogic.class).deleteContent(contentDto, true);
// }
// }
// String projectTaskDirPath = ABVEnvironment.getInstance().getProjectDirFile(localProjectDto.projectId);
// FileUtil.delete(projectTaskDirPath);
// }
}
/**
......
package jp.agentec.abook.abv.bl.net;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.adf.net.http.SimpleWebServer;
/**
* 360°コンテンツ表示用WebServer
*
* Created by tsukada on 2016/02/12.
*/
public class PanoServer extends SimpleWebServer {
private static final java.lang.String TAG = "PanoServer";
public static final String ABOOK = "abook";
public static final String MOVEPAGE = "/abookmovepage";
public static final String DETAILLOG = "/abookdetaillog";
public static final String CONTENTLINK = "/abookcontentlink";
public static final String NEXTCONTENT = "/abooknextcontent";
public static final String SEND_CUSTOM_LOG = "/abooksendcustomlog";
public static final String GETITS_OPEN_SHARE = "/abookopengetitsshare";
public static final String PING = "/ping";
public static final String CMD_GETITS_OPEN_SHARE = "opengetitsshare";
public static final String CMD_GETITS_CLOSE_SHARE = "closegetitsshare";
public static final String PARAM_LAST_PAGE_NUMBER = "lastPageNo";
public static final String PARAM_LAST_PAGE_START_DATE = "lastPageStartDate";
public static final String PARAM_READING_LOG_ID = "readingLogId";
public static final String PARAM_SHARE_URL = "shareUrl";
public static final String URI = "uri";
public static final String CLOSE = "CLOSE";
public static final String OK = "OK";
public static final int MAX_NO_ACCESS_TIME = 60000; // pingがこれ以上の間来ない場合にコンテンツ閲覧終了とみなす(ミリ秒)
private Callback callback;
private Long contentId;
private Thread panoCheckThread;
private boolean isCloseWaiting = false;
public PanoServer(String host, int port, Long contentId, String wwwroot, boolean quiet, boolean extAccess, List<String> userAgentList, Callback callback) {
super(host, port, wwwroot, quiet, extAccess, userAgentList);
this.contentId = contentId;
this.callback = callback;
panoCheckThread = new Thread() { // チェックスレッド(リクエストが一定時間以上ない場合に終了させる)
@Override
public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
break;
}
if (System.currentTimeMillis() - getLastAccess() > PanoServer.MAX_NO_ACCESS_TIME) {
callStop();
break;
}
}
}
};
}
@Override
public void start(final int timeout, boolean daemon) throws IOException {
super.start(timeout, daemon);
panoCheckThread.start();
}
@Override
protected String modifyUri(String uri) throws Exception {
if (!uri.startsWith("/" + contentId + "/")) {
Logger.e(TAG, "invalid uri. server=" + getHostname());
throw new Exception("You are not allowed to access.");
}
uri = uri.substring(("/" + contentId).length());
return super.modifyUri(uri);
}
@Override
protected Response getResponse(String uri, Map<String, String> params, Map<String, String> headers, IHTTPSession session) {
if (isCloseWaiting()) {
return newFixedLengthResponse(CLOSE);
}
else if (uri.startsWith(PING)) {
return newFixedLengthResponse(OK);
}
else if (uri.startsWith(MOVEPAGE) || uri.startsWith(DETAILLOG) || uri.startsWith(CONTENTLINK)) {
params.put(URI, uri);
Object ret = callback.callback(params);
if (ret != null) {
return newFixedLengthResponse(ret.toString());
}
return newFixedLengthResponse(OK);
}
else {
return super.getResponse(uri, params, headers, session);
}
}
public void callStop() {
if (!isCloseWaiting()) {
isCloseWaiting = true;
callback.callback(contentId);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
PanoServer.this.stop();
}
}, 30000L);
}
if (panoCheckThread != null) {
panoCheckThread.interrupt();
panoCheckThread = null;
}
}
public boolean isCloseWaiting() {
return isCloseWaiting;
}
}
\ No newline at end of file
......@@ -137,33 +137,6 @@ public class RepoClient {
AbstractDao.getDao(EnqueteDao.class).deleteUnsendEnquete(contentListStr);
}
/**
* ShareKeyを解決し、コンテンツ情報・ダウンロード先を取得する
*
* @param repositoryFqdn
* @param shareKey
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ReaderContentJSON resolveShareKey(String repositoryFqdn, String shareKey, String password) throws NetworkDisconnectedException, AcmsException {
String keyForReader = SecurityUtil.getEncryptString(ReaderConstant.SHARED_SECRET_REPO, "" + System.currentTimeMillis(), true);
String url = "https://" + repositoryFqdn + "/repo/getDlUrl?key="+ keyForReader + "&shareKey=" + shareKey
+ (StringUtil.isNullOrEmpty(password)?"":"&password="+password) + "&language=" + Locale.getDefault().getLanguage() + "&checkOnly=n";
HttpResponse response = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).send(url , "", null);
Logger.d(TAG, "resolveShareKey response=%s", response.httpResponseBody);
return new ReaderContentJSON(response.httpResponseBody, "http://" + repositoryFqdn + "/" + shareKey);
}
public ReaderContentJSON resolveShareKeyCheckOnly(String repositoryFqdn, String shareKey, String password) throws NetworkDisconnectedException, AcmsException {
String keyForReader = SecurityUtil.getEncryptString(ReaderConstant.SHARED_SECRET_REPO, "" + System.currentTimeMillis(), true);
String url = "https://" + repositoryFqdn + "/repo/getDlUrl?key="+ keyForReader + "&shareKey=" + shareKey
+ (StringUtil.isNullOrEmpty(password)?"":"&password="+password) + "&language=" + Locale.getDefault().getLanguage() + "&checkOnly=y";
HttpResponse response = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).send(url , "", null);
Logger.d(TAG, "resolveShareKey response=%s", response.httpResponseBody);
return new ReaderContentJSON(response.httpResponseBody, "http://" + repositoryFqdn + "/" + shareKey);
}
public AcmsCommonJSON sendReaderUserAccount(String repositoryFqdn, String registractionId, List<ContractDto> permitContractList) throws AcmsException, NetworkDisconnectedException {
// 送信
StringBuilder sb = new StringBuilder();
......
......@@ -56,9 +56,6 @@
</intent-filter>
</receiver>
<service android:name="jp.agentec.abook.abv.cl.beacon.BeaconIntentService" />
<service android:name="jp.agentec.abook.abv.cl.beacon.BeaconPeriodicService" />
<service android:name="jp.agentec.abook.abv.cl.push.ABVFcmListenerService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"></action>
......@@ -166,11 +163,6 @@
android:label="LoginActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity
android:name="jp.agentec.abook.abv.ui.home.activity.ContentDetailViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="ContentDetailViewActivity"
android:theme="@style/Theme_Contentdetailview" />
<activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="false"
......@@ -206,11 +198,6 @@
android:label="LoginPasswordChangeActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.PanoViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity" android:theme="@android:style/Theme.NoTitleBar"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/>
......
......@@ -40,7 +40,6 @@ android {
resValue("bool", "follow_service_option", "${follow_service_option}")
resValue("bool", "is_check_invalid_passward_limit", "${is_check_invalid_passward_limit}")
resValue("bool", "repeat_default", "${repeat_default}")
resValue("integer", "pano_web_server_port", "${pano_web_server_port}")
resValue("string", "version_name", "${version_name}")
resValue("string", "release_date", "${release_date}")
resValue("string", "copy_right", "${copy_right}")
......@@ -53,9 +52,6 @@ android {
resValue("integer", "app_log_retention", "${app_log_retention}")
resValue("bool", "hprof", "${hprof}")
resValue("string", "repository_fqdn", "${repository_fqdn}")
resValue("string", "default_content_key", "${default_content_key}")
resValue("array", "Beacon_UUID", "${Beacon_UUID}")
resValue("integer", "beacon_scan_interval", "${beacon_scan_interval}")
//abvFunctionOptions
resValue("integer", "login_mode", "${login_mode}")
......
......@@ -15,7 +15,6 @@ dependencies {
api 'com.google.firebase:firebase-messaging:11.4.0'
implementation 'commons-codec:commons-codec:1.10'
implementation 'org.xerial:sqlite-jdbc:3.7.2'
implementation 'net.lingala.zip4j:zip4j:1.3.2'
implementation 'com.google.guava:guava:18.0'
implementation 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
......
package jp.agentec.abook.abv.cl.beacon;
public class Beacon {
public String uuid;
public String major;
public String minor;
public int rssi;
public long receiveTime;
public boolean isSameBeacon(Beacon beacon) {
return beacon.uuid.equals(uuid) && beacon.major.equals(major) && beacon.minor.equals(minor);
}
public boolean isNear(){
// 0~5m
return rssi > -70;
}
}
\ No newline at end of file
package jp.agentec.abook.abv.cl.beacon;
import jp.agentec.abook.abv.cl.util.AppUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.BeaconKey;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
public class BeaconBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (AppUtil.isAppForground(context)) {
Intent i = new Intent(AppDefType.Intent.Action_Receive_Message);
i.putExtra(BeaconKey.major, intent.getStringExtra(BeaconKey.major));
i.putExtra(BeaconKey.minor, intent.getStringExtra(BeaconKey.minor));
context.sendBroadcast(i);
} else {
ComponentName comp = new ComponentName(context.getPackageName(), BeaconIntentService.class.getName());
startWakefulService(context, (intent.setComponent(comp)));
}
}
}
package jp.agentec.abook.abv.cl.beacon;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.BeaconKey;
import android.annotation.TargetApi;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.WakefulBroadcastReceiver;
public class BeaconIntentService extends IntentService {
private NotificationManager mNotificationManager;
NotificationCompat.Builder builder;
private static int mNotificationConnect = 0;
public BeaconIntentService() {
super("BeaconIntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
Bundle extras = intent.getExtras();
if (!extras.isEmpty()) {
sendNotification(extras.getString(BeaconKey.major), extras.getString(BeaconKey.minor));
}
WakefulBroadcastReceiver.completeWakefulIntent(intent);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void sendNotification(String major, String minor) {
mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder nb = new Notification.Builder(this);
nb.setDefaults(Notification.DEFAULT_ALL);
nb.setSmallIcon(R.drawable.icon);
nb.setWhen(System.currentTimeMillis());
nb.setAutoCancel(true);
Intent intent = new Intent(Intent.ACTION_VIEW);
String downloadUrl = getDownloadUrl(major, minor);
Uri.Builder uriBuilder = new Uri.Builder();
uriBuilder.scheme(getString(R.string.scheme_url));
uriBuilder.authority("abook");
uriBuilder.appendQueryParameter(ABVActivity.URL, downloadUrl);
uriBuilder.appendQueryParameter(ABVActivity.PASSWORD, "" + 0);
intent.setData(uriBuilder.build());
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
nb.setContentTitle(getString(R.string.app_name));
nb.setContentText(getString(R.string.receive_message)+ "(" + major + minor + ")");
nb.setContentIntent(pi);
Notification n;
if (android.os.Build.VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN_MR1) {
//noinspection deprecation(API16から非推奨になった無視)
n = nb.getNotification();
} else {
n = nb.build();
}
n.flags |= Notification.FLAG_SHOW_LIGHTS;
n.flags |= Notification.FLAG_AUTO_CANCEL;
// Notification ID 증가 0~999 까지 순환
mNotificationConnect = (mNotificationConnect + 1) % 1000;
mNotificationManager.notify(mNotificationConnect, n);
}
// テキスト内からダウンロードURLを検索して返します
private String getDownloadUrl(String major, String minor) {
return "http://" + getString(R.string.repository_fqdn) + "/" + major + minor;
}
}
package jp.agentec.abook.abv.cl.beacon;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
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.BeaconHistoryDao;
import jp.agentec.abook.abv.bl.dto.BeaconHistoryDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
public class BeaconPeriodicService extends Service {
private final String TAG = "BeaconPeriodicService";
private List<Beacon> beaconList;
private List<Beacon> sentBeaconList = new ArrayList<>();
private BluetoothAdapter mBluetoothAdapter;
private BluetoothAdapter.LeScanCallback mLeScanCallback;
public static BeaconPeriodicService activeService;
private int containInterval = 1000 * 20;
protected void execTask() {
activeService = this;
iBeaconScan();
}
/**
* 次回の実行計画を立てる。
*/
protected void makeNextPlan() {
this.scheduleNextTime();
}
protected final IBinder binder = new Binder() {
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
return super.onTransact(code, data, reply, flags);
}
};
@Override
public IBinder onBind(Intent intent) {
return binder;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
init();
execTask();
return START_STICKY;
}
/**
* サービスの次回の起動を予約
*/
public void scheduleNextTime() {
long now = System.currentTimeMillis();
PendingIntent alarmSender = PendingIntent.getService(this, 0, new Intent(this, this.getClass()), 0);
AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
am.set(AlarmManager.RTC, now + getResources().getInteger(R.integer.beacon_scan_interval), alarmSender);
}
/**
* サービスの定期実行を解除し,サービスを停止
*/
public void stopResident(Context context) {
Intent intent = new Intent(context, this.getClass());
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
stopSelf();
}
@Override
public void onDestroy() {
super.onDestroy();
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private synchronized void iBeaconScan() {
final BluetoothManager bluetoothManager = (BluetoothManager) getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = bluetoothManager.getAdapter();
if (mBluetoothAdapter != null && mBluetoothAdapter.isEnabled()) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
leScan();
}
});
} else {
makeNextPlan();
}
}
private String IntToHex(int Value) {
char HEX2[] = { Character.forDigit((Value >> 4) & 0x0F, 16), Character.forDigit(Value & 0x0F, 16) };
return new String(HEX2);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private void init(){
mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
if (scanRecord.length > 30) {
if ((scanRecord[5] == (byte) 0x4c) && (scanRecord[6] == (byte) 0x00) && (scanRecord[7] == (byte) 0x02) && (scanRecord[8] == (byte) 0x15)) {
String uuid = IntToHex(scanRecord[9] & 0xff)
+ IntToHex(scanRecord[10] & 0xff)
+ IntToHex(scanRecord[11] & 0xff)
+ IntToHex(scanRecord[12] & 0xff)
+ "-"
+ IntToHex(scanRecord[13] & 0xff)
+ IntToHex(scanRecord[14] & 0xff)
+ "-"
+ IntToHex(scanRecord[15] & 0xff)
+ IntToHex(scanRecord[16] & 0xff)
+ "-"
+ IntToHex(scanRecord[17] & 0xff)
+ IntToHex(scanRecord[18] & 0xff)
+ "-"
+ IntToHex(scanRecord[19] & 0xff)
+ IntToHex(scanRecord[20] & 0xff)
+ IntToHex(scanRecord[21] & 0xff)
+ IntToHex(scanRecord[22] & 0xff)
+ IntToHex(scanRecord[23] & 0xff)
+ IntToHex(scanRecord[24] & 0xff);
if(!isAvailableServiceUUID(uuid)){
return;
}
String major = IntToHex(scanRecord[25] & 0xff) + IntToHex(scanRecord[26] & 0xff);
String minor = IntToHex(scanRecord[27] & 0xff) + IntToHex(scanRecord[28] & 0xff);
Beacon beacon = new Beacon();
beacon.uuid = uuid;
beacon.major = major;
beacon.minor = minor;
beacon.rssi = rssi;
beacon.receiveTime = System.currentTimeMillis();
Logger.d(TAG, "Beacon received UUID:" + beacon.uuid + ", Major:" + beacon.major + ", Minor: " + beacon.minor + ", Rssi: " + beacon.rssi);
if(!isBeaconListContains(beaconList, beacon) && beacon.isNear()){
beaconList.add(beacon);
}
}
}
}
};
}
private boolean isBeaconListContains(List<Beacon> beaconList, Beacon beacon){
for (Beacon b : beaconList) {
if (beacon.isSameBeacon(b)) {
return true;
}
}
return false;
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private synchronized void leScan() {
beaconList = new ArrayList<>();
// TODO later UUIDのフィルタリングがうまく動作しない。
Logger.d(TAG, "startLeScan");
//noinspection deprecation(API21から非推奨になった、無視)
mBluetoothAdapter.startLeScan(mLeScanCallback);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
//ignore
}
Logger.d(TAG, "stoptLeScan");
//noinspection deprecation(API21から非推奨になった、無視)
mBluetoothAdapter.stopLeScan(mLeScanCallback);
sendBeaconBroadcast();
makeNextPlan();
}
private void sendBeaconBroadcast() {
if(isSplashScreenForground(this)){
return;
}
Beacon targetBeacon = getNearestBeacon();
if (targetBeacon != null) {
if (isUnSentBeacon(targetBeacon)) {
sendBroadcastBeaconMessage(targetBeacon);
saveBeaconHistory(targetBeacon);
}
}
resetSentBeaconList();
}
private Beacon getNearestBeacon() {
Beacon targetBeacon = null;
for (Beacon beacon : beaconList) {
if (targetBeacon == null) {
targetBeacon = beacon;
} else {
if (targetBeacon.rssi < beacon.rssi) {
targetBeacon = beacon;
}
}
}
return targetBeacon;
}
private boolean isUnSentBeacon(Beacon beacon){
return !isBeaconListContains(sentBeaconList, beacon);
}
private void sendBroadcastBeaconMessage(Beacon beacon) {
Logger.d(TAG, "SendBroadcastBeaconMessage UUID:" + beacon.uuid + ", Major:" + beacon.major + ", Minor: " + beacon.minor + ", Rssi: " + beacon.rssi);
Intent it = new Intent(BeaconPeriodicService.this, BeaconBroadcastReceiver.class);
it.setAction(AppDefType.Intent.Action_Receive_iBeacon_Message);
it.putExtra("major", beacon.major.toUpperCase());
it.putExtra("minor", beacon.minor.toUpperCase());
sendBroadcast(it);
// 送信済みリストに保存
sentBeaconList.add(beacon);
}
private void saveBeaconHistory(Beacon beacon) {
BeaconHistoryDto dto = new BeaconHistoryDto();
dto.major = Integer.parseInt(beacon.major, 16);
dto.minor = Integer.parseInt(beacon.minor, 16);
AbstractDao.getDao(BeaconHistoryDao.class).insertOrUpdate(dto);
}
private void resetSentBeaconList(){
for (int i = sentBeaconList.size() - 1; i >= 0; i--) {
Beacon sentBeacon = sentBeaconList.get(i);
boolean isRemoveTarget = true;
for (Beacon beacon : beaconList) {
if (sentBeacon.isSameBeacon(beacon)) {
sentBeacon.receiveTime = beacon.receiveTime;
isRemoveTarget = false;
break;
}
}
if (isRemoveTarget) {
if (sentBeacon.receiveTime + containInterval < System.currentTimeMillis()) {
Logger.d(TAG, "Remove UUID:" + sentBeacon.uuid + ", Major:" + sentBeacon.major + ", Minor: " + sentBeacon.minor + ", Rssi: " + sentBeacon.rssi);
sentBeaconList.remove(i);
}
}
}
}
private boolean isAvailableServiceUUID(String serviceUUID) {
String[] uuids = getResources().getStringArray(R.array.Beacon_UUID);
for (String uuid : uuids) {
if (serviceUUID.toUpperCase().equals(uuid.toUpperCase())) {
return true;
}
}
return false;
}
private boolean isSplashScreenForground(Context context) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
//noinspection deprecation(API21から非推奨になった。無視)
List<RunningTaskInfo> taskInfoList = am.getRunningTasks(1);
if (taskInfoList.size() > 0) {
RunningTaskInfo runningTaskInfo = taskInfoList.get(0);
ComponentName topActivity = runningTaskInfo.topActivity;
if (topActivity.getPackageName().equals(context.getPackageName()) && topActivity.getClassName().equals(SplashScreenActivity.class.getName())) {
return true;
}
}
return false;
}
}
\ No newline at end of file
......@@ -61,8 +61,6 @@ public class ABVUIDataCache {
private int homeContractId;
private int homeSiteId;
public int contentShareType = 0; // 0:なし,1:ABook+,2:Reader
public boolean preIsCatalogEdition;
public int preScale;
public int preDeviceLocationMode;
......@@ -106,7 +104,6 @@ public class ABVUIDataCache {
loadHomeContractId();
loadHomeSiteId();
loadContentLocationTypeEnable();
contentShareType = AbstractLogic.getLogic(ContractLogic.class).getContentShareType();
}
public boolean getFavoriteFlag() {
......
package jp.agentec.abook.abv.launcher.android;
import java.util.Calendar;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.beacon.BeaconPeriodicService;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
......
......@@ -85,8 +85,6 @@ import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.MemoLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.bl.net.PanoServer;
import jp.agentec.abook.abv.bl.repo.RepoClient;
import jp.agentec.abook.abv.cl.billing.Purchase;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.util.AndroidStringUtil;
......@@ -279,27 +277,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
}
public void contentDetailActivityMove(long contentId, String className) {
contentDetailActivityMove(contentId, className, -1, false);
}
// 2012 12 17 Contents link by jeonghun
// ActivityView에서 사용할수 있기 위하여 contentDetailActivityMove 추가
// 상세화면에서 이전화면 이동시 Bug수정
protected void contentDetailActivityMove(final long contentId, final String className, final int pre_page, final boolean contentLinkFlag) {
showProgressPopup();
ActivityHandlingHelper.getInstance().contentDetailActivityMove(this, contentId, className, pre_page, contentLinkFlag, new Callback() {
@Override
public Object callback(Object ret) {
closeProgressPopup();
if (ret != null) {
handleErrorMessageToast(ret);
}
return null;
}
});
}
/**
* Viewを開始します。
*/
......@@ -1065,7 +1042,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
if (xWalkView != null) {
// xWalkViewがnullではない場合、javaScriptでopengetitsshareコマンド実行
javaScriptSignageCmd(PanoServer.CMD_GETITS_OPEN_SHARE, xWalkView);
javaScriptSignageCmd(ABookKeys.CMD_GETITS_OPEN_SHARE, xWalkView);
}
}
});
......
......@@ -78,7 +78,6 @@ 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.PushMessageSettingDialog;
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;
......@@ -295,12 +294,6 @@ public class ABookSettingFragment extends PreferenceFragment {
getPreferenceScreen().removePreference(prefGroup);
}
private void showPushMessageSettingDialog() {
PushMessageSettingDialog dialog = new PushMessageSettingDialog(getActivity());
dialog.setNormalSizeFlag(isNormalSize());
dialog.show();
}
private void setViewerSetting() {
PreferenceGroup viewerSettings = (PreferenceGroup) findPreference(VIEWER_SETTING);
......
......@@ -176,7 +176,6 @@ public class GuideViewActivity extends ABVContentViewActivity {
private ContentJSON mContentJSON; // コンテンツのJSONデータ
private PDFIndexInfoJSON mPDFIndexInfoJSON; // PDFインデックスのJSONデータ
private PDFLinkJSON mPDFLinkJSON; // PDFリンクのJSONデータ
private PageInfoJSON mPageInfoJSON; // オーサリング画面の各ページサイズのJSONデータ
private Size mBaseFileSize;
......
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.ArrayList;
import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppColor;
import jp.agentec.abook.abv.ui.common.dto.ContentPageSerializableDto;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
/** 
* 詳細リストデータ
* @author Minhyuk Seok
* @version 1.0.0
*/
public class ContentDetailListAdapter extends BaseAdapter {
Context context;
LayoutInflater Inflater;
ArrayList<ContentPageSerializableDto> listItem;
private final int mThumbnailSize;
int layout;
public ContentDetailListAdapter(Context context, int alayout, ArrayList<ContentPageSerializableDto> detailPage) {
this.context = context;
Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.listItem = detailPage;
layout = alayout;
mThumbnailSize = context.getResources().getDimensionPixelSize(R.dimen.content_thumbnail_image_size);
}
@Override
public int getCount() {
if (listItem == null) {
return 0;
}
else
{
return listItem.size();
}
}
@Override
public long getItemId(int position) {
return position;
}
public void setItemId(int position) {
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = Inflater.inflate(layout, parent, false);
}
// setStripeColor(context, convertView, position);
ImageView image = (ImageView)convertView.findViewById(R.id.img_content_detail_list);
final Bitmap resized = BitmapUtil.getResizedBitmap(listItem.get(position).getPageThumbnailPath(), mThumbnailSize, mThumbnailSize, Config.RGB_565);
image.setImageBitmap(resized);
image.setAdjustViewBounds(true);
image.setScaleType(ImageView.ScaleType.FIT_CENTER);
image.setPadding(0, 0, 1, 1);
GradientDrawable g = new GradientDrawable(
GradientDrawable.Orientation.TL_BR,
new int[] {Color.WHITE,Color.WHITE, AppColor.getBackground()});
//noinspection deprecation(API16から非推奨になった。無視)
image.setBackgroundDrawable(g);
TextView comment = (TextView)convertView.findViewById(R.id.txt_content_detail_list_comment);
comment.setText(listItem.get(position).getPageText());
return convertView;
}
@Override
public Object getItem(int position) {
return null;
}
}
\ No newline at end of file
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.List;
import jp.agentec.abook.abv.bl.common.Constant.ReaderConstant.ReceivePushMessage;
import jp.agentec.abook.abv.bl.dto.ContractDto;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
public class PushMessageContractListAdapter extends BaseAdapter {
private Context context;
private LayoutInflater inflater;
public List<ContractDto> listItem;
public PushMessageContractListAdapter(Context context, List<ContractDto> listItem) {
this.context = context;
this.listItem = listItem;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for(ContractDto contractDto : listItem){
if(ReceivePushMessage.NOT_SET == contractDto.receivePushMessage){
contractDto.receivePushMessage = ReceivePushMessage.REFUSE;
}
}
}
@Override
public int getCount() {
return listItem.size();
}
@Override
public Object getItem(int position) {
return listItem.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (null == convertView) {
convertView = inflater.inflate(R.layout.item_push_message_contract, null);
holder = new ViewHolder();
holder.tvContractName = (TextView) convertView.findViewById(R.id.tv_contract_name);
holder.swContract = (Switch) convertView.findViewById(R.id.sw_contract);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final ContractDto contractDto = listItem.get(position);
holder.tvContractName.setText(contractDto.companyName + "[" + contractDto.siteId + "-" + contractDto.contractId + "]");
holder.swContract.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
contractDto.receivePushMessage = ReceivePushMessage.PERMIT;
} else {
contractDto.receivePushMessage = ReceivePushMessage.REFUSE;
}
}
});
if(ReceivePushMessage.PERMIT == contractDto.receivePushMessage){
holder.swContract.setChecked(true);
} else {
holder.swContract.setChecked(false);
}
return convertView;
}
private static class ViewHolder {
TextView tvContractName;
Switch swContract;
}
}
package jp.agentec.abook.abv.ui.home.dialog;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.view.ABVDialog;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;
public class HtmlViewDialog extends ABVDialog {
public HtmlViewDialog(Context context, String linkUrl) {
super(context, android.R.style.Theme_Holo_Light_Dialog_NoActionBar);
init(linkUrl);
}
@SuppressLint("SetJavaScriptEnabled")
private void init(String linkUrl) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_htmlview);
setCanceledOnTouchOutside(false);
findViewById(R.id.close_dialog).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
WebView webView = (WebView) findViewById(R.id.htmlWebView);
webView.loadUrl(linkUrl);
// //ブラウザの描画領域を対象としたイベントをフック
WebSettings settings = webView.getSettings();
settings.setSupportMultipleWindows(true); // 新しいウィンドウを開くイベントを取得する
settings.setLoadsImagesAutomatically(true); // イメージを自動的にロードする
settings.setBuiltInZoomControls(true); // ズーム機能を有効にする
settings.setSupportZoom(true); // ズーム機能を有効にする
settings.setJavaScriptEnabled(true); // JavaScriptを有効にする
settings.setLoadWithOverviewMode(true); // 画面の横幅にページの横幅を合わせる
settings.setUseWideViewPort(true); // 画面の横幅にページの横幅を合わせる
}
public void setToolbarTitle(String title) {
TextView titleView = (TextView) findViewById(R.id.dialog_title);
titleView.setText(title);
}
}
package jp.agentec.abook.abv.ui.home.dialog;
import android.app.Activity;
import android.view.View;
import android.view.Window;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
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.ContractDao;
import jp.agentec.abook.abv.bl.dto.ContractDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.cl.push.FcmManager;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
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.view.ABVDialog;
import jp.agentec.abook.abv.ui.home.adapter.PushMessageContractListAdapter;
/**
* Readerアプリへコンテンツを共有する際に設定する情報の画面
* @author jang
*
*/
public class PushMessageSettingDialog extends ABVDialog {
private Activity activity;
private ContractLogic logic;
public PushMessageSettingDialog(Activity activity) {
super(activity, android.R.style.Theme_Holo_Light_Dialog_NoActionBar);
this.activity = activity;
logic = AbstractLogic.getLogic(ContractLogic.class);
init();
}
private void init() {
ContractDao contractDao = AbstractDao.getDao(ContractDao.class);
List<ContractDto> contractList = contractDao.getListByUsablePushMessage();
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.push_message_setting);
setCanceledOnTouchOutside(false);
ListView lvContract = (ListView) findViewById(R.id.list_contract);
// キャンセルボタン
findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
if(contractList.size() > 0){
final PushMessageContractListAdapter adapter = new PushMessageContractListAdapter(getContext(), contractList);
lvContract.setAdapter(adapter);
findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ProgressDialogHelper.showProgressPopup(activity, true);
final String fcmToken = FcmManager.getFcmToken(getContext());
if (fcmToken == null || fcmToken.equals("noneId")) {
ABVToastUtil.showMakeText(getContext(), R.string.fcm_not_supported, Toast.LENGTH_SHORT);
} else {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
try {
logic.updateReceivePushMessage(getContext().getString(R.string.repository_fqdn), fcmToken, adapter.listItem);
dismiss();
} catch (AcmsException e) {
ErrorMessage.showErrorMessageToast(getContext(), e);
Logger.e("PushMessageSettingDialog", e);
} catch (NetworkDisconnectedException e) {
ABVToastUtil.showMakeText(getContext(), R.string.request_network_connection, Toast.LENGTH_SHORT);
} finally {
ProgressDialogHelper.closeProgressPopup();
}
}
});
}
}
});
} else {
((TextView) findViewById(R.id.tv_summary)).setText(getContext().getString(R.string.push_message_contract_not_exist));
findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
}
}
package jp.agentec.abook.abv.ui.home.dto;
import java.util.Date;
public class ContentLinkAdapterDto {
public String thumbnailPath;
public String contentName;
public long contentId;
public ContentStatus contentStatus;
public boolean checked = false;
public boolean checkable = false;
public boolean selectable = false;
public Date deliveryStartDate;
public enum ContentStatus {
IMPOSSIBLE, DONE, POSSIBLE, DOWNLOADING, WAITING, STREAMING
}
}
......@@ -83,7 +83,6 @@ import jp.agentec.abook.abv.ui.common.dto.ContentPageSerializableDto;
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.vo.ContentMyList;
import jp.agentec.abook.abv.ui.home.activity.ContentDetailViewActivity;
import jp.agentec.abook.abv.ui.home.activity.ProjectListActivity;
import jp.agentec.abook.abv.ui.home.activity.ProjectMeetingListActivity;
import jp.agentec.abook.abv.ui.home.activity.ProjectRelatedContentActivity;
......@@ -94,7 +93,6 @@ import jp.agentec.abook.abv.ui.viewer.activity.EnqueteWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.ImageViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.PanoViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.PreviewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.VideoViewActivity;
......@@ -361,139 +359,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
}
public void contentDetailActivityMove(long contentId, int prePage) {
ABVAuthenticatedActivity activity = getCurrentActivity();
contentDetailActivityMove(activity, contentId, activity.getClass().getSimpleName(), prePage, false, null);
}
public void contentDetailActivityMove(final Context context, final long contentId, final String className, final int pre_page, final boolean contentLinkFlag, final Callback callback) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
try {
ContentDto contentDto = contentDao.getContent(contentId);
ContentDto detail;
// PDFコンテンツ以外は詳細を取得しにいかない
if (contentDto.contentType == null || ContentJSON.KEY_PDF_TYPE.equals(contentDto.contentType.toLowerCase(Locale.US))) {
detail = contentLogic.getContentDetail(contentId);
} else {
detail = contentDto;
}
if (detail != null) {
callContentDetailActivity(context, detail, className, pre_page, contentLinkFlag);
if (callback != null) {
callback.callback(null);
}
} else {
contentDownloader.downloadContentDetail(contentId);
}
} catch (NetworkDisconnectedException e) {
if (callback != null) {
callback.callback(ErrorCode.NETWORK);
}
} catch (Exception e) {
Logger.e(TAG, "Exception " + e);
if (callback != null) {
callback.callback(ErrorCode.E107);
}
}
}
});
}
// ActivityView에서 사용할수 있기 위하여 callContentDetailActivity 추가
// 상세화면에서 이전화면 이동시 Bug수정
private void callContentDetailActivity(Context context, final ContentDto detail, final String className, int pre_page, boolean contentLinkFlag) {
Intent intent = new Intent();
intent.setClassName(context.getPackageName(), ContentDetailViewActivity.class.getName());
if (contentLinkFlag) {
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
}
if (context instanceof PanoViewActivity) {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
}
String dateFormat = "yyyy'" + context.getResources().getString(R.string.date_format_year) + "'MM'" + context.getResources().getString(R.string.date_format_month) + "'dd'"
+ context.getResources().getString(R.string.date_format_day) + "'HH:mm:ss";
intent.putExtra(ABookKeys.CONTENT_ID, detail.contentId);
intent.putExtra("ThumbnailNormalPath", detail.thumbnailNormalPath);
intent.putExtra("ContentName", detail.contentName);
intent.putExtra("ContentDetail", detail.contentDetail);
intent.putExtra("DeliveryStartDate", DateTimeUtil.toString(detail.deliveryStartDate, dateFormat));
intent.putExtra("DeliveryEndDate", DateTimeUtil.toString(detail.deliveryEndDate, dateFormat));
intent.putExtra("ContentSize", detail.contentSize);
intent.putExtra("LastDeliveryDate", DateTimeUtil.toString(detail.lastDeliveryDate, dateFormat));
intent.putExtra("ContentType", detail.contentType);
intent.putExtra("ContractContentId", detail.contractContentId);
// 콘텐츠 정보 (콘텐츠 경고 ?)
intent.putExtra("ContentAlertLevel", detail.alertMessageLevel);
intent.putExtra("AllPageNum", detail.allPageNum);
intent.putExtra("DownloadedFlg", detail.downloadedFlg);
intent.putExtra("DownloadingFlg", detail.downloadingFlg);
intent.putExtra("UpdatedFlg", detail.updatedFlg);
intent.putExtra("FromClassName", className);
boolean pdfSendMailFlg = false;
ContractLogic contractLgic = AbstractLogic.getLogic(ContractLogic.class);
if (contractLgic.getPdfSendMail() && detail.pdfSendMailFlg && detail.contentType.equals(ContentJSON.KEY_PDF_TYPE)) {
pdfSendMailFlg = true;
}
intent.putExtra("PdfSendMailFlg", pdfSendMailFlg);
intent.putExtra("PrintFlg", detail.printFlg);
intent.putExtra("ReaderShareFlg", detail.readerShareFlg);
intent.putExtra("HideFlg", detail.hideFlg);
DownloadStatusType type = detail.getDownloadStatus();
if (type == DownloadStatusType.Paused) {
intent.putExtra("PausedFlg", true);
} else {
intent.putExtra("PausedFlg", false);
}
if (pre_page != -1) {
intent.putExtra("pre_page", pre_page);
}
intent.putExtra("ContentLinkFlag", contentLinkFlag);
if (ContentMyList.searchDivisionType != null) {
intent.putExtra("seartSelect", ContentMyList.searchDivisionType.type());
intent.putExtra("seartComment", ContentMyList.searchKeyword);
}
ArrayList<ContentPageSerializableDto> spages = new ArrayList<>();
if (detail.pages != null) {
for (int i = 0; i < detail.pages.size() && i < 6; i++) {
ContentPageSerializableDto pagedata = new ContentPageSerializableDto();
pagedata.setPageText(detail.pages.get(i).pageText);
pagedata.setPageThumbnailPath(detail.pages.get(i).getPageThumbnailPath());
spages.add(pagedata);
}
}
intent.putExtra("Pages", spages);
// 그룹, 장르 정보
long contentId = detail.contentId;
ArrayList<String> groupList;
ArrayList<String> categoryList;
groupList = AbstractLogic.getLogic(GroupLogic.class).getExistContentsGroupInfo(contentId);
categoryList = AbstractLogic.getLogic(CategoryLogic.class).getExistContentsCategoryInfo(contentId);
intent.putStringArrayListExtra("GroupInfo", groupList);
intent.putStringArrayListExtra("CategoryInfo", categoryList);
if (context instanceof PanoViewActivity) {
((Activity)context).finish();
}
context.startActivity(intent);
}
private void startActivity(Context context, Intent intent, NaviConsts ABVNavi, Integer flags, long contentId, String contentType, String path) throws Exception {
contentRefresher.stopRefresh(); // 新着更新を停止する
// 360°用のWebサーバが動作している場合停止
PanoViewHelper.getInstance().callStopPanoServer();
if (intent == null) {
intent = new Intent();
}
......@@ -514,11 +381,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.setClass(context, ImageViewActivity.class);
} else if (contentType.equals(ContentJSON.KEY_MOVIE_TYPE)) { // 動画ファイル
intent.setClass(context, VideoViewActivity.class);
} else if (contentType.equals(ContentJSON.KEY_PANO_MOVIE_TYPE) && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // 360°動画(5.0未満)
intent.setClass(context, PanoViewActivity.class);
intent.putExtra("path", path);
intent.putExtra("contentId", contentId);
context.startActivity(intent);
} else if (contentType.equals(ContentJSON.KEY_MUSIC_TYPE)) { // 音声ファイル
intent.setClass(context, AudioPlayActivity.class);
} else if (contentType.equals(ContentJSON.KEY_HTML_TYPE)) { // HTMLファイル
......@@ -1365,7 +1227,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
} else {
handler.post(new Runnable() {
@Override
public void run() {showDownloadConfirm(contentId, contentDto.contentName);
public void run() {
showDownloadConfirm(contentId, contentDto.contentName);
}
});
}
......
package jp.agentec.abook.abv.ui.home.view;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
import android.graphics.Color;
import android.widget.Button;
/**
* パンくず履歴用のボタン
* @author jang
*
*/
public class BreadCrumbButton extends Button {
private BreadCrumbButton(Context context) {
super(context);
}
public BreadCrumbButton(Context context, String name) {
super(context);
this.name = name;
setText(name);
setTextColor(Color.BLACK);
setBackgroundResource(R.drawable.btn_breadcrumbs);
setPadding(10, 0, 40, 0);
}
public int level;
public long dtoId;
public String name;
}
package jp.agentec.abook.abv.ui.home.view;
import android.content.Context;
import android.os.Bundle;
import android.preference.ListPreference;
import android.util.AttributeSet;
/**
* Created by ThanhChung on 2016/06/02.
*/
public class CustomListPreference extends ListPreference {
private Context mContext;
private boolean isHideDialog;
public CustomListPreference(Context context) {
super(context);
mContext = context;
}
public CustomListPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
public void setHideDialog(boolean isHideDialog) {
this.isHideDialog = isHideDialog;
}
@Override
protected void showDialog(Bundle state) {
if (!isHideDialog) {
super.showDialog(state);
}
}
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
}
}
......@@ -5003,94 +5003,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
//2012 12 17 Contents link by jeonghun
private void linkDownloadChecked(final long contentId, int page) {
Logger.i(TAG, "linkDownloadChecked targetContentId=" + contentId + " targetPage=" + page);
int result = ContentViewHelper.getInstance().linkDownloadChecked(contentId, page);
switch (result) {
case LinkContentStatus.FolderLock:
{
// フォルダーロックしている状態でかつリンク先のコンテンツが別のフォルダーにある
ABookAlertDialog linkLockDialog = AlertDialogUtil.createAlertDialog(this, R.string.content_link);
linkLockDialog.setMessage(R.string.link_lock_folder);
linkLockDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
showAlertDialog(linkLockDialog);
}
break;
case LinkContentStatus.NoExist:
{
// コンテンツが存在しない
ABookAlertDialog linknonServerDialog = AlertDialogUtil.createAlertDialog(this, R.string.content_link);
linknonServerDialog.setMessage(R.string.link_new_nonexits);
linknonServerDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
showAlertDialog(linknonServerDialog);
}
break;
case LinkContentStatus.BeforeReleaseDate:
{
// 公開日前
ABookAlertDialog linknonServerDialog = AlertDialogUtil.createAlertDialog(this, R.string.content_link);
linknonServerDialog.setMessage(R.string.reader_content_download_404);
linknonServerDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
showAlertDialog(linknonServerDialog);
}
break;
case LinkContentStatus.DownloadedContent:
{
// コンテンツがダウンロード済み
mActivityFinishFlg = true;
allReset();
if (isEnquete) {
isEnquete = false;
mMainLayout.removeView(enqueteLayout);
}
//戻る用のコンテンツIDをセット
getABVUIDataCache().setReturnContentIdList(getContentId(), getCurrentPageNumber());
Intent intent = new Intent();
intent.putExtra("page", page - 1);
Logger.d(TAG, "next page : %s", (page - 1));
if (mProjectId != null) {
intent.putExtra(ABookKeys.PROJECT_ID, mProjectId);
}
startContentViewActivity(intent, contentId);
}
break;
case LinkContentStatus.StreamingContent:
{
Intent intent = new Intent();
intent.putExtra("page", page - 1);
startStreamingActivity(contentId, intent);
}
break;
case LinkContentStatus.ShowDetailContent:
{
// 未ダウンロードの場合詳細画面アラートを表示
showDetailOpenAlert();
}
break;
}
}
private boolean checkValidContentLink(long contentId) {
ContentDto content = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (content == null) {
......@@ -5100,39 +5012,9 @@ public class ContentViewActivity extends ABVContentViewActivity {
return ContentJSON.KEY_PDF_TYPE.equals(content.contentType) || ContentJSON.KEY_NONE_TYPE.equals(content.contentType);
}
private void showDetailOpenAlert() {
//해당 콘텐츠를 다운받기위한 AlertDialog 호출
ABookAlertDialog linkDialog = AlertDialogUtil.createAlertDialog(ContentViewActivity.this, getString(R.string.confirm), getString(R.string.link_non_download));
linkDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
//해당 콘텐츠가 없는 경우 다운 받기 위하여 Detail 화면으로 이동하여 콘텐츠 다운로드
linkDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
contentLinkStatus = true;
//jeonghun 콘텐츠 링크 실행시 앙케이트 닫아 버린다.
if (isEnquete) {
isEnquete = false;
mMainLayout.removeView(enqueteLayout);
}
contentDetailActivityMove(getContentId(), ContentViewActivity.class.getName(), mCurrentPageNumber, contentLinkStatus);
}
});
showAlertDialog(linkDialog);
}
/**
* 콘텐츠 링크 중 콘텐츠가 없을 경우 콘텐츠 다운을 받기위하여
* contentDetailActivityMove 를 다시 한번 호출
* コンテンツリンク中でコンテンツがない場合、ダウンロードするように
* checkContentをもう一度呼び出す
*
*/
......@@ -5154,7 +5036,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
});
} else {
contentDetailActivityMove(getContentId(), ContentViewActivity.class.getName(), mCurrentPageNumber , contentLinkStatus);
ActivityHandlingHelper.getInstance().checkContent(getContentId(), mCurrentPageNumber);
}
}
......
......@@ -52,7 +52,6 @@ import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentCustomLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.net.PanoServer;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
......@@ -382,7 +381,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
} else {
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.startsWith(PanoServer.SEND_CUSTOM_LOG)) {
if (url.startsWith(ABookKeys.SEND_CUSTOM_LOG)) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
......@@ -403,7 +402,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
commonShouldOverrideUrlLoading(uri, null);
}
}
return true;
}
......@@ -757,24 +755,21 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
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);
exitMeetingBtn.setVisibility(View.VISIBLE);
promoteBtn.setVisibility(View.VISIBLE);
}
}
else {
} else {
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);
}
......
......@@ -2,11 +2,8 @@ package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
......@@ -30,7 +27,6 @@ import org.xwalk.core.XWalkView;
import org.xwalk.core.XWalkWebResourceRequest;
import org.xwalk.core.XWalkWebResourceResponse;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
......@@ -53,23 +49,17 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentCustomLogLogic;
import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.ProjectLogic;
import jp.agentec.abook.abv.bl.net.PanoServer;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
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.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.PanoViewHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
/**
* Created by leej on 2018/04/17.
......@@ -341,7 +331,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
public boolean shouldOverrideUrlLoading(XWalkView view, String url) {
Logger.d(TAG, "shouldOverrideUrlLoading: %s", url);
if (url.startsWith(PanoServer.ABOOK)) {
if (url.startsWith(ABookKeys.ABOOK)) {
final Uri uri = Uri.parse(url);
if (isStreaming) {
if (url.startsWith("abooksendlog://")) { // ログ送信完了
......@@ -368,7 +358,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
} else {
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.startsWith(PanoServer.SEND_CUSTOM_LOG)) {
if (url.startsWith(ABookKeys.SEND_CUSTOM_LOG)) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
......@@ -386,15 +376,15 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
});
}
else if (url.startsWith(PanoServer.MOVEPAGE) || url.startsWith(PanoServer.CONTENTLINK) || url.startsWith(PanoServer.DETAILLOG)){
else if (url.startsWith(ABookKeys.MOVEPAGE) || url.startsWith(ABookKeys.CONTENTLINK) || url.startsWith(ABookKeys.DETAILLOG)){
Map<String, String> param = new HashMap<String, String>();
for (String key : uri.getQueryParameterNames()) {
param.put(key, uri.getQueryParameter(key));
}
param.put(PanoServer.URI, url);
param.put(ABookKeys.URI, url);
// プロジェクト関連資料なのかをチェック
if ( url.startsWith(PanoServer.CONTENTLINK) && ABVEnvironment.getInstance().isABookCheck()) {
if ( url.startsWith(ABookKeys.CONTENTLINK) && ABVEnvironment.getInstance().isABookCheck()) {
Long dstContentId = Long.valueOf(param.get("contentId"));
if (ActivityHandlingHelper.getInstance().isExistCommonContent(contentId)) {
if (!ActivityHandlingHelper.getInstance().isExistCommonContent(dstContentId)) {
......@@ -409,33 +399,33 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
}
String ret = PanoViewHelper.getInstance().doParameter(param, getApplicationContext(), contentId, lastPageNo, readingLogId, lastPageStartDate, new Callback() {
String ret = doParameter(param, getApplicationContext(), contentId, lastPageNo, readingLogId, lastPageStartDate, new Callback() {
@Override
public Object callback(Object ret) {
Map<String, Object> map = (Map<String, Object>) ret;
if (map.containsKey(PanoServer.PARAM_LAST_PAGE_NUMBER)) {
lastPageNo = (int) map.get(PanoServer.PARAM_LAST_PAGE_NUMBER);
if (map.containsKey(ABookKeys.PARAM_LAST_PAGE_NUMBER)) {
lastPageNo = (int) map.get(ABookKeys.PARAM_LAST_PAGE_NUMBER);
}
if (map.containsKey(PanoServer.PARAM_LAST_PAGE_START_DATE)) {
lastPageStartDate = (Date) map.get(PanoServer.PARAM_LAST_PAGE_START_DATE);
if (map.containsKey(ABookKeys.PARAM_LAST_PAGE_START_DATE)) {
lastPageStartDate = (Date) map.get(ABookKeys.PARAM_LAST_PAGE_START_DATE);
}
if (map.containsKey(PanoServer.PARAM_READING_LOG_ID)) {
readingLogId = (Integer) map.get(PanoServer.PARAM_READING_LOG_ID);
if (map.containsKey(ABookKeys.PARAM_READING_LOG_ID)) {
readingLogId = (Integer) map.get(ABookKeys.PARAM_READING_LOG_ID);
}
return null;
}
});
if (ret != null && !ret.startsWith(PanoServer.OK)) {
if (ret != null && !ret.startsWith(ABookKeys.OK)) {
showSimpleAlertDialog(getRString(R.string.error), ret);
}
} else if (url.startsWith(PanoServer.GETITS_OPEN_SHARE)) {
} else if (url.startsWith(ABookKeys.GETITS_OPEN_SHARE)) {
Map<String, String> param = new HashMap<String, String>();
for (String key : uri.getQueryParameterNames()) {
param.put(key, uri.getQueryParameter(key));
}
String shareUrl = null;
if (param.containsKey(PanoServer.PARAM_SHARE_URL)) {
shareUrl = (String) param.get(PanoServer.PARAM_SHARE_URL);
if (param.containsKey(ABookKeys.PARAM_SHARE_URL)) {
shareUrl = (String) param.get(ABookKeys.PARAM_SHARE_URL);
}
if (beaconDialog != null && beaconDialog.isShowing()) {
Logger.d(TAG, "Already Open Beacon Dialog");
......@@ -449,7 +439,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
beaconDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
javaScriptSignageCmd(PanoServer.CMD_GETITS_CLOSE_SHARE, webView);
javaScriptSignageCmd(ABookKeys.CMD_GETITS_CLOSE_SHARE, webView);
dialog.dismiss();
}
});
......@@ -459,7 +449,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
}
return true;
} else if (url.startsWith(PanoServer.PING)) {
} else if (url.startsWith(ABookKeys.PING)) {
return true;
}
return false;
......
package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView;
import jp.agentec.abook.abv.bl.common.log.Logger;
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.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.PanoViewHelper;
/**
* 360度コンテンツを表示する画面
* 内部サーバーを作成して起動させる
* Created by jang on 2016/03/07.
*/
public class PanoViewActivity extends NoPdfViewActivity {
private static final String TAG = PanoViewActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {// 4.2.2
showAlertMessage(R.string.msg_require_ver422);
return;
}
try {
PanoViewHelper.getInstance().startPanoContent(this, path, contentId);
} catch (ActivityNotFoundException e) {
showAlertMessage(R.string.msg_require_chrome);
return;
}
Logger.d(TAG, "[startPanoContent]");
TextView message = (TextView) findViewById(R.id.txt_message);
message.setText(getString(R.string.msg_pano_viewer));
}
private void showAlertMessage(int messageId) {
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.confirm), getString(messageId));
alertDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finishActivity();
}
});
showAlertDialog(alertDialog);
}
}
package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.view.View;
......@@ -12,15 +14,22 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.type.ProjectType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentObjectLogLogic;
import jp.agentec.abook.abv.bl.logic.ProjectLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
......@@ -30,6 +39,10 @@ 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.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
public class ParentWebViewActivity extends ABVContentViewActivity {
......@@ -330,4 +343,75 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
return mProjectId;
}
public String doParameter(Map<String, String> param, Context context, long contentId, Integer lastPageNo, Integer readingLogId, Date lastPageStartDate, Callback callback) {
String uri = param.get(ABookKeys.URI);
Long dstContentId = Long.valueOf(param.get("contentId"));
Integer pageNo = param.containsKey("pageNo")? Integer.valueOf(param.get("pageNo")) - 1: 0; // 1スタートを0スタート
if (uri.startsWith(ABookKeys.CONTENTLINK)) {
int result = ContentViewHelper.getInstance().linkDownloadChecked(dstContentId, pageNo);
Logger.d(TAG, "linkDownloadChecked result=%s", result);
if (result == ContentViewHelper.LinkContentStatus.NoExist) {
return context.getString(R.string.msg_require_content_refresh);
}
ContentLogUtil.getInstance().endContentPageReadLog(contentId, lastPageNo, readingLogId);
if (result == ContentViewHelper.LinkContentStatus.DownloadedContent) {
Activity currentActivity = ActivityHandlingHelper.getInstance().getContentViewActivity();
// HTMLWebViewActivityの場合はfinish()を実施して、コンテンツを開く
if (currentActivity instanceof HTMLWebViewActivity) {
currentActivity.finish();
}
ActivityHandlingHelper.getInstance().startContentActivity(dstContentId, pageNo);
} else {
int prePage = 0;
ABVContentViewActivity viewActivity = ActivityHandlingHelper.getInstance().getContentViewActivity();
if (viewActivity != null) {
prePage = viewActivity.getCurrentPageNumber();
}
if (ActivityHandlingHelper.getInstance().checkContent(dstContentId, prePage)) {
ActivityHandlingHelper.getInstance().startContentActivity(dstContentId, prePage);
}
return null;
}
} else if (uri.startsWith(ABookKeys.DETAILLOG)) {
if (readingLogId == null) { // 開始
readingLogId = ContentLogUtil.getInstance().startContentReadLog(context, contentId, PreferenceUtil.getUserPref(context, AppDefType.DefPrefKey.PERMISSION_ACCESS_LOCATION, false));
}
AbstractLogic.getLogic(ContentObjectLogLogic.class).insertContentObjectLog(contentId, readingLogId, pageNo, param);
} else if (uri.startsWith(ABookKeys.MOVEPAGE)) { // ブラウザから送られてきた時間は使わず、アプリの時間を用いる
if (readingLogId == null) { // 開始ページ
readingLogId = ContentLogUtil.getInstance().startContentReadLog(context, contentId, PreferenceUtil.getUserPref(context, AppDefType.DefPrefKey.PERMISSION_ACCESS_LOCATION, false));
ContentLogUtil.getInstance().startContentPageReadLog(contentId, readingLogId, pageNo);
} else {
if (param.get("readingEndDate") != null) { // 終了時刻有
ContentLogUtil.getInstance().endContentPageReadLog(contentId, pageNo, readingLogId);
} else {
ContentLogUtil.getInstance().endContentPageReadLog(contentId, lastPageNo, readingLogId); // crosswalkのときもjsではローカルサーバに送るが受取がないためここで終了を呼び出す。ただしローカルサーバを使う場合2重に処理が走る。
ContentLogUtil.getInstance().startContentPageReadLog(contentId, readingLogId, pageNo);
}
}
String[] readingStartDate = param.get("readingStartDate").split(",");
Date pageStartDate = DateTimeUtil.toDate(readingStartDate[0], readingStartDate[1], DateTimeFormat.yyyyMMddHHmmss_hyphen);
if (lastPageStartDate == null || lastPageStartDate.before(pageStartDate)) {
lastPageStartDate = pageStartDate;
lastPageNo = pageNo;
}
}
Map<String, Object> ret = new HashMap<String, Object>();
if (lastPageStartDate != null) {
ret.put("lastPageStartDate", lastPageStartDate);
}
if (lastPageNo != null) {
ret.put("lastPageNo", lastPageNo);
}
if (readingLogId != null) {
ret.put("readingLogId", readingLogId);
}
callback.callback(ret);
return null;
}
}
......@@ -23,7 +23,7 @@ import android.widget.TextView;
public class PDFIndexDialog {
// private static final String TAG = "PDFIndexDialog";
private static final String TAG = "PDFIndexDialog";
private final int ROOT_ID = 0; // ルートID
private List<ContentPDFIndexDto> dataList; // データリスト
private ContentViewActivity activity; // 呼出元アクティビティ
......
......@@ -84,8 +84,6 @@ follow_service_option=true
is_check_invalid_passward_limit=true
#リピート再生のデフォルト値
repeat_default=true
#360°コンテンツ用のWebサーバポート
pano_web_server_port=28080
#Setting Info(設定画面のABookについての設定情報)
version_name=1.9.401
......@@ -105,9 +103,6 @@ app_log_retention=7
hprof=false
repository_fqdn=s.abook.bz
default_content_key=0000
Beacon_UUID=
beacon_scan_interval=3000
# abvFunctionOptions.xml
......
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