Commit b33f949d by Lee Jaebin

Getits関連のソース削除

parent e5e8fc96
......@@ -19,7 +19,6 @@ sourceSets {
srcDir 'src'
}
}
// test.java.srcDir 'test'
}
subprojects {
......
......@@ -313,26 +313,7 @@ public class AcmsClient implements AcmsClientResponseListener {
* @since 1.0.0
*/
public boolean contentReadingLog(ContentReadingLogParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response;
if (ABVEnvironment.getInstance().isReader) { // Readerの場合
// if (!ABVEnvironment.getInstance().logSend) { // ログ送信が無効の場合は何もしない
// return true;
// }
ContentReadingLogParameters rLogParam = param;
String logSendUrl = AbstractLogic.getLogic(SiteLogic.class).getLogUrl(rLogParam.getContentId(), true);
if (logSendUrl == null) {
return false;
} else if (logSendUrl.equals("NOSEND")) { // サイト、事業者が削除されている場合は送らない
return true;
}
rLogParam.setLoginId(ABVDataCache.getInstance().getMemberInfo().loginId); // loginIdをセット
rLogParam.setKey(SecurityUtil.getEncryptString(ReaderConstant.SHARED_SECRET_CMS, "" + System.currentTimeMillis(), false)); // keyをセット
response = AcmsClient.getInstance(networkAdapter).send(logSendUrl, "", param);
}
else {
response = send(AcmsApis.ApiUrlContentReadingLog, param);
}
HttpResponse response = send(AcmsApis.ApiUrlContentReadingLog, param);
AcmsBooleanResultJSON json = new AcmsBooleanResultJSON(response.httpResponseBody);
lastPresentTime = json.presentTime;
return json.result;
......@@ -347,27 +328,7 @@ public class AcmsClient implements AcmsClientResponseListener {
* @since 1.0.0
*/
public boolean contentDownloadLog(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response;
if (ABVEnvironment.getInstance().isReader) { // Readerの場合
// if (!ABVEnvironment.getInstance().logSend) { // ログ送信が無効の場合は何もしない
// return true;
// }
ContentDownloadLogParameters dlLogParam = (ContentDownloadLogParameters)param;
String logSendUrl = AbstractLogic.getLogic(SiteLogic.class).getLogUrl(dlLogParam.getContentId(), false);
if (logSendUrl == null) {
return false;
}
else if (logSendUrl.equals("NOSEND")) { // サイト、事業者が削除されている場合は送らない
return true;
}
dlLogParam.setLoginId(ABVDataCache.getInstance().getMemberInfo().loginId); // loginIdをセット
dlLogParam.setKey(SecurityUtil.getEncryptString(ReaderConstant.SHARED_SECRET_CMS, "" + System.currentTimeMillis(), false)); // keyをセット
response = AcmsClient.getInstance(networkAdapter).send(logSendUrl, "", param);
}
else {
response = send(AcmsApis.ApiUrlContentDownloadLog, param);
}
HttpResponse response = send(AcmsApis.ApiUrlContentDownloadLog, param);
AcmsBooleanResultJSON json = new AcmsBooleanResultJSON(response.httpResponseBody);
lastPresentTime = json.presentTime;
return json.result;
......@@ -734,26 +695,9 @@ public class AcmsClient implements AcmsClientResponseListener {
throw new RuntimeException(e);
}
}
//HttpResponse result = HttpRequestSender.post(apiUrl, multiParts);
HttpResponse response;
if (ABVEnvironment.getInstance().isReader) { // Readerの場合
String enqueteSendUrl = AbstractLogic.getLogic(SiteLogic.class).getEnqueteSendUrl(getParam.getContentId());
if (enqueteSendUrl == null) {
return "fail";
}
else if (enqueteSendUrl.equals("NOSEND")) { // サイト、事業者が削除されている場合は送らない
return "success";
}
getParam.setLoginId(ABVDataCache.getInstance().getMemberInfo().loginId); // loginIdをセット
getParam.setKey(SecurityUtil.getEncryptString(ReaderConstant.SHARED_SECRET_CMS, "" + System.currentTimeMillis(), false)); // keyをセット
response = send(enqueteSendUrl + "?" + getParam.toHttpParameterString(), AcmsApis.ApiUrlEnqueteReply, new PostEnqueteReplyParameters(map));
}
else {
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiUrlEnqueteReply);
apiUrl = String.format("%s?%s",apiUrl,getParam.toHttpParameterString());
response = send(apiUrl, AcmsApis.ApiUrlEnqueteReply, new PostEnqueteReplyParameters(map));
}
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiUrlEnqueteReply);
apiUrl = String.format("%s?%s", apiUrl, getParam.toHttpParameterString());
HttpResponse response = send(apiUrl, AcmsApis.ApiUrlEnqueteReply, new PostEnqueteReplyParameters(map));
ResultJSON json = new ResultJSON(response.httpResponseBody);
......
......@@ -265,7 +265,6 @@ public interface ServiceOption {
interface ContentShareType {
int NONE = 0;
int ABOOK_TYPE = 1;
int READER_TYPE = 2; // ABook ReaderType(複数CMS環境)
}
}
\ No newline at end of file
......@@ -33,8 +33,7 @@ public class ABVEnvironment {
public String mainFolderName = null;
public boolean isContentProtected;
public boolean isPdfThumbnailOutput;
public boolean isReader; // リーダーモード
public boolean disableLogSend; // ログを送信しないフラグ(現状false固定)
public NetworkAdapter networkAdapter;
......
......@@ -220,16 +220,7 @@ public enum ABVExceptionCode {
/**
* 定期点検、既に点検済みです。点検データ送信できません。
*/
P_E_ACMS_P005,
/**
* 定期点検、「%s」から情報更新ができるようになります。
*/
P_E_ACMS_P006,
/**
* 定期点検、作業データがありません。
*/
P_E_ACMS_P007;
P_E_ACMS_P005;
/**
* HTTPレスポンスコードから対応するコードを返す
......
......@@ -546,10 +546,8 @@ public class ABVDataCache {
* @return 「事業者文字列」+「ログインID」文字列をMD5変換を返します。nullの場合もあります。
*/
public String getAdummyKey() {
if (!ABVEnvironment.getInstance().isReader) {
if (getUrlPath() != null && getMemberInfo().loginId != null) {
return SecurityUtil.getMd5Hash(getUrlPath() + getMemberInfo().loginId);
}
if (getUrlPath() != null && getMemberInfo().loginId != null) {
return SecurityUtil.getMd5Hash(getUrlPath() + getMemberInfo().loginId);
}
return null;
}
......
......@@ -13,23 +13,19 @@ import jp.agentec.abook.abv.bl.data.tables.LContentReadingLog;
import jp.agentec.abook.abv.bl.data.tables.MAcms;
import jp.agentec.abook.abv.bl.data.tables.MAppConfig;
import jp.agentec.abook.abv.bl.data.tables.MCategory;
import jp.agentec.abook.abv.bl.data.tables.MContract;
import jp.agentec.abook.abv.bl.data.tables.MGroup;
import jp.agentec.abook.abv.bl.data.tables.MMemberInfo;
import jp.agentec.abook.abv.bl.data.tables.MPasswordLockInfo;
import jp.agentec.abook.abv.bl.data.tables.MServiceOption;
import jp.agentec.abook.abv.bl.data.tables.MSite;
import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.RProjectContent;
import jp.agentec.abook.abv.bl.data.tables.RContentCategory;
import jp.agentec.abook.abv.bl.data.tables.RContentFolder;
import jp.agentec.abook.abv.bl.data.tables.RContentGroup;
import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript;
import jp.agentec.abook.abv.bl.data.tables.TBeaconHistory;
import jp.agentec.abook.abv.bl.data.tables.TContent;
import jp.agentec.abook.abv.bl.data.tables.TContentBookmark;
import jp.agentec.abook.abv.bl.data.tables.TContentDownloadQueue;
import jp.agentec.abook.abv.bl.data.tables.TContentIdConv;
import jp.agentec.abook.abv.bl.data.tables.TContentMarking;
import jp.agentec.abook.abv.bl.data.tables.TContentMemo;
import jp.agentec.abook.abv.bl.data.tables.TContentOldPdf;
......@@ -96,14 +92,6 @@ public class ABVDataOpenHelper {
iTableScripts.add(new TContentServerSearched());
iTableScripts.add(new TSearchHistory());
// ABook Reader
if (ABVEnvironment.getInstance().isReader) {
iTableScripts.add(new MSite());
iTableScripts.add(new MContract());
iTableScripts.add(new TContentIdConv());
iTableScripts.add(new TBeaconHistory());
}
iTableScripts.add(new MAcms());
iTableScripts.add(new MAppConfig());
iTableScripts.add(new TContentResource());
......
......@@ -187,12 +187,6 @@ public class ContentDao extends AbstractDao {
if (column != -1) {
dto.disableAutoDl = toBool(cursor.getInt(column));
}
if (ABVEnvironment.getInstance().isReader) {
column = cursor.getColumnIndex("short_url");
if (column != -1) {
dto.shortUrl = cursor.getString(column);
}
}
column = cursor.getColumnIndex("pay_flg");
if (column != -1) {
dto.payFlg = toBool(cursor.getInt(column));
......@@ -458,13 +452,7 @@ public class ContentDao extends AbstractDao {
private String generateGetcontentQuery(ContentSearchDto contentSearchDto) {
StringBuffer sql = new StringBuffer();
if(ABVEnvironment.getInstance().isReader){
sql.append(" SELECT tc.*, short_url ");
} else {
sql.append(" SELECT tc.* ");
}
sql.append(" SELECT tc.* ");
sql.append(" FROM ( ");
sql.append(" SELECT * ");
sql.append(" FROM t_content ");
......@@ -489,12 +477,6 @@ public class ContentDao extends AbstractDao {
default:
break;
}
if(ABVEnvironment.getInstance().isReader){
sql.append(" LEFT OUTER JOIN t_content_id_conv AS tcic ");
sql.append(" ON tc.content_id = tcic.content_id ");
}
if (contentSearchDto.isOnlineSearched) {
sql.append(" INNER JOIN t_content_server_searched AS tcss ");
sql.append(" ON tc.content_id = tcss.content_id ");
......@@ -806,18 +788,12 @@ public class ContentDao extends AbstractDao {
delete("t_content_resource", "content_id=?", keyValues);
delete("r_content_folder", "content_id=?", keyValues);
delete("t_content_bookmark", "content_id=?", keyValues);
// 閲覧ログは削除しない
// delete("l_content_reading_log", "content_id=?", keyValues);
// delete("l_content_page_reading_log", "content_id=?", keyValues);
// delete("l_content_object_log", "content_id=?", keyValues);
delete("t_content_memo", "content_id=?", keyValues);
delete("t_content_marking", "content_id=?", keyValues);
delete("t_content_tag", "content_id=?", keyValues);
delete("t_content_page", "content_id=?", keyValues);
delete("t_content_old_pdf", "content_id=?", keyValues);
if (ABVEnvironment.getInstance().isReader) {
delete("t_content_id_conv", "content_id=?", keyValues);
}
if (physicalDelete) {
delete("r_content_category", "content_id=?", keyValues);
......
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class MContract extends SQLiteTableScript {
public MContract() {
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
Logger.d("DATA", "create version : %s", version);
// Reader
sql.append(" create table m_contract ( ");
sql.append(" site_id integer not null ");
sql.append(" , contract_id integer not null ");
sql.append(" , company_name VARCHAR(50) not null ");
sql.append(" , url_path VARCHAR(31) not null ");
sql.append(" , undeliverable_delete VARCHAR(1) default 'N' not null ");
sql.append(" , usable_push_message VARCHAR(1) default 'N' not null ");
sql.append(" , usable_readinglog_gps VARCHAR(1) default 'N' not null ");
sql.append(" , usable_readinglog_object VARCHAR(1) default 'N' not null ");
sql.append(" , del_flg integer default 0 not null ");
sql.append(" , insert_date DATETIME not null ");
sql.append(" , update_date DATETIME not null ");
sql.append(" , receive_push_message integer default 0 not null ");
sql.append(" , user_update_date DATETIME ");
sql.append(" , primary key (site_id,contract_id) ");
sql.append(" , FOREIGN KEY (site_id) REFERENCES m_site (site_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Plus_1_4_0 && oldVersion != DatabaseVersions.Plus_1_4_0_OLD) {
ddl.add(" ALTER TABLE m_contract ADD COLUMN receive_push_message integer default 0 not null ");
ddl.add(" ALTER TABLE m_contract ADD COLUMN user_update_date DATETIME ");
}
return ddl;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... arg2) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger;
public class MSite extends SQLiteTableScript {
public MSite() {
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
Logger.d("DATA", "create version : %s", version);
// Reader
sql.append(" create table m_site ( ");
sql.append(" site_id integer not null ");
sql.append(" , site_url TEXT not null ");
sql.append(" , site_name VARCHAR(100) not null ");
sql.append(" , download_url TEXT ");
sql.append(" , log_send_url TEXT ");
sql.append(" , enquete_send_url TEXT ");
sql.append(" , del_flg integer default 0 not null ");
sql.append(" , insert_date DATETIME not null ");
sql.append(" , update_date DATETIME not null ");
sql.append(" , primary key (site_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... arg2) {
return null;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class TBeaconHistory extends SQLiteTableScript {
public TBeaconHistory() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
// since plus 1.4.3
sql.append(" CREATE TABLE t_beacon_history ( ");
sql.append(" beacon_history_id INTEGER NOT NULL ");
sql.append(" , major INTEGER NOT NULL ");
sql.append(" , minor INTEGER NOT NULL ");
sql.append(" , insert_date DATETIME NOT NULL ");
sql.append(" , update_date DATETIME NOT NULL ");
sql.append(" , PRIMARY KEY (beacon_history_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Plus_1_4_3) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class TContentIdConv extends SQLiteTableScript {
public TContentIdConv() {
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
Logger.d("DATA", "create version : %s", version);
// Reader
sql.append(" create table t_content_id_conv ( ");
sql.append(" content_id bigint not null ");
sql.append(" , site_id integer not null ");
sql.append(" , contract_id integer not null ");
sql.append(" , cms_content_id bigint not null ");
sql.append(" , contract_content_id integer not null ");
sql.append(" , download_url TEXT ");
sql.append(" , target_app_version VARCHAR(20) ");
sql.append(" , export_date DATETIME ");
sql.append(" , cms_content_update_id VARCHAR(16) ");
sql.append(" , short_url VARCHAR(50) ");
sql.append(" , insert_date DATETIME not null ");
sql.append(" , update_date DATETIME not null ");
sql.append(" , primary key (content_id) ");
sql.append(" , foreign key (content_id) references t_content (content_id) ");
sql.append(" , foreign key (site_id, contract_id) references m_contract (site_id, contract_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... arg2) {
List<String> ddl = new ArrayList<String>();
// 1.0で参照キーがなかったので、t_contentにないものを削除処理する。foreignキー追加はできないよう(旧バージョンがほとんど使われていないのでテーブル再作成は行わない)。
if (oldVersion < DatabaseVersions.Plus_1_4_0 && oldVersion != DatabaseVersions.Plus_1_4_0_OLD) {
String sql = "delete from t_content_id_conv where not exists (select content_id from t_content b where t_content_id_conv.content_id=b.content_id)";
ddl.add(sql);
ddl.add(" ALTER TABLE t_content_id_conv ADD COLUMN short_url VARCHAR(50) ");
}
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
}
......@@ -65,7 +65,6 @@ public class ContentDownloader {
private ABVDataCache cache = ABVDataCache.getInstance();
private NetworkAdapter networkAdapter = ABVEnvironment.getInstance().networkAdapter;
private boolean isReader = ABVEnvironment.getInstance().isReader;
private DownloadObserver downloadObserver = new DownloadObserver();
private Set<ContentDownloadListener> contentDownloadListenerSet = Collections.newSetFromMap(new ConcurrentHashMap<ContentDownloadListener, Boolean>());
......@@ -635,24 +634,20 @@ public class ContentDownloader {
contentDao.updateContent(contentDto, false);
// DL開始
HttpFileDownloader downloader;
if (isReader) {
downloader = ReaderContentDownloader.getInstance().executeDownload(contentDto);
// 開始のログ送信
try {
sendDownloadStartLog(contentDto);
} catch (Exception e) {
Logger.e(TAG, "sendDownloadLogStart failed.", e);
}
else {
// 開始のログ送信
try {
sendDownloadStartLog(contentDto);
} catch (Exception e) {
Logger.e(TAG, "sendDownloadLogStart failed.", e);
}
GetContentParameters param = getContentParameter(contentDto);
String downloadUrl = getDownloadUrl(param);
Logger.d(TAG, "[url : %s], [param : %s]", downloadUrl, param.toHttpParameterString());
GetContentParameters param = getContentParameter(contentDto);
String downloadUrl = getDownloadUrl(param);
Logger.d(TAG, "[url : %s], [param : %s]", downloadUrl, param.toHttpParameterString());
HttpFileDownloader downloader = executeDownload(contentDto, downloadUrl);
downloader = executeDownload(contentDto, downloadUrl);
}
contentDto.downloader = downloader;
}
......@@ -729,7 +724,7 @@ public class ContentDownloader {
* @throws AcmsException
*/
private void sendDownloadLog(ContentDto dto, DownloadStatusType statusType) {
ContentDownloadLogParameters downloadParam = new ContentDownloadLogParameters(isReader? null: cache.getMemberInfo().sid, dto.contentId
ContentDownloadLogParameters downloadParam = new ContentDownloadLogParameters(cache.getMemberInfo().sid, dto.contentId
, new Timestamp(dto.downloadStartDate.getTime()), dto.resourceVersion, ABVEnvironment.DeviceTypeId, statusType);
downloadParam.setDownloadEndtime(DateTimeUtil.getCurrentTimestamp());
downloadParam.setDownloadSize(dto.downloadedBytes);
......@@ -775,7 +770,6 @@ public class ContentDownloader {
changeDownloadStatus(contentId, notification, notification.getDownloadState()==HttpDownloadState.failed?
DownloadStatusType.Failed: DownloadStatusType.Canceled);
FileUtil.delete(notification.getDownloadFileName());
contentDeteteCausedByDownloadFailed(contentId);
break;
case finished:
changeDownloadStatus(contentId, notification, DownloadStatusType.Initializing);
......@@ -792,7 +786,6 @@ public class ContentDownloader {
notification.setError(e);
notification.setDownloadState(HttpDownloadState.failed);
changeDownloadStatus(contentId, notification, DownloadStatusType.Failed);
contentDeteteCausedByDownloadFailed(contentId);
} finally {
// ダウンロードしていたファイルの削除
FileUtil.delete(notification.getDownloadFileName());
......@@ -870,17 +863,6 @@ public class ContentDownloader {
}
}
private void contentDeteteCausedByDownloadFailed(long contentId){
// Readerの場合、ダウンロード失敗時に未ダウンロードコンテンツであれば削除する
if (ABVEnvironment.getInstance().isReader) {
ContentDto dto = contentDao.getContent(contentId);
if (dto != null && !dto.downloadedFlg) {
contentLogic.deleteContent(dto, true);
}
}
}
/// Progress ///
/**
......
......@@ -30,7 +30,6 @@ import jp.agentec.abook.abv.bl.logic.CategoryLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.DashboardLogic;
import jp.agentec.abook.abv.bl.logic.EnqueteLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.ProjectLogic;
......@@ -52,7 +51,6 @@ public class ContentRefresher {
private ContractLogic contractLogic = AbstractLogic.getLogic(ContractLogic.class);
private GroupLogic groupLogic = AbstractLogic.getLogic(GroupLogic.class);
private CategoryLogic categoryLogic = AbstractLogic.getLogic(CategoryLogic.class);
private DashboardLogic dashBoardLogic = AbstractLogic.getLogic(DashboardLogic.class);
private EnqueteLogic enqueteLogic = AbstractLogic.getLogic(EnqueteLogic.class);
private ContentLogic contentLogic = AbstractLogic.getLogic(ContentLogic.class);
private ProjectLogic projectLogic = AbstractLogic.getLogic(ProjectLogic.class);
......@@ -360,11 +358,6 @@ public class ContentRefresher {
private void doWithServiceOption() throws NetworkDisconnectedException, AcmsException {
// サービスオプションの初期化
contractLogic.initializeContractServiceOption();
// refresh dashboard List
if (cache.serviceOption.isUsableDashboard()) {
dashBoardLogic.setDashboard();
}
// 定期購読期間更新(決済ありの場合)
if (ABVDataCache.getInstance().serviceOption.isPayment() && ABVDataCache.getInstance().serviceOption.isAutoSubscriptionAll()) {
......@@ -480,7 +473,7 @@ public class ContentRefresher {
if (list != null && list.size() > 0) {
for (ContentDto dto : list) { // FIXME: Readerがここに来るかどうか
ContentDownloadLogParameters downloadParam = new ContentDownloadLogParameters(ABVEnvironment.getInstance().isReader? null: cache.getMemberInfo().sid
ContentDownloadLogParameters downloadParam = new ContentDownloadLogParameters(cache.getMemberInfo().sid
, dto.contentId, DateTimeUtil.dateToTimestamp(dto.downloadStartDate)
, dto.resourceVersion, ABVEnvironment.DeviceTypeId, dto.getDownloadStatus());
downloadParam.setDownloadSize(dto.downloadedBytes);
......
......@@ -217,7 +217,7 @@ public class ContentObjectLogLogic extends AbstractLogic {
Timestamp actionDate = new Timestamp(dto.actionDate.getTime());
linesArray.put(DateTimeUtil.toStringInTimeZone(actionDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT") + ",GMT");
linesArray.put(ABVEnvironment.getInstance().isReader ? ContentLogic.getCmsContentId(dto.contentId) : dto.contentId); // Readerの場合ContentId変換
linesArray.put(dto.contentId);
// Androidは0からで管理しているので+1する
linesArray.put(dto.pageNum + 1);
......
......@@ -137,7 +137,7 @@ public class ContentPageReadingLogLogic extends AbstractLogic {
// 3秒以上の場合のみJSONに含める
if(dto.duration >= ABVEnvironment.getInstance().minPageLogSecond){
JSONArray linesArray = new JSONArray();
linesArray.put(ABVEnvironment.getInstance().isReader ? ContentLogic.getCmsContentId(dto.contentId) : dto.contentId); // Readerの場合ContentId変換
linesArray.put(dto.contentId);
// Androidはページ数を0から管理しているので+1する
linesArray.put(dto.pageNum + 1);
......
......@@ -148,7 +148,7 @@ public class ContentReadingLogLogic extends AbstractLogic {
Timestamp StartDate = new Timestamp(logDto.startDate.getTime());
Timestamp EndDate = new Timestamp(logDto.endDate.getTime());
ContentReadingLogParameters logParam =
new ContentReadingLogParameters(ABVEnvironment.getInstance().isReader? null: cache.getMemberInfo().sid,
new ContentReadingLogParameters(cache.getMemberInfo().sid,
logDto.contentId,
StartDate,
EndDate,
......
package jp.agentec.abook.abv.bl.logic;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.CategoryDao;
import jp.agentec.abook.abv.bl.data.dao.FolderDao;
import jp.agentec.abook.abv.bl.data.dao.GroupDao;
import jp.agentec.abook.abv.bl.dto.CategoryDto;
import jp.agentec.abook.abv.bl.dto.DashBoardListDto;
import jp.agentec.abook.abv.bl.dto.DashboardDto;
import jp.agentec.abook.abv.bl.dto.FolderDto;
import jp.agentec.abook.abv.bl.dto.GroupDto;
public class DashboardLogic extends AbstractLogic {
private GroupDao groupDao = AbstractDao.getDao(GroupDao.class);
private CategoryDao categoryDao = AbstractDao.getDao(CategoryDao.class);
private FolderDao folderDao = AbstractDao.getDao(FolderDao.class);
public void setDashboard() throws AcmsException, NetworkDisconnectedException{
AcmsClient acms = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid);
ArrayList<DashboardDto> list = acms.getDashboardList(param);
cache.addDashboardList(list);
}
public void setReaderDashboard(String[] list) {
ArrayList<DashboardDto> dashboardList = new ArrayList<DashboardDto>();
DashboardDto dto;
for (int i = 0; i < list.length; i++) {
dto = new DashboardDto();
dto.dispOrder = i;
dto.status = 1;
dto.type = list[i];
dashboardList.add(dto);
}
cache.addDashboardList(dashboardList);
}
public ArrayList<DashboardDto> getDashboard() {
return cache.getDashboardList();
}
public List<DashBoardListDto> getSpareList(String choice, int baseId,int parentId) {
List<DashBoardListDto> dashboardList = new ArrayList<DashBoardListDto>();
List<GroupDto>groupList;
List<CategoryDto>categoryList;
List<FolderDto>folderList;
if (choice.equals("group")) {
// groupList= groupDao.getGroupSpareList(baseId, groupDao.getGroup(baseId).parentGroupId);
groupList= groupDao.getGroupSpareList(baseId, parentId);
for (GroupDto groupDto : groupList) {
DashBoardListDto dashDto = new DashBoardListDto();
dashDto.item = "group";
dashDto.listId = groupDto.groupId;
dashDto.listName = groupDto.groupName;
dashboardList.add(dashDto);
}
}else if (choice.equals("genre")) {
// categoryList = categoryDao.getCategorySpareList(baseId, categoryDao.getCategory(baseId).parentCategoryId);
categoryList = categoryDao.getCategorySpareList(baseId, parentId);
for (CategoryDto categoryDto : categoryList) {
DashBoardListDto dashDto = new DashBoardListDto();
dashDto.item = "genre";
dashDto.listId = categoryDto.categoryId;
dashDto.listName = categoryDto.categoryName;
dashboardList.add(dashDto);
}
}else if (choice.equals("myfolder")) {
// folderList = folderDao.getFolderSpareList(baseId, folderDao.getFolderInfo(baseId).parentFolderId);
folderList = folderDao.getFolderSpareList(baseId, parentId);
for (FolderDto folderDto : folderList) {
DashBoardListDto dashDto = new DashBoardListDto();
dashDto.item = "myfolder";
dashDto.listId = folderDto.folderId;
dashDto.listName = folderDto.folderName;
dashboardList.add(dashDto);
}
}
return dashboardList;
}
public int[] getTopId(String choice) {
if (choice.equals("group")) {
return new int[]{groupDao.getTopGroupInfo().groupId, groupDao.getTopGroupInfo().parentGroupId};
}else if (choice.equals("genre")) {
return new int[]{categoryDao.getTopCategoryInfo().categoryId, categoryDao.getTopCategoryInfo().parentCategoryId};
}else{
return new int[]{0,-1};
}
}
public int getMyparentId(String choice, int baseId) {
if (choice.equals("group")) {
return groupDao.getGroup(baseId).parentGroupId;
}else if (choice.equals("genre")) {
return categoryDao.getCategory(baseId).parentCategoryId;
}else if (choice.equals("myfolder")) {
return folderDao.getFolderInfo(baseId).parentFolderId;
}else{
return 0;
}
}
public boolean isTopPosition(String choice, int baseId) {
int parentId = getMyparentId(choice, baseId);
if (choice.equals("group")) {
return parentId == 0;
}else if (choice.equals("genre")) {
return parentId == 0;
}else if (choice.equals("myfolder")) {
return parentId == -1;
}else{
return false;
}
}
public boolean isExistParent(String choice, int baseId) {
if (choice.equals("group")) {
return groupDao.isExistParent(baseId);
}else if (choice.equals("genre")) {
return categoryDao.isExistParent(baseId);
}else if (choice.equals("myfolder")) {
return folderDao.isExistParent(baseId);
}else{
return false;
}
}
}
......@@ -54,7 +54,7 @@ public class EnqueteLogic extends AbstractLogic {
String result;
AcmsClient acms = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter);
Timestamp replyDateStr1 = new Timestamp(replyDateStr.getTime());
GetEnqueteReplyParameters getParam = new GetEnqueteReplyParameters(ABVEnvironment.getInstance().isReader? null: cache.getMemberInfo().sid, contentId, abObjectId, replyDateStr1, 3);
GetEnqueteReplyParameters getParam = new GetEnqueteReplyParameters(cache.getMemberInfo().sid, contentId, abObjectId, replyDateStr1, 3);
EnqueteReplyParameters postParam = new EnqueteReplyParameters(param);
result = acms.enqueteReply(postParam, getParam);
return result.equals("success");
......
......@@ -1810,4 +1810,13 @@ public class ProjectLogic extends AbstractLogic {
}
}
}
public String getInspectProjectAvailableDateStr(Long projectId) {
ProjectDto projectDto = getProject(projectId);
Date currDate = DateTimeUtil.getCurrentSqlDate();
if (DateTimeUtil.isDateBefore(currDate, projectDto.projectStartDate)) {
return DateTimeUtil.toString(projectDto.projectStartDate, DateTimeFormat.yyyyMMdd_slash);
}
return null;
}
}
......@@ -71,22 +71,6 @@
</intent-filter>
</service>
<receiver android:name="jp.agentec.abook.abv.ui.widget.ABVAppWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="jp.agentec.abook.abv.launcher.android.ABVAppWidgetProvider.SETTING" />
<action android:name="jp.agentec.abook.abv.launcher.android.ABVAppWidgetProvider.WIDGETREFRESH" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/abook_appwidget_info" />
</receiver>
<service
android:name="jp.agentec.abook.abv.ui.widget.ABVAppWidgetService"
android:exported="false"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<receiver android:name="jp.agentec.abook.abv.launcher.android.OnAppDownloadReceiver">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
......@@ -177,37 +161,11 @@
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity
android:name="jp.agentec.abook.abv.ui.widget.DashboardWidgetSettingActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:excludeFromRecents="true"
android:taskAffinity=""
android:label="DashboardWidgetSettingActivity"
android:theme="@android:style/Theme.Dialog">
<intent-filter>
<action android:name="android.intent.action.APPWIDGET_CONFIGURE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="jp.agentec.abook.abv.ui.home.activity.DashboardActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="DashboardActivity" />
<activity
android:name="jp.agentec.abook.abv.ui.home.activity.DashSpareboard"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="DashSpareboardActivity"
android:theme="@style/Theme_SpareBoardDialog" />
<activity
android:name="jp.agentec.abook.abv.ui.home.activity.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="LoginActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity
android:name="jp.agentec.abook.abv.ui.home.activity.MCMLoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="MCMLoginActivity"
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"
......@@ -253,15 +211,6 @@
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.HomeUIActivity"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.SearchActivity"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.SearchActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.SearchResultActivity"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.SearchResultActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.MeetingListActivity"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.MeetingListActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ShowQrcodeActivity"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ShowQrcodeActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/>
<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"/>
......@@ -282,12 +231,6 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.CaptureQRCodeActivity"
android:screenOrientation="fullSensor"
android:stateNotNeeded="false"
android:theme="@style/zxing_CaptureTheme"/>
<!-- CustomActivity -->
<activity android:name="jp.agentec.abook.abv.ui.home.activity.custom.MainViewActivity"/><!-- KOMAS対応 -->
<!--Voip-->
<!-- ABookCheck対応 -->
......
......@@ -53,7 +53,6 @@ android {
resValue("string", "error_report_email", "${error_report_email}")
resValue("integer", "app_log_retention", "${app_log_retention}")
resValue("bool", "hprof", "${hprof}")
resValue("bool", "reader_mode", "${reader_mode}")
resValue("string", "repository_fqdn", "${repository_fqdn}")
resValue("string", "default_content_key", "${default_content_key}")
resValue("array", "Beacon_UUID", "${Beacon_UUID}")
......
......@@ -2,13 +2,9 @@ buildscript {
repositories {
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:3.1.4'
}
}
apply plugin: 'com.android.library'
//apply plugin: 'android-library'
dependencies {
......@@ -69,7 +65,5 @@ android {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
// options.encoding = "UTF-8"
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearlayoutlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<jp.agentec.abook.abv.ui.common.view.ABVFolderView
android:id="@+id/folder_list"
android:layout_width="match_parent"
android:layout_height="500dp"
android:fillViewport="true"/>
</LinearLayout>
\ No newline at end of file
/***
Copyright (c) 2013 CommonsWare, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.commonsware.cwac.preso;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Build;
import android.view.Display;
public class PresentationHelper implements
DisplayManager.DisplayListener {
public interface Listener {
void showPreso(Display display);
void clearPreso(boolean switchToInline);
}
private Listener listener=null;
private DisplayManager mgr=null;
private Display current=null;
private boolean isFirstRun=true;
private boolean isEnabled=true;
public PresentationHelper(Context ctxt, Listener listener) {
this.listener=listener;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
mgr=
(DisplayManager)ctxt.getSystemService(Context.DISPLAY_SERVICE);
}
}
public void onResume() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
handleRoute();
mgr.registerDisplayListener(this, null);
}
}
public void onPause() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
listener.clearPreso(false);
current=null;
mgr.unregisterDisplayListener(this);
}
}
public void enable() {
isEnabled=true;
handleRoute();
}
public void disable() {
isEnabled=false;
if (current != null) {
listener.clearPreso(true);
current=null;
}
}
public boolean isEnabled() {
return(isEnabled);
}
private void handleRoute() {
if (isEnabled()) {
Display[] displays=
mgr.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
if (displays.length == 0) {
if (current != null || isFirstRun) {
listener.clearPreso(true);
current=null;
}
}
else {
Display display=displays[0];
if (display != null && display.isValid()) {
if (current == null) {
listener.showPreso(display);
current=display;
}
else if (current.getDisplayId() != display.getDisplayId()) {
listener.clearPreso(true);
listener.showPreso(display);
current=display;
}
else {
// no-op: should already be set
}
}
else if (current != null) {
listener.clearPreso(true);
current=null;
}
}
isFirstRun=false;
}
}
@Override
public void onDisplayAdded(int displayId) {
handleRoute();
}
@Override
public void onDisplayChanged(int displayId) {
handleRoute();
}
@Override
public void onDisplayRemoved(int displayId) {
handleRoute();
}
}
\ No newline at end of file
/***
Copyright (c) 2014 CommonsWare, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.commonsware.cwac.preso;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.os.IBinder;
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
public abstract class PresentationService extends Service implements
PresentationHelper.Listener {
protected abstract int getThemeId();
protected abstract View buildPresoView(Context ctxt,
LayoutInflater inflater, Display display);
private WindowManager wm=null;
private View presoView=null;
private PresentationHelper helper=null;
@Override
public IBinder onBind(Intent intent) {
return(null);
}
@Override
public void onCreate() {
super.onCreate();
helper=new PresentationHelper(this, this);
helper.onResume();
}
@Override
public void onDestroy() {
helper.onPause();
super.onDestroy();
}
@Override
public void showPreso(Display display) {
Context presoContext=createPresoContext(display);
LayoutInflater inflater=LayoutInflater.from(presoContext);
wm=
(WindowManager)presoContext.getSystemService(Context.WINDOW_SERVICE);
presoView=buildPresoView(presoContext, inflater, display);
wm.addView(presoView, buildLayoutParams());
}
@Override
public void clearPreso(boolean switchToInline) {
if (presoView != null) {
try {
wm.removeView(presoView);
}
catch (Exception e) {
// probably the window is gone, don't worry, be
// happy
}
}
presoView=null;
}
protected WindowManager.LayoutParams buildLayoutParams() {
return new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.OPAQUE);
}
private Context createPresoContext(Display display) {
Context displayContext=createDisplayContext(display);
final WindowManager windowManager=
(WindowManager)displayContext.getSystemService(WINDOW_SERVICE);
return(new ContextThemeWrapper(displayContext, getThemeId()) {
@Override
public Object getSystemService(String name) {
if (Context.WINDOW_SERVICE.equals(name)) {
return(windowManager);
}
return(super.getSystemService(name));
}
});
}
}
......@@ -74,32 +74,17 @@ public class ContentLogUtil {
}
/**
* Readerの場合、GPS送信が有効かチェックする
* GPS送信が有効かチェックする
*
* @param contentId
* @return
*/
private boolean checkUsableReadinglogGps(long contentId) {
boolean result;
if (ABVEnvironment.getInstance().isReader) {
ContractDto contractDto = contractLogic.getContractByContentId(contentId);
result = (contractDto != null && StringUtil.equals(contractDto.usableReadinglogGps, "Y"));
}
else {
result = contractLogic.getUsableReadinglogGps();
}
return result;
return contractLogic.getUsableReadinglogGps();
}
private boolean checkUsableReadinglogObject(long contentId) {
boolean result;
if (ABVEnvironment.getInstance().isReader) {
ContractDto contractDto = contractLogic.getContractByContentId(contentId);
result = (contractDto != null && StringUtil.equals(contractDto.usableReadinglogObject, "Y"));
} else {
result = contractLogic.getUsableReadinglogObject();
}
return result;
return contractLogic.getUsableReadinglogObject();
}
/**
......
......@@ -3,18 +3,14 @@ package jp.agentec.abook.abv.launcher.android;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.view.View;
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 jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.ui.common.util.Initializer;
import jp.agentec.abook.abv.ui.home.activity.HomeUIActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.FileUtil;
......@@ -51,10 +47,6 @@ public class ABVApplication extends MultiDexApplication {
ABVUncaughtExceptionHandler exceptionHandler = ABVUncaughtExceptionHandler.getInstancer();
exceptionHandler.init(this);
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
if (ABVEnvironment.getInstance().isReader && android.os.Build.VERSION.SDK_INT >= 18 && getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
startService(new Intent(this, BeaconPeriodicService.class));
}
if (ABVEnvironment.getInstance().isABookCheck()) {
//添付ファイル臨時保存場所削除
......@@ -83,43 +75,7 @@ public class ABVApplication extends MultiDexApplication {
Application app = (context instanceof Activity)? ((Activity) context).getApplication(): (Application)context;
return ((ABVApplication)app).getABVUIDataCache();
}
/**
* 携帯左メニューのonClickイベントはこちらを経由する
*
* @param view
*/
public void onClickSideMenu(View view) {
Activity act = ActivityHandlingHelper.getInstance().getCurrentActivity();
if(act instanceof HomeUIActivity){
((HomeUIActivity)act).onClickSideMenu(view);
}
}
/**
* 携帯左メニューのonClickイベントはこちらを経由する(KPCカスタマイズ)
*
* @param view
*/
public void onClickSideMenuKpc(View view) {
Activity act = ActivityHandlingHelper.getInstance().getCurrentActivity();
if(act instanceof HomeUIActivity){
((HomeUIActivity)act).onClickSideMenuKpc(view);
}
}
/**
* 携帯左メニューのonClickイベントはこちらを経由する(KPCカスタマイズ)
*
* @param view
*/
public void onClickSearchView(View view) {
Activity act = ActivityHandlingHelper.getInstance().getCurrentActivity();
if(act instanceof HomeUIActivity){
((HomeUIActivity)act).onClickSearchView(view);
}
}
public ABVApplicationHelper getABVApplicationHelper() {
return abvApplicationHelper;
}
......
package jp.agentec.abook.abv.launcher.android;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.home.activity.HomeUIActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
......
......@@ -287,13 +287,13 @@ public class ABVUIDataCache {
contentTypes.add(ContentTypeId.PDF_TYPE_ID);
if (Options.getInstance(context).getFilerContentType() == 1) {
contentTypes.add(ContentTypeId.MOVIE_TYPE_ID);
if (ABVEnvironment.getInstance().isReader || ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PanoMovie)) {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PanoMovie)) {
contentTypes.add(ContentTypeId.PANO_MOVIE_TYPE_ID);
}
if (ABVEnvironment.getInstance().isReader || ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PanoImage)) {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PanoImage)) {
contentTypes.add(ContentTypeId.PANO_IMAGE_TYPE_ID);
}
if (ABVEnvironment.getInstance().isReader || ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Objectvr)) {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Objectvr)) {
contentTypes.add(ContentTypeId.OBJECTVR_TYPE_ID);
}
contentTypes.add(ContentTypeId.IMAGE_TYPE_ID);
......@@ -307,7 +307,7 @@ public class ABVUIDataCache {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Exam)) {
contentTypes.add(ContentTypeId.EXAM_TYPE_ID);
}
if (ABVEnvironment.getInstance().isReader || ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.OtherContent)) {
if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.OtherContent)) {
contentTypes.add(ContentTypeId.OTHER_TYPE_ID);
}
}
......@@ -367,15 +367,9 @@ public class ABVUIDataCache {
}
private void loadSortCondition() {
if (!ABVEnvironment.getInstance().isReader) {
sortConditionAll = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_ALL, SortType.DELIVERY_STARTDATE);
sortConditionCloud = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_CLOUD, SortType.DELIVERY_STARTDATE);
sortConditionDevice = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_DEVICE, SortType.DELIVERY_STARTDATE);
} else {
sortConditionAll = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_ALL, SortType.DOWNLOAD_DATE);
sortConditionCloud = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_CLOUD, SortType.DOWNLOAD_DATE);
sortConditionDevice = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_DEVICE, SortType.DOWNLOAD_DATE);
}
sortConditionAll = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_ALL, SortType.DELIVERY_STARTDATE);
sortConditionCloud = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_CLOUD, SortType.DELIVERY_STARTDATE);
sortConditionDevice = PreferenceUtil.getUserPref(context, UserPrefKey.SORT_CONDITION_DEVICE, SortType.DELIVERY_STARTDATE);
}
public int getSelectedHomeMenu() {
......
......@@ -19,18 +19,6 @@ public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) || intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED) || intent.getAction().equals(Intent.ACTION_MY_PACKAGE_REPLACED)) {
// Push機能の使用を確認
// if (ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.Apns))
// {
// PushService.actionStart(context.getApplicationContext());
// }
// Getits
// Android SDK 4.3以上
// Bluetooth LE対応
if (ABVEnvironment.getInstance().isReader && android.os.Build.VERSION.SDK_INT >= 18 && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
context.startService(new Intent(context, BeaconPeriodicService.class));
}
// 自動ダウンロードチェックの開始
// TODO later ABVNoAuthenticatedActivityとソース重複のため統一
......
......@@ -165,7 +165,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
path = intent.getStringExtra("path");
isLinkedContent = intent.getBooleanExtra("isLinkedContent", false);
mProjectId = intent.getLongExtra(ABookKeys.PROJECT_ID, -1);
Logger.i(TAG,">>>>>>>>>>>>>>mProjectId=" +mProjectId + ",isLinkedContent=" + isLinkedContent);
if (ABVEnvironment.getInstance().isABookCheck() && !isLinkedContent) {
projectDto = AbstractLogic.getLogic(ProjectLogic.class).getProject(mProjectId);
......@@ -205,11 +204,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean(AppDefType.AutoDownloadPrefKey.CONTENT_OPEN, true);
editor.commit();
if (ABVEnvironment.getInstance().isReader) {
ContractDto contractDto = AbstractLogic.getLogic(ContractLogic.class).getContractByContentId(contentId);
siteId = contractDto.siteId;
}
// 遠隔連動
meetingManager = MeetingManager.getInstance();
......@@ -585,22 +579,20 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
});
alert.show();
}
@Override
protected void onApplicationBroughtFromBackground() {
if(!ABVEnvironment.getInstance().isReader){
new Handler().post(new Runnable() {
@Override
public void run() {
// コンテンツビューワーでは定期パスワード変更以外のチェックを行う
if (checkForceOfflineLogout()) {
finish();
} else if (checkValidAuthTime()) {
finish();
}
new Handler().post(new Runnable() {
@Override
public void run() {
// コンテンツビューワーでは定期パスワード変更以外のチェックを行う
if (checkForceOfflineLogout()) {
finish();
} else if (checkValidAuthTime()) {
finish();
}
});
}
}
});
}
@Override
......@@ -1100,10 +1092,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
isLinkedContent = true;
pageNo = pageNum -1 ;
Logger.d(TAG,">>>>>>>>>>>>>> mProjectId=" +mProjectId);
if (ActivityHandlingHelper.getInstance().checkContent(linkedContentId, pageNo)) { // コンテンツをチェックし、なければDL後開く
Logger.d(TAG,"downloaded .......................");
ActivityHandlingHelper.getInstance().startContentActivityForLinkedConent(mProjectId, linkedContentId, pageNo, false,true);
ActivityHandlingHelper.getInstance().startContentActivityForLinkedConent(mProjectId, linkedContentId, pageNo);
}
} catch (Exception e) {
Logger.e(TAG, "startContentActivity failed.", e);
......
......@@ -63,12 +63,9 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.helper.ABVViewUnbindHelper;
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.HomeUIActivity;
import jp.agentec.abook.abv.ui.home.activity.LoginActivity;
import jp.agentec.abook.abv.ui.home.activity.ProjectListActivity;
import jp.agentec.abook.abv.ui.home.activity.custom.MainViewActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.widget.ABVAppWidgetProvider;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
......@@ -107,7 +104,6 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
startActivity(new Intent().setClassName(getApplicationContext().getPackageName(), getMainActivityClassName()).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP), NaviConsts.Right);
finish();
Intent intent = new Intent();
intent.setAction(ABVAppWidgetProvider.SETTING_ACTION);
getApplicationContext().sendBroadcast(intent);
}
......@@ -167,41 +163,32 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
// Wifi接続の確認
String loginId = UUID.randomUUID().toString();
if (ABVEnvironment.getInstance().isReader) { // reader
MemberInfoDto dto = new MemberInfoDto();
dto.loginId = loginId;
dto.password = "dummy";
dto.loginStatus = LoginStatus.LoggedIn.statusCode();
AbstractDao.getDao(MemberInfoDao.class).insertMemberInfo(dto);
NetworkAdapter na = NetworkAdapter.getInstance();
boolean network_conn = na.isNetworkConnected();
if (network_conn) {
// ym.chae
// 初回ログインの場合、任意のID&PWDを生成してサーバへ登録する
UserAuthenticateLogic userAuthenticateService = AbstractLogic.getLogic(UserAuthenticateLogic.class);
if (urlPath == null) {
urlPath = getResources().getString(R.string.account_path);
}
String password = "password";
Logger.d("UUID 테스트", "UUID 테스트 : " + loginId);
userAuthenticateService.noAuthenticatedLogin(urlPath, loginId, password, deviceToken, isGuestLogin);
startLogoAnimation();
goNext();
} else {
NetworkAdapter na = NetworkAdapter.getInstance();
boolean network_conn = na.isNetworkConnected();
if (network_conn) {
// ym.chae
// 初回ログインの場合、任意のID&PWDを生成してサーバへ登録する
UserAuthenticateLogic userAuthenticateService = AbstractLogic.getLogic(UserAuthenticateLogic.class);
if (urlPath == null) {
urlPath = getResources().getString(R.string.account_path);
}
String password = "password";
Logger.d("UUID 테스트", "UUID 테스트 : " + loginId);
userAuthenticateService.noAuthenticatedLogin(urlPath, loginId, password, deviceToken, isGuestLogin);
startLogoAnimation();
} else {
ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(mContext, R.string.app_name);
messageDialog.setMessage(R.string.NETWORK);
messageDialog.setPositiveButton(R.string.confirm, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
finish();
}
});
messageDialog.show();
}
ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(mContext, R.string.app_name);
messageDialog.setMessage(R.string.NETWORK);
messageDialog.setPositiveButton(R.string.confirm, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
finish();
}
});
messageDialog.show();
}
} catch (final NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException", e);
if (getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH) { // 汎用版の場合
......@@ -285,13 +272,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
if (!requireAuthentication()) { // 認証なしの場合このタイミングでプログレスを閉じる。
closeProgressPopup();
}
if (ABVEnvironment.getInstance().isReader) {
moveToHome();
}
else {
showMain();
}
showMain();
}
});
handler.post(new Runnable() {
......@@ -469,13 +450,10 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
final Uri data = getIntent().getData();
Logger.i(TAG, "call from URI intent : %s", data);
if (data != null && data.getScheme() != null) {
if (!ABVEnvironment.getInstance().isReader && data.getScheme().equals("file")) { // CMS入稿
if (data.getScheme().equals("file")) { // CMS入稿
contentUpload(intent, data);
return;
}
if (ABVEnvironment.getInstance().isReader && getIntent().getData().getScheme().equals("file")) { // abkファイルによるインポート
intent.putExtra(IMPORT_ABK_PATH, getIntent().getData().getPath());
}
if (data.getScheme().equals(getString(R.string.scheme_url))) { // カスタムURI
intent.putExtra(CID, getLongValFromURI(data, CID));
intent.putExtra(PAGE, (int)getLongValFromURI(data, PAGE));
......
......@@ -25,7 +25,6 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
final String shareKey = getIntent().getExtras().getString(PushMessageKey.shareKey);
final long projectId = StringUtil.isNullOrEmpty(getIntent().getExtras().getString(PushMessageKey.projectId)) ? 0 : Long.parseLong(getIntent().getExtras().getString(PushMessageKey.projectId));
// 定期点検用
if (projectId > 0) {
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ShowPushMessageDailogActivity.this, getRString(R.string.app_name), getIntent().getExtras().getString(PushMessageKey.message));
......@@ -54,7 +53,6 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
}
}
}
dialog.dismiss();
}
});
......@@ -76,33 +74,15 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
alertDialog.show();
} else if (StringUtil.isNullOrEmpty(shareKey)) {
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ShowPushMessageDailogActivity.this, getRString(R.string.app_name), getIntent().getExtras().getString(PushMessageKey.message));
alertDialog.setPositiveButton(R.string.ok, null);
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
});
alertDialog.show();
} else {
callContentDownloadByPushMessage(shareKey, getIntent().getExtras().getString(PushMessageKey.message));
}
}
}
}
private void showControlCenterRoomAccessRequest(String message) {
ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ShowPushMessageDailogActivity.this, getRString(R.string.app_name), message);
alertDialog.setPositiveButton(R.string.ok,null);
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
});
alertDialog.show();
}
}
package jp.agentec.abook.abv.ui.common.adapter;
import java.util.List;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppColor;
import jp.agentec.abook.abv.ui.common.constant.ContentMyListType;
import jp.agentec.abook.abv.ui.common.dto.HierarchicalDto;
import jp.agentec.abook.abv.ui.common.vo.ContentMyList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
public class ABVFolderAdapter extends BaseAdapter {
private LayoutInflater layoutInflater_;
private static final int LEVEL_MARGIN = 20;
private int text = 0;
private int textSelect = 0;
private List<HierarchicalDto> listAdapter;
private OnFolderClickTransferListener mOnFolderClickTransferListener;
public interface OnFolderClickTransferListener {
void OnFolderClickTransfer(int folderId);
void OnFolderClickCloseTransfer(int folderId, boolean selected);
}
public ABVFolderAdapter(Context context, int textViewResourceId, List<HierarchicalDto> objects, OnFolderClickTransferListener listener) {
//super(context, textViewResourceId, objects);
layoutInflater_ = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
text = context.getResources().getColor(AppColor.getTxtFolder());
textSelect = context.getResources().getColor(AppColor.getTxtFolderSelect());
mOnFolderClickTransferListener = listener;
this.listAdapter = objects;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final HierarchicalDto item = listAdapter.get(position);
if (null == convertView) {
convertView = layoutInflater_.inflate(R.layout.item_list_folder, null);
}
int iconImageOn;
int iconImageOff;
iconImageOn = R.drawable.icon_folder_on;
iconImageOff = R.drawable.icon_folder_off;
int WC = ViewGroup.LayoutParams.WRAP_CONTENT;
TextView txtTop_ = (TextView) convertView.findViewById(R.id.txtTop);
LinearLayout.LayoutParams param_txtTop_ = new LinearLayout.LayoutParams(0, WC);
if (!ContentMyList.lockFlg) {
param_txtTop_.leftMargin = item.getFolderLevel() * LEVEL_MARGIN;
}
txtTop_.setLayoutParams(param_txtTop_);
ImageView imgFolder_ = (ImageView) convertView.findViewById(R.id.imgFolder);
LinearLayout listFolder = (LinearLayout) convertView.findViewById(R.id.listFolder);
TextView txtFolderName_ = (TextView) convertView.findViewById(R.id.txtFolderName);
if (ContentMyList.lockFlg) {
imgFolder_.setImageResource(R.drawable.icon_folder_lock);
listFolder.setBackgroundResource(R.drawable.bg_sidemenu_cell_selected);
} else if (ContentMyListType.MyLibrary.equals(ContentMyList.getMyList()) && ContentMyList.getFolderPosition() == position) {
imgFolder_.setImageResource(iconImageOn);
listFolder.setBackgroundResource(R.drawable.bg_sidemenu_cell_selected);
txtTop_.setTextColor(textSelect);
txtFolderName_.setTextColor(textSelect);
} else {
imgFolder_.setImageResource(iconImageOff);
listFolder.setBackgroundResource(R.drawable.bg_sidemenu_cell);
txtTop_.setTextColor(text);
txtFolderName_.setTextColor(text);
}
final int imageSelect = iconImageOn;
final int selectPosition = position;
imgFolder_.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
if (!ContentMyList.lockFlg) {
ImageView imgFolder = (ImageView) v.findViewById(R.id.imgFolder);
imgFolder.setImageResource(imageSelect);
if (item.getOpenFlg()) {
mOnFolderClickTransferListener.OnFolderClickCloseTransfer(selectPosition, ContentMyList.getFolderId() == item.getFolderId());
item.setOpenFlg(false);
} else {
mOnFolderClickTransferListener.OnFolderClickTransfer(selectPosition);
item.setOpenFlg(true);
}
}
}
});
CheckBox checkbox_ = (CheckBox) convertView.findViewById(R.id.checkbox);
if (item.getCheckShowFlg() == true) {
LinearLayout.LayoutParams param_checkbox_ = new LinearLayout.LayoutParams(WC, WC);
checkbox_.setLayoutParams(param_checkbox_);
} else {
LinearLayout.LayoutParams param_checkbox_ = new LinearLayout.LayoutParams(0, 0);
checkbox_.setLayoutParams(param_checkbox_);
}
checkbox_.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked == true) {
item.setCheckFlg(true);
} else {
item.setCheckFlg(false);
}
}
});
checkbox_.setChecked(item.getCheckFlg());
int txtlength_ = item.getFolderMaxLength();
StringBuilder sb = new StringBuilder();
sb.append(item.getFolderName());
sb.append(" ");
sb.append(item.getDisplayCount());
for (int i = 0; i < txtlength_; i++) {
sb.append(" ");
}
String foldertxt_ = sb.toString();
txtFolderName_.setText(foldertxt_);
return convertView;
}
@Override
public int getCount() {
if (listAdapter == null) {
return 0;
}
else
{
return listAdapter.size();
}
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
}
package jp.agentec.abook.abv.ui.common.adapter;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
/**
* テキストを共有するアプリリストを表示する
* @author jang
*
*/
public class ShareAppListAdapter extends BaseAdapter {
private static LayoutInflater mInflater = null;
private String mShareContentString = null;
private Context mContext = null;
private List<String> mPackageName = null;
private List<String> mPackageLabel = null;
private List<Drawable> mPackageIcon = null;
private OnItemClickListener mItemClickListener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
try {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.setPackage(getItem(position));
intent.putExtra(Intent.EXTRA_TEXT, mShareContentString);
mContext.startActivity(intent);
} catch (Exception e) {
Log.d("", "Error");
}
}
};
public ShareAppListAdapter(Context context, String shareContentString) {
mShareContentString = shareContentString;
mContext = context;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPackageName = new ArrayList<>();
mPackageLabel = new ArrayList<>();
mPackageIcon = new ArrayList<>();
// Text共有用のアプリのリストを作成する
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
PackageManager manager = context.getPackageManager();
List<ResolveInfo> resInfo = manager.queryIntentActivities(sendIntent, 0);
for (ResolveInfo resolveInfo : resInfo) {
String packageName = resolveInfo.activityInfo.packageName;
if (checkValidApp(packageName) == false) {
continue;
}
mPackageName.add(packageName);
mPackageLabel.add(resolveInfo.loadLabel(manager).toString());
mPackageIcon.add(resolveInfo.loadIcon(manager));
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (null == convertView) {
convertView = mInflater.inflate(R.layout.item_image_text, null);
holder = new ViewHolder();
holder.icon = (ImageView) convertView.findViewById(R.id.iconImage);
holder.title = (TextView) convertView.findViewById(R.id.iconName);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// Logger.d("ShareAppListAdapter", "label name(%d)=%s %s", position, mPackageLabel.get(position), mPackageName.get(position));
holder.icon.setImageDrawable(mPackageIcon.get(position));
holder.title.setText(mPackageLabel.get(position));
return convertView;
}
@Override
public int getCount() {
return mPackageName.size();
}
@Override
public String getItem(int position) {
return mPackageName.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
public OnItemClickListener getItemClickListener() {
return mItemClickListener;
}
private boolean checkValidApp(String packageName) {
String[] shareAppList = mContext.getResources().getStringArray(R.array.avaliable_share_app);
for (int i = 0; i < shareAppList.length; i++) {
String string = shareAppList[i];
if (packageName.contains(string)) {
return true;
}
}
return false;
}
static class ViewHolder {
ImageView icon;
TextView title;
}
}
......@@ -164,11 +164,7 @@ public class ABVFunctionOptions extends AbstractOptions {
@Override
public int getSettingMenuAccount() {
if (ABVEnvironment.getInstance().isReader) {
return 0;
} else {
return context.getResources().getInteger(R.integer.setting_menu_account);
}
return context.getResources().getInteger(R.integer.setting_menu_account);
}
@Override
......@@ -240,11 +236,7 @@ public class ABVFunctionOptions extends AbstractOptions {
@Override
public int getViewerMenuTextcopy() {
if (ABVEnvironment.getInstance().isReader) {
return 1;
} else {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
@Override
......@@ -259,14 +251,10 @@ public class ABVFunctionOptions extends AbstractOptions {
@Override
public int getViewerMenuMarking() {
if (ABVEnvironment.getInstance().isReader) {
return 1;
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
} else {
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
} else {
return context.getResources().getInteger(R.integer.viewer_menu_marking);
}
return context.getResources().getInteger(R.integer.viewer_menu_marking);
}
}
......
......@@ -36,52 +36,34 @@ public abstract class AbstractOptions implements IOptions {
int visible = 0;
int contentShareType = AbstractLogic.getLogic(ContractLogic.class).getContentShareType();
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
if (ABVEnvironment.getInstance().isReader) {
ContentIdConvDto contentIdConvDto = AbstractDao.getDao(ContentIdConvDao.class).getDto(contentId);
if (contentIdConvDto.shortUrl != null || contentDto.shareUrl != null) {
visible = 1;
}
} else {
if (contentDto.deliveryType == DeliveryType.STREAMING) { // ストリーミングコンテンツは共有不可
}
else if (contentShareType == ContentShareType.READER_TYPE && contentDto.readerShareFlg) {
visible = 1;
} else if (contentShareType == ContentShareType.ABOOK_TYPE) {
visible = 1;
}
if (contentShareType == ContentShareType.ABOOK_TYPE) {
visible = 1;
}
return visible;
}
protected int getPdfSendMailVisibility(long contentId) {
int visible = 0;
if (!ABVEnvironment.getInstance().isReader) {
ContractLogic cl = AbstractLogic.getLogic(ContractLogic.class);
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
try {
DownloadedContentInfoJSON json = ContentFileUtil.getDownloadedContentInfoJSON(contentId);
if (contentDto.contentType.equals(ContentJSON.KEY_PDF_TYPE) && cl.getPdfSendMail() && json.pdfSendMailFlg) {
visible = 1;
}
} catch (Exception e) {
Logger.e("PdfSendMail", "error", e);
ContractLogic cl = AbstractLogic.getLogic(ContractLogic.class);
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
try {
DownloadedContentInfoJSON json = ContentFileUtil.getDownloadedContentInfoJSON(contentId);
if (contentDto.contentType.equals(ContentJSON.KEY_PDF_TYPE) && cl.getPdfSendMail() && json.pdfSendMailFlg) {
return 1;
}
} catch (Exception e) {
Logger.e("PdfSendMail", "error", e);
}
return visible;
return 0;
}
@Override
public boolean getIsEnableQRCodeFlag() {
if (ABVEnvironment.getInstance().isReader) {
return true;
} else {
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOption.ServiceOptionId.QRCode);
} else {
return context.getResources().getInteger(R.integer.home_qrcode) == 1;
}
}
}
@Override
public boolean getIsEnableQRCodeFlag() {
if (context.getResources().getBoolean(R.bool.follow_service_option)) {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOption.ServiceOptionId.QRCode);
} else {
return context.getResources().getInteger(R.integer.home_qrcode) == 1;
}
}
@Override
public int getSettingMenuErrorSend() {
......
......@@ -190,11 +190,7 @@ public class DefaultOptions extends AbstractOptions {
@Override
public int getViewerMenuTextcopy() {
if (ABVEnvironment.getInstance().isReader) {
return 1;
} else {
return 0;
}
return 0;
}
@Override
......@@ -209,11 +205,7 @@ public class DefaultOptions extends AbstractOptions {
@Override
public int getViewerMenuMarking() {
if (ABVEnvironment.getInstance().isReader) {
return 1;
} else {
return 0;
}
return 0;
}
@Override
......
......@@ -197,11 +197,7 @@ public class LargeOptions extends AbstractOptions {
@Override
public int getViewerMenuTextcopy() {
if (ABVEnvironment.getInstance().isReader) {
return 1;
} else {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
@Override
......@@ -216,11 +212,7 @@ public class LargeOptions extends AbstractOptions {
@Override
public int getViewerMenuMarking() {
if (ABVEnvironment.getInstance().isReader) {
return 1;
} else {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
}
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
}
@Override
......
......@@ -197,11 +197,7 @@ public class MidOptions extends AbstractOptions {
@Override
public int getViewerMenuTextcopy() {
if (ABVEnvironment.getInstance().isReader) {
return 1;
} else {
return 0;
}
return 0;
}
@Override
......
package jp.agentec.abook.abv.ui.common.dialog;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
import java.lang.reflect.Method;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.ui.common.util.ViewUtil;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.WindowManager;
import android.widget.FrameLayout;
public class OverlayDialog extends ABookAlertDialog {
private static final String TAG = "OverlayDialog";
private Method collapse;
private Object sbservice;
private Handler handler;
private boolean isShown;
private boolean currentFocus;
private int repeatCount;
private volatile boolean isPaused;
public OverlayDialog(Activity activity, boolean isShown) {
super(activity);
this.isShown = isShown;
if (getWindow() != null) {
WindowManager.LayoutParams params = getWindow().getAttributes();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
params.type = TYPE_APPLICATION_OVERLAY;
} else {
params.type = TYPE_SYSTEM_ERROR;
}
if (!isShown) {
params.dimAmount = 0.0F; // transparent
params.width = 0;
params.height = 0;
getWindow().setFlags(FLAG_SHOW_WHEN_LOCKED | FLAG_NOT_TOUCH_MODAL, 0xffffff);
}
params.gravity = Gravity.CENTER;
getWindow().setAttributes(params);
setOwnerActivity(activity);
setCancelable(false);
handler = new Handler();
try {
createCollapseMethod();
} catch (Exception e) {
Logger.e(TAG, "createCollapseMethod failed.", e);
throw new RuntimeException(e.toString());
}
}
}
public boolean isPaused() {
return isPaused;
}
public void setPaused(boolean isPaused) {
this.isPaused = isPaused;
}
@Override
protected void onStop() {
super.onStop();
isPaused = true;
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionevent) {
if (isShown) {
return super.dispatchTouchEvent(motionevent);
}
return true;
}
@Override
protected final void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (!isShown) {
FrameLayout framelayout = new FrameLayout(getContext());
framelayout.setBackgroundColor(0);
setContentView(framelayout);
}
if (getOwnerActivity() != null) {
ViewUtil.configureFullScreen(getOwnerActivity().findViewById(android.R.id.content));
}
if (getWindow() != null) {
ViewUtil.configureFullScreen(getWindow().getDecorView());
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
Logger.d(TAG, "Focus changed. hasuFous=%s", hasFocus);
currentFocus = hasFocus;
super.onWindowFocusChanged(hasFocus);
try {
if (!hasFocus) {
if (getOwnerActivity() != null) {
getOwnerActivity().sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
}
repeatCallCollapseStatusBar();
}
} catch (Exception e) {
Logger.e(TAG, "onWindowFocusChanged error.", e);
}
}
private void repeatCallCollapseStatusBar() {
if (!currentFocus && !isPaused) {
repeatCount = 1;
handler.postDelayed(new Runnable() {
@Override
public void run() {
try {
repeatCount++;
Logger.v(TAG, "repeatCount %d", repeatCount);
if (repeatCount > 100) { // 100回以上繰り返される場合以上なのでいったんリピートしない
repeatCount = 0;
return;
}
collapseStatusBar();
if (!currentFocus && !isPaused) {
handler.postDelayed(this, 100L);
}
} catch (Exception e) {
Logger.e(TAG, "repeatCallCollapseStatusBar error.", e);
}
}
}, 200L);
}
}
private void collapseStatusBar() { // working on mobile 203SH but not on Galaxy S4
Logger.v(TAG, "collapseStatusBar");
try {
collapse.invoke(sbservice);
} catch (Exception e) {
Logger.e(TAG, "collapseStatusBar error.", e);
}
}
private void createCollapseMethod() throws ClassNotFoundException, NoSuchMethodException {
if(getOwnerActivity() != null) {
sbservice = getOwnerActivity().getSystemService("statusbar");
}
Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
String method;
if (android.os.Build.VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN_MR1) { // API Level 16 (Android 4.1, 4.1.1) or lower
method = "collapse";
} else { // API Level 17 (Android 4.2, 4.2.2) or higher
method = "collapsePanels";
}
collapse = statusbarManager.getMethod(method);
}
}
......@@ -24,7 +24,6 @@ import jp.agentec.abook.abv.cl.billing.Inventory;
import jp.agentec.abook.abv.cl.billing.Purchase;
import jp.agentec.abook.abv.cl.billing.SkuDetails;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.activity.HomeUIActivity;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.DateTimeUtil.DateUnit;
import jp.agentec.adf.util.StringUtil;
......@@ -222,9 +221,6 @@ public class BillingHelper {
if (contentList.size() == 0) { // 残りがない場合(全終了)
isQuerying = false;
Logger.d(TAG, "Query inventory all finished.");
if (act instanceof HomeUIActivity) {
((HomeUIActivity)act).refreshContentList();
}
}
else {
queryInventory(new ArrayList<String>()); // 残りのコンテンツIDリストにつき再度実行
......@@ -370,18 +366,6 @@ public class BillingHelper {
public void refreshContentList(Purchase purchase) {
Logger.d(TAG, "refreshContentList: %s", act);
if (act instanceof HomeUIActivity) {
// 単品購入の場合はupdateDownloadView()を呼び出してそのビューだけ変更するようにしていたが、なぜかパスワード入力があると全く同じ処理を辿っているのに
// ボタンが更新されないことが高い確率で起きる。また他のボタンにまで影響がある。なので購入後は全体リフレッシュにする。
// if (purchase.getItemType().equals(IabHelper.ITEM_TYPE_INAPP)) {
// ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContentByProductId(purchase.getSku());
// ((HomeUIActivity)act).updateDownloadView(contentDto);
// }
// else {
// ((HomeUIActivity)act).refreshContentList();
// }
((HomeUIActivity)act).refreshContentList();
}
}
};
......
package jp.agentec.abook.abv.ui.common.util;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.dialog.OverlayDialog;
import android.app.Activity;
import android.content.Context;
import android.view.Gravity;
import android.view.ViewGroup;
......
......@@ -101,7 +101,6 @@ public class Initializer {
env.websocketServerWsUrl = s(R.string.websocket_server_ws_url);
}
env.isCheckInvalidPasswordLimit = b(R.bool.is_check_invalid_passward_limit);
env.isReader = b(R.bool.reader_mode);
env.editionType = i(R.integer.edition_type);
env.isContentProtected = b(R.bool.content_protected);
env.isPdfThumbnailOutput = b(R.bool.pdf_thumbnail_output);
......@@ -119,7 +118,7 @@ public class Initializer {
// 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する
int loginMode = context.getResources().getInteger(R.integer.login_mode);
if((env.isReader || (loginMode == LoginMode.NO_AUTH||loginMode == LoginMode.SITE_PATH)) && !PreferenceUtil.getUserPref(context, UserPrefKey.AGREE_MACINFO, false)){
if((loginMode == LoginMode.NO_AUTH||loginMode == LoginMode.SITE_PATH) && !PreferenceUtil.getUserPref(context, UserPrefKey.AGREE_MACINFO, false)){
env.deviceId = DeviceInfo.getDeviceUUID(context);
env.encryptKey = DeviceInfo.getEncryptKeyByUUID(context);
env.deviceIdType = Constant.DeviceIdType.UUID;
......
package jp.agentec.abook.abv.ui.common.view;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.ui.home.activity.DashSpareboard;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;
//드래그를 지원하는 스크롤 뷰. 터치 가로채기 메서드를
//재정의하여 부모에게 보내주는 역할만 한다.
public class ABVReorderScrollView extends ScrollView {
public DashSpareboard mDashSpareBoard;
private static final String TAG = "ABVReorderScrollView";
public ABVReorderScrollView(Context context) {
super(context);
}
public ABVReorderScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ABVReorderScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
// 좌표는 리스트 뷰 좌상단 기준 좌표이며 스크롤 상태는 고려 안됨.
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (mDashSpareBoard.onInterceptTouchEvent(this, event) == false) {
return false;
}
boolean result = super.onInterceptTouchEvent(event);
Logger.d(TAG, "onInterceptTouchEvent return = " + result);
return result;
}
}
\ No newline at end of file
......@@ -16,7 +16,6 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.activity.custom.MainViewActivity;
import jp.agentec.adf.util.FileUtil;
public class ABookSettingActivity extends PreferenceActivity {
......
......@@ -82,7 +82,6 @@ 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;
import jp.agentec.abook.abv.ui.widget.ABVAppWidgetProvider;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ABookSettingFragment extends PreferenceFragment {
......@@ -186,7 +185,7 @@ public class ABookSettingFragment extends PreferenceFragment {
if (Options.getInstance(getActivity()).getSettingMenuGeneral() == 1) {
// 位置情報アクセス許可
Preference permissionAccessLocation = findPref(DefPrefKey.PERMISSION_ACCESS_LOCATION);
if (!ABVEnvironment.getInstance().isReader && !AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps()) {
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);
......@@ -217,24 +216,12 @@ public class ABookSettingFragment extends PreferenceFragment {
// プッシュメッセージ受信設定
Preference pushMessage = getPreferenceManager().findPreference(DefPrefKey.PUSH_MESSAGE);
if (ABVEnvironment.getInstance().isReader) {
pushMessage.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(getActivity(), R.string.request_network_connection, Toast.LENGTH_SHORT);
}
showPushMessageSettingDialog();
return false;
}
});
} else {
generalSettings.removePreference(pushMessage);
if (contains(DefPrefKey.PUSH_MESSAGE)) { // prefからも削除する
delete(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);
......@@ -249,12 +236,6 @@ public class ABookSettingFragment extends PreferenceFragment {
return true;
}
});
if (ABVEnvironment.getInstance().isReader) {
generalSettings.removePreference(updatePreference);
if (contains(DefPrefKey.TAP_ACTION_ON_UPDATE)) { // prefからも削除する
delete(DefPrefKey.TAP_ACTION_ON_UPDATE);
}
}
// 配信タイプを選べるときの動作
final ListPreference deliveryPreference = (ListPreference) findPref(DefPrefKey.TAP_ACTION_ON_DELIVERY_SELECT);
......@@ -460,7 +441,6 @@ public class ABookSettingFragment extends PreferenceFragment {
user.signoutUser();
// Widgetへ通知
Intent intent = new Intent();
intent.setAction(ABVAppWidgetProvider.SETTING_ACTION);
getActivity().sendBroadcast(intent);
}
} catch (Exception e) {
......@@ -690,7 +670,7 @@ public class ABookSettingFragment extends PreferenceFragment {
// 利用規約
Preference termOfUse = findPreference(TERM_OF_USE);
if (ABVEnvironment.getInstance().isReader || ABVDataCache.getInstance().serviceOption.isPayment()) {
if (ABVDataCache.getInstance().serviceOption.isPayment()) {
termOfUse.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
......
package jp.agentec.abook.abv.ui.home.activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.CompoundBarcodeView;
import jp.agentec.abook.abv.launcher.android.R;
public class CaptureQRCodeActivity extends Activity {
private CaptureManager capture;
private CompoundBarcodeView barcodeView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.capture_qrcode_layout);
setFinishOnTouchOutside(false);
barcodeView = (CompoundBarcodeView)findViewById(R.id.bar_code_id);
capture = new CaptureManager(this, barcodeView);
capture.initializeFromIntent(getIntent(), savedInstanceState);
capture.decode();
}
public void onClick(View v) {
finish();
}
@Override
protected void onResume() {
super.onResume();
capture.onResume();
}
@Override
protected void onPause() {
super.onPause();
capture.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
capture.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
capture.onSaveInstanceState(outState);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return barcodeView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
}
}
......@@ -232,23 +232,7 @@ public class ContentDetailViewActivity extends ABVUIActivity {
mBtnSubmenu.setVisibility(View.INVISIBLE);
}
}
// 発行者情報はReaderでない場合非表示
if (ABVEnvironment.getInstance().isReader) {
findViewById(R.id.linear_publisher_info).setVisibility(View.VISIBLE);
mTxtPublisherInfo = (TextView) findViewById(R.id.txt_publisher_info);
mTxtPublisherId = (TextView) findViewById(R.id.txt_publisher_id);
mContractDto = contractLogic.getContractByContentId(mContentId);
if (mContractDto != null) {
mTxtPublisherInfo.setText(StringUtil.abbreviate(mContractDto.companyName, 14));
mTxtPublisherId.setText("[" + mContractDto.siteId + "-" + mContractDto.contractId + "]");
} else {
mTxtPublisherInfo.setText("");
mTxtPublisherId.setText("");
}
} else {
findViewById(R.id.linear_publisher_info).setVisibility(View.GONE);
}
findViewById(R.id.linear_publisher_info).setVisibility(View.GONE);
mTxtLastDeliveryDateValue = (TextView)findViewById(R.id.txt_update_date_value);
mTxtContentSizeValue = (TextView)findViewById(R.id.txt_content_size_value);
......@@ -297,25 +281,14 @@ public class ContentDetailViewActivity extends ABVUIActivity {
}
boolean showImgShareFlg = false;
if (ABVEnvironment.getInstance().isReader) {
ContentIdConvDto contentIdConvDto = AbstractDao.getDao(ContentIdConvDao.class).getDto(mContentId);
if (contentIdConvDto.shortUrl != null || mContentDto.shareUrl != null) {
mImgShare.setVisibility(View.VISIBLE);
showImgShareFlg = true;
}
} else {
if (AbstractLogic.getLogic(ContractLogic.class).getContentShareType() == ContentShareType.READER_TYPE && mReaderShareFlg) {
mImgShare.setVisibility(View.VISIBLE);
showImgShareFlg = true;
}
}
if (Options.getInstance(this).getHomeMenuGroup() == 0) {
headLayout.findViewById(R.id.linear_group).setVisibility(View.GONE);
}
if (Options.getInstance(this).getHomeMenuCategory() == 0) {
headLayout.findViewById(R.id.linear_category).setVisibility(View.GONE);
}
if (mContentAlertLevel == 0 && !mPdfSendMailFlg && !showImgShareFlg) {
if (mContentAlertLevel == 0 && !mPdfSendMailFlg) {
headLayout.findViewById(R.id.linear_detail_icons).setVisibility(View.GONE);
if (Options.getInstance(this).getHomeMenuGroup() == 0 && Options.getInstance(this).getHomeMenuCategory() == 0) {
headLayout.findViewById(R.id.linear1).setVisibility(View.GONE);
......@@ -572,15 +545,8 @@ public class ContentDetailViewActivity extends ABVUIActivity {
}
mTxtMenutitle.setCompoundDrawablesWithIntrinsicBounds(drawableId, 0, 0, 0);
}
if (ABVEnvironment.getInstance().isReader) {
findViewById(R.id.txt_content_num_info).setVisibility(View.GONE);
mTxtContractContentId.setVisibility(View.GONE);
} else {
findViewById(R.id.txt_content_num_info).setVisibility(View.VISIBLE);
mTxtContractContentId.setText("" + mContractContentId);
}
findViewById(R.id.txt_content_num_info).setVisibility(View.VISIBLE);
mTxtContractContentId.setText("" + mContractContentId);
mTxtContentSizeValue.setText(makeContentSizeStr(mContentSize));
if (isNormalSize()) {
......@@ -906,11 +872,7 @@ public class ContentDetailViewActivity extends ABVUIActivity {
case DONE:
break;
case POSSIBLE:
if (ABVEnvironment.getInstance().isReader) {
result = readerContentDownload(mContractDto, contentId);
dto.contentStatus = ContentStatus.DOWNLOADING;
dto.checkable = false;
} else if (dto.selectable) {
if (dto.selectable) {
ContentDto contentDto = AbstractDao.getDao(ContentDao.class).getContent(contentId);
contentOpenOrDownload(contentDto);
} else {
......@@ -976,12 +938,7 @@ public class ContentDetailViewActivity extends ABVUIActivity {
}
}
long[] downloadIds = mLinkAdapter.getDownloadList();
if (ABVEnvironment.getInstance().isReader) {
startReaderContentDownload(downloadIds);
} else {
startContentDownload(downloadIds);
}
startContentDownload(downloadIds);
}
}
});
......@@ -1003,15 +960,10 @@ public class ContentDetailViewActivity extends ABVUIActivity {
setDetal();
setDownloadStatus();
// リーダーはPDF・オリジナル以外はサブメニュー非表示
if (!mContentType.equals(ContentJSON.KEY_PDF_TYPE) && !mContentType.equals(ContentJSON.KEY_NONE_TYPE) && ABVEnvironment.getInstance().isReader) {
mBtnSubmenu.setVisibility(View.GONE);
if(mDownloadedFlg) {
checkSubMenu();
} else {
if(mDownloadedFlg){
checkSubMenu();
} else {
mBtnSubmenu.setVisibility(View.GONE);
}
mBtnSubmenu.setVisibility(View.GONE);
}
}
......@@ -1064,13 +1016,7 @@ public class ContentDetailViewActivity extends ABVUIActivity {
if (mLinkListItem != null) {
for (ContentLinkAdapterDto dto : mLinkListItem) {
if (dto.contentId == linkContentId) {
long contentId;
if (ABVEnvironment.getInstance().isReader) {
contentId = ContentLogic.getCmsContentId(linkContentId);
} else {
contentId = linkContentId;
}
makeContentLinkDto(dto, contentId, dto.contentName);
makeContentLinkDto(dto, linkContentId, dto.contentName);
dto.contentStatus = ContentStatus.DONE;
dto.checkable = false;
}
......@@ -1087,11 +1033,7 @@ public class ContentDetailViewActivity extends ABVUIActivity {
}
});
}
if (DashboardActivity.class.getName().equals(mFromClassName)) {
ActivityHandlingHelper.getInstance().setRequireDashBoardReload(true);
} else {
ActivityHandlingHelper.getInstance().setRequireHomeReload(true);
}
ActivityHandlingHelper.getInstance().setRequireHomeReload(true);
break;
case Canceled:
if (notification.getContentId() != mContentId) {
......@@ -1157,15 +1099,8 @@ public class ContentDetailViewActivity extends ABVUIActivity {
@Override
public void finish() {
if (DashboardActivity.class.getName().equals(mFromClassName)) {
// ダッシュボードリロード
ActivityHandlingHelper.getInstance().setRequireDashBoardReload(true);
} else {
// ホーム画面リロード
ActivityHandlingHelper.getInstance().setRequireHomeReload(true);
}
// ホーム画面リロード
ActivityHandlingHelper.getInstance().setRequireHomeReload(true);
super.finish();
}
......@@ -1210,12 +1145,7 @@ public class ContentDetailViewActivity extends ABVUIActivity {
private ContentLinkAdapterDto.ContentStatus getContentStatus(ContentDto contentDto) {
// ローカルに存在しない場合、ダウンロード不可
if (contentDto == null) {
if(ABVEnvironment.getInstance().isReader){
// リーダーの場合、一律でダウンロード可能状態で表示する
return ContentLinkAdapterDto.ContentStatus.POSSIBLE;
} else {
return ContentLinkAdapterDto.ContentStatus.IMPOSSIBLE;
}
return ContentLinkAdapterDto.ContentStatus.IMPOSSIBLE;
}
// ダウンロード済みならば、ダウンロード済み
......@@ -1261,14 +1191,7 @@ public class ContentDetailViewActivity extends ABVUIActivity {
contentLinkDto.contentName = contentName;
contentLinkDto.contentId = contentId;
ContentDto contentDto;
if(ABVEnvironment.getInstance().isReader){
contentDto= contentLogic.getContentBySiteId(mContractDto.siteId, contentLinkDto.contentId);
contentLinkDto.checkable = true;
} else {
contentDto= contentDao.getContent(contentLinkDto.contentId);
}
ContentDto contentDto= contentDao.getContent(contentLinkDto.contentId);
contentLinkDto.contentStatus = getContentStatus(contentDto);
if (contentDto != null) {
......@@ -1284,10 +1207,6 @@ public class ContentDetailViewActivity extends ABVUIActivity {
// Streaming選択が可能な場合、設定の優先に従って変更
contentLinkDto.selectable = true;
}
} else {
if (ABVEnvironment.getInstance().isReader) {
contentLinkDto.contentId = ContentLogic.getReaderContentId(mContractDto.siteId, contentId);
}
}
}
......@@ -1420,14 +1339,10 @@ public class ContentDetailViewActivity extends ABVUIActivity {
case SubMenuType.USER_INFO_PASTE:
copyUserInfoCheckOrientation(getABVUIDataCache().srcContentId, contentDto.contentId);
break;
case SubMenuType.SHARE_CONTENT:
doWithContentShare(contentDto);
break;
}
popupWindow.dismiss();
}
});
popupWindow.showAsDropDown(anchor);
}
......@@ -1476,7 +1391,6 @@ public class ContentDetailViewActivity extends ABVUIActivity {
*/
public void onClickPublisherAll(View view) {
Logger.d(TAG, "onClickPublisherAll: %s", view.getId());
showPublisherContentList(getABVUIDataCache().getHomeSiteId(), getABVUIDataCache().getHomeContractId());
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
package jp.agentec.abook.abv.ui.home.activity;
public class MeetingListActivityDialog extends MeetingListActivity {
}
......@@ -848,9 +848,23 @@ public class ProjectListActivity extends ABVUIActivity {
mProjectLastEditDate = receptionTaskData(projectId, progressCallback, buttonEventFlag);
if (projectReportType == Constant.ProjectReportType.INSPECT_REPORT) {
if (buttonEventFlag) {
String dialogMsg = null;
// 定期点検プロジェクトの利用可能日付を取得
String avilableDateStr = mProjectLogic.getInspectProjectAvailableDateStr(projectId);
if (!StringUtil.isNullOrEmpty(avilableDateStr)) {
// 利用可能メッセージ
dialogMsg = String.format(getString(R.string.msg_inspect_report_available_from), avilableDateStr);
} else if (!mInspectTaskReportDao.existsToDoInspectTaskReportData(projectId)) {
// 作業データが存在しないメッセージ
dialogMsg = getString(R.string.msg_no_report_data);
}
if (!StringUtil.isNullOrEmpty(dialogMsg)) {
showSimpleAlertDialog(getString(R.string.app_name), dialogMsg);
}
}
putUserPref(String.format(AppDefType.UserPrefKey.SYNCED_PROJECT_ID, projectId), DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none));
}
} catch (ABVException e) {
//noinspection EnumSwitchStatementWhichMissesCases
switch (e.getCode()) {
......@@ -863,12 +877,6 @@ public class ProjectListActivity extends ABVUIActivity {
case S_E_ACMS_0500:
handleErrorMessageToast(ABVExceptionCode.S_E_ACMS_0500);
break;
case P_E_ACMS_P006:
case P_E_ACMS_P007:
mProjectLogic.updateSyncProject(projectId, false);
putUserPref(String.format(AppDefType.UserPrefKey.SYNCED_PROJECT_ID, projectId), DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none));
showSimpleAlertDialog(getString(R.string.app_name), e.getMessage());
break;
default:
Logger.e(TAG, "syncProject", e);
handleErrorMessageToast(ErrorCode.E107);
......@@ -892,8 +900,6 @@ public class ProjectListActivity extends ABVUIActivity {
if (mProjectLastEditDate != null) {
mProjectLogic.finishedSyncProject(projectId, mProjectLastEditDate);
progressDialogHorizontal.setProgress(100);
} else {
}
mProjectLastEditDate = null;
refreshProject();
......@@ -965,13 +971,6 @@ public class ProjectListActivity extends ABVUIActivity {
Date lastEditDate;
if (projectDto.projectReportType == Constant.ProjectReportType.INSPECT_REPORT) {
if (buttonEventFlag) {
Date currDate = DateTimeUtil.getCurrentSqlDate();
if (DateTimeUtil.isDateBefore(currDate, projectDto.projectStartDate)) {
throw new ABVException(ABVExceptionCode.P_E_ACMS_P006, String.format(getString(R.string.msg_inspect_report_available_from), DateTimeUtil.toString(projectDto.projectStartDate, DateTimeFormat.yyyyMMdd_slash)));
}
}
ProjectInspectDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getProjectInspectData(param);
//プログレスを40%進行させるための計算
......@@ -1030,13 +1029,6 @@ public class ProjectListActivity extends ABVUIActivity {
}
progressCallback.callback(new Integer(progress));
}
if (buttonEventFlag) {
if(!mInspectTaskReportDao.existsToDoInspectTaskReportData(projectDto.projectId)) {
throw new ABVException(ABVExceptionCode.P_E_ACMS_P007, getString(R.string.msg_no_report_data));
}
}
lastEditDate = json.lastEditDate;
} else {
ProjectDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getProjectData(param);
......
package jp.agentec.abook.abv.ui.home.activity;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant.ReaderConstant;
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.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContractDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.StringUtil;
import org.apache.http.HttpStatus;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.impl.client.DefaultHttpClient;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class PublisherContentListActivity extends ABVUIActivity {
private static final String TAG = "PublisherContentListActivity";
private WebView mWebView;
private boolean mIsFailure;
private View mErrorPage;
private View mLoadingSpinner;
private String contentListUrl;
// private String downloadUrl;
private String excludeContentIds;
private int siteId;
private int contractId;
ContractDto contractDto;
@Override
protected void onCreate(Bundle savedInstanceState) {
Logger.i("PublisherContentListActivity", "onCreate");
super.onCreate(savedInstanceState);
Logger.d(TAG, "PublisherContentListActivity.onCreate");
// URL取得
Intent intent = getIntent();
contentListUrl = intent.getStringExtra("contentListUrl");
// downloadUrl = intent.getStringExtra("downloadUrl"); // CMSのdownloadUrl
String companyName = intent.getStringExtra("companyName"); // 事業者名
Logger.d(TAG, "url: %s", contentListUrl);
excludeContentIds = intent.getStringExtra("excludeContentIds");
siteId = intent.getIntExtra("siteId", 0);
contractId = intent.getIntExtra("contractId", 0);
contractDto = AbstractDao.getDao(ContractDao.class).getDto(siteId, contractId);
// URLチェック(200OK以外はNG)
if (!checkUrl()) {
ABVToastUtil.showMakeText(this, R.string.publisher_content_list_error, Toast.LENGTH_SHORT);
finish();
return;
}
// ビュー初期設定
setContentView(R.layout.contract_content_list);
mIsFailure = false;
TextView titleView = (TextView) findViewById(R.id.contract_content_list_title);
if (companyName.length() > 12) {
companyName = companyName.substring(0, 12) + "...";
}
titleView.setText(String.format(getString(R.string.publisher_content_list), companyName));
mLoadingSpinner = findViewById(R.id.loading_spinner);
mErrorPage= findViewById(R.id.webview_error_page);
configureWebView();
// CMS読み込み
mWebView.loadUrl(contentListUrl);
// 終了ボタン
final Button closeBtn = (Button) findViewById(R.id.close);
closeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private boolean checkUrl() { // webViewではステータスコードはチェックできず、200以外の場合でもonReceivedErrorは呼ばれないので、事前にHEADメソッドでチェックする
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
Callable<Integer> c = new Callable<Integer>() {
@Override
public Integer call() {
try {
StatusLine httpStatus = new DefaultHttpClient().execute(new HttpHead(contentListUrl)).getStatusLine(); // TODO: 共通化
Logger.i(TAG, "httpStatus: %s for %s", httpStatus, contentListUrl);
return httpStatus.getStatusCode();
} catch (ClientProtocolException e) {
Logger.e(TAG, "Failed to head the url " + contentListUrl, e);
} catch (IOException e) {
Logger.e(TAG, "Failed to head the url " + contentListUrl, e);
}
return 0;
}
};
Future<Integer> f = executor.submit(c);
int httpStatus = 0;
try {
httpStatus = f.get(5, TimeUnit.SECONDS);
} catch (Exception e) {
Logger.e(TAG, "Failed to call. url=" + contentListUrl, e);
}
return httpStatus == HttpStatus.SC_OK;
} finally {
executor.shutdown();
}
}
protected void configureWebView() {
mWebView = (WebView) findViewById(R.id.webView);
mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
//noinspection deprecation(API18から非推奨になった。無視)
mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
WebSettings settings = mWebView.getSettings();
settings.setSupportMultipleWindows(false); // 新しいウィンドウを開くイベントを取得する
settings.setLoadsImagesAutomatically(true); // イメージを自動的にロードする
settings.setJavaScriptEnabled(true); // JavaScriptを有効にする
mWebView.setWebViewClient(new WebViewClient() {
private boolean pageStart;
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
Logger.d(TAG, "onPageStarted: %s", url);
super.onPageStarted(view, url, favicon);
mLoadingSpinner.setVisibility(View.VISIBLE);
mWebView.setVisibility(View.INVISIBLE);
mErrorPage.setVisibility(View.GONE);
}
@Override
public void onPageFinished(WebView view, String url) {
Logger.d(TAG, "onPageFinished excludeContentIds : %s", excludeContentIds);
mLoadingSpinner.setVisibility(View.GONE);
if (mIsFailure) {
mErrorPage.setVisibility(View.VISIBLE);
mWebView.setVisibility(View.INVISIBLE);
} else {
mErrorPage.setVisibility(View.GONE);
mWebView.setVisibility(View.VISIBLE);
if (!pageStart) {
if (!StringUtil.isNullOrEmpty(excludeContentIds)) { // DL済みの場合、ReDownloadに表記を変える
mWebView.loadUrl("javascript:setExcludeContentIds('" + excludeContentIds + "')");
mWebView.loadUrl("javascript:changeButtonBatch()");
}
pageStart = true;
}
}
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Logger.e(TAG, "onReceivedError: " + failingUrl);
mIsFailure = true;
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Logger.v(TAG, "shouldOverrideUrlLoading: %s", url);
if (url.startsWith("content-dl://")) { // コンテンツダウンロード
Uri uri = Uri.parse(url);
final String contentId = uri.getQueryParameter("contentId");
Logger.d(TAG, "shouldOverrideUrlLoading:contentId %s", contentId);
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
readerContentDownload(contractDto, Long.valueOf(contentId));
ActivityHandlingHelper.getInstance().refreshContentList();
}
});
}
return true;
}
});
}
@Override
public void finish() {
super.finish();
ActivityHandlingHelper.getInstance().refreshContentList();
Logger.d(TAG, "finish");
if (mWebView != null) {
ViewGroup parent = (ViewGroup) mWebView.getParent();
if (parent != null) {
parent.removeView(mWebView);
}
mWebView.removeAllViews();
mWebView.destroy();
mWebView = null;
}
}
@Override
public void onDownloadingContentZip(final ContentZipDownloadNotification notification) {
if(notification.getDownloadStatus() == DownloadStatusType.Succeeded) {
if (mWebView != null) {
runOnUiThread(new Runnable() {
@Override
public void run() {
mWebView.loadUrl("javascript:downloaded('" + notification.contentId % ReaderConstant.SITEID_IN_CONTENTID_FOLD + "')");
}
});
}
}
}
}
package jp.agentec.abook.abv.ui.home.activity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.WindowManager;
public class PublisherContentListActivityDialog extends PublisherContentListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams lp = getWindow().getAttributes();
DisplayMetrics metrics = getResources().getDisplayMetrics();
lp.width = (int) (metrics.widthPixels * 0.6);
lp.height = (int) (metrics.heightPixels * 0.8);
getWindow().setAttributes(lp);
}
}
package jp.agentec.abook.abv.ui.home.activity;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.ExceptionHandler;
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.SearchHistoryDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.SearchHistoryDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.ContentLocationType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.SideMenuType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.SideMenuType.SideMenuMyDataSubType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
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.adapter.SearchListAdapter;
import jp.agentec.adf.net.http.HttpDownloadSimpleNotification;
import jp.agentec.adf.net.http.HttpDownloadState;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
public class SearchActivity extends ABVUIActivity {
private static final String TAG = "SearchActivity";
// public static final String KEY_SEARCH_TEXT = "key.searchText";
public static final String KEY_SEARCH_TYPE = "key.searchType";
private int mSearchType = 0; // コンテンツ名(0), コンテンツ本文orメモ内容(1)
private SearchHistoryDao searchHistoryDao = AbstractDao.getDao(SearchHistoryDao.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
Logger.i("SearchActivity", "onCreate");
// if (!isNormalSize()) {
// setTheme(android.R.style.Theme_Dialog);
// }
super.onCreate(savedInstanceState);
Logger.d(TAG, "SearchActivity.onCreate");
setContentView(R.layout.ac_search_view);
initABookMode();
// タグ検索機能がOFFの場合、ラジオボタンを非表示
// abvFunctionOptions.xml
TextView radioContentTag = (TextView)findViewById(R.id.search_content_tag);
TextView textView = (TextView) findViewById(R.id.search_content_text);
if (getRInteger(R.integer.usable_content_tag_search) == 1) {
radioContentTag.setVisibility(View.VISIBLE);
textView.setBackgroundResource(R.drawable.radio_center);
} else {
radioContentTag.setVisibility(View.GONE);
textView.setBackgroundResource(R.drawable.radio_right);
}
if (SideMenuMyDataSubType.SUB_MENU_MEMO.equals(getABVUIDataCache().getMyDataSubmenu()) && getABVUIDataCache().getSelectedHomeMenu() == SideMenuType.MENU_MYDATA) {
textView.setText(R.string.memo_data);
} else {
textView.setText(R.string.content_text);
if(getABVUIDataCache().getContentLocationType() == ContentLocationType.CLOUD){
textView.setEnabled(false);
textView.setTextColor(0xFFE0E0E0);
}
}
// 検索対象のチェック
RadioGroup searchTarget = (RadioGroup) findViewById(R.id.search_target_group);
searchTarget.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.search_content_text) {
mSearchType = 1;
} else if (checkedId == R.id.search_content_tag) {
mSearchType = 2;
} else {
mSearchType = 0;
}
}
});
// 終了ボタン
final Button closeBtn = (Button) findViewById(R.id.close_search);
closeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getABVUIDataCache().searchText = null;
finish();
}
});
}
private void initABookMode() {
// 検索文字列をセットする
final ListView searchHistoryList = (ListView) findViewById(R.id.search_history_list);
// final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.search_list_item);
final SearchListAdapter adapter = new SearchListAdapter(getApplicationContext());
final List<SearchHistoryDto> searchDtoList = addSearchHistoryList(adapter);
searchHistoryList.setEmptyView(findViewById(R.id.no_data_layout));
// if (adapter.getCount() > 0) {
// findViewById(R.id.no_data).setVisibility(View.GONE);
// }
searchHistoryList.setAdapter(adapter);
final EditText searchText = (EditText) findViewById(R.id.search_text);
searchText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
if (event.getAction() == KeyEvent.ACTION_UP) {
onClickSearch(v);
}
return true;
}
return false;
}
});
String text = getABVUIDataCache().searchText;
if (text != null) {
searchText.setText(text);
searchText.setSelection(text.length());
}
// Row選択時、検索文字としてテキストにセットする
searchHistoryList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String text = (String) searchHistoryList.getItemAtPosition(position);
searchText.setText(text);
searchText.setSelection(text.length()); // カーソル移動
}
});
// Rowを長押しすると削除
searchHistoryList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Logger.d(TAG, "search setOnItemLongClickListener");
String text = (String) searchHistoryList.getItemAtPosition(position);
searchHistoryDao.deleteSearchHistory(text);
adapter.remove(text);
adapter.notifyDataSetChanged();
return true;
}
});
// 履歴クリア
findViewById(R.id.btn_search_history_clear).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(SearchActivity.this, R.string.search_history);
alertDialog.setMessage(R.string.search_history_clear_message);
alertDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
for (SearchHistoryDto dto : searchDtoList) {
adapter.remove(dto.searchText);
}
searchHistoryDao.deleteAllSearchHistory();
adapter.notifyDataSetChanged();
}
});
alertDialog.setNegativeButton(R.string.cancel, null);
alertDialog.show();
}
});
}
/**
* テーブルから検索履歴の文字列を取得し、Adapterにセットする
* @param adapter ArrayAdapter<String>
*/
private List<SearchHistoryDto> addSearchHistoryList(SearchListAdapter adapter) {
List<SearchHistoryDto> dtoList = searchHistoryDao.getSearchHistoryDtoList();
int size = dtoList.size();
if (size > 0) {
for (int i = 0; i < size; i++) {
if (!isNormalSize() && i >= 5) {
break; // タブレット版:最大5件まで
}
SearchHistoryDto dto = dtoList.get(i);
adapter.add(dto.searchText);
}
}
return dtoList;
}
@Override
public void finish() {
super.finish();
Logger.d(TAG, "finish");
}
private List<ContentDto> getContentList() {
return contentDao.getAllContents();
}
@Override
public void onDownloadedContentDetail(final HttpDownloadSimpleNotification notification) {
// ここでは、finishedとfailed以外はこない。
if (notification.getDownloadState() == HttpDownloadState.failed) {
// Logger.e("コンテンツ詳細情報取得失敗 :" + notification.getError().toString());
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
if (ExceptionHandler.isNoSpaceLeftOnDeviceIOException(notification.getError())) {
// 空き容量が足りない
handleErrorMessageToast(ErrorCode.STORAGE_ERROR);
} else {
handleErrorMessageToast(ErrorCode.L120);
}
}
});
} else {
Long contentId = (Long) notification.getCustomInformation();
contentDetailActivityMove(contentId, SearchActivity.class.getName());
}
}
// @Override
// public boolean onTouchEvent(MotionEvent event) {
// finish();
// return super.onTouchEvent(event);
// }
public void onClickSearch(View view) {
EditText searchText = (EditText) findViewById(R.id.search_text);
String text = searchText.getText().toString();
getABVUIDataCache().searchText = text;
if (text.length() > 0) {
SearchHistoryDto dto = new SearchHistoryDto();
dto.searchText = text;
dto.insertDate = new Date(System.currentTimeMillis());
searchHistoryDao.insertUpdateSearchHistory(dto);
Intent intent = new Intent();
intent.setClassName(getApplicationContext().getPackageName(), convertClassName(SearchResultActivity.class.getName()));
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(KEY_SEARCH_TYPE, mSearchType);
intent.putExtra("fromClassName", convertClassName(SearchActivity.class.getName()));
startActivity(intent);
finish();
} else {
ABVToastUtil.showMakeText(getApplicationContext(), "No Search Text", Toast.LENGTH_SHORT);
}
}
}
package jp.agentec.abook.abv.ui.home.activity;
public class SearchActivityDialog extends SearchActivity {
}
package jp.agentec.abook.abv.ui.home.activity;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.ContentSortingType;
import jp.agentec.abook.abv.bl.acms.type.SearchDivisionType;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.exception.ExceptionHandler;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.SortDirection;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.UnAuthorizedContentLogic;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.ContentLocationType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.SideMenuType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.SideMenuType.SideMenuMyDataSubType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.SortType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.vo.ContentMyList;
import jp.agentec.abook.abv.ui.home.adapter.SearchResultListAdapter;
import jp.agentec.abook.abv.ui.home.helper.AbstractContentListHelper;
import jp.agentec.adf.net.http.HttpDownloadSimpleNotification;
import jp.agentec.adf.net.http.HttpDownloadState;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
public class SearchResultActivity extends ABVUIActivity {
public static final String TAG = "SearchResultActivity";
private String searchText;
private SortDirection sortDirection;
private SearchDivisionType searchDivisionType;
private ContentSortingType contentSortingType = ContentSortingType.ContentName;
private int locationType;
String[] contentTypes;
private String fromClassName = null;
boolean mSearchErrorFlag = false;
private List<ContentDto> mSearchedContentList;
@Override
protected void onCreate(Bundle savedInstanceState) {
Logger.i("ContentSearchResultActivity", "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_search_result);
sortDirection = SortDirection.ASC;
searchText = getABVUIDataCache().searchText;
int searchType = getIntent().getIntExtra(SearchActivity.KEY_SEARCH_TYPE, 0);
fromClassName = getIntent().getStringExtra("fromClassName");
switch (searchType) {
case 0:
// コンテンツタイトル検索
searchDivisionType = SearchDivisionType.Title;
break;
case 1:
if (SideMenuMyDataSubType.SUB_MENU_MEMO.equals(getABVUIDataCache().getMyDataSubmenu()) && getABVUIDataCache().getSelectedHomeMenu() == SideMenuType.MENU_MYDATA) {
// マイデータのメモの場合メモ本文で検索
searchDivisionType = SearchDivisionType.Memo;
} else {
// それ以外はPDF本文で検索
searchDivisionType = SearchDivisionType.FullText;
}
break;
case 2:
searchDivisionType = SearchDivisionType.Tag;
break;
default:
searchDivisionType = SearchDivisionType.Title;
break;
}
locationType = getABVUIDataCache().getContentLocationType();
contentTypes = AbstractContentListHelper.convertContentType(getABVUIDataCache().getContentTypes());
findViewById(R.id.close_search).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getABVUIDataCache().searchText = null;
finish();
}
});
findViewById(R.id.btn_search).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClassName(getApplicationContext().getPackageName(), fromClassName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.sort_type_group);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.delivery_date) {
contentSortingType = ContentSortingType.DeliveryStartDate;
sortDirection = AbstractContentListHelper.getSortDirection(SortType.DELIVERY_STARTDATE);
} else if (checkedId == R.id.download_date) {
contentSortingType = ContentSortingType.DownloadDate;
sortDirection = AbstractContentListHelper.getSortDirection(SortType.DOWNLOAD_DATE);
} else {
contentSortingType = ContentSortingType.ContentName;
sortDirection = AbstractContentListHelper.getSortDirection(SortType.CONTENT_NAME);
}
threadSearch();
}
});
if (locationType == ContentLocationType.CLOUD) {
findViewById(R.id.download_date).setVisibility(View.GONE);
}
TextView text = (TextView) findViewById(R.id.search_text);
text.setText(getABVUIDataCache().searchText);
showProgressPopup();
threadSearch();
Logger.d(TAG, "onCreate end");
}
private void threadSearch() {
CommonExecutor.execute(new SearchHandler());
}
@Override
public void finish() {
super.finish();
Logger.d(TAG, "finish");
}
private class SearchHandler implements Runnable {
@Override
public void run() {
Logger.d(TAG, "SearchHandler.run 1");
try {
ArrayList<ContentDto> contentDtoList;
switch (locationType) {
case ContentLocationType.CLOUD:
contentDtoList = contentLogic.getContentList(false, searchText, searchDivisionType, contentSortingType,
sortDirection, ContentMyList.searchFlg, contentTypes);
break;
case ContentLocationType.DEVICE:
contentDtoList = contentLogic.getContentList(true, searchText, searchDivisionType, contentSortingType,
sortDirection, ContentMyList.searchFlg, contentTypes);
break;
default:
contentDtoList = contentLogic.getContentList(null, searchText, searchDivisionType, contentSortingType,
sortDirection, ContentMyList.searchFlg, contentTypes);
break;
}
// 検索結果をお気に入りで絞り込み
if (getABVUIDataCache().getFavoriteFlag()) {
if (mSearchedContentList == null) {
mSearchedContentList = new ArrayList<>();
} else {
mSearchedContentList.clear();
}
for (ContentDto contentDto : contentDtoList) {
if (contentDto.favoriteFlg) {
mSearchedContentList.add(contentDto);
}
}
} else {
mSearchedContentList = contentDtoList;
}
} catch (Exception e) {
Logger.e(TAG, "showRestoreDialog failed.", e);
mSearchErrorFlag = true;
} finally {
handler.post(new Runnable() {
@Override
public void run() {
if (mSearchErrorFlag) {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.ERROR, Toast.LENGTH_SHORT);
}
final SearchResultListAdapter adapter = new SearchResultListAdapter(getApplicationContext(), mSearchedContentList);
ListView listView = (ListView) findViewById(R.id.search_result_list);
listView.setEmptyView(findViewById(R.id.no_data));
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> patent, View view, int position, long id) {
ContentDto infoDto = adapter.getItem(position);
String className = convertClassName(SearchResultActivity.class.getName());
contentDetailActivityMove(infoDto.contentId, className);
}
});
TextView resultCount = (TextView) findViewById(R.id.search_count);
if (mSearchedContentList.size() > 0) {
resultCount.setText(mSearchedContentList.size()+"");
} else {
resultCount.setText("0");
}
closeProgressPopup();
}
});
}
Logger.d(TAG, "SearchHandler.run 2");
}
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
public void onDownloadedContentDetail(final HttpDownloadSimpleNotification notification) {
// ここでは、finishedとfailed以外はこない。
if (notification.getDownloadState() == HttpDownloadState.failed) {
// Logger.e("コンテンツ詳細情報取得失敗 :" + notification.getError().toString());
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
if (ExceptionHandler.isNoSpaceLeftOnDeviceIOException(notification.getError())) {
// 空き容量が足りない
handleErrorMessageToast(ErrorCode.STORAGE_ERROR);
} else {
handleErrorMessageToast(ErrorCode.L120);
}
}
});
} else {
Long contentId = (Long) notification.getCustomInformation();
contentDetailActivityMove(contentId, HomeUIActivity.class.getName());
}
}
}
package jp.agentec.abook.abv.ui.home.activity;
public class SearchResultActivityDialog extends SearchResultActivity {
}
package jp.agentec.abook.abv.ui.home.activity;
import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.adapter.ShareAppListAdapter;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v4.content.Loader;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class ShowQrcodeActivity extends FragmentActivity {
private static final String URL = "url";
private static final String SHARE_URL_TEXT = "shareUrlText";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.ac_show_qrcode);
String shareUrl = getIntent().getStringExtra(URL);
final String shareUrlText = getIntent().getStringExtra(SHARE_URL_TEXT);
TextView txtUrl = (TextView) findViewById(R.id.qrcodeUrl);
txtUrl.setText("URL: " + shareUrl);
Button btnClose = (Button) findViewById(R.id.close);
btnClose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
Button btnShare = (Button) findViewById(R.id.shareByEmail);
btnShare.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showShareAppList(shareUrlText);
}
});
// QR コードを生成して ImageView に表示(非同期でエンコードする)
Bundle bundle = new Bundle();
bundle.putString(URL, shareUrl);
getSupportLoaderManager().initLoader(0, bundle, callbacks);
}
/**
* コンテンツリンクを共有するアプリ一覧を表示する
*
* @param shareUrlText
* 共有コンテンツリンク
*/
protected void showShareAppList(String shareUrlText) {
final ShareAppListAdapter adapter = new ShareAppListAdapter(this, shareUrlText);
final ABookAlertDialog shareDialog = AlertDialogUtil.createAlertDialog(this, R.string.share_contents);
shareDialog.setAdapter(adapter, adapter.getItemClickListener());
shareDialog.show();
}
private LoaderCallbacks<Bitmap> callbacks = new LoaderCallbacks<Bitmap>() {
@Override
public Loader<Bitmap> onCreateLoader(int id, Bundle bundle) {
EncodeTaskLoader loader = new EncodeTaskLoader(getApplicationContext(), bundle.getString(URL));
loader.forceLoad();
return loader;
}
@Override
public void onLoaderReset(Loader<Bitmap> loader) {
}
@Override
public void onLoadFinished(Loader<Bitmap> loader, Bitmap bitmap) {
getSupportLoaderManager().destroyLoader(0);
if (bitmap == null) {
// エンコード失敗
Toast.makeText(getApplicationContext(), getString(R.string.error), Toast.LENGTH_SHORT).show();
} else {
// エンコード成功
ImageView imageView = (ImageView) findViewById(R.id.qrcodeView);
imageView.setImageBitmap(bitmap);
}
}
};
public static class EncodeTaskLoader extends AsyncTaskLoader<Bitmap> {
private String mUrl;
public EncodeTaskLoader(Context context, String url) {
super(context);
mUrl = url;
}
@Override
public Bitmap loadInBackground() {
try {
int size = (int)(200 * getContext().getResources().getDisplayMetrics().density);
return BitmapUtil.createQrCode(mUrl, size);
} catch (Exception e) { // 失敗
return null;
}
}
}
}
package jp.agentec.abook.abv.ui.home.activity;
public class ShowQrcodeActivityDialog extends ShowQrcodeActivity {
}
package jp.agentec.abook.abv.ui.home.activity.custom;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.CategoryDao;
import jp.agentec.abook.abv.bl.dto.CategoryDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity;
import jp.agentec.abook.abv.ui.home.activity.DashboardActivity;
import jp.agentec.abook.abv.ui.home.dialog.HtmlViewDialog;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;
public class MainViewActivity extends ABVUIActivity {
private static final String KOMAS_MAIN_URL = "http://ekomas.net/mobile/main";
private static final String KOMAS_BBS_URL = "http://ekomas.net/mobile/notice";
private List<CategoryDto> mCategoryDtoList = null;
private ListView mCategoryListView = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_komas_main);
mRefreshImage = (ImageView) findViewById(R.id.menu_refresh);
mCategoryListView = (ListView) findViewById(R.id.categoryListView);
mCategoryListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CategoryDto dto = mCategoryDtoList.get(position);
Intent intent = new Intent(MainViewActivity.this, DashboardActivity.class);
intent.putExtra("categoryId", dto.categoryId);
intent.putExtra("categoryName", dto.categoryName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
}
@Override
protected void onResume() {
super.onResume();
// 自動新着更新を実行する
int refreshInterval = getApplicationContext().getResources().getInteger(R.integer.content_refresh_interval);
boolean toBeRefreshed = getABVUIDataCache().isFirstLaunching || refreshInterval != -1 && contentRefresher.isRefreshDateAfter(refreshInterval);
if (toBeRefreshed) {
// 起動時に新着更新を行う
dataRefresh(true);
getABVUIDataCache().isFirstLaunching = false;
} else {
setCategoryList();
}
}
@Override
public void onRefreshedContent(boolean result, long contentId, Exception e) {
super.onRefreshedContent(result, contentId, e);
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!contentRefresher.isRefreshing()) {
stopUpdateAnimation();
setCategoryList();
}
}
});
}
public void onClickRefresh(View v) {
dataRefresh(false);
}
public void onClickShowWebView(View v) {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(this, R.string.request_network_connection, Toast.LENGTH_SHORT);
return;
}
HtmlViewDialog htmlViewDialog = null;
if (v.getId() == R.id.mainImageView) {
// HP画面を表示する
htmlViewDialog = new HtmlViewDialog(this, KOMAS_MAIN_URL);
htmlViewDialog.setToolbarTitle(getResources().getString(R.string.app_name));
} else if (v.getId() == R.id.bbsBtn) {
// BBS画面を表示する
htmlViewDialog = new HtmlViewDialog(this, KOMAS_BBS_URL);
htmlViewDialog.setToolbarTitle(getResources().getString(R.string.bbs_title));
}
if (htmlViewDialog != null) {
htmlViewDialog.setNormalSizeFlag(true);// 全画面表示
htmlViewDialog.show();
}
}
public void onClickShowSetting(View v) {
// 設定画面
Intent intent = new Intent();
intent.setClassName(getApplicationContext().getPackageName(), ABookSettingActivity.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
return;
}
public void onClickShowMeetingView(View v) {
SharedPreferences pref = getSharedPreferences(AppDefType.PrefName.USER_PREFERENCE, Context.MODE_PRIVATE);
boolean isGuestLogin = pref.getBoolean(AppDefType.UserPrefKey.GUEST_LOGIN, false);
if (isGuestLogin) {
ABVToastUtil.showMakeText(this, R.string.msg_only_pament_member, Toast.LENGTH_SHORT);
} else {
ActivityHandlingHelper.getInstance().startMeetingActivity();
}
}
private void setCategoryList() {
CategoryDao categoryDao = AbstractDao.getDao(CategoryDao.class);
mCategoryDtoList = categoryDao.getCategoryChildList(0);
ArrayList<String> categoryNames = new ArrayList<>();
for (CategoryDto categoryDto : mCategoryDtoList) {
categoryNames.add(categoryDto.categoryName);
}
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, categoryNames);
mCategoryListView.setAdapter(adapter);
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckedTextView;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
public class ContentChoiceAdapter extends BaseAdapter implements Filterable {
private static LayoutInflater mInflater = null;
private List<ContentDto> mListContent;
private List<ContentDto> mOriginalListContent;
private final int mThumbnailSize;
public ContentChoiceAdapter(Context context, List<ContentDto> listContent) {
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mListContent = listContent;
mThumbnailSize = context.getResources().getDimensionPixelSize(R.dimen.content_thumbnail_image_size);
}
@Override
public int getCount() {
return mListContent.size();
}
@Override
public ContentDto getItem(int position) {
return mListContent.get(position);
}
public List<ContentDto> getItems() {
return mListContent;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (null == convertView) {
convertView = mInflater.inflate(R.layout.item_content_choice, null);
holder = new ViewHolder();
holder.contentThumbnail = (ImageView) convertView.findViewById(R.id.content_thumbnail);
holder.title = (CheckedTextView) convertView.findViewById(R.id.text1);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
ContentDto contentDto = getItem(position);
holder.title.setText(contentDto.contentName);
// サムネイル
if (holder.contentThumbnail.getDrawable() != null) {
Bitmap bitmap = ((BitmapDrawable) holder.contentThumbnail.getDrawable()).getBitmap();
if (bitmap != null) {
bitmap.recycle();
}
}
Bitmap resized = BitmapUtil.getResizedBitmap(contentDto.thumbnailNormalPath, mThumbnailSize, mThumbnailSize, Config.RGB_565);
holder.contentThumbnail.setImageBitmap(resized);
holder.title.setChecked(contentDto.isChecked);
return convertView;
}
private static class ViewHolder {
ImageView contentThumbnail;
CheckedTextView title;
}
@Override
public Filter getFilter() {
Filter filter = new Filter() {
@SuppressWarnings("unchecked")
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
mListContent = (List<ContentDto>) results.values;
notifyDataSetChanged();
}
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
List<ContentDto> filteredArrList = new ArrayList<>();
if (mOriginalListContent == null) {
mOriginalListContent = new ArrayList<>(mListContent);
}
if (constraint == null || constraint.length() == 0) {
// set the Original result to return
results.count = mOriginalListContent.size();
results.values = mOriginalListContent;
} else {
constraint = constraint.toString().toLowerCase();
for (int i = 0; i < mOriginalListContent.size(); i++) {
ContentDto data = mOriginalListContent.get(i);
if (data.contentName.toLowerCase().startsWith(constraint.toString())) {
filteredArrList.add(data);
}
}
// set the Filtered result to return
results.count = filteredArrList.size();
results.values = filteredArrList;
}
return results;
}
};
return filter;
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.activity.HomeUIActivity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
public class ContentListAdapter extends AbstractContentListAdapter {
private Context context;
private LayoutInflater inflater;
private ConcurrentHashMap<Long, ViewHolder> viewHolderMap;
public ContentListAdapter(Context context, List<ContentDto> listItem) {
this.context = context;
this.listItem = listItem;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
viewHolderMap = new ConcurrentHashMap<>();
}
@Override
public View getView(int position, View convertView, final ViewGroup parent) {
// if (ABVDataCache.getInstance().serviceOption.isPayment()) { // 決済の時は万が一でもこのビューは表示させない
// return null;
// }
ViewHolder holder;
if (null == convertView) {
convertView = inflater.inflate(R.layout.item_content_list_render, null);
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.content_title);
holder.tvContentId = (TextView) convertView.findViewById(R.id.content_id);
holder.thumbnail = (ImageView) convertView.findViewById(R.id.content_thumbnail);
holder.selected = (ImageView) convertView.findViewById(R.id.content_selected);
holder.downloadProgressBar = (ProgressBar) convertView.findViewById(R.id.content_download_progress);
holder.downloadIcon = (ImageView) convertView.findViewById(R.id.content_download_icon);
holder.submenuButton = (ImageButton) convertView.findViewById(R.id.content_submenu_button);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final ContentDto contentDto = listItem.get(position);
// タイトル
holder.title.setText(contentDto.contentName);
// コンテンツID
if (ABVEnvironment.getInstance().isReader) {
holder.tvContentId.setVisibility(View.INVISIBLE);
} else {
holder.tvContentId.setText("No." + contentDto.contractContentId);
}
// サムネイル コンテンツタイプによって表示切替
if (contentDto.contentType.equals(ContentJSON.KEY_IMAGE_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_image_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_MOVIE_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_movie_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_PANO_MOVIE_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_pano_movie_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_PANO_IMAGE_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_pano_image_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_OBJECTVR_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_objectvr_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_MUSIC_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_music_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_HTML_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_html_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_OTHER_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_other_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_NONE_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_no_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_LINK_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_weblink_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_ENQUETE_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_enquete_file);
} else if (contentDto.contentType.equals(ContentJSON.KEY_EXAM_TYPE)) {
holder.thumbnail.setImageResource(R.drawable.icon_exam_file);
} else {
holder.thumbnail.setImageResource(R.drawable.icon_pdf_file);
}
// ダウンロードボタン
// ListViewのバグのためここでFocusableをfalse
createDownloadView(holder, contentDto);
// サブメニューボタン
// ListViewのバグのためここでFocusableをfalse
holder.submenuButton.setFocusable(false);
holder.submenuButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onOpenContentSubmenu(contentDto);
}
});
holder.contentId = contentDto.contentId;
viewHolderMap.put(contentDto.contentId, holder);
return convertView;
}
@Override
public void updateDownloadView(ContentDto contentDto) {
ViewHolder holder = viewHolderMap.get(contentDto.contentId);
if(holder != null && holder.contentId == contentDto.contentId){
createDownloadView(holder, contentDto);
if (listItem.indexOf(contentDto) == 0) {
notifyDataSetChanged();
}
}
}
/**
* ダウンロードの状態によって表示が変化するViewを作成する
*
* @param holder
* @param contentDto
*/
private void createDownloadView(ViewHolder holder, final ContentDto contentDto) {
ImageView downloadIcon = holder.downloadIcon;
ProgressBar downloadProgressBar = holder.downloadProgressBar;
if (contentDto.downloadingFlg) {
if (contentDto.isDownloadPaused()) {
// ダウンロード一時停止中
downloadIcon.setBackgroundResource(R.drawable.ic_download_resume);
downloadIcon.setVisibility(View.VISIBLE);
downloadProgressBar.setEnabled(false);
} else if (contentDto.isDownloadInitializing()) {
// 初期化中
downloadIcon.setVisibility(View.INVISIBLE);
downloadProgressBar.setEnabled(true);
} else {
// ダウンロード中
downloadIcon.setBackgroundResource(R.drawable.ic_download_pause);
downloadIcon.setVisibility(View.VISIBLE);
downloadProgressBar.setEnabled(true);
}
// プログレスバー設定
downloadProgressBar.setProgress(contentDto.downloadProgress);
downloadProgressBar.setVisibility(View.VISIBLE);
} else {
Integer downloadIconResId = ((HomeUIActivity)context).getDownloadIconResId(contentDto);
if (downloadIconResId == null) {
downloadIcon.setVisibility(View.INVISIBLE);
}
else {
downloadIcon.setVisibility(View.VISIBLE);
downloadIcon.setBackgroundResource(downloadIconResId);
}
downloadProgressBar.setProgress(0);
downloadProgressBar.setVisibility(View.GONE);
}
// 選択アイコン
if (isEditMode) {
if (contentDto.downloadingFlg) {
holder.selected.setVisibility(View.INVISIBLE);
} else {
holder.selected.setVisibility(View.VISIBLE);
setSelectedBackground(holder.selected, contentDto);
}
} else {
holder.selected.setVisibility(View.GONE);
}
}
private void setSelectedBackground(ImageView selected, ContentDto contentDto) {
if (contentDto.isChecked) {
selected.setImageResource(R.drawable.icon_content_detail_check_selected);
} else {
selected.setImageResource(R.drawable.icon_content_detail_check_deselected);
}
}
private static class ViewHolder {
long contentId;
TextView title;
TextView tvContentId;
ImageView thumbnail;
ImageView selected;
ProgressBar downloadProgressBar;
ImageView downloadIcon;
ImageButton submenuButton;
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.List;
import jp.agentec.abook.abv.bl.dto.DashBoardListDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.DashboardLogic;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
/** 
* Group, Category, MyFolder 데이터
* @author Chae
* @version 1.0.0
*/
public class ContentSpareListAdapter extends BaseAdapter {
Context context;
LayoutInflater Inflater;
List<DashBoardListDto> listItem;
private DashboardLogic dashboardLogic = AbstractLogic.getLogic(DashboardLogic.class);
private OnDashboardTransferListener mOnDashboardTransferListener;
public interface OnDashboardTransferListener {
void onDashboardAddTransfer(DashBoardListDto dto);
void onDashboardUpTransfer(DashBoardListDto dto);
void onDashboardDownTransfer(DashBoardListDto dto);
}
public void setDashboardTransferListener(OnDashboardTransferListener listener) {
mOnDashboardTransferListener = listener;
}
int layout;
public ContentSpareListAdapter(Context context, int alayout, List<DashBoardListDto> listItem) {
this.context = context;
Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.listItem = listItem;
layout = alayout;
}
@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);
}
ImageButton btnUp = (ImageButton)convertView.findViewById(R.id.btn_up);
ImageButton btnDown = (ImageButton)convertView.findViewById(R.id.btn_down);
RelativeLayout relCell = (RelativeLayout)convertView.findViewById(R.id.rel_cell);
final DashBoardListDto dto = listItem.get(position);
btnDown.setVisibility(View.GONE);
btnUp.setVisibility(View.GONE);
if (position == 0) {
boolean result =false;
for (DashBoardListDto dashDto : listItem) {
result = dashboardLogic.isTopPosition(dashDto.item, dashDto.listId);
if (!result) {
break;
}
}
if (!result) {
btnUp.setVisibility(View.VISIBLE);
}
}
if (btnUp.getVisibility() == View.VISIBLE) {
//상위 계층 이동
btnUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnDashboardTransferListener.onDashboardUpTransfer(dto);
}
});
//대쉬보드 위젯 리스트에 추가
relCell.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnDashboardTransferListener.onDashboardUpTransfer(dto);
}
});
} else {
if (dashboardLogic.isExistParent(dto.item, dto.listId)) {
//하위 계층 이동
btnDown.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnDashboardTransferListener.onDashboardDownTransfer(dto);
}
});
btnDown.setVisibility(View.VISIBLE);
}
//대쉬보드 위젯 리스트에 추가
relCell.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnDashboardTransferListener.onDashboardAddTransfer(dto);
}
});
}
TextView txt_title = (TextView)convertView.findViewById(R.id.txt_title);
txt_title.setText(dto.listName);
if(dto.checked){
txt_title.setTextColor(Color.GRAY);
relCell.setOnClickListener(null);
}
return convertView;
}
@Override
public Object getItem(int position) {
return null;
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.List;
import jp.agentec.abook.abv.bl.dto.DashBoardListDto;
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.TextView;
/** 
* Group, Category, MyFolder 데이터
* @author Chae
* @version 1.0.0
*/
public class ContentSpareListNormalAdapter extends BaseAdapter {
Context context;
LayoutInflater Inflater;
List<DashBoardListDto> listItem;
int layout;
public ContentSpareListNormalAdapter(Context context, int alayout, List<DashBoardListDto> listItem) {
this.context = context;
Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.listItem = listItem;
layout = alayout;
}
@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);
}
final DashBoardListDto dto = listItem.get(position);
TextView txt_title = (TextView)convertView.findViewById(R.id.txt_title);
txt_title.setText(dto.listName);
return convertView;
}
@Override
public Object getItem(int position) {
return null;
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.activity.HomeUIActivity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ContentThumbnailAdapter extends AbstractContentListAdapter {
private Context context;
private LayoutInflater inflater;
private final int thumbnailSize;
private final int padding;
private ConcurrentHashMap<Long, ViewHolder> viewHolderMap;
public ContentThumbnailAdapter(Context context, List<ContentDto> listItem) {
this.context = context;
this.listItem = listItem;
padding = (int) (4f * context.getResources().getDisplayMetrics().density + 0.5f);
thumbnailSize = context.getResources().getDimensionPixelSize(R.dimen.content_thumbnail_image_size) - padding;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
viewHolderMap = new ConcurrentHashMap<>();
}
@Override
public View getView(int position, View convertView, final ViewGroup parent) {
// if (ABVDataCache.getInstance().serviceOption.isPayment()) { // 決済の時は万が一でもこのビューは表示させない
// return null;
// }
ViewHolder holder;
if (null == convertView) {
convertView = inflater.inflate(R.layout.item_content_thumbnail_render, null);
holder = new ViewHolder();
holder.layout = (RelativeLayout) convertView.findViewById(R.id.content_thumbnail_layout);
holder.title = (TextView) convertView.findViewById(R.id.content_title);
holder.thumbnail = (ImageView) convertView.findViewById(R.id.content_thumbnail);
holder.ribbon = (ImageView) convertView.findViewById(R.id.content_ribbon);
holder.selected = (ImageView) convertView.findViewById(R.id.content_selected);
holder.downloadProgressBar = (ProgressBar) convertView.findViewById(R.id.content_download_progress);
holder.downloadIcon = (ImageView) convertView.findViewById(R.id.content_download_icon);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final ContentDto contentDto = listItem.get(position);
// タイトル
holder.title.setText(contentDto.contentName);
// サムネイル
if (holder.thumbnail.getDrawable() != null) {
((BitmapDrawable) holder.thumbnail.getDrawable()).getBitmap().recycle();
}
// サムネイル正方形
BitmapFactory.Options options = BitmapUtil.getBitmapDimensions(contentDto.thumbnailNormalPath);
// 縦横小さい方いっぱいになるようにリサイズする
float scale = Math.max((float)thumbnailSize / options.outWidth, (float)thumbnailSize / options.outHeight);
int resizeWidth = (int) (options.outWidth * scale + 0.5f);
int resizeHeight = (int) (options.outHeight * scale + 0.5f);
Bitmap resized = BitmapUtil.getResizedBitmap(contentDto.thumbnailNormalPath, resizeWidth, resizeHeight, Config.RGB_565, false);
// nullの場合サムネイルなしイメージを表示
if (resized == null) {
resized = BitmapUtil.getResizedBitmapResource(context.getResources(), R.drawable.not_exist_thumbnail, thumbnailSize, thumbnailSize, Config.RGB_565, false);
}
// レイアウトを画像サイズに合わせる
ViewGroup.LayoutParams params = holder.layout.getLayoutParams();
params.width = thumbnailSize + padding;
params.height = thumbnailSize + padding;
holder.thumbnail.setImageBitmap(resized);
LayoutParams thumbnailParams = holder.thumbnail.getLayoutParams();
thumbnailParams.width = thumbnailSize;
thumbnailParams.height = thumbnailSize;
createDownloadView(holder, contentDto);
// サムネイル長押し
holder.thumbnail.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
listener.onOpenContentSubmenu(contentDto);
return true;
}
});
holder.contentId = contentDto.contentId;
viewHolderMap.put(contentDto.contentId, holder);
return convertView;
}
@Override
public void updateDownloadView(ContentDto contentDto){
ViewHolder holder = viewHolderMap.get(contentDto.contentId);
if(holder != null && holder.contentId == contentDto.contentId){
createDownloadView(holder, contentDto);
if (listItem.indexOf(contentDto) == 0) {
notifyDataSetChanged();
}
}
}
/**
* ダウンロードの状態によって表示が変化するViewを作成する
*
* @param holder
* @param contentDto
*/
private void createDownloadView(ViewHolder holder, final ContentDto contentDto) {
ImageView thumbnail = holder.thumbnail;
final ImageView selected = holder.selected;
ImageView downloadIcon = holder.downloadIcon;
ProgressBar downloadProgressBar = holder.downloadProgressBar;
if (contentDto.downloadingFlg) {
if (contentDto.isDownloadPaused()) {
// ダウンロード一時停止中
thumbnail.setEnabled(true);
thumbnail.setOnClickListener(new OnDownloadResumeButtonClickListener(contentDto));
downloadProgressBar.setEnabled(false);
} else if (contentDto.isDownloadInitializing()) {
// 初期化中
thumbnail.setEnabled(false);
downloadProgressBar.setEnabled(true);
} else {
// ダウンロード中
thumbnail.setEnabled(true);
thumbnail.setOnClickListener(new OnDownloadPauseButtonClickListener(contentDto));
downloadProgressBar.setEnabled(true);
}
// プログレスバー設定
downloadProgressBar.setProgress(contentDto.downloadProgress);
downloadIcon.setVisibility(View.GONE);
downloadProgressBar.setVisibility(View.VISIBLE);
} else {
Integer downloadIconResId = ((HomeUIActivity)context).getDownloadIconResId(contentDto);
if (downloadIconResId == null) {
downloadIcon.setVisibility(View.INVISIBLE);
}
else {
downloadIcon.setVisibility(View.VISIBLE);
downloadIcon.setBackgroundResource(downloadIconResId);
}
thumbnail.setEnabled(true);
thumbnail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
((HomeUIActivity)context).contentOpenOrDownload(contentDto);
}
});
downloadProgressBar.setProgress(0);
downloadProgressBar.setVisibility(View.INVISIBLE);
}
// 編集モード中
if (isEditMode) {
// 選択アイコン
if (contentDto.downloadingFlg) {
holder.selected.setVisibility(View.INVISIBLE);
} else {
holder.selected.setVisibility(View.VISIBLE);
setSelectedBackground(holder.selected, contentDto);
}
thumbnail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!contentDto.downloadingFlg) {
contentDto.isChecked = !contentDto.isChecked;
setSelectedBackground(selected, contentDto);
listener.onContentChecked();
}
}
});
} else {
holder.selected.setVisibility(View.INVISIBLE);
}
// リボン
setRibbonBackground(holder.ribbon, contentDto);
}
private void setSelectedBackground(ImageView selected, ContentDto contentDto) {
if (contentDto.isChecked) {
selected.setImageResource(R.drawable.check_mark);
} else {
selected.setImageResource(R.drawable.checkable_mark);
}
}
private static class ViewHolder {
long contentId;
RelativeLayout layout;
TextView title;
ImageView thumbnail;
ImageView ribbon;
ImageView selected;
ProgressBar downloadProgressBar;
ImageView downloadIcon;
}
// ListViewのタップ時、反応を無効化
@Override
public boolean isEnabled(int position) {
return false;
}
}
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