Commit 9e912ddc by Kim Jinsung

WBS #58709 2.アプリアラート通知

parent e7b9963d
...@@ -28,6 +28,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON; ...@@ -28,6 +28,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MasterDataJSON; import jp.agentec.abook.abv.bl.acms.client.json.MasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON; import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationGroupMasterJSON; import jp.agentec.abook.abv.bl.acms.client.json.OperationGroupMasterJSON;
import jp.agentec.abook.abv.bl.acms.client.json.PushMessageListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON; import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON; import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON; import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
...@@ -56,6 +57,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters; ...@@ -56,6 +57,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ReadPushMessageParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters;
...@@ -756,6 +758,17 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -756,6 +758,17 @@ public class AcmsClient implements AcmsClientResponseListener {
String json = response.httpResponseBody; String json = response.httpResponseBody;
return new DashboardStatusJSON(json); return new DashboardStatusJSON(json);
} }
/**
* プッシュメッセージ既読情報送信
* @param param 送信パラメータ情報
* @return 通信結果JSON
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public AcmsMessageJSON sendReadPushMessageRequest(ReadPushMessageParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiReadPushMessage, param);
return new AcmsMessageJSON(response.httpResponseBody);
}
/**********************************************************************************************/ /**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/ /** 以下、共用メソッド---------------------------------------------------------------------- **/
...@@ -1050,4 +1063,16 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -1050,4 +1063,16 @@ public class AcmsClient implements AcmsClientResponseListener {
MasterDataJSON json = new MasterDataJSON(response.httpResponseBody); MasterDataJSON json = new MasterDataJSON(response.httpResponseBody);
return json; return json;
} }
/**
* プッシュメッセージ情報の取得
* @param param 送信パラメータ情報
* @return 通信結果JSON
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public PushMessageListJSON getPushMessageList(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiGetPushMessagesList, param);
return new PushMessageListJSON(response.httpResponseBody);
}
} }
...@@ -131,23 +131,6 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -131,23 +131,6 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.operationContentDtoList.add(operationContentDto); dto.operationContentDtoList.add(operationContentDto);
} }
} }
JSONArray pushMessagetJsonArray = operationJson.getJSONArray(PushMessageList);
if (pushMessagetJsonArray != null ) {
dto.pushMessageList = new ArrayList<PushMessageDto>();
for (int k = 0; k < pushMessagetJsonArray.length(); k++) {
if (pushMessagetJsonArray.getJSONObject(k).length() == 0) {
break;
}
PushMessageDto pushMessageDto = new PushMessageDto();
pushMessageDto.pushMessageId = pushMessagetJsonArray.getJSONObject(k).getLong(PushMessageId);
pushMessageDto.operationId = dto.operationId;
pushMessageDto.pushSendLoginId = pushMessagetJsonArray.getJSONObject(k).getString(PushSendLoginId);
pushMessageDto.pushSendDate = DateTimeUtil.toDate(pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
pushMessageDto.pushMessage = pushMessagetJsonArray.getJSONObject(k).getString(PushMessage);
pushMessageDto.readingFlg = false;
dto.pushMessageList.add(pushMessageDto);
}
}
if (operationJson.has(WorkingGroupList)) { if (operationJson.has(WorkingGroupList)) {
JSONArray workingGroupJsonArray = operationJson.getJSONArray(WorkingGroupList); JSONArray workingGroupJsonArray = operationJson.getJSONArray(WorkingGroupList);
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class PushMessageListJSON extends AcmsCommonJSON {
private static final String PushMessageList = "pushMessageList";
public List<PushMessageDto> pushMessageList;
public static final String OperationId = "operationId";
private static final String PushMessageId = "pushMessageId";
private static final String PushSendDate = "pushSendDate";
private static final String PushMessage = "pushMessage";
private static final String ReadFlg = "readFlg";
public PushMessageListJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) {
pushMessageList = new ArrayList();
if (json.has(PushMessageList)) {
JSONArray pushMessageArray = json.getJSONArray(PushMessageList);
for (int i = 0; i < pushMessageArray.length(); i++) {
JSONObject pushMessageJson = pushMessageArray.getJSONObject(i);
PushMessageDto pushMessageDto = new PushMessageDto();
pushMessageDto.pushMessageId = pushMessageJson.getLong(PushMessageId);
if (pushMessageJson.has(OperationId)) {
pushMessageDto.operationId = pushMessageJson.getLong(OperationId);
} else {
pushMessageDto.operationId = Long.valueOf(0);
}
pushMessageDto.pushSendDate = DateTimeUtil.toDate(pushMessageJson.getString(PushSendDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
pushMessageDto.pushMessage = pushMessageJson.getString(PushMessage);
pushMessageDto.readingFlg = (pushMessageJson.getInt(ReadFlg) != 0);
pushMessageList.add(pushMessageDto);
}
}
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
/**
* プッシュメッセージ既読送信のパラメータ情報
* Created by kim jinsung on 2018/09/15.
*/
public class ReadPushMessageParameters extends AcmsParameters {
private Long pushMessageId;
public ReadPushMessageParameters(String sid, Long pushMessageId) {
super(sid);
this.pushMessageId = pushMessageId;
}
public Long getPushMessageId() {
return pushMessageId;
}
}
...@@ -166,6 +166,10 @@ public class AcmsApis { ...@@ -166,6 +166,10 @@ public class AcmsApis {
public static final String ApiUnlockReport = "unlockReport"; public static final String ApiUnlockReport = "unlockReport";
// ダッシュボード // ダッシュボード
public static final String ApiGetDashboardStatus = "getDashboardStatus"; public static final String ApiGetDashboardStatus = "getDashboardStatus";
// プッシュメッセージ一覧取得
public static final String ApiGetPushMessagesList = "getPushMessageList";
// プッシュメッセージ既読送信
public static final String ApiReadPushMessage = "readPushMessage";
// download // download
/** /**
...@@ -215,7 +219,8 @@ public class AcmsApis { ...@@ -215,7 +219,8 @@ public class AcmsApis {
// カテゴリ選択機能、IO帳票で3つ追加 // カテゴリ選択機能、IO帳票で3つ追加
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision) || methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision) ||
// ダッシュボード、ロック追加 // ダッシュボード、ロック追加
methodName.equals(ApiGetDashboardStatus) || methodName.equals(ApiLockReport) || methodName.equals(ApiUnlockReport)) { methodName.equals(ApiGetDashboardStatus) || methodName.equals(ApiLockReport) || methodName.equals(ApiUnlockReport) ||
methodName.equals(ApiGetPushMessagesList) || methodName.equals(ApiReadPushMessage)) {
apiValue = Constant.ApiValue.checkapi; apiValue = Constant.ApiValue.checkapi;
} }
......
...@@ -19,7 +19,7 @@ import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; ...@@ -19,7 +19,7 @@ import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class DBConnector { public class DBConnector {
private static volatile DBConnector dbConnector = null; private static volatile DBConnector dbConnector = null;
public static final String DatabaseName = "ABVJE"; public static final String DatabaseName = "ABVJE";
public static final int DatabaseVersion = DatabaseVersions.Ver1_0_4; public static final int DatabaseVersion = DatabaseVersions.Ver1_0_5;
protected SQLiteDatabase db = null; protected SQLiteDatabase db = null;
......
...@@ -6,4 +6,5 @@ public class DatabaseVersions { ...@@ -6,4 +6,5 @@ public class DatabaseVersions {
public static final int Ver1_0_2 = 11; // SATO HACCP 1.0.2 public static final int Ver1_0_2 = 11; // SATO HACCP 1.0.2
public static final int Ver1_0_3 = 21; // @From カテゴリ選択機能追加 public static final int Ver1_0_3 = 21; // @From カテゴリ選択機能追加
public static final int Ver1_0_4 = 31; // @From ロック、ダッシュボード対応 public static final int Ver1_0_4 = 31; // @From ロック、ダッシュボード対応
public static final int Ver1_0_5 = 32; // Ver.1.0.600 プッシュメッセージ仕様変更対応
} }
...@@ -248,6 +248,7 @@ public class OperationDao extends AbstractDao { ...@@ -248,6 +248,7 @@ public class OperationDao extends AbstractDao {
delete("t_push_message", null, null); delete("t_push_message", null, null);
delete("r_operation_content", null, null); delete("r_operation_content", null, null);
delete("r_task_worker_group", null, null); delete("r_task_worker_group", null, null);
delete("r_operation_group_master_relation", null, null);
delete("t_operation", null, null); delete("t_operation", null, null);
delete("t_task", null, null); delete("t_task", null, null);
delete("t_task_report", null, null); delete("t_task_report", null, null);
......
...@@ -29,11 +29,6 @@ public class PushMessageDao extends AbstractDao { ...@@ -29,11 +29,6 @@ public class PushMessageDao extends AbstractDao {
dto.operationId = cursor.getLong(column); dto.operationId = cursor.getLong(column);
} }
column = cursor.getColumnIndex("push_send_login_id");
if (column != -1) {
dto.pushSendLoginId = cursor.getString(column);
}
column = cursor.getColumnIndex("push_send_date"); column = cursor.getColumnIndex("push_send_date");
if (column != -1) { if (column != -1) {
dto.pushSendDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmm_hyphen); dto.pushSendDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmm_hyphen);
...@@ -55,8 +50,8 @@ public class PushMessageDao extends AbstractDao { ...@@ -55,8 +50,8 @@ public class PushMessageDao extends AbstractDao {
public void insert(PushMessageDto dto) { public void insert(PushMessageDto dto) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO t_push_message "); sql.append(" INSERT OR IGNORE INTO t_push_message ");
sql.append(" (push_message_id, operation_id, push_send_login_id, push_send_date, push_message, reading_flg) "); sql.append(" (push_message_id, operation_id, push_send_date, push_message, reading_flg) ");
sql.append(" VALUES (?,?,?,?,?,?) "); sql.append(" VALUES (?,?,?,?,?) ");
try { try {
beginTransaction(); beginTransaction();
insert(sql.toString(), dto.getInsertValues()); insert(sql.toString(), dto.getInsertValues());
...@@ -87,18 +82,34 @@ public class PushMessageDao extends AbstractDao { ...@@ -87,18 +82,34 @@ public class PushMessageDao extends AbstractDao {
Logger.v(TAG, "sql=%s", sql); Logger.v(TAG, "sql=%s", sql);
} }
public void delete(long operationId) { public void delete(long pushMessageId) {
String[] args = new String[] { "" + operationId }; String[] args = new String[] { "" + pushMessageId };
delete("t_push_message", "operation_id=?", args); delete("t_push_message", "push_message_id=?", args);
} }
public List<PushMessageDto> selectAll() { public List<PushMessageDto> selectAll() {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name "); sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name ");
sql.append(" FROM t_push_message AS tpm ");
sql.append(" LEFT OUTER JOIN t_operation AS top ");
sql.append(" on tpm.operation_id = top.operation_id ");
sql.append(" ORDER BY tpm.push_send_date DESC ");
Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDtoList(sql.toString(), null, PushMessageDto.class);
}
/**
* 未読プッシュメッセージ最大3つを返す。
* @return プッシュメッセージ情報配列
*/
public List<PushMessageDto> selectUnreadPushMessage() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name ");
sql.append(" FROM t_push_message AS tpm "); sql.append(" FROM t_push_message AS tpm ");
sql.append(" INNER JOIN t_operation AS top "); sql.append(" LEFT OUTER JOIN t_operation AS top ");
sql.append(" ON tpm.operation_id = top.operation_id "); sql.append(" ON tpm.operation_id = top.operation_id ");
sql.append(" ORDER BY tpm.push_message_id DESC "); sql.append(" ORDER BY tpm.push_send_date DESC ");
sql.append(" LIMIT 3 ");
Logger.v(TAG, "sql=%s", sql); Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDtoList(sql.toString(), null, PushMessageDto.class); return rawQueryGetDtoList(sql.toString(), null, PushMessageDto.class);
} }
...@@ -106,9 +117,9 @@ public class PushMessageDao extends AbstractDao { ...@@ -106,9 +117,9 @@ public class PushMessageDao extends AbstractDao {
public PushMessageDto select(long pushMessageId) { public PushMessageDto select(long pushMessageId) {
String[] args = new String[] { "" + pushMessageId }; String[] args = new String[] { "" + pushMessageId };
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name "); sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name ");
sql.append(" FROM t_push_message AS tpm "); sql.append(" FROM t_push_message AS tpm ");
sql.append(" INNER JOIN t_operation AS top "); sql.append(" LEFT OUTER JOIN t_operation AS top ");
sql.append(" ON tpm.operation_id = top.operation_id "); sql.append(" ON tpm.operation_id = top.operation_id ");
sql.append(" WHERE tpm.push_message_id = ? "); sql.append(" WHERE tpm.push_message_id = ? ");
Logger.v(TAG, "sql=%s", sql); Logger.v(TAG, "sql=%s", sql);
......
...@@ -22,21 +22,45 @@ public class TPushMessage extends SQLiteTableScript { ...@@ -22,21 +22,45 @@ public class TPushMessage extends SQLiteTableScript {
sql.append(" CREATE TABLE t_push_message ( "); sql.append(" CREATE TABLE t_push_message ( ");
sql.append(" push_message_id BIGINT NOT NULL "); sql.append(" push_message_id BIGINT NOT NULL ");
sql.append(" , operation_id BIGINT NOT NULL "); sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , push_send_login_id VARCHAR(128) ");
sql.append(" , push_send_date DATE NOT NULL "); sql.append(" , push_send_date DATE NOT NULL ");
sql.append(" , push_message TEXT "); sql.append(" , push_message TEXT ");
sql.append(" , reading_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , reading_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (push_message_id) "); sql.append(" , PRIMARY KEY (push_message_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
return ddl; return ddl;
} }
/**
* Ver.1.0.600でプッシュメッセージ仕様変更によって
* 制約削除が必要ですが、できないため、テーブル再作成
* @return テーブル作成SQL
*/
private String getCreatePushMessageTable() {
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_push_message_temp ( ");
sql.append(" push_message_id BIGINT NOT NULL ");
sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , push_send_date DATE NOT NULL ");
sql.append(" , push_message TEXT ");
sql.append(" , reading_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (push_message_id) ");
sql.append(" ) ");
return sql.toString();
}
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_0_5) {
ddl.add(getCreatePushMessageTable());
ddl.add(" INSERT INTO t_push_message_temp (push_message_id, operation_id, push_send_date, push_message, reading_flg) SELECT push_message_id, operation_id, push_send_date, push_message, reading_flg FROM t_push_message ");
ddl.add(" DROP TABLE t_push_message ");
ddl.add(" ALTER TABLE t_push_message_temp RENAME TO t_push_message ");
}
return ddl;
} }
@Override @Override
......
...@@ -33,6 +33,7 @@ import jp.agentec.abook.abv.bl.logic.GroupLogic; ...@@ -33,6 +33,7 @@ import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.MasterDataLogic; import jp.agentec.abook.abv.bl.logic.MasterDataLogic;
import jp.agentec.abook.abv.bl.logic.OperationGroupMasterLogic; import jp.agentec.abook.abv.bl.logic.OperationGroupMasterLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic; import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
...@@ -52,6 +53,8 @@ import jp.agentec.adf.util.DateTimeUtil; ...@@ -52,6 +53,8 @@ import jp.agentec.adf.util.DateTimeUtil;
private EnqueteLogic enqueteLogic = AbstractLogic.getLogic(EnqueteLogic.class); private EnqueteLogic enqueteLogic = AbstractLogic.getLogic(EnqueteLogic.class);
private ContentLogic contentLogic = AbstractLogic.getLogic(ContentLogic.class); private ContentLogic contentLogic = AbstractLogic.getLogic(ContentLogic.class);
private OperationLogic operationLogic = AbstractLogic.getLogic(OperationLogic.class); private OperationLogic operationLogic = AbstractLogic.getLogic(OperationLogic.class);
private PushMessageLogic pushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private ContentDao contentDao = AbstractDao.getDao(ContentDao.class); private ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
private SppDeviceDao sppDeviceDao = AbstractDao.getDao(SppDeviceDao.class); private SppDeviceDao sppDeviceDao = AbstractDao.getDao(SppDeviceDao.class);
private OperationGroupMasterLogic operationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class); private OperationGroupMasterLogic operationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
...@@ -394,6 +397,8 @@ import jp.agentec.adf.util.DateTimeUtil; ...@@ -394,6 +397,8 @@ import jp.agentec.adf.util.DateTimeUtil;
try { try {
// サーバー通信でプロジェクト取得 // サーバー通信でプロジェクト取得
operationLogic.initializeOperations(); operationLogic.initializeOperations();
//プッシュメッセージ情報を取得
pushMessageLogic.initializePushMessage();
} catch (Exception e1) { } catch (Exception e1) {
Logger.e(TAG, e1); Logger.e(TAG, e1);
e = e1; e = e1;
......
...@@ -9,7 +9,6 @@ import java.util.Date; ...@@ -9,7 +9,6 @@ import java.util.Date;
public class PushMessageDto extends AbstractDto { public class PushMessageDto extends AbstractDto {
public Long pushMessageId; public Long pushMessageId;
public Long operationId; public Long operationId;
public String pushSendLoginId;
public Date pushSendDate; public Date pushSendDate;
public String pushMessage; public String pushMessage;
public String operationName; public String operationName;
...@@ -22,6 +21,6 @@ public class PushMessageDto extends AbstractDto { ...@@ -22,6 +21,6 @@ public class PushMessageDto extends AbstractDto {
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
return new Object[] { pushMessageId, operationId, pushSendLoginId, pushSendDate, pushMessage, readingFlg }; return new Object[] { pushMessageId, operationId, pushSendDate, pushMessage, readingFlg };
} }
} }
...@@ -88,8 +88,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -88,8 +88,6 @@ public class OperationLogic extends AbstractLogic {
private ContentLogic mContentLogic = AbstractLogic.getLogic(ContentLogic.class); private ContentLogic mContentLogic = AbstractLogic.getLogic(ContentLogic.class);
private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class);
private TaskWorkerGroupDao mTaskWorkerGroupDao = AbstractDao.getDao(TaskWorkerGroupDao.class); private TaskWorkerGroupDao mTaskWorkerGroupDao = AbstractDao.getDao(TaskWorkerGroupDao.class);
private static final int FINISHED_STATUS = 999; private static final int FINISHED_STATUS = 999;
public void initializeOperations() throws AcmsException, NetworkDisconnectedException { public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
...@@ -97,6 +95,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -97,6 +95,7 @@ public class OperationLogic extends AbstractLogic {
setWorkingGroupList(); setWorkingGroupList();
// プロジェクト一覧取得し、登録・更新・削除する // プロジェクト一覧取得し、登録・更新・削除する
retrieveServerOperation(); retrieveServerOperation();
} }
/** /**
...@@ -214,10 +213,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -214,10 +213,6 @@ public class OperationLogic extends AbstractLogic {
mTaskWorkerGroupDao.insert(taskWorkerGroupDto); mTaskWorkerGroupDao.insert(taskWorkerGroupDto);
} }
} }
for (PushMessageDto dto : serverOperationDto.pushMessageList) {
mPushMessageDao.insert(dto);
}
} }
List<OperationDto> deleteListDtoArray = new ArrayList<OperationDto>(); List<OperationDto> deleteListDtoArray = new ArrayList<OperationDto>();
...@@ -241,7 +236,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -241,7 +236,6 @@ public class OperationLogic extends AbstractLogic {
for(TaskDto taskDto : taskDtoList) { for(TaskDto taskDto : taskDtoList) {
mTaskDao.delete(taskDto); mTaskDao.delete(taskDto);
} }
mPushMessageDao.delete(deleteOperationDto.operationId);
mOperationDao.delete(deleteOperationDto); mOperationDao.delete(deleteOperationDto);
// 作業削除時、紐づいた資料を削除 // 作業削除時、紐づいた資料を削除
......
package jp.agentec.abook.abv.bl.logic; package jp.agentec.abook.abv.bl.logic;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient; import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsMessageJSON; import jp.agentec.abook.abv.bl.acms.client.json.AcmsMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON; import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.PushMessageListJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ReadPushMessageParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.AcmsException; import jp.agentec.abook.abv.bl.common.exception.AcmsException;
...@@ -23,6 +27,66 @@ import jp.agentec.abook.abv.bl.dto.PushMessageDto; ...@@ -23,6 +27,66 @@ import jp.agentec.abook.abv.bl.dto.PushMessageDto;
public class PushMessageLogic extends AbstractLogic { public class PushMessageLogic extends AbstractLogic {
private static final String TAG = "OperationRelatedContentActivity"; private static final String TAG = "OperationRelatedContentActivity";
private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class); private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class);
/**
* サーバ側からプッシュメッセージを取得し、DB更新する。
* @throws AcmsException ACMS関連例外
* @throws NetworkDisconnectedException ネットワーク接続例外
*/
public void initializePushMessage() throws AcmsException, NetworkDisconnectedException {
AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid);
PushMessageListJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getPushMessageList(param);
List<PushMessageDto> serverPushMessageList = json.pushMessageList;
List<PushMessageDto> localPushMessageList = mPushMessageDao.selectAll();
//追加
for (PushMessageDto serverPushMessageDto : serverPushMessageList) {
boolean insertFlg = true;
for (PushMessageDto localPushMessageDto : localPushMessageList) {
if (serverPushMessageDto.pushMessageId.equals(localPushMessageDto.pushMessageId)) {
if (serverPushMessageDto.readingFlg && !localPushMessageDto.readingFlg) {
updateReadingFlg(localPushMessageDto.pushMessageId);
}
insertFlg = false;
break;
}
}
if (insertFlg) {
mPushMessageDao.insert(serverPushMessageDto);
}
}
//削除
List<PushMessageDto> deleteListDtoArray = new ArrayList();
for (PushMessageDto localPushMessageDto : localPushMessageList) {
boolean deleteFlg = true;
for (PushMessageDto serverPushMessageDto : serverPushMessageList) {
if (serverPushMessageDto.pushMessageId.equals(localPushMessageDto.pushMessageId)) {
deleteFlg = false;
break;
}
}
if (deleteFlg) {
mPushMessageDao.delete(localPushMessageDto.pushMessageId);
}
}
}
/**
* 作業一覧上部に表示する未読プッシュメッセージ3つを返す
* @return プッシュメッセージ情報配列
*/
public List<PushMessageDto> getUnreadPushMessageList() {
List<PushMessageDto> savedPushMessageList = mPushMessageDao.selectUnreadPushMessage();
List<PushMessageDto> pushMessageList = new ArrayList();
if (savedPushMessageList != null && savedPushMessageList.size() > 0) {
for (PushMessageDto pushMessageDto : savedPushMessageList) {
if (!pushMessageDto.readingFlg) {
pushMessageList.add(pushMessageDto);
}
}
}
return pushMessageList;
}
/** /**
* プッシュメッセージの定型文取得 * プッシュメッセージの定型文取得
* @return 定型文リスト * @return 定型文リスト
...@@ -62,4 +126,21 @@ public class PushMessageLogic extends AbstractLogic { ...@@ -62,4 +126,21 @@ public class PushMessageLogic extends AbstractLogic {
public void updateReadingFlg(long pushMessageId) { public void updateReadingFlg(long pushMessageId) {
mPushMessageDao.updateReadingFlg(pushMessageId); mPushMessageDao.updateReadingFlg(pushMessageId);
} }
/**
* プッシュメッセージ既読情報を送信
* @return
* @throws IOException
* @throws AcmsException
*/
public boolean sendReadPushMessage(Long pushMessageId) throws IOException, AcmsException, NetworkDisconnectedException {
ReadPushMessageParameters param = new ReadPushMessageParameters(cache.getMemberInfo().sid, pushMessageId);
AcmsMessageJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendReadPushMessageRequest(param);
Logger.d(TAG, " status=" + json.httpStatus);
if (json.httpStatus == ABookKeys.HTTP_STATUS_SUCCESS) {
Logger.v(TAG, "sendPushMessageRequest httpStatus=" + json.httpStatus);
return true;
}
return false;
}
} }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 背景色 -->
<solid android:color="#ef6352" />
<!-- 角の丸み -->
<corners android:radius="6dp" />
</shape>
\ No newline at end of file
...@@ -460,7 +460,7 @@ ...@@ -460,7 +460,7 @@
<string name="communication">コミュニケーション</string> <string name="communication">コミュニケーション</string>
<string name="operation_select">作業選択</string> <string name="operation_select">作業選択</string>
<string name="detail">詳細</string> <string name="detail">詳細</string>
<string name="title_message_detail">メッセージ詳細</string> <string name="title_message_detail">プッシュメッセージ詳細</string>
<string name="push_message_sender">送信者:</string> <string name="push_message_sender">送信者:</string>
<string name="title_operation_report_form">作業報告フォーム </string> <string name="title_operation_report_form">作業報告フォーム </string>
<string name="title_preview">プレビュー</string> <string name="title_preview">プレビュー</string>
...@@ -1474,4 +1474,12 @@ ...@@ -1474,4 +1474,12 @@
<string name="auto_sync_setting_subtitle">作業一覧で作業の自動同期を可能にします。</string> <string name="auto_sync_setting_subtitle">作業一覧で作業の自動同期を可能にします。</string>
<string name="msg_new_content_update_error">サーバ通信エラーの為、新着更新に失敗しました。</string> <string name="msg_new_content_update_error">サーバ通信エラーの為、新着更新に失敗しました。</string>
<string name="msg_push_message_list_notes">最新100件以外は、管理画面(CMS)で確認してください。</string>
<string name="title_date">日時</string>
<string name="title_content">内容</string>
<string name="msg_push_message_detail_api_disconnect">オフラインのため既読情報はサーバへ送信されませんでした。</string>
<string name="msg_push_message_detail_api_error">サーバ通信が失敗したため既読情報はサーバへ送信されませんでした。</string>
<string name="title_other">その他</string>
<string name="msg_push_message_content_not_downloaded">作業が同期されていないので作業報告画面へ遷移できません。</string>
</resources> </resources>
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
<color name="basic_blue3">#995781a9</color> <color name="basic_blue3">#995781a9</color>
<color name="basic_orange1">#99eca14f</color> <color name="basic_orange1">#99eca14f</color>
<color name="basic_orange2">#66eca14f</color> <color name="basic_orange2">#66eca14f</color>
<color name="basic_white">#ffffffff</color>
<color name="basic_white1">#eeffffff</color> <color name="basic_white1">#eeffffff</color>
<color name="basic_white2">#99ffffff</color> <color name="basic_white2">#99ffffff</color>
<color name="light_blue">#d1edfc</color> <color name="light_blue">#d1edfc</color>
...@@ -94,4 +95,11 @@ ...@@ -94,4 +95,11 @@
<color name="task_count_not_started">#e84c17</color> <color name="task_count_not_started">#e84c17</color>
<color name="task_count_working">#0080c6</color> <color name="task_count_working">#0080c6</color>
<color name="task_count_completed">#00b18a</color> <color name="task_count_completed">#00b18a</color>
<color name="unread_push_list_bg">#ffe9e9</color>
<color name="push_message_list_notes_bg">#d2edd4</color>
<color name="push_message_list_notes_text">#00b050</color>
<color name="push_message_list_send_date_text">#7f7f7f</color>
<color name="push_message_list_unread_bg">#c4eafe</color>
</resources> </resources>
\ No newline at end of file
...@@ -462,7 +462,7 @@ ...@@ -462,7 +462,7 @@
<string name="communication">communication</string> <string name="communication">communication</string>
<string name="operation_select">Wokring choice</string> <string name="operation_select">Wokring choice</string>
<string name="detail">detail</string> <string name="detail">detail</string>
<string name="title_message_detail">message detail</string> <string name="title_message_detail">Push message detail</string>
<string name="push_message_sender">Sender :</string> <string name="push_message_sender">Sender :</string>
<string name="title_operation_report_form">Task report </string> <string name="title_operation_report_form">Task report </string>
<string name="title_preview">preivew</string> <string name="title_preview">preivew</string>
...@@ -1486,5 +1486,11 @@ ...@@ -1486,5 +1486,11 @@
<string name="auto_sync_setting_title">Automatically sync</string> <string name="auto_sync_setting_title">Automatically sync</string>
<string name="auto_sync_setting_subtitle">Enables automatic synchronization of operations in the operation list.</string> <string name="auto_sync_setting_subtitle">Enables automatic synchronization of operations in the operation list.</string>
<string name="msg_new_content_update_error">Failed to update because of communication error.</string> <string name="msg_new_content_update_error">Failed to update because of communication error.</string>
<string name="msg_push_message_list_notes">Check the CMS Admin screen for items beyond the latest 100.</string>
<string name="title_date">Date</string>
<string name="title_content">Content</string>
<string name="msg_push_message_detail_api_disconnect">Offline: read info wasn\'t sent to the server.</string>
<string name="msg_push_message_detail_api_error">Read info wasn\'t sent due to server error.</string>
<string name="title_other">Other</string>
<string name="msg_push_message_content_not_downloaded">Unable to move to the task screen due to sync error.</string>
</resources> </resources>
\ No newline at end of file
...@@ -87,6 +87,16 @@ ...@@ -87,6 +87,16 @@
android:background="@drawable/ic_operation_help" android:background="@drawable/ic_operation_help"
android:onClick="onClickShowHelpView" /> android:onClick="onClickShowHelpView" />
</RelativeLayout> </RelativeLayout>
<ListView
android:id="@+id/lv_message_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="@color/unread_push_list_bg"/>
<FrameLayout <FrameLayout
android:id="@+id/operation_list_layout" android:id="@+id/operation_list_layout"
style="@style/content_list_bg" style="@style/content_list_bg"
...@@ -97,5 +107,4 @@ ...@@ -97,5 +107,4 @@
android:layout_weight="1"></FrameLayout> android:layout_weight="1"></FrameLayout>
<include layout="@layout/operation_common_toolbar" android:id="@+id/toolbar2"/> <include layout="@layout/operation_common_toolbar" android:id="@+id/toolbar2"/>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -3,53 +3,44 @@ ...@@ -3,53 +3,44 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="10dp" android:layout_weight="10"
android:orientation="horizontal"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="10" android:orientation="vertical"
android:orientation="vertical"> android:background="@color/operation_bg">
<LinearLayout <LinearLayout
android:id="@+id/ll_row"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:layout_marginTop="3dp"
</LinearLayout> android:layout_marginBottom="3dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_message" android:id="@+id/tv_message"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="5dp"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:textSize="@dimen/app_normal_text_size" android:textSize="@dimen/app_normal_text_size"
android:textColor="@color/operation_default_text_color" /> android:textColor="@color/operation_default_text_color" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -58,7 +49,8 @@ ...@@ -58,7 +49,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/dummy_date_time" android:text="@string/dummy_date_time"
android:textColor="@color/operation_default_text_color" /> android:padding="5dp"
android:textColor="@color/push_message_list_send_date_text" />
<TextView <TextView
android:id="@+id/tv_operation_name" android:id="@+id/tv_operation_name"
...@@ -72,21 +64,8 @@ ...@@ -72,21 +64,8 @@
android:paddingLeft="3dp" android:paddingLeft="3dp"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:textColor="@color/operation_default_text_color" /> android:textColor="@color/operation_default_text_color" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<Button
android:id="@+id/btn_detail"
android:layout_width="120dp"
android:layout_height="45dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="@drawable/btn_detail"
android:text="@string/detail"
android:textColor="@color/text_color" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/unread_push_list_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_margin="5dp"
android:orientation="horizontal"
android:layout_weight="8">
<TextView
android:id="@+id/tv_send_date"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_marginLeft="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="0000/00/00 00:00"
android:background="@drawable/corners"
android:textColor="@color/basic_white" />
<TextView
android:id="@+id/tv_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingLeft="3dp"
android:singleLine="true"
android:text="message"
android:textColor="@color/text_error" />
</LinearLayout>
<ImageButton
android:id="@+id/ib_move_operation"
android:layout_width="80dp"
android:layout_height="35dp"
android:gravity="center_vertical"
android:scaleType="fitCenter"
android:padding="5dp"
android:src="@drawable/btn_arrow_right_red"
android:background="@android:color/transparent"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
android:singleLine="true" android:singleLine="true"
android:text="@string/push_message_list" android:text="@string/push_message_list"
android:textColor="@color/edt_text" android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" /> android:textStyle="bold"/>
<Button <Button
android:id="@+id/close_btn" android:id="@+id/close_btn"
...@@ -48,83 +48,117 @@ ...@@ -48,83 +48,117 @@
android:id="@+id/ll_detail" android:id="@+id/ll_detail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="15dp" android:layout_margin="7dp"
android:orientation="vertical" android:orientation="vertical"
android:visibility="visible"> android:visibility="visible">
<TextView <TextView
android:id="@+id/tv_message" android:id="@+id/tv_detail_notes"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:padding="5dp"
android:layout_marginBottom="10dp" android:textAlignment="center"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:ellipsize="end" android:textColor="@color/text_error"
android:maxLines="5" android:background="@color/unread_push_list_bg"/>
android:textColor="@android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/tv_operation_name_title"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="@string/operation_name"
android:textColor="@color/push_message_list_send_date_text"/>
<TextView
android:id="@+id/tv_operation_name"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="@string/dummy_str"
android:textColor="@android:color/black"/>
</LinearLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="@color/black_translucent" /> android:background="@color/push_message_list_send_date_text" />
<LinearLayout
<TextView
android:id="@+id/tv_send_date"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp">
android:text="@string/dummy_date_time" <TextView
android:textColor="@android:color/black" /> android:layout_width="100dp"
android:layout_height="wrap_content"
<TextView android:layout_marginLeft="25dp"
android:id="@+id/tv_operation_name_title" android:text="@string/title_date"
android:layout_width="match_parent" android:textColor="@color/push_message_list_send_date_text" />
android:layout_height="wrap_content" <TextView
android:text="@string/operation_name" android:id="@+id/tv_send_user"
android:textColor="@android:color/black"/> android:layout_width="200dp"
android:layout_height="wrap_content"
<TextView android:text="@string/dummy_str"
android:id="@+id/tv_operation_name" android:textColor="@android:color/black" />
</LinearLayout>
<View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1dp"
android:ellipsize="end" android:background="@color/push_message_list_send_date_text" />
android:maxLines="1"
android:paddingLeft="3dp"
android:text="@string/dummy_str"
android:textColor="@color/operation_default_text_color"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:orientation="horizontal"> >
<TextView <TextView
android:id="@+id/tv_title_send_user" android:layout_width="100dp"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="wrap_content" android:layout_marginLeft="25dp"
android:layout_weight="3" android:text="@string/title_content"
android:text="@string/push_message_sender" android:textColor="@color/push_message_list_send_date_text" />
android:textColor="@android:color/black" />
<TextView <TextView
android:id="@+id/tv_send_user" android:id="@+id/tv_message"
android:layout_width="match_parent" android:layout_width="300dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginBottom="10dp"
android:layout_weight="2"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:ellipsize="end"
android:maxLines="5"
android:textColor="@android:color/black" /> android:textColor="@android:color/black" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<ListView <LinearLayout
android:id="@+id/lv_push_message" android:id="@+id/ll_push_message_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="match_parent"
android:layout_margin="7dp"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/tv_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="@string/dummy_str"
android:textAlignment="center"
android:textColor="@color/push_message_list_notes_text"
android:background="@color/push_message_list_notes_bg"/>
<ListView
android:id="@+id/lv_push_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@color/push_message_list_send_date_text"
android:dividerHeight="1px" />
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -96,7 +96,15 @@ ...@@ -96,7 +96,15 @@
android:onClick="onClickShowHelpView"/> android:onClick="onClickShowHelpView"/>
</RelativeLayout> </RelativeLayout>
<ListView
android:id="@+id/lv_message_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:focusable="false"
android:background="@color/unread_push_list_bg"/>
<FrameLayout <FrameLayout
android:id="@+id/operation_list_layout" android:id="@+id/operation_list_layout"
style="@style/content_list_bg" style="@style/content_list_bg"
......
...@@ -3,36 +3,29 @@ ...@@ -3,36 +3,29 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_weight="10"
android:orientation="horizontal"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="10" android:orientation="vertical"
android:orientation="vertical"> android:background="@color/operation_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_row"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -40,16 +33,18 @@ ...@@ -40,16 +33,18 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:ellipsize="end" android:ellipsize="end"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:paddingRight="5dp"
android:singleLine="true" android:singleLine="true"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:textSize="@dimen/app_normal_text_size" android:textColor="@color/operation_default_text_color"
android:textColor="@color/operation_default_text_color" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -57,39 +52,25 @@ ...@@ -57,39 +52,25 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:padding="5dp"
android:text="@string/dummy_date_time" android:text="@string/dummy_date_time"
android:textColor="@color/operation_default_text_color" /> android:textColor="@color/push_message_list_send_date_text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_operation_name" android:id="@+id/tv_operation_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:paddingLeft="3dp"
android:singleLine="true"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:textColor="@color/operation_default_text_color" /> android:textColor="@color/operation_default_text_color" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<Button
android:id="@+id/btn_detail"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:background="@drawable/operation_radius_frame"
android:text="@string/detail"
android:textColor="@color/text_color" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/unread_push_list_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_margin="5dp"
android:orientation="horizontal"
android:layout_weight="8">
<TextView
android:id="@+id/tv_send_date"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_marginLeft="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textSize="12sp"
android:text="0000/00/00 00:00"
android:background="@drawable/corners"
android:textColor="@color/basic_white" />
<TextView
android:id="@+id/tv_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingLeft="3dp"
android:singleLine="true"
android:text="message"
android:textColor="@color/text_error" />
</LinearLayout>
<ImageButton
android:id="@+id/ib_move_operation"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:background="@drawable/btn_arrow_right_red" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:minWidth="500dp" android:minWidth="500dp"
android:minHeight="300dp" android:minHeight="300dp"
android:background="@drawable/list_selector" android:background="@color/basic_white"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
android:maxLines="1" android:maxLines="1"
android:text="@string/push_message_list" android:text="@string/push_message_list"
android:textColor="@color/edt_text" android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" /> android:textStyle="bold"/>
<Button <Button
android:id="@+id/close_btn" android:id="@+id/close_btn"
...@@ -50,82 +50,119 @@ ...@@ -50,82 +50,119 @@
android:id="@+id/ll_detail" android:id="@+id/ll_detail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="15dp" android:layout_margin="7dp"
android:orientation="vertical" android:orientation="vertical"
android:visibility="visible"> android:visibility="visible">
<TextView <TextView
android:id="@+id/tv_message" android:id="@+id/tv_detail_notes"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="10dp" android:padding="5dp"
android:layout_weight="1" android:textSize="13dp"
android:textAlignment="center"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:ellipsize="end" android:textColor="@color/text_error"
android:maxLines="5" android:background="@color/unread_push_list_bg"/>
android:textColor="@android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/tv_operation_name_title"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text="@string/operation_name"
android:textColor="@color/push_message_list_send_date_text"/>
<TextView
android:id="@+id/tv_operation_name"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="@string/dummy_str"
android:textColor="@android:color/black"/>
</LinearLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="@color/black_translucent" /> android:background="@color/push_message_list_send_date_text" />
<LinearLayout
<TextView
android:id="@+id/tv_send_date"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp">
android:text="@string/dummy_date_time" <TextView
android:textColor="@android:color/black" /> android:layout_width="100dp"
android:layout_height="wrap_content"
<TextView android:layout_marginLeft="15dp"
android:id="@+id/tv_operation_name_title" android:text="@string/title_date"
android:layout_width="match_parent" android:textColor="@color/push_message_list_send_date_text" />
android:layout_height="wrap_content" <TextView
android:text="@string/operation_name" android:id="@+id/tv_send_user"
android:textColor="@android:color/black"/> android:layout_width="200dp"
android:layout_height="wrap_content"
<TextView android:text="@string/dummy_str"
android:id="@+id/tv_operation_name" android:textColor="@android:color/black" />
</LinearLayout>
<View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1dp"
android:ellipsize="end" android:background="@color/push_message_list_send_date_text" />
android:maxLines="1"
android:paddingLeft="3dp"
android:text="@string/dummy_str"
android:textColor="@color/operation_default_text_color"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:orientation="horizontal"> >
<TextView <TextView
android:id="@+id/tv_title_send_user" android:layout_width="100dp"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="wrap_content" android:layout_marginLeft="15dp"
android:layout_weight="3" android:text="@string/title_content"
android:text="@string/push_message_sender" android:textColor="@color/push_message_list_send_date_text" />
android:textColor="@android:color/black" />
<TextView <TextView
android:id="@+id/tv_send_user" android:id="@+id/tv_message"
android:layout_width="match_parent" android:layout_width="300dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginBottom="10dp"
android:layout_weight="2"
android:text="@string/dummy_str" android:text="@string/dummy_str"
android:ellipsize="end"
android:maxLines="5"
android:textColor="@android:color/black" /> android:textColor="@android:color/black" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<ListView <LinearLayout
android:id="@+id/lv_push_message" android:id="@+id/ll_push_message_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="match_parent"
android:layout_margin="7dp"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/tv_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="@string/dummy_str"
android:textSize="13dp"
android:textAlignment="center"
android:textColor="@color/push_message_list_notes_text"
android:background="@color/push_message_list_notes_bg"/>
<ListView
android:id="@+id/lv_push_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@color/push_message_list_send_date_text"
android:dividerHeight="2px"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="300dp"
android:minHeight="200dp"
android:background="@color/operation_bg"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/toolbar_layout"
style="@style/OperationSearchToolBar"
android:layout_height="50dp"
android:layout_width="match_parent">
<Button
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_history_back_on"
android:visibility="gone" />
<TextView
android:id="@+id/tv_toolbar_title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/title_other"
android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" />
<Button
android:id="@+id/close_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"
android:contentDescription="@string/cont_desc" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:clickable="false"
android:focusable="false"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="3"
android:background="@drawable/list_selector_holo_light"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible">
<ImageView
android:id="@+id/btn_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:layout_weight="0"
android:src="@drawable/ic_operation_list_submenu_setting"
android:visibility="visible" />
<TextView
android:id="@+id/item3_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:paddingLeft="6dip"
android:text="@string/setting"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_select" />
<ImageView
android:id="@+id/item3_nextLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="0"
android:src="@drawable/ic_navigation_next_item"
android:visibility="visible" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:id="@+id/ll_push_message_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="3"
android:background="@drawable/list_selector_holo_light"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:layout_weight="0"
android:src="@drawable/ic_communication_push_message_list"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:paddingLeft="6dip"
android:text="@string/push_message_list"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_select" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="0"
android:src="@drawable/ic_navigation_next_item"
android:visibility="visible" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -34,6 +34,7 @@ public class OperationActivity extends ABVUIActivity { ...@@ -34,6 +34,7 @@ public class OperationActivity extends ABVUIActivity {
protected ImageButton mQuickReportPrintButton; // 簡易帳票印刷ボタン protected ImageButton mQuickReportPrintButton; // 簡易帳票印刷ボタン
private PushMessageLogic mPushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class); private PushMessageLogic mPushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private Dialog mCommunicationMenuDialog; private Dialog mCommunicationMenuDialog;
private Dialog mSubMenuDialog;
protected void createCommonToolber() { protected void createCommonToolber() {
...@@ -68,19 +69,7 @@ public class OperationActivity extends ABVUIActivity { ...@@ -68,19 +69,7 @@ public class OperationActivity extends ABVUIActivity {
// コミュニケーション // コミュニケーション
mCommunicationButton = findViewById(R.id.btn_communication_menu); mCommunicationButton = findViewById(R.id.btn_communication_menu);
List<PushMessageDto> pushMessageDtoList = mPushMessageLogic.getAllPushMessageList(); mCommunicationButton.setImageDrawable(getRDrawable(R.drawable.ic_communication_menu));
boolean existUnreadFlg = false;
for (PushMessageDto pushMessageDto : pushMessageDtoList) {
if (!pushMessageDto.readingFlg) {
existUnreadFlg = true;
break;
}
}
if (existUnreadFlg) {
mCommunicationButton.setImageDrawable(getRDrawable(R.drawable.ic_communication_menu_with_badge));
} else {
mCommunicationButton.setImageDrawable(getRDrawable(R.drawable.ic_communication_menu));
}
mCommunicationButton.setOnClickListener(new View.OnClickListener() { mCommunicationButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
...@@ -154,7 +143,32 @@ public class OperationActivity extends ABVUIActivity { ...@@ -154,7 +143,32 @@ public class OperationActivity extends ABVUIActivity {
// 設定画面へ遷移 // 設定画面へ遷移
public void onClickSetting(View v) { public void onClickSetting(View v) {
showSetting(); mSubMenuDialog = new Dialog(OperationActivity.this);
mSubMenuDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mSubMenuDialog.setCanceledOnTouchOutside(false);
mSubMenuDialog.setContentView(R.layout.operation_list_submenu_dialog);
mSubMenuDialog.findViewById(R.id.ll_setting).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mSubMenuDialog.dismiss();
showSetting();
}
});
mSubMenuDialog.findViewById(R.id.ll_push_message_list).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mSubMenuDialog.dismiss();
showPushMessageListDialog();
}
});
mSubMenuDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSubMenuDialog.dismiss();
}
});
mSubMenuDialog.show();
} }
/** /**
...@@ -193,4 +207,6 @@ public class OperationActivity extends ABVUIActivity { ...@@ -193,4 +207,6 @@ public class OperationActivity extends ABVUIActivity {
intent.putExtra("LINKURL", AcmsApis.getApiUrl(ABVEnvironment.getInstance().acmsAddress, ABVDataCache.getInstance().getUrlPath(), AcmsApis.ApiQuickReportSearch)); intent.putExtra("LINKURL", AcmsApis.getApiUrl(ABVEnvironment.getInstance().acmsAddress, ABVDataCache.getInstance().getUrlPath(), AcmsApis.ApiQuickReportSearch));
startActivity(intent, NaviConsts.Right); startActivity(intent, NaviConsts.Right);
} }
protected void showPushMessageListDialog(){}
} }
package jp.agentec.abook.abv.ui.home.adapter; package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.Button; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.dto.PushMessageDto; import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.adf.util.DateTimeFormat; import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
/** /**
* Created by kim jinsung on 2018/09/18. * Created by kim jinsung on 2018/09/18.
*/ */
...@@ -27,7 +24,6 @@ public class PushMessageListAdapter extends BaseAdapter { ...@@ -27,7 +24,6 @@ public class PushMessageListAdapter extends BaseAdapter {
private static final String TAG = "PushMessageListAdapter"; private static final String TAG = "PushMessageListAdapter";
private Context mContext; private Context mContext;
private LayoutInflater mInflater; private LayoutInflater mInflater;
private PushMessageListAdapter.PushMessageListAdapterListener listener;
List<PushMessageDto> mListItem; List<PushMessageDto> mListItem;
...@@ -66,8 +62,7 @@ public class PushMessageListAdapter extends BaseAdapter { ...@@ -66,8 +62,7 @@ public class PushMessageListAdapter extends BaseAdapter {
holder.operationNameTextView = (TextView) convertView.findViewById(R.id.tv_operation_name); holder.operationNameTextView = (TextView) convertView.findViewById(R.id.tv_operation_name);
holder.sendDateTextView = (TextView) convertView.findViewById(R.id.tv_send_date); holder.sendDateTextView = (TextView) convertView.findViewById(R.id.tv_send_date);
holder.messageTextView = (TextView) convertView.findViewById(R.id.tv_message); holder.messageTextView = (TextView) convertView.findViewById(R.id.tv_message);
holder.rowLinearLayout = (LinearLayout) convertView.findViewById(R.id.ll_row);
holder.detailButton = (Button) convertView.findViewById(R.id.btn_detail);
convertView.setTag(holder); convertView.setTag(holder);
}else { }else {
holder = (ViewHolder) convertView.getTag(); holder = (ViewHolder) convertView.getTag();
...@@ -81,28 +76,15 @@ public class PushMessageListAdapter extends BaseAdapter { ...@@ -81,28 +76,15 @@ public class PushMessageListAdapter extends BaseAdapter {
} }
private void settingDisplay(ViewHolder holder, final PushMessageDto pushMessageDto) { private void settingDisplay(ViewHolder holder, final PushMessageDto pushMessageDto) {
if (pushMessageDto != null) { if (pushMessageDto != null) {
holder.operationNameTextView.setText(pushMessageDto.operationName); holder.operationNameTextView.setText(pushMessageDto.operationName);
holder.sendDateTextView.setText(DateTimeUtil.toString(pushMessageDto.pushSendDate, DateTimeFormat.yyyyMMddHHmm_slash)); holder.sendDateTextView.setText(DateTimeUtil.toString(pushMessageDto.pushSendDate, DateTimeFormat.yyyyMMddHHmm_slash));
holder.messageTextView.setText(pushMessageDto.pushMessage); holder.messageTextView.setText(pushMessageDto.pushMessage);
// リソースパターンの適用
holder.detailButton.setText(PatternStringUtil.patternToString(mContext,
R.string.detail,
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)) );
if (pushMessageDto.readingFlg) { if (pushMessageDto.readingFlg) {
holder.detailButton.setBackgroundResource(R.drawable.btn_detail); holder.rowLinearLayout.setBackgroundColor(Color.WHITE);
} else { } else {
holder.detailButton.setBackgroundResource(R.drawable.btn_detail_with_badge); holder.rowLinearLayout.setBackgroundColor(mContext.getColor(R.color.push_message_list_unread_bg));
} }
holder.detailButton.findViewById(R.id.btn_detail).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onDetailView(pushMessageDto);
}
});
} }
} }
...@@ -110,14 +92,6 @@ public class PushMessageListAdapter extends BaseAdapter { ...@@ -110,14 +92,6 @@ public class PushMessageListAdapter extends BaseAdapter {
TextView operationNameTextView; TextView operationNameTextView;
TextView sendDateTextView; TextView sendDateTextView;
TextView messageTextView; TextView messageTextView;
Button detailButton; LinearLayout rowLinearLayout;
}
public void setAdapterListener(PushMessageListAdapterListener listener) {
this.listener = listener;
}
public interface PushMessageListAdapterListener {
void onDetailView(PushMessageDto pushMessageDto);
} }
} }
package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.TextView;
import java.util.List;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
/**
* 作業一覧画面上部に表示する未読プッシュメッセージ表示用アダプター
* Created by kim jinsung on 2024/05/28.
*/
public class UnreadPushMessageListAdapter extends BaseAdapter {
private static final String TAG = "PushMessageListAdapter";
private Context mContext;
private LayoutInflater mInflater;
private UnreadPushMessageListAdapter.UnreadPushMessageListAdapterListener listener;
List<PushMessageDto> mListItem;
public UnreadPushMessageListAdapter(Context context, List<PushMessageDto> objects) {
mContext = context;
mListItem = objects;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return mListItem.size();
}
@Override
public PushMessageDto getItem(int position) {
return mListItem.get(position);
}
public void setItem(List<PushMessageDto> objects) {
mListItem = objects;
notifyDataSetChanged();
}
@Override
public long getItemId(int position) {
return mListItem.get(position).pushMessageId;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_unread_push_message_list, parent, false);
holder = new UnreadPushMessageListAdapter.ViewHolder();
holder.sendDateTextView = (TextView) convertView.findViewById(R.id.tv_send_date);
holder.messageTextView = (TextView) convertView.findViewById(R.id.tv_message);
holder.moveOperationButton = (ImageButton) convertView.findViewById(R.id.ib_move_operation);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final PushMessageDto pushMessageDto = getItem(position);
settingDisplay(holder, pushMessageDto);
return convertView;
}
private void settingDisplay(ViewHolder holder, final PushMessageDto pushMessageDto) {
if (pushMessageDto != null) {
holder.sendDateTextView.setText(DateTimeUtil.toString(pushMessageDto.pushSendDate, DateTimeFormat.yyyyMMddHHmm_slash));
holder.messageTextView.setText(pushMessageDto.pushMessage);
holder.moveOperationButton.setFocusable(false);
if (pushMessageDto.operationName == null) {
holder.moveOperationButton.setVisibility(View.INVISIBLE);
} else {
holder.moveOperationButton.setVisibility(View.VISIBLE);
holder.moveOperationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onMoveOperation(pushMessageDto.operationId);
}
});
}
}
}
private class ViewHolder {
TextView operationNameTextView;
TextView sendDateTextView;
TextView messageTextView;
ImageButton moveOperationButton;
}
public void setAdapterListener(UnreadPushMessageListAdapterListener listener) {
this.listener = listener;
}
public interface UnreadPushMessageListAdapterListener {
void onMoveOperation(Long operationId);
}
}
\ No newline at end of file
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