Commit 4a769161 by Lee Munkyeong

オフライン対応

parent 5379e727
...@@ -84,10 +84,18 @@ public interface ABookCommConstants { ...@@ -84,10 +84,18 @@ public interface ABookCommConstants {
Integer DM = 1; Integer DM = 1;
Integer ALL = 2; Integer ALL = 2;
} }
interface MESSAGE_TYPE {
Integer TEXT = 0;
Integer PHOTO = 1;
Integer VIDEO = 2;
Integer SYSTEM = 4;
}
Integer GROUP_REQUEST_ALL = 0; Integer GROUP_REQUEST_ALL = 0;
} }
interface SIZE { interface SIZE {
Integer MAX_FAVORITE_COUNT = 100; Integer MAX_FAVORITE_COUNT = 100;
} }
String FILE_SAVE_PATH = "/data/user/0/jp.co.agentec.abookplus.check/files/";
} }
...@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.logic; ...@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.logic;
import org.json.adf.JSONArray; import org.json.adf.JSONArray;
import org.json.adf.JSONObject; import org.json.adf.JSONObject;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -62,7 +63,11 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -62,7 +63,11 @@ public class CommunicationLogic extends AbstractLogic {
chatRoomMap.put(ABookCommConstants.KEY.TYPE, chatRoomDto.type); chatRoomMap.put(ABookCommConstants.KEY.TYPE, chatRoomDto.type);
chatRoomMap.put(ABookCommConstants.KEY.FAVORITE_REGISTER_DATE, chatRoomDto.favoriteRegisterDate); chatRoomMap.put(ABookCommConstants.KEY.FAVORITE_REGISTER_DATE, chatRoomDto.favoriteRegisterDate);
chatRoomMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatRoomDto.unreadCount); chatRoomMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatRoomDto.unreadCount);
if (ABookCommConstants.FLAG.MESSAGE_TYPE.PHOTO.equals(chatRoomDto.messageType) || ABookCommConstants.FLAG.MESSAGE_TYPE.VIDEO.equals(chatRoomDto.messageType)) {
chatRoomMap.put(ABookCommConstants.KEY.MESSAGE, getFileUrlPath(chatRoomDto.message));
} else {
chatRoomMap.put(ABookCommConstants.KEY.MESSAGE, chatRoomDto.message); chatRoomMap.put(ABookCommConstants.KEY.MESSAGE, chatRoomDto.message);
}
chatRoomMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatRoomDto.messageType); chatRoomMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatRoomDto.messageType);
chatRoomMap.put(ABookCommConstants.KEY.INSERT_DATE, chatRoomDto.insertDate); chatRoomMap.put(ABookCommConstants.KEY.INSERT_DATE, chatRoomDto.insertDate);
chatRoomMap.put(ABookCommConstants.KEY.USER_COUNT, chatRoomDto.userCount); chatRoomMap.put(ABookCommConstants.KEY.USER_COUNT, chatRoomDto.userCount);
...@@ -73,7 +78,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -73,7 +78,7 @@ public class CommunicationLogic extends AbstractLogic {
for (ShopMemberDto user : userList) { for (ShopMemberDto user : userList) {
Map<String, Object> userMap = new HashMap<String, Object>(); Map<String, Object> userMap = new HashMap<String, Object>();
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, user.shopMemberId); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, user.shopMemberId);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, user.profileUrl); userMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(user.profileUrl));
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, user.shopMemberName); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, user.shopMemberName);
JSONObject jsonObject = new JSONObject(userMap); JSONObject jsonObject = new JSONObject(userMap);
attendUsers.put(jsonObject); attendUsers.put(jsonObject);
...@@ -93,7 +98,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -93,7 +98,7 @@ public class CommunicationLogic extends AbstractLogic {
for (ShopMemberDto user : userList) { for (ShopMemberDto user : userList) {
Map<String, Object> userMap = new HashMap<String, Object>(); Map<String, Object> userMap = new HashMap<String, Object>();
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, user.shopMemberId); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, user.shopMemberId);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, user.profileUrl); userMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(user.profileUrl));
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, user.shopMemberName); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, user.shopMemberName);
JSONObject jsonObject = new JSONObject(userMap); JSONObject jsonObject = new JSONObject(userMap);
attendUsers.put(jsonObject); attendUsers.put(jsonObject);
...@@ -111,10 +116,14 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -111,10 +116,14 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId); chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName); chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, chatMessageDto.shopMemberId); chatMessageMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, chatMessageDto.shopMemberId);
if (ABookCommConstants.FLAG.MESSAGE_TYPE.PHOTO.equals(chatMessageDto.messageType) || ABookCommConstants.FLAG.MESSAGE_TYPE.VIDEO.equals(chatMessageDto.messageType)) {
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, getFileUrlPath(chatMessageDto.message));
} else {
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message);
}
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType);
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate); chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl); chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(chatMessageDto.profileUrl));
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg); chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount); chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap); JSONObject jsonObject = new JSONObject(chatMessageMap);
...@@ -134,10 +143,14 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -134,10 +143,14 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId); chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName); chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, chatMessageDto.shopMemberId); chatMessageMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, chatMessageDto.shopMemberId);
if (ABookCommConstants.FLAG.MESSAGE_TYPE.PHOTO.equals(chatMessageDto.messageType) || ABookCommConstants.FLAG.MESSAGE_TYPE.VIDEO.equals(chatMessageDto.messageType)) {
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, getFileUrlPath(chatMessageDto.message));
} else {
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message);
}
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType);
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate); chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl); chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(chatMessageDto.profileUrl));
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg); chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount); chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap); JSONObject jsonObject = new JSONObject(chatMessageMap);
...@@ -166,7 +179,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -166,7 +179,7 @@ public class CommunicationLogic extends AbstractLogic {
} }
resultJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMemberDto.shopMemberId); resultJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMemberDto.shopMemberId);
resultJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMemberDto.shopMemberName); resultJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMemberDto.shopMemberName);
resultJson.put(ABookCommConstants.KEY.PROFILE_URL, shopMemberDto.profileUrl); resultJson.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(shopMemberDto.profileUrl));
resultJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathJsonArray); resultJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathJsonArray);
boolean hasRegisteredDate = StringUtil.isNullOrEmpty(shopMemberDto.favoriteRegisterDate) == false; boolean hasRegisteredDate = StringUtil.isNullOrEmpty(shopMemberDto.favoriteRegisterDate) == false;
resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, hasRegisteredDate); resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, hasRegisteredDate);
...@@ -180,7 +193,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -180,7 +193,7 @@ public class CommunicationLogic extends AbstractLogic {
JSONObject myInfoJson = new JSONObject(); JSONObject myInfoJson = new JSONObject();
myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myInfo.shopMemberId); myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myInfo.shopMemberId);
myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myInfo.shopMemberName); myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myInfo.shopMemberName);
myInfoJson.put(ABookCommConstants.KEY.PROFILE_URL, myInfo.profileUrl); myInfoJson.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(myInfo.profileUrl));
myInfoJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList); myInfoJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
String myInfoStr = myInfoJson.toString(); String myInfoStr = myInfoJson.toString();
return myInfoStr; return myInfoStr;
...@@ -200,7 +213,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -200,7 +213,7 @@ public class CommunicationLogic extends AbstractLogic {
myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, groupUser.shopMemberId); myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, groupUser.shopMemberId);
myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, groupUser.shopMemberName); myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, groupUser.shopMemberName);
myGroupUserMap.put(ABookCommConstants.KEY.CHECKED, ""); myGroupUserMap.put(ABookCommConstants.KEY.CHECKED, "");
myGroupUserMap.put(ABookCommConstants.KEY.PROFILE_URL, groupUser.profileUrl); myGroupUserMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(groupUser.profileUrl));
myGroupUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupUser); myGroupUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupUser);
if (StringUtil.isNullOrEmpty(groupUser.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(groupUser.favoriteRegisterDate)) {
myGroupUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, false); myGroupUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
...@@ -231,7 +244,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -231,7 +244,7 @@ public class CommunicationLogic extends AbstractLogic {
myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, groupUser.shopMemberId); myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, groupUser.shopMemberId);
myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, groupUser.shopMemberName); myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, groupUser.shopMemberName);
myGroupUserMap.put(ABookCommConstants.KEY.CHECKED, ""); myGroupUserMap.put(ABookCommConstants.KEY.CHECKED, "");
myGroupUserMap.put(ABookCommConstants.KEY.PROFILE_URL, groupUser.profileUrl); myGroupUserMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(groupUser.profileUrl));
myGroupUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupUser); myGroupUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupUser);
if (StringUtil.isNullOrEmpty(groupUser.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(groupUser.favoriteRegisterDate)) {
myGroupUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, false); myGroupUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
...@@ -267,7 +280,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -267,7 +280,7 @@ public class CommunicationLogic extends AbstractLogic {
} }
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl); userMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(shopMember.profileUrl));
userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray); userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray);
if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false); userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
...@@ -301,7 +314,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -301,7 +314,7 @@ public class CommunicationLogic extends AbstractLogic {
} }
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl); userMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(shopMember.profileUrl));
userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray); userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray);
if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false); userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
...@@ -334,7 +347,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -334,7 +347,7 @@ public class CommunicationLogic extends AbstractLogic {
} }
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl); userMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(shopMember.profileUrl));
userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray); userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray);
if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false); userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
...@@ -369,7 +382,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -369,7 +382,7 @@ public class CommunicationLogic extends AbstractLogic {
} }
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl); userMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(shopMember.profileUrl));
userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray); userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray);
if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false); userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
...@@ -444,7 +457,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -444,7 +457,7 @@ public class CommunicationLogic extends AbstractLogic {
favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, favoriteUser.shopMemberId); favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, favoriteUser.shopMemberId);
favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, favoriteUser.shopMemberName); favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, favoriteUser.shopMemberName);
favoriteUserMap.put(ABookCommConstants.KEY.CHECKED, ""); favoriteUserMap.put(ABookCommConstants.KEY.CHECKED, "");
favoriteUserMap.put(ABookCommConstants.KEY.PROFILE_URL, favoriteUser.profileUrl); favoriteUserMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(favoriteUser.profileUrl));
favoriteUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray); favoriteUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray);
favoriteUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, true); favoriteUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, true);
JSONObject jsonObject = new JSONObject(favoriteUserMap); JSONObject jsonObject = new JSONObject(favoriteUserMap);
...@@ -474,7 +487,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -474,7 +487,7 @@ public class CommunicationLogic extends AbstractLogic {
favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, favoriteUser.shopMemberId); favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, favoriteUser.shopMemberId);
favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, favoriteUser.shopMemberName); favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, favoriteUser.shopMemberName);
favoriteUserMap.put(ABookCommConstants.KEY.CHECKED, ""); favoriteUserMap.put(ABookCommConstants.KEY.CHECKED, "");
favoriteUserMap.put(ABookCommConstants.KEY.PROFILE_URL, favoriteUser.profileUrl); favoriteUserMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(favoriteUser.profileUrl));
favoriteUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray); favoriteUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathArray);
favoriteUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, true); favoriteUserMap.put(ABookCommConstants.KEY.IS_FAVORITE, true);
JSONObject jsonObject = new JSONObject(favoriteUserMap); JSONObject jsonObject = new JSONObject(favoriteUserMap);
...@@ -568,7 +581,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -568,7 +581,7 @@ public class CommunicationLogic extends AbstractLogic {
Map<String, Object> shopMemberMap = new HashMap<String, Object>(); Map<String, Object> shopMemberMap = new HashMap<String, Object>();
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId); shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName); shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl); shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(shopMember.profileUrl));
shopMemberMap.put(ABookCommConstants.KEY.CHECKED, ""); shopMemberMap.put(ABookCommConstants.KEY.CHECKED, "");
shopMemberMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, chatGroupDao.getUserGroupPathList(shopMember.shopMemberId)); shopMemberMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, chatGroupDao.getUserGroupPathList(shopMember.shopMemberId));
if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
...@@ -747,17 +760,54 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -747,17 +760,54 @@ public class CommunicationLogic extends AbstractLogic {
public void roomDisplayOff(Integer roomId) { public void roomDisplayOff(Integer roomId) {
chatRoomDao.changeRoomViewFlg(roomId); chatRoomDao.changeRoomViewFlg(roomId);
} }
public String getUserList(String userIdList) { public String getUserList(String userIdList) {
List<ShopMemberDto> selectedUsers = shopMemberDao.getSelectedUsers(userIdList); List<ShopMemberDto> selectedUsers = shopMemberDao.getSelectedUsers(userIdList);
JSONArray attendUsers = new JSONArray(); JSONArray attendUsers = new JSONArray();
for (ShopMemberDto dto : selectedUsers) { for (ShopMemberDto dto : selectedUsers) {
Map<String, Object> userMap = new HashMap<String, Object>(); Map<String, Object> userMap = new HashMap<String, Object>();
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, dto.shopMemberId); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, dto.shopMemberId);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, dto.profileUrl); userMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(dto.profileUrl));
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, dto.shopMemberName); userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, dto.shopMemberName);
JSONObject jsonObject = new JSONObject(userMap); JSONObject jsonObject = new JSONObject(userMap);
attendUsers.put(jsonObject); attendUsers.put(jsonObject);
} }
return attendUsers.toString(); return attendUsers.toString();
}; };
public String getProfileUrlPath(String profileUrl) {
if (profileUrl == null) {
return null;
}
String[] filePaths = profileUrl.split("/");
String fileName = filePaths[filePaths.length-1];
String filePath = ABookCommConstants.FILE_SAVE_PATH + fileName;
File file = new File(filePath);
if (file.exists()) {
String uri = file.toURI().toString();
return uri;
} else {
return profileUrl;
}
};
public String getFileUrlPath(String fileUrlPath) {
if (!fileUrlPath.contains("fileName=")) {
return fileUrlPath;
}
String fileName = fileUrlPath.split("fileName=")[1].split("&amp;")[0];
String filePath = ABookCommConstants.FILE_SAVE_PATH + fileName;
File file = new File(filePath);
if (file.exists()) {
String replaceTarget = "https" + fileUrlPath.split("https")[1].split("\"")[0];
String uri = file.toURI().toString();
String resultPath = fileUrlPath;
while(resultPath.contains(replaceTarget)) {
resultPath = resultPath.replace(replaceTarget, uri);
}
return resultPath;
} else {
return fileUrlPath;
}
};
} }
package jp.agentec.abook.abv.cl.util; package jp.agentec.abook.abv.cl.util;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
...@@ -17,6 +18,7 @@ import android.graphics.BitmapFactory; ...@@ -17,6 +18,7 @@ import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.media.MediaMetadataRetriever; import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.util.Base64;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException; import com.google.zxing.WriterException;
...@@ -433,4 +435,23 @@ public class BitmapUtil { ...@@ -433,4 +435,23 @@ public class BitmapUtil {
return bitmapList; return bitmapList;
} }
public static Bitmap convert(String base64Str) throws IllegalArgumentException
{
byte[] decodedBytes = Base64.decode(
base64Str.substring(base64Str.indexOf(",") + 1),
Base64.DEFAULT
);
return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);
}
public static String convert(Bitmap bitmap)
{
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
return Base64.encodeToString(outputStream.toByteArray(), Base64.DEFAULT);
}
} }
package jp.agentec.abook.abv.ui.home.activity; package jp.agentec.abook.abv.ui.home.activity;
import android.annotation.SuppressLint;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DownloadManager; import android.app.DownloadManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.util.Log; import android.util.Log;
...@@ -30,9 +35,12 @@ import android.widget.ImageView; ...@@ -30,9 +35,12 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import org.json.adf.HTTP; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -209,6 +217,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -209,6 +217,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView.setWebChromeClient(new FullscreenableChromeClient(this) { mChatWebView.setWebChromeClient(new FullscreenableChromeClient(this) {
@Override @Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) { public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
boolean result = false; boolean result = false;
...@@ -376,6 +386,32 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -376,6 +386,32 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView.setWebViewClient(new WebViewClient() { mChatWebView.setWebViewClient(new WebViewClient() {
@Override @Override
public void onLoadResource(WebView view, String url) {
if(url.contains("profileFileName")) {
Uri uri = Uri.parse(url);
String fileName = uri.getQueryParameter("profileFileName");
String filePath = getFilesDir().getAbsolutePath() + "/" + fileName;
Logger.i(TAG, filePath);
File file = new File(filePath);
NetworkTask networkTask = new NetworkTask(url, filePath);
networkTask.execute();
} else if (url.contains("/file/getImage")) {
Uri uri = Uri.parse(url);
String fileName = uri.getQueryParameter("fileName");
String filePath = getFilesDir().getAbsolutePath() + "/" + fileName;
Logger.i(TAG, filePath);
File file = new File(filePath);
NetworkTask networkTask = new NetworkTask(url, filePath);
networkTask.execute();
} else {
super.onLoadResource(view, url);
}
}
@Override
public void onReceivedError(WebView view, int errorCode, public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) { String description, String failingUrl) {
...@@ -403,7 +439,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -403,7 +439,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
DownloadManager mdDownloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager mdDownloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request( DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url)); Uri.parse(url));
File destinationFile = new File(Environment.getExternalStorageDirectory(), fileName); request.setDescription("Downloading ..."); File destinationFile = new File(Environment.getExternalStorageDirectory(), fileName);
request.setDescription("Downloading ...");
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationUri(Uri.fromFile(destinationFile)); request.setDestinationUri(Uri.fromFile(destinationFile));
assert mdDownloadManager != null; assert mdDownloadManager != null;
...@@ -1175,7 +1212,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1175,7 +1212,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
intent.setClass(ChatWebviewActivity.this, OperationRelatedContentActivity.class); intent.setClass(ChatWebviewActivity.this, OperationRelatedContentActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent, NaviConsts.Left); startActivity(intent, NaviConsts.Left);
// overridePendingTransition(R.anim.viewin_left_to_right, R.anim.viewin_left_to_right);
} }
// 設定画面へ遷移 // 設定画面へ遷移
...@@ -1185,4 +1221,54 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1185,4 +1221,54 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
showSetting(); showSetting();
} }
public class NetworkTask extends AsyncTask<Void, Void, Bitmap> {
private String url;
private String filePath;
private ContentValues values;
private Bitmap mBitmap;
public NetworkTask(String url, String filePath) {
this.url = url;
this.filePath = filePath;
}
@Override
protected Bitmap doInBackground(Void... params) {
try {
mBitmap =BitmapFactory.decodeStream((InputStream) new URL(url).getContent());
} catch (IOException e) {
e.printStackTrace();
}
return mBitmap;
}
@Override
protected void onPostExecute(Bitmap resultBitmap) {
super.onPostExecute(resultBitmap);
try {
if (resultBitmap == null) {
return;
}
File f = new File(filePath);
f.createNewFile();
Bitmap bitmap = resultBitmap;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 0 , bos);
byte[] bitmapdata = bos.toByteArray();
FileOutputStream fos = new FileOutputStream(f);
fos.write(bitmapdata);
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} }
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