Commit d1d7ccfa by onuma

プッシュメッセージを格納するJSONクラスを作成

parent 50b97e6a
......@@ -48,9 +48,6 @@ public class ChatPushDataJSON extends AcmsCommonJSON {
}
PushMessageDto pushMessageDto = new PushMessageDto();
String tempDate = DateTimeUtil.toString(DateTimeUtil.toDate(pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate), DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmssSSS_none);
Logger.d("messageId","messageId : " + pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate));
Logger.d("oerationId","oerationId : " + pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate)+1);
Logger.d("date","date : " + tempDate);
pushMessageDto.pushMessageId = Long.valueOf(tempDate);
pushMessageDto.operationId = Long.valueOf(tempDate+1);
pushMessageDto.pushSendLoginId = pushMessagetJsonArray.getJSONObject(k).getString(PushSendLoginId);
......
......@@ -171,4 +171,15 @@ public interface ABookCommConstants {
String DEFAULT_CHECKSUM = "0000000000";
String PLATFORM_NAME = "android";
int PUSH_MESSAGE_DLG_REQUEST_CODE = 200;
interface PUSH_MESSAGE_DLG_RESULT {
int OK = 0;
int CANCEL = 1;
}
// ABookCheckで、onActivityResultのリクエストコードとして使用されている
int ABOOK_CHECK_TASK_IMAGE = 103;
int ABOOK_CHECK_TASK_VIDEO = 104;
int ABOOK_CHECK_SELECT_SCENE = 105;
}
package jp.agentec.abook.abv.cl.push;
import org.json.adf.JSONObject;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
/**
* プッシュメッセージをJSONにしたクラス
* 既存のデータのキーは、AppDefType.PushMessageKey
* チャットで追加されたデータのキーは、AppDefType.ChatPushMessageKey
*/
public class PushMessageJSON {
private JSONObject jsonObject;
public PushMessageJSON(String jsonText) {
jsonObject = new JSONObject(jsonText);
}
// プッシュメッセージデータ
public String getMessage() {
return jsonObject.getString(AppDefType.PushMessageKey.message);
}
public String getData() {
try {
return jsonObject.getString(AppDefType.PushMessageKey.data);
} catch (Exception e) {
return "";
}
}
public String getOperationID() {
try {
return jsonObject.getString(AppDefType.PushMessageKey.operationId);
} catch (Exception e) {
return "";
}
}
// ここからチャットデータ
public String getRoomName() {
try {
return jsonObject.getString(AppDefType.ChatPushMessageKey.roomName);
} catch (Exception e){
return "";
}
}
public Long getRoomId() {
try {
return jsonObject.getLong(AppDefType.ChatPushMessageKey.roomId);
} catch (Exception e){
return new Long(0);
}
}
public String getRoomType() {
try {
return jsonObject.getString(AppDefType.ChatPushMessageKey.roomType);
} catch (Exception e){
return "";
}
}
public String getPushSendLoginId() {
try {
return jsonObject.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
} catch (Exception e) {
return "";
}
}
public long getPushSendDate() {
try {
return jsonObject.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
} catch (Exception e) {
return 0;
}
}
public String getCollaborationType() {
try {
return jsonObject.getString(AppDefType.ChatPushMessageKey.collaborationType);
} catch (Exception e) {
return "";
}
}
}
......@@ -89,9 +89,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected static GroupLogic groupLogic = AbstractLogic.getLogic(GroupLogic.class);
private static final String TAG ="ABVContentViewActivity";
public final static int ABOOK_CHECK_TASK_IMAGE = 103;
public final static int ABOOK_CHECK_TASK_VIDEO = 104;
protected final static int ABOOK_CHECK_SELECT_SCENE = 105;
protected long contentId;// 表示中のコンテンツID
protected long objectId; // オブジェクトID(オブジェクト用のActivityのときのみ使用)
......
......@@ -147,5 +147,6 @@ public interface AppDefType {
String roomType = "roomType";
String shopName = "shopName";
String loginId = "loginId";
String fromClassName = "fromClassName";
}
}
......@@ -307,7 +307,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
// 動画が選択された場合
} else if (fileChooserParams.getAcceptTypes()[0].toLowerCase().contains(ABookKeys.VIDEO)) {
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Camera", ABookKeys.VIDEO, true);
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
if (result) {
if (mUploadMessage != null) {
......
......@@ -37,6 +37,7 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
......@@ -224,9 +225,9 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
Logger.d(TAG, "*********************commonOpenFileChooser");
boolean result = false;
if (acceptType.toLowerCase().indexOf(ABookKeys.IMAGE) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
result = startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
} else if (acceptType.toLowerCase().indexOf(ABookKeys.VIDEO) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
result = startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
mUploadMessage = uploadFile;
if (result) {
......@@ -713,7 +714,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
Uri result = (intent == null || resultCode != RESULT_OK) ? null : intent.getData();
if (requestCode == ABOOK_CHECK_TASK_IMAGE) {
if (requestCode == ABookCommConstants.ABOOK_CHECK_TASK_IMAGE) {
if (mUploadMessage == null) {
return;
}
......@@ -729,13 +730,13 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
mUploadMessage.onReceiveValue(null);
ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107);
}
} else if (requestCode == ABOOK_CHECK_TASK_VIDEO) {
} else if (requestCode == ABookCommConstants.ABOOK_CHECK_TASK_VIDEO) {
if (mUploadMessage == null) {
return;
}
// 動画
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
} else if (requestCode == ABookCommConstants.ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result);
}
......
......@@ -23,6 +23,7 @@ import org.json.adf.JSONObject;
import java.util.List;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
......@@ -131,10 +132,10 @@ public class OperationTaskLayout extends RelativeLayout {
FileChooserParams fileChooserParams) {
boolean result = false;
if(fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.IMAGE) != -1) {
result = ((ABVActivity)context).startCameraIntent(((ABVContentViewActivity)context).ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
result = ((ABVActivity)context).startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
} else if(fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.VIDEO) != -1) {
result = ((ABVActivity)context).startCameraIntent(((ABVContentViewActivity)context).ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
result = ((ABVActivity)context).startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
if (result) {
......
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