Commit 8f4fc580 by Kim Peace

Merge branch 'communication/develop' into 'features/1.3.200'

Communication/develop

See merge request !180
parents 9fab7701 407ebf5b
......@@ -40,10 +40,12 @@ import jp.agentec.abook.abv.bl.acms.client.json.OperationListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProcessDataJSON;
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.RoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UnreadCountJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AbstractAcmsLoginParameters;
......@@ -53,6 +55,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AppStoreNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ArchiveDetailRequestParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ArchiveRequestParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ChangeCollaborationParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ChangeRoomNameParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.CheckSendLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters;
......@@ -62,6 +65,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.FavoriteGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.FavoriteUserParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.FinishCollaborationParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters;
......@@ -562,6 +566,12 @@ public class AcmsClient implements AcmsClientResponseListener {
return json;
}
public RoomJSON getRoom(String sid,String roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new GetMessagesParameters(sid, AcmsApis.RoomCmds.getRoom, roomId, null, null, null ));
RoomJSON json = new RoomJSON(response.httpResponseBody);
return json;
}
/**
* ログインしたユーザの情報を取得する。
*
......@@ -595,14 +605,13 @@ public class AcmsClient implements AcmsClientResponseListener {
* 全てのグループ更新。
*
* @param sid
* @param groupId
* @param updatedDate
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public GroupListJSON getGroupInfo(String sid, String groupId, String updatedDate) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new GetGroupInfoParameters(sid, AcmsApis.UserCmds.getGroupInfo, groupId, updatedDate));
public GroupListJSON getGroupInfo(String sid, String updatedDate) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new GetGroupInfoParameters(sid, AcmsApis.UserCmds.getGroupInfo, updatedDate));
GroupListJSON json = new GroupListJSON(response.httpResponseBody);
return json;
}
......@@ -649,12 +658,17 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public MessageInfoListJSON getMessages(String sid, String roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid, AcmsApis.MessageCmds.getMessages, roomId, "0"));
public MessageInfoListJSON getMessages(String sid, String roomId, String messageId, String updateDate) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid, AcmsApis.MessageCmds.getMessages, roomId, "0", messageId, updateDate));
MessageInfoListJSON json = new MessageInfoListJSON(response.httpResponseBody);
return json;
}
public UnreadCountJSON getMessagesUnreadCount(String sid, String roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid, AcmsApis.MessageCmds.getUnreadCount, roomId, "0", null, null));
UnreadCountJSON json = new UnreadCountJSON(response.httpResponseBody);
return json;
}
/**
* ユーザ招待。
*
......@@ -795,12 +809,25 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ArchiveDetailJSON joinCollaboration(String sid, Integer roomId) throws NetworkDisconnectedException, AcmsException {
public void joinCollaboration(String sid, Integer roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetCollaboration, new JoinCollaborationParameters(sid, AcmsApis.CollaborationCmds.join, roomId));
ArchiveDetailJSON json = new ArchiveDetailJSON(response.httpResponseBody);
return json;
if (response.httpResponseCode != 200) {
}
}
public void finishCollaboration(String sid, int roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetCollaboration, new FinishCollaborationParameters(sid, AcmsApis.CollaborationCmds.finish, roomId));
}
public void finishAllCollaboration(String sid, int roomId) throws NetworkDisconnectedException, AcmsException {
send(AcmsApis.ApigetCollaboration, new FinishCollaborationParameters(sid, AcmsApis.CollaborationCmds.finishAll, roomId));
}
public void changeCollaboration(String sid, int roomId, int changeCollaborationType, int meetingId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetCollaboration, new ChangeCollaborationParameters(sid, AcmsApis.CollaborationCmds.change, roomId, changeCollaborationType, meetingId));
}
/**
* 協業内ユーザー招待
*
......@@ -813,10 +840,11 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ArchiveDetailJSON inviteCollaboration(String sid, Integer roomId, String roomName, String inveitedUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
public void inviteCollaboration(String sid, Integer roomId, String roomName, String inveitedUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetCollaboration, new InviteCollaborationParameters(sid, AcmsApis.CollaborationCmds.invite, roomId, roomName, inveitedUserIds, collaborationType));
ArchiveDetailJSON json = new ArchiveDetailJSON(response.httpResponseBody);
return json;
if (response.httpResponseCode != 200) {
}
}
/**
......@@ -1112,9 +1140,7 @@ public class AcmsClient implements AcmsClientResponseListener {
*/
private HttpResponse send(String methodName, HttpParameterObject param) throws NetworkDisconnectedException, AcmsException {
Logger.d(TAG, "call api : %s", methodName);
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, methodName);
HttpResponse response = send(apiUrl, methodName, param);
// 最終アクセス時間更新
......
......@@ -8,9 +8,11 @@ import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ArchiveListJSON extends AcmsCommonJSON {
......@@ -41,18 +43,25 @@ public class ArchiveListJSON extends AcmsCommonJSON {
ArchiveDto archiveDto = new ArchiveDto();
archiveDto.archiveId = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_ID);
archiveDto.collaborationDetailId = archiveJSON.getInt(ABookCommConstants.KEY.COLLABORATION_DEATAIL_ID);
archiveDto.archiveName = archiveJSON.getString(ABookCommConstants.KEY.ARCHIVE_NAME);
archiveDto.archiveType = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_TYPE);
archiveDto.archiveDate = DateTimeUtil.millToDateString(archiveJSON.getJSONObject(ABookCommConstants.KEY.ARCHIVE_DATE)
.getLong(ABookCommConstants.KEY.TIME), "yyyy/MM/dd HH:mm");
archiveDto.archiveType = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_TYPE);
archiveDto.delFlg = archiveJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
archiveDto.collaborationDetailId = archiveJSON.getInt(ABookCommConstants.KEY.COLLABORATION_DEATAIL_ID);
archiveList.add(archiveDto);
archiveDto.roomId = archiveJSON.getInt(ABookCommConstants.KEY.ROOM_ID);
archiveDto.saveUserId = archiveJSON.getInt(ABookCommConstants.KEY.SAVE_USER_ID);
archiveDto.filePath = archiveJSON.getString(ABookCommConstants.KEY.FILE_PATH);
if (archiveJSON.has(ABookCommConstants.KEY.ATTEND_USER_IDS)) {
archiveDto.attendUserIds = archiveJSON.getJSONArray(ABookCommConstants.KEY.ATTEND_USER_IDS).toString();
}
if (json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE)) {
archiveLastUpdateDate = json.getJSONObject(ABookCommConstants.KEY.BODY).getString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE);
archiveList.add(archiveDto);
}
String time = JsonUtil.getString(json, PresentTime);
presentTime = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
archiveLastUpdateDate = DateTimeUtil.toString(presentTime, DateTimeFormat.yyyyMMddHHmmss_none);
}
}
......@@ -4,18 +4,22 @@ import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import java.util.Date;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class GroupListJSON extends AcmsCommonJSON {
public ArrayList<ChatGroupDto> groupList;
public String allGroupLastUpdateDate;
public String lastRequestDate;
public GroupListJSON(String jsonString) throws AcmsException {
super(jsonString);
......@@ -46,9 +50,6 @@ public class GroupListJSON extends AcmsCommonJSON {
}
groupDto.groupName = groupJSON.getString(ABookCommConstants.KEY.GROUP_NAME);
groupDto.delFlg = groupJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
if (groupJSON.has(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE)) {
groupDto.updateDate = groupJSON.getString(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE);
}
if (groupJSON.has(ABookCommConstants.KEY.GROUP_MEMBER_LIST)) {
JSONArray groupMemberJsonArray = groupJSON.getJSONArray(ABookCommConstants.KEY.GROUP_MEMBER_LIST);
ArrayList<ShopMemberDto> groupMembers = new ArrayList<ShopMemberDto>();
......@@ -62,19 +63,15 @@ public class GroupListJSON extends AcmsCommonJSON {
if (groupMember.has(ABookCommConstants.KEY.PROFILE_IMAGE_PATH)) {
shopMemberDto.profileUrl = groupMember.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
}
ArrayList groupIds = new ArrayList();
groupIds.add(groupDto.groupId);
shopMemberDto.groupIdList = groupIds;
groupMembers.add(shopMemberDto);
}
groupDto.groupMembers = groupMembers;
}
groupList.add(groupDto);
}
if (json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE)) {
allGroupLastUpdateDate = json.getJSONObject(ABookCommConstants.KEY.BODY).getString(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE);
}
String time = JsonUtil.getString(json, PresentTime);
presentTime = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
lastRequestDate = DateTimeUtil.toString(presentTime, DateTimeFormat.yyyyMMddHHmmss_none);
}
}
......
......@@ -9,8 +9,10 @@ import java.util.HashMap;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class MessageInfoListJSON extends AcmsCommonJSON {
......@@ -18,6 +20,7 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
public ArrayList<ChatMessageDto> chatMessageDtoArrayList;
public ArrayList<ShopMemberDto> shopMemberDtoArrayList;
public String updateDate;
public MessageInfoListJSON(String jsonString) throws AcmsException {
super(jsonString);
......@@ -54,14 +57,11 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
} else {
chatMessageDto.message = messageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
}
chatMessageDto.unreadCount = messageInfoJSON.getInt(ABookCommConstants.KEY.UNREAD_COUNT);
if (messageInfoJSON.has(ABookCommConstants.KEY.TIME)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(messageInfoJSON.getJSONObject(ABookCommConstants.KEY.TIME).getLong(ABookCommConstants.KEY.TIME));
}
chatMessageDtoArrayList.add(chatMessageDto);
if (existShopMmeberMap.get(chatMessageDto.shopMemberId) != null) { continue; }
ShopMemberDto shopMemberDto = new ShopMemberDto();
shopMemberDto.shopMemberId = messageInfoJSON.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
......@@ -74,6 +74,10 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
shopMemberDtoArrayList.add(shopMemberDto);
}
String time = JsonUtil.getString(json, PresentTime);
presentTime = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
updateDate = DateTimeUtil.toString(presentTime, DateTimeFormat.yyyyMMddHHmmss_none);
}
}
......@@ -27,12 +27,12 @@ public class MyInfoJSON extends AcmsCommonJSON {
if (MyInfoJson == null) { return; }
shopMemberDto = new ShopMemberDto();
ArrayList<Integer> groupIdList = new ArrayList<Integer>();
JSONArray groupIdJsonArray = (JSONArray) MyInfoJson.get(ABookCommConstants.KEY.GROUP_ID_LIST);
//ArrayList<Integer> groupIdList = new ArrayList<Integer>();
/*JSONArray groupIdJsonArray = (JSONArray) MyInfoJson.get(ABookCommConstants.KEY.GROUP_ID_LIST);
for (int i = 0; i < groupIdJsonArray.length(); i++) {
groupIdList.add(groupIdJsonArray.getInt(i));
}
shopMemberDto.groupIdList = groupIdList;
}*/
//shopMemberDto.groupIdList = groupIdList;
shopMemberDto.selfFlg = ABookCommConstants.FLAG.SELF_FLAG.ON;
shopMemberDto.profileUrl = MyInfoJson.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
shopMemberDto.shopMemberId = MyInfoJson.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.adf.util.DateTimeUtil;
public class RoomJSON extends AcmsCommonJSON {
public ChatRoomDto chatRoomDto;
public RoomJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject roomInfo = json.getJSONObject(ABookCommConstants.KEY.BODY);
chatRoomDto = new ChatRoomDto();
chatRoomDto.chatRoomId = roomInfo.getInt(ABookCommConstants.KEY.ROOM_ID);
chatRoomDto.chatRoomName = roomInfo.getString(ABookCommConstants.KEY.ROOM_NAME);
chatRoomDto.type = roomInfo.getInt(ABookCommConstants.KEY.ROOM_TYPE);
chatRoomDto.userCount = roomInfo.getJSONArray(ABookCommConstants.KEY.ATTEND_USER_IDS).length();
JSONArray attendUsers = roomInfo.getJSONArray(ABookCommConstants.KEY.ATTEND_USER_IDS);
ArrayList<Integer> attendUserList = new ArrayList<Integer>();
for (int attendUserCount = 0; attendUserCount < attendUsers.length(); attendUserCount++) {
attendUserList.add((Integer) attendUsers.get(attendUserCount));
}
chatRoomDto.attendUsers = attendUserList;
}
}
......@@ -48,8 +48,13 @@ public class RoomListJSON extends AcmsCommonJSON {
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(ABookCommConstants.KEY.LAST_MESSAGE_INFO) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(ABookCommConstants.KEY.LAST_MESSAGE_INFO) : null;
if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(ABookCommConstants.KEY.MESSAGE_ID)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE);
if (ABookCommConstants.FLAG.MESSAGE_TYPE.COLLABORATION_START.equals(chatMessageDto.messageType)
|| ABookCommConstants.FLAG.MESSAGE_TYPE.COLLABORATION_END.equals(chatMessageDto.messageType)) {
chatMessageDto.message = lastMessageInfoJSON.getJSONObject(ABookCommConstants.KEY.MESSAGE).toString();
} else {
chatMessageDto.message = lastMessageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
}
if (lastMessageInfoJSON.has(ABookCommConstants.KEY.INSERT_DATE)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(ABookCommConstants.KEY.INSERT_DATE).getLong(ABookCommConstants.KEY.TIME));
}
......
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.HashMap;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class UnreadCountJSON extends AcmsCommonJSON {
public ArrayList<ChatMessageDto> chatMessageDtoArrayList;
public UnreadCountJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// メッセージ情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
HashMap<Integer, Integer> existShopMmeberMap = new HashMap<Integer, Integer>();
JSONArray unreadCountList = json.getJSONArray(ABookCommConstants.KEY.BODY);
if (unreadCountList == null) { return; }
chatMessageDtoArrayList = new ArrayList<ChatMessageDto>();
for (int listCount = 0; listCount < unreadCountList.length(); listCount++) {
ChatMessageDto chatMessageDto = new ChatMessageDto();
JSONObject messageInfoJSON = unreadCountList.getJSONObject(listCount);
if (messageInfoJSON == null) { continue; }
chatMessageDto.chatMessageId = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatMessageDto.unreadCount = messageInfoJSON.getInt(ABookCommConstants.KEY.UNREAD_COUNT);
chatMessageDtoArrayList.add(chatMessageDto);
}
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link ChangeCollaborationParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author lee-mk
* @version 1.0.0
*/
public class ChangeCollaborationParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private Integer roomId;
private Integer collaborationType;
private Integer meetingId;
/**
* {@link ChangeCollaborationParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @param roomId roomId
* @param meetingId meetingId
* @since 1.0.0
*/
public ChangeCollaborationParameters(String sid, String cmd, Integer roomId, Integer collaborationType, Integer meetingId) {
this.sid = sid;
this.cmd = cmd;
this.roomId = roomId;
this.collaborationType = collaborationType;
this.meetingId = meetingId;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* roomIdを返します。
* @return roomId
* @since 1.0.0
*/
public Integer getRoomId() {
return roomId;
}
/**
* meetingIdを返します。
* @return meetingId
* @since 1.0.0
*/
public Integer getMeetingId() {
return meetingId;
}
/**
* collaborationTypeを返します。
* @return collaborationType
* @since 1.0.0
*/
public Integer getCollaborationType() {
return collaborationType;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link FinishCollaborationParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author lee-mk
* @version 1.0.0
*/
public class FinishCollaborationParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private Integer roomId;
/**
* {@link FinishCollaborationParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public FinishCollaborationParameters(String sid, String cmd, Integer roomId) {
this.sid = sid;
this.cmd = cmd;
this.roomId = roomId;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* roomIdを返します。
* @return roomId
* @since 1.0.0
*/
public Integer getRoomId() {
return roomId;
}
}
......@@ -38,10 +38,9 @@ public class GetGroupInfoParameters extends HttpParameterObject {
this.cmd = cmd;
}
public GetGroupInfoParameters(String sid, String cmd, String groupId, String updatedDate) {
public GetGroupInfoParameters(String sid, String cmd, String updatedDate) {
this.sid = sid;
this.cmd = cmd;
this.groupIds = groupId;
this.updatedDate = updatedDate;
}
......
......@@ -17,6 +17,8 @@ public class GetMessagesParameters extends HttpParameterObject {
private String cmd;
private String roomId;
private String lineNum;
private String messageId;
private String updateDate;
/**
* {@link GetMessagesParameters} のインスタンスを初期化します。
......@@ -33,11 +35,13 @@ public class GetMessagesParameters extends HttpParameterObject {
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public GetMessagesParameters(String sid, String cmd, String roomId, String lineNum) {
public GetMessagesParameters(String sid, String cmd, String roomId, String lineNum, String messageId, String updateDate) {
this.sid = sid;
this.cmd = cmd;
this.roomId = roomId;
this.lineNum = lineNum;
this.messageId = messageId;
this.updateDate = updateDate;
}
/**
......@@ -66,4 +70,11 @@ public class GetMessagesParameters extends HttpParameterObject {
return lineNum;
}
public String getMessageId() {
return messageId;
}
public String getUpdateDate() {
return updateDate;
}
}
......@@ -188,10 +188,12 @@ public class AcmsApis {
public static final String getRoomList = "5";
public static final String createRoom = "2";
public static final String changeRoomName = "6";
public static final String getRoom = "7";
}
public static final class MessageCmds {
public static final String getMessages = "2";
public static final String getUnreadCount = "4";
}
public static final class FavoriteCmds {
......@@ -209,10 +211,11 @@ public class AcmsApis {
}
public static final class CollaborationCmds {
public static final String start = "1";
public static final String change = "1";
public static final String join = "2";
public static final String finish = "3";
public static final String invite = "4";
public static final String finishAll = "5";
}
// download
......
......@@ -55,7 +55,7 @@ public interface ABookCommConstants {
String LAST_MESSAGE_INFO = "lastMessageInfo";
String FAVORITE_USER_IDS = "favoriteUserIds";
String FAVORITE_GROUP_IDS = "favoriteGroupIds";
String GROUP_INFO_LAST_UPDATE_DATE = "groupInfoLastUpdateDate";
String LAST_REQUEST_DATE = "lastRequestDate";
String ARCHIVE_INFO_LIST = "archiveInfoList";
String ARCHIVE_INFO = "archiveInfo";
......@@ -77,7 +77,13 @@ public interface ABookCommConstants {
String COLLABORATION_DEATAIL_ID = "collaborationDetailId";
String MY_SHOPE_MEMBER_ID = "myShopMemberId";
String ROOT_GROUP_ID = "rootGroupId";
String GROUP_MEMBER_UPDATED_DATE = "groupMemberUpdatedDate";
String MESSAGE_UPDATED_DATE = "MessageUpdatedDate";
String ARCHIVE_UPDATED_DATE = "ArchiveUpdatedDate";
String HTTP_STATUS = "httpStatus";
interface API_KIND {
String USER = "user";
......@@ -120,6 +126,8 @@ public interface ABookCommConstants {
Integer AUDIO = 0;
Integer CAMERA = 2;
Integer VIDEO = 3;
Integer DOCUMENT = 4;
Integer BOARD = 5;
}
interface COLLABORATION_JOIN_FLG {
......@@ -138,6 +146,7 @@ public interface ABookCommConstants {
interface SIZE {
Integer MAX_FAVORITE_COUNT = 100;
Integer MESSAGE_PAGING_SIZE = 100;
}
String FILE_SAVE_PATH = "/data/user/0/jp.co.agentec.abookplus.check/files/";
......
......@@ -161,7 +161,7 @@ public class ArchiveDao extends AbstractCommunicationDao {
}
public boolean updateArchiveDetailInfo(ArchiveDto dto) {
long count = update("update t_archive set archive_name=?, archive_type=?, archive_date=?, room_id=?, room_name=?, attend_user_ids=?, file_path=?, save_user_id=? where archive_id=?", dto.getUpdateDetailValues());
long count = update("update t_archive set room_name=? where archive_id=?", new String[]{"" + dto.roomName, "" + dto.archiveId});
return count > 0;
}
......
......@@ -283,6 +283,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
beginTransaction();
for (ChatGroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupId });
update("delete from r_shop_member_group where group_id = ? ", new Object[] { groupDto.groupId });
}
commit();
} catch (Exception e) {
......
......@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
......@@ -107,10 +108,41 @@ public class ChatMessageDao extends AbstractCommunicationDao {
sql.append(" ON cm.shop_member_id = sm.shop_member_id ");
sql.append(" WHERE cm.chat_room_id = ? ");
sql.append(" ORDER BY cm.insert_date DESC ");
sql.append(" LIMIT " + ABookCommConstants.SIZE.MESSAGE_PAGING_SIZE);
List<ChatMessageDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ chatRoomId}, ChatMessageDto.class);
return list;
}
public List<ChatMessageDto> getChatMessageFromMessageId(int chatRoomId, String MessageId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" cm.chat_message_id ");
sql.append(" ,cm.chat_room_id ");
sql.append(" ,cm.shop_member_id ");
sql.append(" ,cm.login_id ");
sql.append(" ,cm.message ");
sql.append(" ,cm.message_type ");
sql.append(" ,cm.image_name ");
sql.append(" ,cm.download_file_name ");
sql.append(" ,cm.save_path ");
sql.append(" ,cm.insert_date ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url ");
sql.append(" ,sm.self_flg ");
sql.append(" ,cm.unread_count ");
sql.append(" FROM ");
sql.append(" t_chat_message AS cm ");
sql.append(" INNER JOIN ");
sql.append(" m_shop_member AS sm ");
sql.append(" ON cm.shop_member_id = sm.shop_member_id ");
sql.append(" WHERE cm.chat_room_id = ? ");
sql.append(" AND cm.chat_message_id < ? ");
sql.append(" ORDER BY cm.insert_date DESC ");
sql.append(" LIMIT " + ABookCommConstants.SIZE.MESSAGE_PAGING_SIZE);
List<ChatMessageDto> list = rawQueryGetDtoList(sql.toString(), new String[]{"" + chatRoomId, "" + MessageId}, ChatMessageDto.class);
return list;
}
public List<ChatMessageDto> searchChatMessage(int chatRoomId, String[] keywords, String userList) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
......@@ -177,6 +209,15 @@ public class ChatMessageDao extends AbstractCommunicationDao {
return count > 0;
}
public void updatUnreadCount(List<ChatMessageDto> messageDtoList, String roomId) {
beginTransaction();
update("update t_chat_message set unread_count = 0 where chat_room_id=?", new String[]{"" + roomId});
for (ChatMessageDto messageDto : messageDtoList) {
update("update t_chat_message set unread_count = ? where chat_message_id=?", new String[]{"" + messageDto.unreadCount, "" + messageDto.chatMessageId});
}
commit();
}
public void deleteChatMessage() {
try {
beginTransaction();
......
......@@ -188,9 +188,15 @@ public class ChatRoomDao extends AbstractCommunicationDao {
}
public void insertChatRoomUsers(List<Integer> attendUsers, Integer chatRoomId) {
if (CollectionUtil.isEmpty(attendUsers)) {
return;
}
String sql = "insert or replace into r_chat_room_shop_member (chat_room_id, shop_member_id) values ";
ArrayList<String> insertAttendUser = new ArrayList<String>();
for (Integer attendUserId : attendUsers) {
insert("insert or replace into r_chat_room_shop_member (chat_room_id, shop_member_id) values (?,?)", new Integer[]{chatRoomId, attendUserId});
insertAttendUser.add("(" + chatRoomId + ", " + attendUserId + ")");
}
insert(sql + StringUtil.join(", ", insertAttendUser), new Object[] {});
}
public void deleteChatRoomUsers(Integer chatRoomId) {
......
......@@ -2,6 +2,7 @@ package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
......@@ -69,11 +70,12 @@ public class ShopMemberDao extends AbstractCommunicationDao {
try {
beginTransaction();
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, login_id, profile_url, self_flg, favorite_register_date) values (?,?,?,?,?,(select favorite_register_date from m_shop_member where shop_member_id = ?))", dto.getInsertValues());
if (dto.groupIdList != null && dto.groupIdList.size() > 0) {
update(" delete from r_shop_member_group WHERE shop_member_id = ? ", new Integer[]{dto.shopMemberId});
for (Integer groupId : dto.groupIdList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
}
commit();
} catch (Exception e) {
rollback();
......@@ -102,10 +104,29 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
}
public void insertShopMemberGroupRelation(Integer groupId, List<ShopMemberDto> dtoList) {
try {
update("delete from r_shop_member_group where group_id = ? ", new Object[] { groupId });
for (ShopMemberDto dto : dtoList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
} catch (Exception e) {
rollback();
Logger.e("insertShopMember failed.", e);
throw new RuntimeException(e);
} finally {
}
}
public ShopMemberDto getMyInfo() {
return rawQueryGetDto("select * from m_shop_member where self_flg = 1", null, ShopMemberDto.class);
}
public void resetSelfFlg() {
update("update m_shop_member set self_flg = 0", new String[]{});
}
public List<ShopMemberDto> getUserInRoom(Integer chatRoomId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT sm.* ");
......@@ -400,6 +421,17 @@ public class ShopMemberDao extends AbstractCommunicationDao {
return count > 0;
}
public void updateFavoriteUserList(List<Integer> shopMemberIdList) {
beginTransaction();
for (Integer shopMemberId : shopMemberIdList ) {
ShopMemberDto favoriteUserDto= new ShopMemberDto();
favoriteUserDto.shopMemberId = shopMemberId;
favoriteUserDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
update("update m_shop_member set favorite_register_date=? where shop_member_id=?", new Object[]{favoriteUserDto.favoriteRegisterDate, favoriteUserDto.shopMemberId});
}
commit();
}
public void deleteShopMember() {
try {
beginTransaction();
......
......@@ -9,6 +9,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
......@@ -126,6 +127,35 @@ public class CommunicationLogic extends AbstractLogic {
Map<String, Object> chatMessageMap = new HashMap<String, Object>();
chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_ID, chatMessageDto.chatMessageId);
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_TYPE, chatMessageDto.messageType);
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(chatMessageDto.profileUrl));
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap);
resultJsonArray.put(jsonObject);
}
String messageListStr = resultJsonArray.toString();
return messageListStr;
}
public String getMessagesFromMessageId(Integer roomId, String messageId) {
List<ChatMessageDto> chatMessageDtoList = chatMessageDao.getChatMessageFromMessageId(roomId, messageId);
JSONArray resultJsonArray = new JSONArray();
for (ChatMessageDto chatMessageDto : chatMessageDtoList) {
Map<String, Object> chatMessageMap = new HashMap<String, Object>();
chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_ID, chatMessageDto.chatMessageId);
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));
......@@ -762,7 +792,6 @@ public class CommunicationLogic extends AbstractLogic {
List<ShopMemberDto> deleteList = new ArrayList<ShopMemberDto>();
for (ShopMemberDto shopMemberDto : shopMemberDtoList) {
//TODO ユーザ最新化処理必要
//if (ABookCommConstants.FLAG.DEL_FLAG.EXIST.equals(shopMemberDto.delFlg)) {
if (myInfo.shopMemberId.equals(shopMemberDto.shopMemberId)) {
shopMemberDto.selfFlg = 1;
......@@ -778,6 +807,28 @@ public class CommunicationLogic extends AbstractLogic {
//shopMemberDao.deleteShopMemberByList(deleteList);
}
public void insertShopMemberByMap(HashMap<Integer, List<ShopMemberDto>> shopMemberDtoListMap) {
ShopMemberDto myInfo = shopMemberDao.getMyInfo();
List<ShopMemberDto> insertList = new ArrayList<ShopMemberDto>();
shopMemberDao.beginTransaction();
Set<Integer> groupIds = shopMemberDtoListMap.keySet();
for (Integer groupId : groupIds) {
List<ShopMemberDto> shopMemberDtoList = shopMemberDtoListMap.get(groupId);
for (ShopMemberDto shopMemberDto : shopMemberDtoList) {
if (myInfo.shopMemberId.equals(shopMemberDto.shopMemberId)) {
shopMemberDto.selfFlg = 1;
} else {
shopMemberDto.selfFlg = 0;
}
insertList.add(shopMemberDto);
}
shopMemberDao.insertShopMemberGroupRelation(groupId, shopMemberDtoList);
}
shopMemberDao.commit();
shopMemberDao.insertShopMember(insertList);
}
public void updateArchives(List<ArchiveDto> archiveDtoList) {
List<ArchiveDto> insertList = new ArrayList<ArchiveDto>();
List<ArchiveDto> deleteList = new ArrayList<ArchiveDto>();
......@@ -805,31 +856,31 @@ public class CommunicationLogic extends AbstractLogic {
}
public void updateGroup(List<ChatGroupDto> GroupList) {
List<ChatGroupDto> existGroupList = chatGroupDao.getAllGroups();
Map<Integer, ChatGroupDto> existGroupMap = convertGroupListToMap(existGroupList);
ArrayList<ChatGroupDto> insertGroupList = new ArrayList<ChatGroupDto>();
ArrayList<ChatGroupDto> deleteGroupList = new ArrayList<ChatGroupDto>();
ArrayList<ChatGroupDto> updateGroupList = new ArrayList<ChatGroupDto>();
HashMap<Integer, List<ShopMemberDto>> groupMembersMap = new HashMap<Integer, List<ShopMemberDto>>();
for (ChatGroupDto chatGroupDto : GroupList) {
if (chatGroupDto.delFlg == 1) {
deleteGroupList.add(chatGroupDto);
continue;
}
if (chatGroupDao.getGroup(chatGroupDto.groupId) == null) {
if (existGroupMap.get(chatGroupDto.groupId) == null) {
insertGroupList.add(chatGroupDto);
} else {
updateGroupList.add(chatGroupDto);
}
if (chatGroupDto.groupMembers == null) {
continue;
}
insertShopMember(chatGroupDto.groupMembers);
groupMembersMap.put(chatGroupDto.groupId, chatGroupDto.groupMembers);
}
chatGroupDao.insertGroupList(insertGroupList);
chatGroupDao.updateGroupList(updateGroupList);
chatGroupDao.deleteGroupList(deleteGroupList);
insertShopMemberByMap(groupMembersMap);
}
public ShopMemberDto getMyShopMemberDto() {
......@@ -843,16 +894,12 @@ public class CommunicationLogic extends AbstractLogic {
public void insertMyInfo(ShopMemberDto shopMemberDto) {
shopMemberDto.selfFlg = 1;
shopMemberDao.resetSelfFlg();
shopMemberDao.insertShopMember(shopMemberDto);
}
public void updateFavoriteUser(List<Integer> favoriteUserIds){
for (Integer favoriteUserId : favoriteUserIds) {
ShopMemberDto favoriteUserDto= new ShopMemberDto();
favoriteUserDto.shopMemberId = favoriteUserId;
favoriteUserDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
shopMemberDao.updateFavoriteUser(favoriteUserDto);
}
shopMemberDao.updateFavoriteUserList(favoriteUserIds);
}
public void updateFavoriteGroup(List<Integer> favoriteGroupIds){
......@@ -1064,4 +1111,16 @@ public class CommunicationLogic extends AbstractLogic {
}
return resultJsonArray.toString();
}
public Map<Integer, ChatGroupDto> convertGroupListToMap(List<ChatGroupDto> groupList) {
Map<Integer, ChatGroupDto> map = new HashMap<Integer, ChatGroupDto>();
for (ChatGroupDto group : groupList) {
map.put(group.groupId, group);
}
return map;
}
public void updateUnreadCount(List<ChatMessageDto> messageList, String roomId) {
chatMessageDao.updatUnreadCount(messageList, roomId);
}
}
......@@ -138,6 +138,7 @@ public class MeetingManager extends Observable {
private int status = STATUS_READY; // ws通信ステータス
private boolean isOwner; // オーナーか否か
private boolean paused; // 一時停止状態
private boolean isCollaboration = false;
private ArrayList<MeetingDto> meetingList;
private BlockingQueue<Object> messageQueue;
......@@ -337,7 +338,7 @@ public class MeetingManager extends Observable {
joinedMeetingId = NO_MEETING_ID;
status = STATUS_READY;
paused = false;
isCollaboration = false;
if (messageHandlingThread != null) {
messageHandlingThread.terminate();
messageHandlingThread = null;
......@@ -794,6 +795,14 @@ public class MeetingManager extends Observable {
}
}
public void setCollaboration(boolean isCollaboration) {
this.isCollaboration = isCollaboration;
}
public boolean isCollaboration() {
return isCollaboration;
}
public String getJoinedMeetingPassword() {
return joinedMeetingPassword;
}
......
......@@ -249,7 +249,8 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" >
</activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChatWebviewActivity" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:taskAffinity=".ChatWebViewActivity"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"/>
......
Subproject commit 515a1461c829fcc0a8a7aca957d2ce730e317ce0
Subproject commit fb49ca8c69944606f132d7a602477c2b8306657c
......@@ -494,7 +494,8 @@
<string name="ReportReply">報告(回答)</string>
<string name="content_link_update">資料名「%1$s」は更新状態となります。\n更新しますか?</string>
<string name="msg_non_target_meeting_content">遠隔支援中には対象外の資料なので、開けません。</string>
<string name="msg_non_target_collaboration_content">協業中は閲覧できない資料です。</string>
<string name="msg_non_target_document_collaboration_content">文書協業では利用できない機能です。</string>
<string name="msg_help_operation_list_list_view">リスト表示に変更できます。</string>
<string name="msg_help_operation_list_panel_view">パネル表示に変更できます。</string>
<string name="msg_help_operation_list_filter">表示する作業の種類を選択できます。</string>
......@@ -1478,9 +1479,18 @@
<string name="msg_error_chat_room_name_too_long">ルーム名は文字列20字以内に入力してください。</string>
<string name="msg_error_chat_name_has_invalid_character">特殊文字 ;/?:@&amp;=+$,-_.!~*\'()#\\\"` はルーム名に含めることができません。</string>
<string name="msg_error_chat_room_sc_forbidden">認証に失敗しました。再度ログインが必要です。</string>
<string name="msg_error_already_exist_same_room">同じルームが既に存在します。</string>
<string name="msg_confirm_send_host_change">ホスト権限を渡しますか?</string>
<string name="msg_error_already_exist_same_room">同じルームが既に存在します。\n入室しますか</string>
<string name="msg_confirm_send_host_change">ホスト権限変更の依頼があります。変更しますか?</string>
<string name="host_confirm">ホスト変更リクエストがあります。</string>
<string name="msg_confirm_share_image">キャプチャーした写真を共有しますか?</string>
<string name="msg_invite_collaboration">協業に招待されました。</string>
<string name="msg_wait_for_host">ホストが文書を選択中です</string>
<string name="msg_rejected_by_host">ホストの変更依頼は拒否されました。</string>
<string name="msg_invalid_parameters">通信に失敗しました。チャットルームに戻ります。</string>
<string name="msg_destroy_exist_collaboration">進行中の協業が存在します。既存協業を終了し、新しい協業を開始してもよろしいですか</string>
<string name="not_found_camera">利用可能なカメラを見つかりませんでした。</string>
<string name="error_fail_record">レコーディングに失敗しました。管理者にお問い合わせしてください。</string>
<!-- 連続作業 -->
<string name="msg_error_all_process_delete">全削除の送信に失敗しました。</string>
<string name="msg_ozd_file_could_not_opened">帳票ファイルを開くことができませんでした。</string>
......
......@@ -497,7 +497,8 @@
<string name="ReportReply">보고(응답)</string>
<string name="content_link_update">자료명[%1$s]는 업데이트 가능한 상태입니다.\n업데이트 하시겠습니까?</string>
<string name="msg_non_target_meeting_content">원격 지원 접속 중에는 열람할 수 없는 자료입니다.</string>
<string name="msg_non_target_collaboration_content">협업중에는 열람할 수 없는 자료입니다.</string>
<string name="msg_non_target_document_collaboration_content">문서협업중에는 이용하실수 없는 기능입니다.</string>
<string name="msg_help_operation_list_list_view">리스트 표시로 변경 가능합니다.</string>
<string name="msg_help_operation_list_panel_view">패널 표시로 변경 가능합니다.</string>
<string name="msg_help_operation_list_filter">표시할 작업의 종류를 선택 가능합니다.</string>
......@@ -1485,8 +1486,16 @@
<string name="msg_error_chat_name_has_invalid_character">특수문자 ;/?:@&amp;=+$,-_.!~*\'()#\\\"` 는 방 제목에 포함될 수 없습니다.</string>
<string name="msg_error_chat_room_sc_forbidden">사용자 정보를 확인할 수 없습니다. 다시 로그인하시기 바랍니다.</string>
<string name="msg_error_all_process_delete">모두 삭제 송신에 실패하였습니다.</string>
<string name="msg_error_already_exist_same_room">동일한 채팅방이 이미 존재합니다.</string>
<string name="msg_error_already_exist_same_room">동일한 채팅방이 이미 존재합니다.\n 입장하시겠습니까?</string>
<string name="msg_ozd_file_could_not_opened">장표 파일을 열 수 없습니다.</string>
<string name="msg_confirm_send_host_change">방장 권한을 전달 받으시겠습니까?</string>
<string name="host_confirm">호스트변경을 요청하셨습니다</string>
<string name="msg_confirm_share_image">캡쳐한 사진을 공유 하시겠습니까?</string>
<string name="msg_invite_collaboration">협업에 초대되셨습니다.</string>
<string name="msg_wait_for_host">호스트가 문서를 선택중입니다.</string>
<string name="msg_rejected_by_host">호스트가 요청을 거절하셨습니다.</string>
<string name="msg_invalid_parameters">통신에 실패했습니다. 채팅룸으로 돌아갑니다.</string>
<string name="not_found_camera">사용 가능한 카메라 기기를 찾을수 없습니다.</string>
<string name="msg_destroy_exist_collaboration">진행중인 협업이 존재합니다. 기존 협업을 종료하고 새로운 협업을 시작 하시겠습니까?</string>
<string name="error_fail_record">레코드에 실패했습니다. 관리자에게 문의해주세요.</string>
</resources>
\ No newline at end of file
......@@ -501,7 +501,8 @@
<string name="ReportReply">ReportReply</string>
<string name="content_link_update">The document name [%1$s] will be updated. \nDo you want to update it?</string>
<string name="msg_non_target_meeting_content">It is the document that can not be read during distance support connection.</string>
<string name="msg_non_target_collaboration_content">It is the document that can not be read during collaboration.</string>
<string name="msg_non_target_document_collaboration_content">This is a function that cannot be used in document collaboration.</string>
<string name="msg_help_operation_list_list_view">You can change to list display.</string>
<string name="msg_help_operation_list_panel_view">You can change to panel display.</string>
<string name="msg_help_operation_list_filter">You can select the type of work to be displayed.</string>
......@@ -1482,8 +1483,16 @@
<string name="msg_error_chat_name_has_invalid_character">The character ;/?:@&amp;=+$,-_.!~*\'()#\\\"` cannot be included in the roomname.</string>
<string name="msg_error_chat_room_sc_forbidden">Failed to authenticate. Please login again.</string>
<string name="msg_error_all_process_delete">Failed to send all deletes.</string>
<string name="msg_error_already_exist_same_room">Already exist same room.</string>
<string name="msg_error_already_exist_same_room">Already exist same room.\n do you want enter exist room?</string>
<string name="msg_ozd_file_could_not_opened">Report file could not opened.</string>
<string name="msg_confirm_send_host_change">Do you want to receive host permissions?</string>
<string name="host_confirm">request host permission</string>
<string name="msg_confirm_share_image">Do you want to share captured image?</string>
<string name="msg_invite_collaboration">You are invited to collaboration.</string>
<string name="msg_wait_for_host">Please wait for selecting document by host</string>
<string name="msg_rejected_by_host">Rejected host request.</string>
<string name="msg_invalid_parameters">Communication failed. Return to the chat room.</string>
<string name="not_found_camera">Not found camera device.</string>
<string name="msg_destroy_exist_collaboration">Ongoing collaboration exist. Do you want to terminate exist collaboration and start new?</string>
<string name="error_fail_record">Recording failed. Please contact the administrator.</string>
</resources>
......@@ -3,7 +3,7 @@
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/removal/advanced,!method/inlining/short,!method/inlining/unique,!method/removal/*,!method/marking/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
......
......@@ -16,6 +16,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/related_content_third_linear"
android:orientation="vertical" >
<FrameLayout
......
......@@ -17,6 +17,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/related_content_third_linear"
android:orientation="vertical">
<FrameLayout
......
......@@ -69,6 +69,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
Integer insertId = 0;
Integer messageType = 0;
Integer messageId = 0;
String roomType = "";
Log.d(TAG,"tempMsg : "+ tempMsg);
......@@ -97,6 +98,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
}
if (pushMsg.contains(INVITE_COLLABORATION)) {
roomType = Integer.toString(json.getInt("roomType"));
String[] inviteMessage = pushMsg.split("<::split>");
tempMsg = getString(R.string.msg_invite_collaboration);
Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class);
......@@ -107,6 +109,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId); // sendLoginId
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, inviteMessage[1]);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomType, roomType);
startActivity(pushMsgDialog);
return;
}
......
......@@ -864,7 +864,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
ll_menuItem_chat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityHandlingHelper.getInstance().startChatWebviewActivity();
ActivityHandlingHelper.getInstance().startChatWebViewActivity();
mCommunicationMenuDialog.dismiss();
}
});
......@@ -939,7 +939,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
if(dto.roomName != null && dto.roomId != 0)
{
pushMessageLogic.updateReadingFlg(dto.pushMessageId);
ActivityHandlingHelper.getInstance().startChatWebviewActivityWithPushMessage(dto);
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithPushMessage(dto);
mPushMessageListDialog.dismiss();
} else {
showPushMessageDetailView(dto);
......
......@@ -71,6 +71,7 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
......@@ -147,6 +148,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected String mEnablePhotoEdit; //最初ファイルをアップロードする時、Webからもらう編集可能可否のパラメタ 0:編集する。 1:編集しない。
protected PhotoEditActivity mPhotoEditDialog;
protected boolean isCollaboration = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -196,6 +198,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 遠隔連動
meetingManager = MeetingManager.getInstance();
isCollaboration = meetingManager.isCollaboration();
mContentDir = getIntent().getStringExtra(FILEPATH);
......@@ -462,7 +465,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
params.addRule(RelativeLayout.CENTER_VERTICAL);
params.rightMargin = (int) (getResources().getDisplayMetrics().density * 5);
subMenuBtn.setLayoutParams(params);
if (isCollaboration) {
exitMeetingBtn.setVisibility(View.GONE);
} else {
exitMeetingBtn.setVisibility(View.VISIBLE);
}
// if (helpButton != null && helpButton.getVisibility() == View.VISIBLE) {
// helpButton.setLayoutParams(params);
......@@ -560,7 +568,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
return;
}
textView.setVisibility(View.GONE);
if (isVisible) {
if (isVisible && !isCollaboration) {
if (meetingManager.isConnected() && meetingManager.isOwner()) {
textView.setVisibility(View.VISIBLE);
CommonExecutor.execute(new Runnable() {
......
......@@ -113,6 +113,11 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
alertDialog.show();
} else {
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ShowPushMessageDailogActivity.this, getRString(R.string.app_name), getIntent().getExtras().getString(PushMessageKey.message));
Bundle extras = getIntent().getExtras();
Long roomId = extras.getLong(AppDefType.ChatPushMessageKey.roomId, 0);
if (roomId == 0) {
alertDialog.setPositiveButton(R.string.ok, null);
} else {
alertDialog.setPositiveButton(R.string.move, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
......@@ -124,25 +129,26 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
String pushSendLoginId = extras.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
long pushSendDate = extras.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
String collaborationType = extras.getString(AppDefType.ChatPushMessageKey.collaborationType);
String roomType = extras.getString(AppDefType.ChatPushMessageKey.roomType);
if (roomId > 0 && !StringUtil.isNullOrEmpty(roomName)) {
List<PushMessageDto> pushMessageDtoList = AbstractLogic.getLogic(PushMessageLogic.class).getAllPushMessageList();
Logger.d("pushSendDate","pushSendDate : " + pushSendDate);
Logger.d("pushSendDate", "pushSendDate : " + pushSendDate);
String pushSendDateDate = DateTimeUtil.toString(new Date(pushSendDate), DateTimeFormat.yyyyMMddHHmmssSSS_none);
Logger.d("pushSendDate","pushSendDateDate : " + pushSendDateDate);
Logger.d("pushSendDate", "pushSendDateDate : " + pushSendDateDate);
String pushSendDateDate2 = DateTimeUtil.toString(DateTimeUtil.toDate(pushSendDateDate, DateTimeFormat.yyyyMMddHHmmssSSS_none), DateTimeFormat.yyyyMMddHHmmssSSS_none);
Logger.d("pushSendDate","pushSendDateDate2 : " + pushSendDateDate2);
Logger.d("pushSendDate", "pushSendDateDate2 : " + pushSendDateDate2);
for (int i=0; i < pushMessageDtoList.size() - 1; i++) {
for (int i = 0; i < pushMessageDtoList.size() - 1; i++) {
String tempDate = DateTimeUtil.toString(pushMessageDtoList.get(i).pushSendDate, DateTimeFormat.yyyyMMddHHmmssSSS_none);
Logger.d("tempDate","date : " + tempDate);
Logger.d("tempDate", "date : " + tempDate);
}
if (StringUtil.isNullOrEmpty(collaborationType)) {
ActivityHandlingHelper.getInstance().startChatWebviewActivity(roomId, roomName);
ActivityHandlingHelper.getInstance().startChatWebViewActivity(roomId, roomName);
} else {
ActivityHandlingHelper.getInstance().startChatWebviewActivityWithCollaboration(roomId, roomName, collaborationType);
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(roomId, roomName, collaborationType, roomType);
}
}
}
......@@ -156,10 +162,11 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
finish();
}
});
}
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
});
alertDialog.show();
......
......@@ -144,5 +144,6 @@ public interface AppDefType {
String pushSendLoginId = "pushSendLoginId";
String pushSendDate = "pushSendDate";
String collaborationType = "collaborationType";
String roomType = "roomType";
}
}
......@@ -14,6 +14,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
......@@ -26,8 +27,11 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.BaseColumns;
import android.provider.MediaStore;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.webkit.CookieManager;
......@@ -46,6 +50,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import org.json.adf.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
......@@ -57,6 +63,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Stack;
import java.util.Timer;
import java.util.TimerTask;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ArchiveDetailJSON;
......@@ -68,7 +76,9 @@ import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MyInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UnreadCountJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
......@@ -100,7 +110,10 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.VideoEncoder;
import jp.agentec.abook.abv.ui.home.view.FullscreenableChromeClient;
import jp.agentec.abook.abv.ui.viewer.activity.CommunicationWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -111,28 +124,21 @@ import static org.chromium.net.NetError.ERR_FAILED;
* Created by AIS-NB-048 on 2019/07/31.
*/
public class ChatWebviewActivity extends ParentWebViewActivity {
public class ChatWebViewActivity extends CommunicationWebViewActivity {
private WebView mChatWebView;
private String chatWebviewUrl;
private final String TAG = "ChatWebviewActivity";
private final String TAG = "ChatWebViewActivity";
private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public_new/chat.html";
//private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/networkError.html";
private final String CHAT_PAGE_URL = "file:///android_asset/chat/public_new/chat.html";
private final String CHAT_ROOM_PAGE_URL = "file:///android_asset/chat/public_new/chat_room.html";
private final String PICTURE_COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration_picture.html";
private final String VIDEO_COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration_video.html";
private final String VOICE_COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration_voice.html";
private final String DOCUMENT_COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration_documents.html";
private final String COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration.html";
private final String DEFAULT_CHECKSUM = "0000000000";
//AISDevelop
private JsInf jsInf = new JsInf();
private ValueCallback<Uri[]> mUploadMessage;
private String sid;
private String roomName;
private String loginId;
......@@ -146,9 +152,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private Integer shopMemberId;
private String selectedUserIdList;
private String mSkey;
private Integer joinMeetingId;
private boolean isPIP;
private boolean isStop;
private String encodedFilePath;
private Uri encodedVideoPath;
// 0:協業生成, 1:協業参加
private Integer collaborationJoinFlg = 0;
private MeetingManager meetingManager = MeetingManager.getInstance();
private ActivityHandlingHelper handlingHelper = ActivityHandlingHelper.getInstance();
public AlertDialog myAlertDialog;
private ImageButton mOperationHomeButton; // ホームボタン
......@@ -157,10 +170,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private BroadcastReceiver receiver;
private CommunicationLogic communicationLogic = AbstractLogic.getLogic(CommunicationLogic.class);
private int mCollaborationType;
private int mHostRequestFlg = 0;
private boolean needHostAlert = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isNormalSize()) {
setPortraitIfNormal();
......@@ -184,10 +199,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
sid = intent.getStringExtra("sid");
roomId = intent.getLongExtra("roomId", 0);
roomName = intent.getStringExtra("roomName");
roomType = intent.getStringExtra("roomType");
loginId = intent.getStringExtra("loginId");
shopName = intent.getStringExtra("shopName");
collaborationType = intent.getStringExtra("collaborationType");
isOnline = false;
}
private void setupDefaultChatWebViewURL() {
......@@ -217,7 +234,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
communicationLogic.initChatData();
try {
updateMyInfoFromServer();
updateAllGroupInfo();
......@@ -235,6 +251,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
});
closeProgressPopup();
} catch (Exception e) {
e.printStackTrace();
Logger.d("Update error");
}
}
......@@ -281,7 +298,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
e.printStackTrace();
}
Integer integerRoomId = Integer.parseInt(roomId.toString());
if (StringUtil.isNullOrEmpty(roomType)) {
roomType = communicationLogic.getChatRoom(integerRoomId).type.toString();
}
if (StringUtil.isNullOrEmpty(collaborationType)) {
String parameterData = "sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName + "&roomId=" + roomId + "&roomName=" + roomName + fixedParam;
mChatWebView.postUrl(CHAT_ROOM_PAGE_URL, parameterData.getBytes());
......@@ -338,11 +357,13 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// WebView内のAlert Dialogを処理する
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
if (mChatWebView.getUrl() != null && mChatWebView.getUrl().equals(COLLABORATION_PAGE_URL)) {
mChatWebView.loadUrl("javascript:coview_api.HeartBeatUser(globalUserInfo.loginId);");
}
if (myAlertDialog != null && myAlertDialog.isShowing()) {
result.confirm();
return true;
}
if (message.equals("server error Ocurred")) {
message = getString(R.string.msg_error_chat_server);
} else if (message.equals("Disconnected from the server")) {
......@@ -368,13 +389,26 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
message = getString(R.string.msg_error_chat_name_has_invalid_character);
} else if (message.equals("SC_FORBIDDEN")) {
message = getString(R.string.msg_error_chat_room_sc_forbidden);
} else {
message = message;
} else if (message.contains("Send owner complete")) {
mChatWebView.loadUrl("javascript:$('#userNameCardInCollaboration').modal('hide');");
result.confirm();
return true;
} else if (message.contains("REJECT for owner user")) {
mChatWebView.loadUrl("javascript:$('#userNameCardInCollaboration').modal('hide');");
mChatWebView.loadUrl("javascript:$('#hostRequestModal').modal('hide');");
mChatWebView.loadUrl("javascript:$('#userNameCardInCollaboration').modal('hide');");
message = getString(R.string.msg_rejected_by_host);
} else if (message.contains("Invalid Parameters")) {
message = getString(R.string.msg_invalid_parameters);
} else if (message.contains("사용 가능한 카메라 기기를 찾을수 없습니다")) {
message = getString(R.string.not_found_camera);
} else if (message.contains("Exception while creating MediaRecorder")) {
message = getString(R.string.error_fail_record);
}
final String tempMessage = message;
ABookAlertDialog dialog = AlertDialogUtil.createAlertDialog(ChatWebviewActivity.this, R.string.app_name);
ABookAlertDialog dialog = AlertDialogUtil.createAlertDialog(ChatWebViewActivity.this, R.string.app_name);
dialog.setMessage(message);
dialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
......@@ -393,6 +427,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} else if (tempMessage.equals(getString(R.string.msg_error_chat_join))) {
getLogin();
finish();
} else if (tempMessage.equals(getString(R.string.msg_invalid_parameters))) {
if (roomId != null) {
mChatWebView.loadUrl(String.format("javascript:CHAT_UI.joinRoom('%s', '%s');", roomId.toString(), roomName.toString()));
} else {
mChatWebView.loadUrl(CHAT_PAGE_URL);
}
}
}
});
......@@ -419,10 +459,23 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
message = getString(R.string.msg_error_already_exist_same_room);
} else if (message.equals("방장 권한을 전달 받으시겠습니까?")){
message = getString(R.string.msg_confirm_send_host_change);
if (mHostRequestFlg == 1) {
mChatWebView.loadUrl("javascript:penOff();");
mChatWebView.loadUrl("javascript:$('#hostRequestModal').modal('hide');");
mChatWebView.loadUrl("javascript:$('#userNameCardInCollaboration').modal('hide');");
if (meetingManager.isConnected() && meetingManager.isSubscribed()) {
sendPromoteRequest();
}
ABookAlertDialog confirmAlert = AlertDialogUtil.createAlertDialog(ChatWebviewActivity.this, R.string.app_name);
result.confirm();
return true;
}
} else if (message.equals("캡쳐한 사진을 공유 하시겠습니까?")) {
message = getString(R.string.msg_confirm_share_image);
} else if (message.contains("Create room anyway?")) {
message = getString(R.string.msg_destroy_exist_collaboration);
}
final ABookAlertDialog confirmAlert = AlertDialogUtil.createAlertDialog(ChatWebViewActivity.this, R.string.app_name);
confirmAlert.setMessage(message);
if (message.equals(getString(R.string.msg_error_already_exist_same_room))) {
confirmAlert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.move), new DialogInterface.OnClickListener() {
@Override
......@@ -430,6 +483,19 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
result.confirm();
}
});
} else if (message.equals(getString(R.string.msg_confirm_send_host_change))){
confirmAlert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.confirm), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mChatWebView.loadUrl("javascript:penOff();");
mChatWebView.loadUrl("javascript:$('#hostRequestModal').modal('hide');");
mChatWebView.loadUrl("javascript:$('#userNameCardInCollaboration').modal('hide');");
if (meetingManager.isConnected() && meetingManager.isSubscribed()) {
sendPromoteRequest();
}
result.confirm();
}
});
} else {
confirmAlert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.confirm), new DialogInterface.OnClickListener() {
@Override
......@@ -446,6 +512,26 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
});
confirmAlert.setCancelable(false);
showAlertDialog(confirmAlert);
if (message.equals(getString(R.string.msg_confirm_send_host_change))
|| message.contains(getString(R.string.host_confirm))
|| message.equals(getString(R.string.msg_confirm_share_image))) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
TimerTask task = new TimerTask(){
@Override
public void run() {
result.cancel();
confirmAlert.dismiss();
}
};
Timer timer = new Timer();
timer.schedule(task, 30000);
}
});
thread.start();
}
return true;
}
});
......@@ -500,6 +586,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} else {
isOnline = true;
mChatWebView.loadUrl("javascript:CHAT_UI.refreshForOnline();");
if (mChatWebView.getUrl() != null && mChatWebView.getUrl().equals(CHAT_ROOM_PAGE_URL)) {
mChatWebView.loadUrl("javascript:window.location.reload();");
}
}
}
}
......@@ -525,7 +614,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
File file = new File(filePath);
NetworkTask networkTask = new NetworkTask(url, filePath);
networkTask.execute();
} else if (url.contains("/file/getImage")) {
} else if (url.contains("/file/getImage") && !url.contains(".mp4")) {
Uri uri = Uri.parse(url);
String fileName = uri.getQueryParameter("fileName");
String filePath = getFilesDir().getAbsolutePath() + "/" + fileName;
......@@ -594,16 +683,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
}
@Override
public void onDestroy(){
super.onDestroy();
if (receiver != null) {
unregisterReceiver(receiver);
receiver = null;
}
}
// 下辺のツールバー設定
private void settingBottomToolbar() {
// ホームボタン活性化
......@@ -685,10 +764,10 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// チャット利用のはネットワークが繋がる時のみ
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showProgressPopup();
ActivityHandlingHelper.getInstance().startChatWebviewActivity();
ActivityHandlingHelper.getInstance().startChatWebViewActivity();
mCommunicationMenuDialog.dismiss();
} else {
ABVToastUtil.showMakeText(ChatWebviewActivity.this, R.string.request_network_connection, Toast.LENGTH_SHORT);
ABVToastUtil.showMakeText(ChatWebViewActivity.this, R.string.request_network_connection, Toast.LENGTH_SHORT);
return;
}
}
......@@ -781,15 +860,81 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
if (mUploadMessage == null) {
return;
}
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
if (data != null && result != null) {
confirmEntrySceneDialog(result[0]);
if (dataUri != null) {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl("javascript:CHAT_UI.showLoadingIndicator();");
}
});
Cursor cursor = getContentResolver().query(dataUri, null, null, null, null);
cursor.moveToNext();
final String filePath = cursor.getString(cursor.getColumnIndex("_data"));
cursor.close();
Runnable r = new Runnable() {
@Override
public void run() {
try {
//CallBack
Runnable callBack = new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl("javascript:CHAT_UI.videoEncodeEnd('" +encodedFilePath + "')");
}
});
}
};
Context c = getApplicationContext();
File file = new File(filePath);
String encodedPath = new VideoEncoder().changeResolution(file, callBack);
encodedFilePath = encodedPath;
} catch (Throwable throwable) {
mChatWebView.loadUrl("javascript:CHAT_UI.videoEncodeFail();)");
}
}
};
r.run();
}
mUploadMessage.onReceiveValue(null);
}
mUploadMessage = null;
}
public static Uri getImageContentUri(Context context, File file) {
if (!file.exists()) {
return null;
}
String filePath = file.getAbsolutePath();
Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[] {BaseColumns._ID},
MediaStore.MediaColumns.DATA + "=? ",
new String[] { filePath }, null);
if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor
.getColumnIndex(BaseColumns._ID));
Uri baseUri = Uri.parse("content://media/external/video/media");
return Uri.withAppendedPath(baseUri, "" + id);
} else {
if (!file.exists()) { return null; }
ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, filePath);
return context.getContentResolver().insert(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
values);
}
}
/**
* 未読のプッシュメッセージが存在するかチェック
* @param pushMessageDtoList チェックするリスト
......@@ -873,23 +1018,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public void openSetting() {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl("javascript:CHAT.leaveRoom()");
finish();
showSetting();
}
});
}
@JavascriptInterface
public void reload() {
mChatWebView.post(new Runnable() {
@Override
public void run() {
ActivityHandlingHelper.getInstance().startChatWebviewActivity();
ActivityHandlingHelper.getInstance().startChatWebViewActivity();
}
});
......@@ -915,11 +1048,20 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public void test() {
OperationRelatedContentActivity testact = ActivityHandlingHelper.getInstance().getActivity(OperationRelatedContentActivity.class);
testact.finish();
/*testact.System.runFinalization();
System.exit(0);*/
}
@JavascriptInterface
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
Map<String, Object> chatRoomList;
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
//communicationLogic.deleteChatRoomList();
communicationLogic.insertChatRoomList(resultJson.roomList);
}
@JavascriptInterface
......@@ -928,14 +1070,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public void updateGroupInfo(String groupId) throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(groupId);
}
@JavascriptInterface
public void updateGroupUser() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(communicationLogic.getMyGroupIds());
updateGroupInfoFromServer();
}
@JavascriptInterface
......@@ -1054,12 +1190,18 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface
public void updateMessages(String roomId) throws NetworkDisconnectedException, AcmsException {
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, roomId);
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
String lastUpdatedDate = pref.getString(ABookCommConstants.KEY.MESSAGE_UPDATED_DATE + roomId, DEFAULT_CHECKSUM);
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, roomId, null, lastUpdatedDate);
for (ChatMessageDto chatMessageDto : resultJson.chatMessageDtoArrayList) {
chatMessageDto.chatRoomId = Integer.parseInt(roomId);
}
communicationLogic.insertMessageList(resultJson.chatMessageDtoArrayList);
communicationLogic.insertShopMember(resultJson.shopMemberDtoArrayList);
updateUnreadCount();
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.MESSAGE_UPDATED_DATE + roomId, resultJson.updateDate);
editor.commit();
}
@JavascriptInterface
......@@ -1308,13 +1450,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface
public void updateArchiveList() throws NetworkDisconnectedException, AcmsException {
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
String updateDate = pref.getString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE, DEFAULT_CHECKSUM);
String updateDate = pref.getString(ABookCommConstants.KEY.ARCHIVE_UPDATED_DATE, DEFAULT_CHECKSUM);
ArchiveListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchives(sid, updateDate);
communicationLogic.updateArchives(resultJson.archiveList);
if (StringUtil.isNullOrEmpty(resultJson.archiveLastUpdateDate)) { return; }
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE, resultJson.archiveLastUpdateDate);
editor.putString(ABookCommConstants.KEY.ARCHIVE_UPDATED_DATE, resultJson.archiveLastUpdateDate);
editor.commit();
}
......@@ -1352,22 +1493,27 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface
public void updateArchiveDetail(String archiveId) throws NetworkDisconnectedException, AcmsException {
ArchiveDto archiveDto = communicationLogic.getArchive(Integer.parseInt(archiveId));
ArchiveDetailJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchiveDetail(sid, Integer.parseInt(archiveId), archiveDto.collaborationDetailId);
if (resultJson.archiveDto == null) {
return;
}
communicationLogic.updateArchiveDetial(resultJson.archiveDto);
RoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoom(sid, archiveDto.roomId.toString());
archiveDto.roomName = resultJson.chatRoomDto.chatRoomName;
communicationLogic.updateArchiveDetial(archiveDto);
}
@JavascriptInterface
public void joinCollaboration(String collaborationType) throws NetworkDisconnectedException, AcmsException {
public void joinCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
joinMeetingId = Integer.parseInt(meetingId);
collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.JOIN;
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).joinCollaboration(sid, roomId.intValue());
moveCollaborationScreen(Integer.parseInt(collaborationType));
}
@JavascriptInterface
public void joinChangedCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
joinMeetingId = Integer.parseInt(meetingId);
collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.JOIN;
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).joinCollaboration(sid, roomId.intValue());
}
@JavascriptInterface
public void inviteCollaboration(String inviteUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteCollaboration(sid, roomId.intValue(), roomName, inviteUserIds, collaborationType);
}
......@@ -1379,6 +1525,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public void finishCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishCollaboration(sid, roomId.intValue());
}
@JavascriptInterface
public void finishAllCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishAllCollaboration(sid, roomId.intValue());
}
@JavascriptInterface
public String getCollaborationJoinFlg() {
return collaborationJoinFlg.toString();
}
......@@ -1410,8 +1566,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface
public String createContentView() {
public int createContentView() {
finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
Integer meetingId = null;
meetingManager.close();
try {
connectMeetingServer();
List<MeetingDto> meetingList= meetingManager.getMeetingList(mSkey);
......@@ -1422,36 +1582,46 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
meetingId = meetingManager.createMeeting(mSkey, "Collaboration_"+roomId, roomId.toString());
meetingManager.join(meetingId, mSkey, roomId.toString(), true);
meetingManager.setCollaboration(true);
} catch (Exception e) {
mChatWebView.loadUrl("javascript:alert('" + "会議室サーバに接続できませんでした。" + "');");
}
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
return meetingId.toString();
startContentListActivity(true);
return meetingId.intValue();
}
@JavascriptInterface
public void startContentView(String joinMeetingId) {
Integer meetingId;
public void startContentView() throws InterruptedException {
finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
meetingManager.close();
try {
connectMeetingServer();
List<MeetingDto> meetingList= meetingManager.getMeetingList(mSkey);
for (MeetingDto meeting : meetingList) {
if (meeting.title.equals("Collaboration__"+roomId) && meetingManager.isOwner()) {
meetingManager.deleteMeeting(meeting.meetingId, mSkey);
}
}
if (collaborationJoinFlg == 0) {
meetingId = meetingManager.createMeeting(mSkey, "Collaboration_"+roomId, roomId.toString());
meetingManager.join(meetingId, mSkey, roomId.toString(), true);
} else {
meetingManager.join(Integer.parseInt(joinMeetingId), mSkey, roomId.toString(), true);
}
meetingManager.join(joinMeetingId, mSkey, roomId.toString(), false);
meetingManager.setCollaboration(true);
} catch (Exception e) {
mChatWebView.loadUrl("javascript:alert('" + "会議室サーバに接続できませんでした。" + "');");
}
startContentListActivity(false);
}
@JavascriptInterface
public void joinMeetingRoom(int newMeetingId) throws InterruptedException {
finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
meetingManager.close();
try {
connectMeetingServer();
List<MeetingDto> meetingList= meetingManager.getMeetingList(mSkey);
meetingManager.join(joinMeetingId, mSkey, roomId.toString(), false);
meetingManager.setCollaboration(true);
} catch (Exception e) {
mChatWebView.loadUrl("javascript:alert('" + "会議室サーバに接続できませんでした。" + "');");
}
startContentListActivity(false);
}
@JavascriptInterface
......@@ -1461,17 +1631,88 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public void exitPIPmode() {
finishPIPmode();
}
@JavascriptInterface
public void exitMeetingRoom() {
if (meetingManager.isOwner()) {
try {
meetingManager.deleteMeeting();
} catch (Exception e) {
Logger.e(TAG, "showMeetingExitDialog deleteMeeting error", e);
exitAndDeleteMeetingRoom();
finishPIPmode();
}
@JavascriptInterface
public int getJoinCollaborationType() {
return mCollaborationType;
}
meetingManager.close();
ActivityHandlingHelper handlingHelper = ActivityHandlingHelper.getInstance();
handlingHelper.saveMeetingInfo(null, null, null, false);
@JavascriptInterface
public void setJoinCollaborationType(int collaborationType) {
mCollaborationType = collaborationType;
}
@JavascriptInterface
public void changeCollaboration(int changeCollaborationType, int meetingId) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeCollaboration(sid, roomId.intValue(), changeCollaborationType, meetingId);
}
@JavascriptInterface
public int getAndroidVersion() {
return Build.VERSION.SDK_INT;
}
@JavascriptInterface
public void removeEncodedVideo(String filePath) {
File encodedVideo = new File(filePath);
if (encodedVideo.exists()) {
encodedVideo.delete();
}
}
@JavascriptInterface
public void setHostRequestFlg(int hostRequestFlg) {
mHostRequestFlg = hostRequestFlg;
}
@JavascriptInterface
public int getHostRequestFlg() {
return mHostRequestFlg;
}
@JavascriptInterface
public void finishPip() {
finishPIPmode();
}
@JavascriptInterface
public void setExitHostAlert() {
needHostAlert = true;
}
@JavascriptInterface
public boolean getExitHostAlert() {
if (needHostAlert) {
needHostAlert = false;
return true;
}
return needHostAlert;
}
@JavascriptInterface
public void updatePreMessage(String messageId) throws NetworkDisconnectedException, AcmsException {
if (messageId.equals("0")) {
return;
}
updateMessageFromMessageId(messageId);
}
@JavascriptInterface
public String getMessageListFromMessageId(String messageId) {
if (messageId.equals("0")) {
return "";
}
String messageListStr = communicationLogic.getMessagesFromMessageId(roomId.intValue(), messageId);
return messageListStr;
}
}
......@@ -1480,13 +1721,60 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
*/
private void backToHome() {
mChatWebView.loadUrl("javascript:CHAT.leaveRoom()");
exitAndDeleteMeetingRoom();
finish();
Intent intent = new Intent();
intent.setClass(ChatWebviewActivity.this, OperationListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.setClass(ChatWebViewActivity.this, OperationListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent, NaviConsts.Left);
}
private void finishBeforeContentListActivity() {
OperationRelatedContentActivity beforeActiryty = activityHandlingHelper.getActivity(OperationRelatedContentActivity.class);
if (beforeActiryty != null) {
beforeActiryty.finish();
}
}
private void finishPIPmode() {
if (isPIP) {
getApplication().startActivity(new Intent(this, ChatWebViewActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK));
}
}
public void startPIPmode() {
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
}
public void exitAndDeleteMeetingRoom() {
if (meetingManager.isConnected() && meetingManager.isOwner()) {
try {
meetingManager.deleteMeeting();
} catch (Exception e) {
Logger.e(TAG, "showMeetingExitDialog deleteMeeting error", e);
}
}
meetingManager.close();
handlingHelper.saveMeetingInfo(null, null, null, false);
}
private void startContentListActivity(boolean isOwner) {
Activity targetActivity = activityHandlingHelper.getCurrentActivity();
if (targetActivity instanceof ChatWebViewActivity) {
Stack<ABVAuthenticatedActivity> stack = activityHandlingHelper.getCurrentActivityStack();
if (stack.size() > 1){
targetActivity = stack.get(stack.size()-2);
}
}
Intent intent = new Intent();
intent.setClass(targetActivity, OperationRelatedContentActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
intent.putExtra("isCollaboration", true);
intent.putExtra("isCollaborationOwner", isOwner);
targetActivity.startActivity(intent);
}
public void connectMeetingServer() throws Exception {
meetingManager = MeetingManager.getInstance();
mSkey = meetingManager.getSessionKey(true);
......@@ -1531,43 +1819,23 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
return result;
}
private void moveCollaborationScreen(Integer collaborationType) {
switch (collaborationType) {
case 0:
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(VOICE_COLLABORATION_PAGE_URL);
}
});
break;
case 2:
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(PICTURE_COLLABORATION_PAGE_URL);
public void onBackPressed() {
super.onBackPressed();
}
});
break;
case 3:
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(VIDEO_COLLABORATION_PAGE_URL);
private void moveCollaborationScreen(Integer collaborationType) {
if (collaborationType.equals(ABookCommConstants.FLAG.COLLABORATION_TYPE.DOCUMENT) && !isValidVersion()) {
mChatWebView.loadUrl("javascript:alert(getLocalizedString('not_support_version'));");
return;
}
});
break;
case 4:
mCollaborationType = collaborationType;
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(DOCUMENT_COLLABORATION_PAGE_URL);
mChatWebView.loadUrl(COLLABORATION_PAGE_URL);
}
});
break;
default:
break;
}
}
private boolean deleteFavoriteGroup(String groupId) throws NetworkDisconnectedException, AcmsException {
......@@ -1582,30 +1850,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
return true;
}
private void updateGroupInfoFromServer(String groupIds) throws NetworkDisconnectedException, AcmsException {
private void updateGroupInfoFromServer() throws NetworkDisconnectedException, AcmsException {
ArrayList<String> checkSumList = new ArrayList<String>();
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
for (String groupId : groupIds.split(",")) {
//checkSumList.add(pref.getString(groupId,DEFAULT_CHECKSUM));
checkSumList.add(DEFAULT_CHECKSUM);
}
String checkSumListStr = StringUtil.join(",",checkSumList);
if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) {
checkSumListStr = DEFAULT_CHECKSUM;
}
String lastUpdatedDate = pref.getString(ABookCommConstants.KEY.GROUP_MEMBER_UPDATED_DATE, DEFAULT_CHECKSUM);
try {
GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid,groupIds,checkSumListStr);
GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid, lastUpdatedDate);
if (CollectionUtil.isNotEmpty(resultJson.groupList)) {
SharedPreferences.Editor editor = pref.edit();
communicationLogic.updateGroup(resultJson.groupList);
if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) {
editor.putString(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString(),resultJson.allGroupLastUpdateDate);
} else {
for (ChatGroupDto groupDto : resultJson.groupList) {
editor.putString(Integer.toString(groupDto.groupId),groupDto.updateDate);
}
}
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.GROUP_MEMBER_UPDATED_DATE, resultJson.lastRequestDate);
editor.commit();
}
} catch (AcmsException e) {
......@@ -1619,18 +1873,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
communicationLogic.updateFavoriteUser(resultJson.favoriteUserIds);
}
private void updateFavoriteGroup() throws NetworkDisconnectedException, AcmsException {
GetFavoriteGroupJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteGroup(sid);
communicationLogic.updateFavoriteGroup(resultJson.favoriteGroupIds);
}
private void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString());
List<ChatGroupDto> groupList = communicationLogic.getAllGroup();
for (ChatGroupDto group : groupList) {
updateGroupInfoFromServer(Integer.toString(group.groupId));
}
updateGroupInfoFromServer();
}
private void updateFavoriteInfo() throws NetworkDisconnectedException, AcmsException {
......@@ -1651,21 +1902,36 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
});
}
@Override
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
isPIP = isInPictureInPictureMode;
if (isInPictureInPictureMode) {
mChatWebView.loadUrl("javascript:$('.pip_indicator').removeClass('none');");
} else {
if (isStop) {
mChatWebView.loadUrl("javascript:Coview_exitCollaboration();");
Intent intent = new Intent();
Activity currentActivity = ActivityHandlingHelper.getInstance().getCurrentActivity();
intent.setClass(currentActivity, OperationListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent, NaviConsts.Left);
}
mChatWebView.loadUrl("javascript:$('.pip_indicator').addClass('none');");
if (!meetingManager.isConnected()) {
mChatWebView.loadUrl("javascript:$('.start_pip_btn').addClass('none');");
}
}
}
// 共通資料画面表示
private void showCommonContent() {
Intent intent = new Intent();
intent.setClass(ChatWebviewActivity.this, OperationRelatedContentActivity.class);
intent.setClass(ChatWebViewActivity.this, OperationRelatedContentActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent, NaviConsts.Left);
}
// 設定画面へ遷移
public void onClickSetting(View v) {
mChatWebView.loadUrl("javascript:CHAT.leaveRoom()");
finish();
showSetting();
}
public class NetworkTask extends AsyncTask<Void, Void, Bitmap> {
private String url;
......@@ -1716,4 +1982,70 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
}
@Override
protected void onResume() {
isStop = false;
super.onResume();
if (mChatWebView.getUrl() != null && mChatWebView.getUrl().equals(CHAT_ROOM_PAGE_URL)) {
mChatWebView.loadUrl("javascript:CHAT_SOCKET.socketCheck();");
}
}
@Override
protected void onStop() {
isStop = true;
super.onStop();
}
@Override
public void onDestroy(){
exitAndDeleteMeetingRoom();
super.onDestroy();
if (receiver != null) {
unregisterReceiver(receiver);
receiver = null;
}
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
boolean eventPrevent = false;
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
backToHome();
eventPrevent = true;
break;
}
return eventPrevent;
}
public boolean isValidVersion() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return false;
}
return true;
}
public void sendPromoteRequest() {
ABVContentViewActivity contentViewActivity = ActivityHandlingHelper.getInstance().getContentViewActivity();
JSONObject json = new JSONObject();
json.put(MeetingManager.ID, meetingManager.getSkey());
json.put(MeetingManager.LOGIN_ID, ABVDataCache.getInstance().getMemberInfo().loginId);
meetingManager.sendWs(MeetingManager.CMD_PRESENTERREQUEST, contentViewActivity != null ? contentViewActivity.getContentId() : 0, null, null, json);
}
public void updateUnreadCount() throws NetworkDisconnectedException, AcmsException {
UnreadCountJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessagesUnreadCount(sid, Integer.toString(roomId.intValue()));
communicationLogic.updateUnreadCount(resultJson.chatMessageDtoArrayList, Integer.toString(roomId.intValue()));
}
public void updateMessageFromMessageId(String messageId) throws NetworkDisconnectedException, AcmsException {
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, Integer.toString(roomId.intValue()), messageId, null);
for (ChatMessageDto chatMessageDto : resultJson.chatMessageDtoArrayList) {
chatMessageDto.chatRoomId = roomId.intValue();
}
communicationLogic.insertMessageList(resultJson.chatMessageDtoArrayList);
communicationLogic.insertShopMember(resultJson.shopMemberDtoArrayList);
updateUnreadCount();
}
}
......@@ -357,7 +357,7 @@ public class OperationListActivity extends ABVUIActivity {
// プッシュメッセージがある場合
else if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
ActivityHandlingHelper.getInstance().startChatWebviewActivity(
ActivityHandlingHelper.getInstance().startChatWebViewActivity(
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName));
}
......
package jp.agentec.abook.abv.ui.home.activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
......@@ -28,6 +36,7 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.websocket.MeetingManager;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
......@@ -57,15 +66,19 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
private TextView mTxtOperationRelatedContent;
private Button mAllSaveButton;
private boolean isCollaboration;
private boolean isCollaborationOwner;
private ListView mContentListView;
private List<CategoryContentDto> mOperationContentList;
private LinearLayout mToolbar;
private MeetingManager meetingManager = MeetingManager.getInstance();
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
TextView mWaitOwnerTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
updateCollaborationInfo();
setContentView(R.layout.ac_operation_related_content);
// ホームボタン(作業一覧へ遷移ボタン)
......@@ -78,7 +91,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
mAllSaveButton = (Button) findViewById(R.id.btn_all_save);
mContentListView = (ListView) findViewById(R.id.lv_content_list);
showContentList();
mTxtOperationRelatedContent = (TextView) findViewById(R.id.txt_operation_related_content);
mQuickReportPrintButton = (ImageButton) findViewById(R.id.btn_operation_print);
......@@ -86,12 +99,11 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
mTxtOperationRelatedContent.setText("" + PatternStringUtil.patternToString(getApplicationContext(),
R.string.title_common_content,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
mToolbar = (LinearLayout)findViewById(R.id.toolbar2);
mAllSaveButton.setVisibility(View.GONE);
settingBottomToolbar();
setOnButtonEvent();
settingBottomToolbar();
refreshCollaborationUI();
}
// 下辺のツールバー設定
......@@ -117,6 +129,22 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
}
}
private void hideBottomToolbar() {
mToolbar.setVisibility(View.GONE);
}
private void showBottomToolbar() {
mToolbar.setVisibility(View.VISIBLE);
}
private void hideContentList() {
mContentListView.setVisibility(View.GONE);
}
private void showContentList() {
mContentListView.setVisibility(View.VISIBLE);
}
@Override
public void onDownloadingContentZip(final ContentZipDownloadNotification notification) {
super.onDownloadingContentZip(notification);
......@@ -283,7 +311,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
public void run() {
final ABookAlertDialog nonTargetMeetingContentDialog = AlertDialogUtil.createAlertDialog(OperationRelatedContentActivity.this, R.string.app_name);
nonTargetMeetingContentDialog.setCancelable(false);
nonTargetMeetingContentDialog.setMessage(R.string.msg_non_target_meeting_content);
nonTargetMeetingContentDialog.setMessage(isCollaboration? R.string.msg_non_target_collaboration_content : R.string.msg_non_target_meeting_content);
nonTargetMeetingContentDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
......@@ -445,8 +473,11 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// 端末の戻るボタン処理
Logger.d(TAG, "onKeyUp.Back");
// 端末の戻るボタン処理
if (isCollaboration) {
return true;
}
backToHome();
return true;
}
......@@ -477,21 +508,91 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
}
}
}
if (isCollaboration) {
mAllSaveButton.setVisibility(isCollaborationOwner ? visible : View.GONE);
} else {
mAllSaveButton.setVisibility(visible);
}
}
});
}
public void refreshCollaborationUI() {
if (isCollaboration) {
activityHandlingHelper.removeContentViewActivity(activityHandlingHelper.getContentViewActivity());
hideBottomToolbar();
if (isCollaborationOwner) {
hideWaitOwnerSelect();
showContentList();
mAllSaveButton.setVisibility(View.VISIBLE);
} else {
showWaitOwnerSelect();
hideContentList();
mAllSaveButton.setVisibility(View.GONE);
}
} else {
hideWaitOwnerSelect();
showBottomToolbar();
showContentList();
mAllSaveButton.setVisibility(View.VISIBLE);
}
}
@Override
public void onResume() {
Logger.i(TAG, "onResume:start");
updateCollaborationInfo();
refreshCollaborationUI();
super.onResume();
showOperationRelatedContentList();
}
@Override
protected void onNewIntent(Intent intent) {
updateCollaborationInfo();
refreshCollaborationUI();
super.onNewIntent(intent);
}
// 設定画面へ遷移
public void onClickSetting(View v) {
showSetting();
}
public void showWaitOwnerSelect() {
if (mWaitOwnerTextView != null) {
mWaitOwnerTextView.setVisibility(View.VISIBLE);
return;
}
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics outMetrics = new DisplayMetrics ();
display.getMetrics(outMetrics);
LinearLayout container = (LinearLayout) findViewById(R.id.related_content_third_linear);
mWaitOwnerTextView = new TextView(this);
mWaitOwnerTextView.setText(getString(R.string.msg_wait_for_host));
mWaitOwnerTextView.setGravity(Gravity.CENTER);
mWaitOwnerTextView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.related_content_main_linear);
mWaitOwnerTextView.setHeight((int) (outMetrics.heightPixels / 2));
mWaitOwnerTextView.setTextSize(20);
mWaitOwnerTextView.setTextColor(Color.BLACK);
container.addView(mWaitOwnerTextView);
mWaitOwnerTextView.setVisibility(View.VISIBLE);
}
public void hideWaitOwnerSelect() {
if (mWaitOwnerTextView != null) {
mWaitOwnerTextView.setVisibility(View.GONE);
}
}
public void updateCollaborationInfo() {
isCollaboration = meetingManager.isCollaboration();
isCollaborationOwner = meetingManager.isCollaboration() && meetingManager.isOwner();
}
@Override
public void showAlertDialog(AlertDialog alertDialog) {
super.showAlertDialog(alertDialog);
}
}
......@@ -71,7 +71,7 @@ import jp.agentec.abook.abv.ui.common.constant.NaviConsts;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.activity.ChatWebviewActivity;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationMeetingListActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationRelatedContentActivity;
......@@ -120,7 +120,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
private long lastDisconnect;
private static Dialog meetingAlertDialog;
private ABVUIActivity previousOfSettingActivity;
private boolean isCollaboration = false;
// Chat
private ParentWebViewActivity previousOfSettingActivity2;
......@@ -174,11 +174,11 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
@Override
public void run() {
try {
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | intent.FLAG_ACTIVITY_NEW_TASK);
if (page != null) {
intent.putExtra(ABVActivity.PAGE, page);
}
startContentActivity(mContext, intent, null, Intent.FLAG_ACTIVITY_SINGLE_TOP | intent.FLAG_ACTIVITY_NEW_TASK, contentId);
startContentActivity(mContext, intent, null, Intent.FLAG_ACTIVITY_CLEAR_TOP | intent.FLAG_ACTIVITY_NEW_TASK, contentId);
} catch (Exception e) {
Logger.e(TAG, "startContentActivity contentId=" + contentId, e);
showToast(mContext.getString(R.string.E113));
......@@ -293,6 +293,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
if (intent == null) {
intent = new Intent();
}
intent.putExtra(ABookKeys.CONTENT_ID, contentId);
intent.putExtra(FILEPATH, path);
intent.putExtra(ABookKeys.CONTENT_TYPE, contentType);
......@@ -384,23 +385,22 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
recordContentReadLog(context, contentId);
}
//AbookCommの文書協業の場合(ChatWebviewがPIPモードの場合)既存Contextでなく以前のActivityから画面を遷移する。
ChatWebviewActivity chatWebViewActivity = getActivity(ChatWebviewActivity.class);
if (chatWebViewActivity != null && chatWebViewActivity.isInPictureInPictureMode()) {
context = getCurrentActivity();
intent.removeFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
if (context instanceof ChatWebviewActivity) {
Stack<ABVAuthenticatedActivity> stack = getCurrentActivityStack();
if (stack.size() > 1){
context = stack.get(stack.size()-2);
}
}
}
if (!StringUtil.equalsAny(contentType,
ContentJSON.KEY_HTML_TYPE, ContentJSON.KEY_LINK_TYPE, ContentJSON.KEY_ENQUETE_TYPE, ContentJSON.KEY_EXAM_TYPE,
ContentJSON.KEY_PANO_MOVIE_TYPE, ContentJSON.KEY_PANO_IMAGE_TYPE, ContentJSON.KEY_OBJECTVR_TYPE)) {
//資料が変更されたらPIPモードに更新する。
ChatWebViewActivity chatWebViewActivity = getActivity(ChatWebViewActivity.class);
if (chatWebViewActivity != null && meetingManager.isSubscribed() && !chatWebViewActivity.isInPictureInPictureMode()) {
chatWebViewActivity.startPIPmode();
}
if (!StringUtil.equalsAny(
contentType,
ContentJSON.KEY_HTML_TYPE,
ContentJSON.KEY_LINK_TYPE,
ContentJSON.KEY_ENQUETE_TYPE,
ContentJSON.KEY_EXAM_TYPE,
ContentJSON.KEY_PANO_MOVIE_TYPE,
ContentJSON.KEY_PANO_IMAGE_TYPE,
ContentJSON.KEY_OBJECTVR_TYPE)
) {
context.startActivity(intent);
}
}
......@@ -710,6 +710,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
public synchronized void removeContentViewActivity(ABVContentViewActivity contentViewActivity) {
sendToBookShelf();
if (this.contentViewActivity != null && this.contentViewActivity.equals(contentViewActivity)) {
contentViewActivity.finish();
setContentViewActivity(null);
}
}
......@@ -725,7 +726,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
*/
public synchronized void finishAllContentViewActivity() {
for (ABVAuthenticatedActivity activity : currentActivityStack) {
if (activity instanceof ABVContentViewActivity && !(activity instanceof ChatWebviewActivity)) {
if (activity instanceof ABVContentViewActivity) {
activity.finish();
}
}
......@@ -742,7 +743,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
int activitySize = currentActivityStack.size();
for (int i = 1; i < activitySize - 1; i++) {
ABVAuthenticatedActivity activity = currentActivityStack.get(currentActivityStack.size() - i);
if (activity instanceof ABVContentViewActivity && !(activity instanceof ChatWebviewActivity)) {
if (activity instanceof ABVContentViewActivity) {
activity.finish();
}
}
......@@ -877,8 +878,10 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
final String cmd = json.getString(MeetingManager.CMD);
final long contentId = JsonUtil.getLong(json, MeetingManager.CONTENTID);
final int pageNumber = JsonUtil.getInt(json, MeetingManager.PAGE_NUMBER);
if (cmd.equals(MeetingManager.CMD_MEETINGINFO)) { // 入室結果
if (meetingManager != null) {
isCollaboration = meetingManager.isCollaboration();
}
if (cmd.equals(MeetingManager.CMD_MEETINGINFO) && !isCollaboration) { // 入室結果
showToast(mContext.getString(meetingManager.isOwner() ? R.string.msg_enter_as_publisher : R.string.msg_enter_as_subscriber));
return;
}
......@@ -1102,10 +1105,13 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
*/
public boolean checkContent(final long contentId, int page) {
try {
final ContentDto contentDto = contentDao.getContent(contentId);
if (contentDto == null) {
Logger.e(TAG, "Content not found. contentId=" + contentId);
if (!isCollaboration) {
showToast(mContext.getString(R.string.no_content_need_refresh));
}
return false;
}
......@@ -1200,6 +1206,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
} else { // 却下された場合
msgId = R.string.msg_promotion_denied;
}
if (isCollaboration) { return; }
showToast(mContext.getString(msgId));
}
});
......@@ -1243,7 +1250,13 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
String unAuthorizedContentDownloadMsg = getCurrentActivity().getString(R.string.request_download_un_authorized_content);
final boolean isNoAuthorizedContentDownloadRequest = contentName.equals(unAuthorizedContentDownloadMsg);
if (isCollaboration) {
if (isNoAuthorizedContentDownloadRequest) {
downloadUnAuthorizedContentInfo(contentId);
}
downloadContent(contentId);
downloadConfirmDialog = null;
} else {
downloadConfirmDialog = AlertDialogUtil.createAlertDialog(getCurrentActivity(), R.string.confirm);
downloadConfirmDialog.setCancelable(false);
if (isNoAuthorizedContentDownloadRequest) {
......@@ -1274,6 +1287,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
});
}
}
/**
* 資料の更新ダイアログ生成処理
......@@ -1315,6 +1329,9 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
*/
private void showDownloadConfirm(final long contentId, String contentName) {
createDownloadConfirm(contentId, contentName);
if (isCollaboration) {
return;
}
downloadConfirmDialog.show();
}
......@@ -1360,6 +1377,38 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
Logger.w(TAG, "promotionRequestAlertDialog is showing. ignore request. requesterId=" + requesterId);
return;
}
if (isCollaboration) {
try {
// 承認する前にマーキングモード終了メッセージを送信
if (contentViewActivity instanceof ContentViewActivity && ((ContentViewActivity)contentViewActivity).isMarkingStatus()) {
JSONObject jsonMarkingInvisible = new JSONObject();
jsonMarkingInvisible.put(MeetingManager.MARKING_ACTION, MeetingManager.MARKING_ACTION_END);
meetingManager.sendWs(MeetingManager.CMD_MARKING, contentViewActivity.getContentId(), contentViewActivity.getCurrentPageNumber(), null, jsonMarkingInvisible);
}
JSONObject json = new JSONObject();
json.put(MeetingManager.ID, requesterSkey);
json.put(MeetingManager.APPROVED, true);
meetingManager.sendWs(MeetingManager.CMD_APPROVALSTATUS, null, null, null, json);
meetingManager.setOwner(false); // 司会者ではなくなる
if (contentViewActivity != null) {
if (contentViewActivity instanceof ContentViewActivity) {
((ContentViewActivity) contentViewActivity).setBarVisible(false);
((ContentViewActivity) contentViewActivity).setMarkingReadOnly(true);
}
contentViewActivity.configureRemote();
} else {
OperationRelatedContentActivity operationRelatedContentActivity = getActivity(OperationRelatedContentActivity.class);
if (operationRelatedContentActivity != null) {
operationRelatedContentActivity.refreshCollaborationUI();
}
}
} catch (Exception e) {
Logger.e(TAG, "showPromotionRequest ok failed", e);
showToast("Promotion request failed.");
}
return;
}
promotionRequestAlertDialog = AlertDialogUtil.createAlertDialog(getCurrentActivity(), R.string.confirm);
promotionRequestAlertDialog.setMessage(String.format(mContext.getString(R.string.msg_approve_promotion), requesterId));
promotionRequestAlertDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
......@@ -1581,8 +1630,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
//プシュメッセージ一覧からチャットに入る
public void startChatWebviewActivityWithPushMessage(PushMessageDto dto) {
String className = ChatWebviewActivity.class.getName();
public void startChatWebViewActivityWithPushMessage(PushMessageDto dto) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
......@@ -1599,33 +1648,13 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.putExtra("roomName", dto.roomName);
}
intent.setClassName(mContext.getPackageName(), className);
Activity activity2 = null;
if (!currentActivityStack.isEmpty()) {
int size = currentActivityStack.size();
for(int i = size-1; i >= 0; i--) {
ABVAuthenticatedActivity activity = currentActivityStack.elementAt(i);
if (activity instanceof ChatWebviewActivity) {
activity2 = (ChatWebviewActivity) activity;
}
}
}
if (activity2 != null) {
activity2.finish();
activity2.startActivity(intent);
} else {
Activity activity = getCurrentActivity();
if (activity != null) {
activity.startActivity(intent);
}
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
//チャットに入る
public void startChatWebviewActivity() {
String className = ChatWebviewActivity.class.getName();
public void startChatWebViewActivity() {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
......@@ -1636,33 +1665,13 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.putExtra("loginId", loginId);
intent.putExtra("shopName", shopName);
intent.setClassName(mContext.getPackageName(), className);
Activity activity2 = null;
if (!currentActivityStack.isEmpty()) {
int size = currentActivityStack.size();
for(int i = size-1; i >= 0; i--) {
ABVAuthenticatedActivity activity = currentActivityStack.elementAt(i);
if (activity instanceof ChatWebviewActivity) {
activity2 = (ChatWebviewActivity) activity;
}
}
}
if (activity2 != null) {
activity2.finish();
activity2.startActivity(intent);
} else {
Activity activity = getCurrentActivity();
if (activity != null) {
activity.startActivity(intent);
}
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
// プシュメッセージからチャットに入る
public void startChatWebviewActivity(Long roomId, String roomName) {
String className = ChatWebviewActivity.class.getName();
public void startChatWebViewActivity(Long roomId, String roomName) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
......@@ -1676,28 +1685,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.putExtra("roomName", roomName);
intent.setClassName(mContext.getPackageName(), className);
Activity activity2 = null;
if (!currentActivityStack.isEmpty()) {
int size = currentActivityStack.size();
for(int i = size-1; i >= 0; i--) {
ABVAuthenticatedActivity activity = currentActivityStack.elementAt(i);
if (activity instanceof ChatWebviewActivity) {
activity2 = (ChatWebviewActivity) activity;
}
}
}
if (activity2 != null) {
activity2.finish();
activity2.startActivity(intent);
} else {
Activity activity = getCurrentActivity();
if (activity != null) {
activity.startActivity(intent);
}
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
/**
......@@ -1925,8 +1914,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
this.previousOfSettingActivity2 = activity;
}
public void startChatWebviewActivityWithCollaboration(Long roomId, String roomName, String collaborationType) {
String className = ChatWebviewActivity.class.getName();
public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
......@@ -1939,30 +1928,10 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.putExtra("shopName", shopName);
intent.putExtra("roomId", roomId);
intent.putExtra("roomName", roomName);
intent.putExtra("roomType", roomType);
intent.setClassName(mContext.getPackageName(), className);
Activity activity2 = null;
if (!currentActivityStack.isEmpty()) {
int size = currentActivityStack.size();
for (int i = size - 1; i >= 0; i--) {
ABVAuthenticatedActivity activity = currentActivityStack.elementAt(i);
if (activity instanceof ChatWebviewActivity) {
activity2 = (ChatWebviewActivity) activity;
}
}
}
if (activity2 != null) {
activity2.finish();
activity2.startActivity(intent);
} else {
Activity activity = getCurrentActivity();
if (activity != null) {
activity.startActivity(intent);
}
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
/**
......
package jp.agentec.abook.abv.ui.home.helper;
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.opengl.EGL14;
import android.opengl.EGLExt;
import android.opengl.EGLConfig;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.util.Log;
import android.view.Surface;
/**
* Holds state associated with a Surface used for MediaCodec encoder input.
* <p>
* The constructor takes a Surface obtained from MediaCodec.createInputSurface(), and uses that
* to create an EGL window surface. Calls to eglSwapBuffers() cause a frame of data to be sent
* to the video encoder.
*/
class InputSurface {
private static final String TAG = "InputSurface";
private static final boolean VERBOSE = true;
private static final int EGL_RECORDABLE_ANDROID = 0x3142;
private static final int EGL_OPENGL_ES2_BIT = 4;
private EGLDisplay mEGLDisplay;
private EGLContext mEGLContext;
private EGLSurface mEGLSurface;
private Surface mSurface;
/**
* Creates an InputSurface from a Surface.
*/
public InputSurface(Surface surface) {
if (surface == null) {
throw new NullPointerException();
}
mSurface = surface;
eglSetup();
}
/**
* Prepares EGL. We want a GLES 2.0 context and a surface that supports recording.
*/
private void eglSetup() {
mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
throw new RuntimeException("unable to get EGL14 display");
}
int[] version = new int[2];
if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
mEGLDisplay = null;
throw new RuntimeException("unable to initialize EGL14");
}
// Configure EGL for pbuffer and OpenGL ES 2.0. We want enough RGB bits
// to be able to tell if the frame is reasonable.
int[] attribList = {
EGL14.EGL_RED_SIZE, 8,
EGL14.EGL_GREEN_SIZE, 8,
EGL14.EGL_BLUE_SIZE, 8,
EGL14.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RECORDABLE_ANDROID, 1,
EGL14.EGL_NONE
};
EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1];
if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
numConfigs, 0)) {
throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
}
// Configure context for OpenGL ES 2.0.
int[] attrib_list = {
EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
EGL14.EGL_NONE
};
mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.EGL_NO_CONTEXT,
attrib_list, 0);
checkEglError("eglCreateContext");
if (mEGLContext == null) {
throw new RuntimeException("null context");
}
// Create a window surface, and attach it to the Surface we received.
int[] surfaceAttribs = {
EGL14.EGL_NONE
};
mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], mSurface,
surfaceAttribs, 0);
checkEglError("eglCreateWindowSurface");
if (mEGLSurface == null) {
throw new RuntimeException("surface was null");
}
}
/**
* Discard all resources held by this class, notably the EGL context. Also releases the
* Surface that was passed to our constructor.
*/
public void release() {
if (EGL14.eglGetCurrentContext().equals(mEGLContext)) {
// Clear the current context and surface to ensure they are discarded immediately.
EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_CONTEXT);
}
EGL14.eglDestroySurface(mEGLDisplay, mEGLSurface);
EGL14.eglDestroyContext(mEGLDisplay, mEGLContext);
//EGL14.eglTerminate(mEGLDisplay);
mSurface.release();
// null everything out so future attempts to use this object will cause an NPE
mEGLDisplay = null;
mEGLContext = null;
mEGLSurface = null;
mSurface = null;
}
/**
* Makes our EGL context and surface current.
*/
public void makeCurrent() {
if (!EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
/**
* Calls eglSwapBuffers. Use this to "publish" the current frame.
*/
public boolean swapBuffers() {
return EGL14.eglSwapBuffers(mEGLDisplay, mEGLSurface);
}
/**
* Returns the Surface that the MediaCodec receives buffers from.
*/
public Surface getSurface() {
return mSurface;
}
/**
* Sends the presentation time stamp to EGL. Time is expressed in nanoseconds.
*/
public void setPresentationTime(long nsecs) {
EGLExt.eglPresentationTimeANDROID(mEGLDisplay, mEGLSurface, nsecs);
}
/**
* Checks for EGL errors.
*/
private void checkEglError(String msg) {
boolean failed = false;
int error;
while ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
Log.e(TAG, msg + ": EGL error: 0x" + Integer.toHexString(error));
failed = true;
}
if (failed) {
throw new RuntimeException("EGL error encountered (see log)");
}
}
}
package jp.agentec.abook.abv.ui.home.helper;
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.graphics.SurfaceTexture;
import android.opengl.EGL14;
import android.opengl.GLES20;
import android.opengl.GLES11Ext;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import android.view.Surface;
import java.nio.ByteBuffer;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL;
import javax.microedition.khronos.opengles.GL10;
/**
* Holds state associated with a Surface used for MediaCodec decoder output.
* <p>
* The (width,height) constructor for this class will prepare GL, create a SurfaceTexture,
* and then create a Surface for that SurfaceTexture. The Surface can be passed to
* MediaCodec.configure() to receive decoder output. When a frame arrives, we latch the
* texture with updateTexImage, then render the texture with GL to a pbuffer.
* <p>
* The no-arg constructor skips the GL preparation step and doesn't allocate a pbuffer.
* Instead, it just creates the Surface and SurfaceTexture, and when a frame arrives
* we just draw it on whatever surface is current.
* <p>
* By default, the Surface will be using a BufferQueue in asynchronous mode, so we
* can potentially drop frames.
*/
class OutputSurface implements SurfaceTexture.OnFrameAvailableListener {
private static final String TAG = "OutputSurface";
private static final boolean VERBOSE = true;
private static final int EGL_OPENGL_ES2_BIT = 4;
private EGL10 mEGL;
private EGLDisplay mEGLDisplay;
private EGLContext mEGLContext;
private EGLSurface mEGLSurface;
private SurfaceTexture mSurfaceTexture;
private Surface mSurface;
private Object mFrameSyncObject = new Object(); // guards mFrameAvailable
private boolean mFrameAvailable;
private TextureRender mTextureRender;
private HandlerThread mHandlerThread;
private Handler mHandler;
/**
* Creates an OutputSurface backed by a pbuffer with the specifed dimensions. The new
* EGL context and surface will be made current. Creates a Surface that can be passed
* to MediaCodec.configure().
*/
public OutputSurface(int width, int height) {
if (width <= 0 || height <= 0) {
throw new IllegalArgumentException();
}
eglSetup(width, height);
makeCurrent();
setup();
}
/**
* Creates an OutputSurface using the current EGL context. Creates a Surface that can be
* passed to MediaCodec.configure().
*/
public OutputSurface() {
setup();
}
/**
* Creates instances of TextureRender and SurfaceTexture, and a Surface associated
* with the SurfaceTexture.
*/
private void setup() {
mTextureRender = new TextureRender();
mTextureRender.surfaceCreated();
// Even if we don't access the SurfaceTexture after the constructor returns, we
// still need to keep a reference to it. The Surface doesn't retain a reference
// at the Java level, so if we don't either then the object can get GCed, which
// causes the native finalizer to run.
// mHandlerThread = new HandlerThread("callback-thread");
// mHandlerThread.start();
// mHandler = new Handler(mHandlerThread.getLooper());
if (VERBOSE) {
Log.d(TAG, "textureID=" + mTextureRender.getTextureId());
}
mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId());
// This doesn't work if OutputSurface is created on the thread that CTS started for
// these test cases.
//
// The CTS-created thread has a Looper, and the SurfaceTexture constructor will
// create a Handler that uses it. The "frame available" message is delivered
// there, but since we're not a Looper-based thread we'll never see it. For
// this to do anything useful, OutputSurface must be created on a thread without
// a Looper, so that SurfaceTexture uses the main application Looper instead.
//
// Java language note: passing "this" out of a constructor is generally unwise,
// but we should be able to get away with it here.
mSurfaceTexture.setOnFrameAvailableListener(this, mHandler);
mSurface = new Surface(mSurfaceTexture);
}
/**
* Prepares EGL. We want a GLES 2.0 context and a surface that supports pbuffer.
*/
private void eglSetup(int width, int height) {
mEGL = (EGL10)EGLContext.getEGL();
mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
if (!mEGL.eglInitialize(mEGLDisplay, null)) {
throw new RuntimeException("unable to initialize EGL10");
}
// Configure EGL for pbuffer and OpenGL ES 2.0. We want enough RGB bits
// to be able to tell if the frame is reasonable.
int[] attribList = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_NONE
};
EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1];
if (!mEGL.eglChooseConfig(mEGLDisplay, attribList, configs, 1, numConfigs)) {
throw new RuntimeException("unable to find RGB888+pbuffer EGL config");
}
// Configure context for OpenGL ES 2.0.
int[] attrib_list = {
EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
EGL10.EGL_NONE
};
mEGLContext = mEGL.eglCreateContext(mEGLDisplay, configs[0], EGL10.EGL_NO_CONTEXT,
attrib_list);
checkEglError("eglCreateContext");
if (mEGLContext == null) {
throw new RuntimeException("null context");
}
// Create a pbuffer surface. By using this for output, we can use glReadPixels
// to test values in the output.
int[] surfaceAttribs = {
EGL10.EGL_WIDTH, width,
EGL10.EGL_HEIGHT, height,
EGL10.EGL_NONE
};
mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, configs[0], surfaceAttribs);
checkEglError("eglCreatePbufferSurface");
if (mEGLSurface == null) {
throw new RuntimeException("surface was null");
}
}
/**
* Discard all resources held by this class, notably the EGL context.
*/
public void release() {
if (mEGL != null) {
if (mEGL.eglGetCurrentContext().equals(mEGLContext)) {
// Clear the current context and surface to ensure they are discarded immediately.
mEGL.eglMakeCurrent(mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_CONTEXT);
}
mEGL.eglDestroySurface(mEGLDisplay, mEGLSurface);
mEGL.eglDestroyContext(mEGLDisplay, mEGLContext);
//mEGL.eglTerminate(mEGLDisplay);
}
mSurface.release();
// this causes a bunch of warnings that appear harmless but might confuse someone:
// W BufferQueue: [unnamed-3997-2] cancelBuffer: BufferQueue has been abandoned!
//mSurfaceTexture.release();
// null everything out so future attempts to use this object will cause an NPE
mEGLDisplay = null;
mEGLContext = null;
mEGLSurface = null;
mEGL = null;
mTextureRender = null;
mSurface = null;
mSurfaceTexture = null;
}
/**
* Makes our EGL context and surface current.
*/
public void makeCurrent() {
if (mEGL == null) {
throw new RuntimeException("not configured for makeCurrent");
}
checkEglError("before makeCurrent");
if (!mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
/**
* Returns the Surface that we draw onto.
*/
public Surface getSurface() {
return mSurface;
}
/**
* Replaces the fragment shader.
*/
public void changeFragmentShader(String fragmentShader) {
mTextureRender.changeFragmentShader(fragmentShader);
}
/**
* Latches the next buffer into the texture. Must be called from the thread that created
* the OutputSurface object, after the onFrameAvailable callback has signaled that new
* data is available.
*/
public void awaitNewImage() {
final int TIMEOUT_MS = 2500;
synchronized (mFrameSyncObject) {
while (!mFrameAvailable) {
try {
// Wait for onFrameAvailable() to signal us. Use a timeout to avoid
// stalling the test if it doesn't arrive.
mFrameSyncObject.wait(TIMEOUT_MS);
if (!mFrameAvailable) {
// TODO: if "spurious wakeup", continue while loop
throw new RuntimeException("Surface frame wait timed out");
}
} catch (InterruptedException ie) {
// shouldn't happen
throw new RuntimeException(ie);
}
}
mFrameAvailable = false;
}
// Latch the data.
mTextureRender.checkGlError("before updateTexImage");
mSurfaceTexture.updateTexImage();
}
/**
* Draws the data from SurfaceTexture onto the current EGL surface.
*/
public void drawImage() {
mTextureRender.drawFrame(mSurfaceTexture);
}
@Override
public void onFrameAvailable(SurfaceTexture st) {
if (VERBOSE) {
Log.d(TAG, "new frame available");
}
synchronized (mFrameSyncObject) {
if (mFrameAvailable) {
throw new RuntimeException("mFrameAvailable already set, frame could be dropped");
}
mFrameAvailable = true;
mFrameSyncObject.notifyAll();
}
}
/**
* Checks for EGL errors.
*/
private void checkEglError(String msg) {
boolean failed = false;
int error;
while ((error = mEGL.eglGetError()) != EGL10.EGL_SUCCESS) {
Log.e(TAG, msg + ": EGL error: 0x" + Integer.toHexString(error));
failed = true;
}
if (failed) {
throw new RuntimeException("EGL error encountered (see log)");
}
}
}
package jp.agentec.abook.abv.ui.home.helper;
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.graphics.SurfaceTexture;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import android.util.Log;
/**
* Code for rendering a texture onto a surface using OpenGL ES 2.0.
*/
class TextureRender {
private static final String TAG = "TextureRender";
private static final int FLOAT_SIZE_BYTES = 4;
private static final int TRIANGLE_VERTICES_DATA_STRIDE_BYTES = 5 * FLOAT_SIZE_BYTES;
private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0;
private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3;
private final float[] mTriangleVerticesData = {
// X, Y, Z, U, V
-1.0f, -1.0f, 0, 0.f, 0.f,
1.0f, -1.0f, 0, 1.f, 0.f,
-1.0f, 1.0f, 0, 0.f, 1.f,
1.0f, 1.0f, 0, 1.f, 1.f,
};
private FloatBuffer mTriangleVertices;
private static final String VERTEX_SHADER =
"uniform mat4 uMVPMatrix;\n" +
"uniform mat4 uSTMatrix;\n" +
"attribute vec4 aPosition;\n" +
"attribute vec4 aTextureCoord;\n" +
"varying vec2 vTextureCoord;\n" +
"void main() {\n" +
" gl_Position = uMVPMatrix * aPosition;\n" +
" vTextureCoord = (uSTMatrix * aTextureCoord).xy;\n" +
"}\n";
private static final String FRAGMENT_SHADER =
"#extension GL_OES_EGL_image_external : require\n" +
"precision mediump float;\n" + // highp here doesn't seem to matter
"varying vec2 vTextureCoord;\n" +
"uniform samplerExternalOES sTexture;\n" +
"void main() {\n" +
" gl_FragColor = texture2D(sTexture, vTextureCoord);\n" +
"}\n";
private float[] mMVPMatrix = new float[16];
private float[] mSTMatrix = new float[16];
private int mProgram;
private int mTextureID = -12345;
private int muMVPMatrixHandle;
private int muSTMatrixHandle;
private int maPositionHandle;
private int maTextureHandle;
public TextureRender() {
mTriangleVertices = ByteBuffer.allocateDirect(
mTriangleVerticesData.length * FLOAT_SIZE_BYTES)
.order(ByteOrder.nativeOrder()).asFloatBuffer();
mTriangleVertices.put(mTriangleVerticesData).position(0);
Matrix.setIdentityM(mSTMatrix, 0);
}
public int getTextureId() {
return mTextureID;
}
public void drawFrame(SurfaceTexture st) {
checkGlError("onDrawFrame start");
st.getTransformMatrix(mSTMatrix);
GLES20.glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glUseProgram(mProgram);
checkGlError("glUseProgram");
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureID);
mTriangleVertices.position(TRIANGLE_VERTICES_DATA_POS_OFFSET);
GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false,
TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices);
checkGlError("glVertexAttribPointer maPosition");
GLES20.glEnableVertexAttribArray(maPositionHandle);
checkGlError("glEnableVertexAttribArray maPositionHandle");
mTriangleVertices.position(TRIANGLE_VERTICES_DATA_UV_OFFSET);
GLES20.glVertexAttribPointer(maTextureHandle, 2, GLES20.GL_FLOAT, false,
TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices);
checkGlError("glVertexAttribPointer maTextureHandle");
GLES20.glEnableVertexAttribArray(maTextureHandle);
checkGlError("glEnableVertexAttribArray maTextureHandle");
Matrix.setIdentityM(mMVPMatrix, 0);
GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mMVPMatrix, 0);
GLES20.glUniformMatrix4fv(muSTMatrixHandle, 1, false, mSTMatrix, 0);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
checkGlError("glDrawArrays");
GLES20.glFinish();
}
/**
* Initializes GL state. Call this after the EGL surface has been created and made current.
*/
public void surfaceCreated() {
mProgram = createProgram(VERTEX_SHADER, FRAGMENT_SHADER);
if (mProgram == 0) {
throw new RuntimeException("failed creating program");
}
maPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
checkGlError("glGetAttribLocation aPosition");
if (maPositionHandle == -1) {
throw new RuntimeException("Could not get attrib location for aPosition");
}
maTextureHandle = GLES20.glGetAttribLocation(mProgram, "aTextureCoord");
checkGlError("glGetAttribLocation aTextureCoord");
if (maTextureHandle == -1) {
throw new RuntimeException("Could not get attrib location for aTextureCoord");
}
muMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
checkGlError("glGetUniformLocation uMVPMatrix");
if (muMVPMatrixHandle == -1) {
throw new RuntimeException("Could not get attrib location for uMVPMatrix");
}
muSTMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uSTMatrix");
checkGlError("glGetUniformLocation uSTMatrix");
if (muSTMatrixHandle == -1) {
throw new RuntimeException("Could not get attrib location for uSTMatrix");
}
int[] textures = new int[1];
GLES20.glGenTextures(1, textures, 0);
mTextureID = textures[0];
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureID);
checkGlError("glBindTexture mTextureID");
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
GLES20.GL_NEAREST);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER,
GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S,
GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T,
GLES20.GL_CLAMP_TO_EDGE);
checkGlError("glTexParameter");
}
/**
* Replaces the fragment shader.
*/
public void changeFragmentShader(String fragmentShader) {
GLES20.glDeleteProgram(mProgram);
mProgram = createProgram(VERTEX_SHADER, fragmentShader);
if (mProgram == 0) {
throw new RuntimeException("failed creating program");
}
}
private int loadShader(int shaderType, String source) {
int shader = GLES20.glCreateShader(shaderType);
checkGlError("glCreateShader type=" + shaderType);
GLES20.glShaderSource(shader, source);
GLES20.glCompileShader(shader);
int[] compiled = new int[1];
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
if (compiled[0] == 0) {
Log.e(TAG, "Could not compile shader " + shaderType + ":");
Log.e(TAG, " " + GLES20.glGetShaderInfoLog(shader));
GLES20.glDeleteShader(shader);
shader = 0;
}
return shader;
}
private int createProgram(String vertexSource, String fragmentSource) {
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
if (vertexShader == 0) {
return 0;
}
int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
if (pixelShader == 0) {
return 0;
}
int program = GLES20.glCreateProgram();
checkGlError("glCreateProgram");
if (program == 0) {
Log.e(TAG, "Could not create program");
}
GLES20.glAttachShader(program, vertexShader);
checkGlError("glAttachShader");
GLES20.glAttachShader(program, pixelShader);
checkGlError("glAttachShader");
GLES20.glLinkProgram(program);
int[] linkStatus = new int[1];
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
if (linkStatus[0] != GLES20.GL_TRUE) {
Log.e(TAG, "Could not link program: ");
Log.e(TAG, GLES20.glGetProgramInfoLog(program));
GLES20.glDeleteProgram(program);
program = 0;
}
return program;
}
public void checkGlError(String op) {
int error;
while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
Log.e(TAG, op + ": glError " + error);
throw new RuntimeException(op + ": glError " + error);
}
}
}
package jp.agentec.abook.abv.ui.home.helper;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMetadataRetriever;
import android.media.MediaMuxer;
import android.view.Surface;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicReference;
public class VideoEncoder {
private static final int TIMEOUT_USEC = 10000;
private static final String OUTPUT_VIDEO_MIME_TYPE = "video/avc";
private static final int OUTPUT_VIDEO_BIT_RATE = 2500 * 1024;
private static final int OUTPUT_VIDEO_FRAME_RATE = 30;
private static final int OUTPUT_VIDEO_IFRAME_INTERVAL = 10;
private static final int OUTPUT_VIDEO_COLOR_FORMAT =
MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface;
private static final String OUTPUT_AUDIO_MIME_TYPE = "audio/mp4a-latm";
private static final int OUTPUT_AUDIO_CHANNEL_COUNT = 2;
private static final int OUTPUT_AUDIO_BIT_RATE = 128 * 1024;
private static final int OUTPUT_AUDIO_AAC_PROFILE =
MediaCodecInfo.CodecProfileLevel.AACObjectHE;
private static final int OUTPUT_AUDIO_SAMPLE_RATE_HZ = 44100;
private int mWidth = 854;
private int mHeight = 480;
private String mOutputFile;
private String mInputFile;
@SuppressLint("LongLogTag")
public String changeResolution(File f, Runnable callBack) throws Throwable {
mInputFile = f.getAbsolutePath();
String filePath = mInputFile.substring(0, mInputFile.lastIndexOf(File.separator));
String[] splitByDot = mInputFile.split("\\.");
String ext = "";
if (splitByDot.length > 1) {
ext = splitByDot[splitByDot.length-1];
}
String fileName = mInputFile.substring(mInputFile.lastIndexOf(File.separator)+1);
if (ext.length() > 0) {
fileName = fileName.replace("."+ext, System.currentTimeMillis() + "_out.mp4");
} else {
fileName = fileName.concat(System.currentTimeMillis() + "_out.mp4");
}
final File outFile = new File(filePath, fileName);
if (!outFile.exists()) {
outFile.createNewFile();
}
mOutputFile = outFile.getAbsolutePath();
ChangerWrapper.changeResolutionInSeparatedThread(this, callBack);
return mOutputFile;
}
private static class ChangerWrapper implements Runnable {
private Throwable mThrowable;
private VideoEncoder mChanger;
private Runnable mCallBack;
private ChangerWrapper(VideoEncoder changer, Runnable callBack) {
mChanger = changer;
mCallBack = callBack;
}
@Override
public void run() {
try {
mChanger.prepareAndChangeResolution(mCallBack);
} catch (Throwable th) {
mThrowable = th;
}
}
public static void changeResolutionInSeparatedThread(VideoEncoder encoder, Runnable callBack) throws Throwable {
ChangerWrapper wrapper = new ChangerWrapper(encoder, callBack);
Thread th = new Thread(wrapper, ChangerWrapper.class.getSimpleName());
th.start();
// th.join();
if (wrapper.mThrowable != null) {
throw wrapper.mThrowable;
}
}
}
private void prepareAndChangeResolution(Runnable callBack) throws Exception {
Exception exception = null;
MediaCodecInfo videoCodecInfo = selectCodec(OUTPUT_VIDEO_MIME_TYPE);
if (videoCodecInfo == null) {
return;
}
MediaCodecInfo audioCodecInfo = selectCodec(OUTPUT_AUDIO_MIME_TYPE);
if (audioCodecInfo == null) {
return;
}
MediaExtractor videoExtractor = null;
MediaExtractor audioExtractor = null;
OutputSurface outputSurface = null;
MediaCodec videoDecoder = null;
MediaCodec audioDecoder = null;
MediaCodec videoEncoder = null;
MediaCodec audioEncoder = null;
MediaMuxer muxer = null;
InputSurface inputSurface = null;
try {
videoExtractor = createExtractor();
int videoInputTrack = getAndSelectVideoTrackIndex(videoExtractor);
MediaFormat inputFormat = videoExtractor.getTrackFormat(videoInputTrack);
MediaMetadataRetriever m = new MediaMetadataRetriever();
m.setDataSource(mInputFile);
int inputWidth, inputHeight;
try {
inputWidth = Integer.parseInt(m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
inputHeight = Integer.parseInt(m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
} catch (Exception e) {
Bitmap thumbnail = m.getFrameAtTime();
inputWidth = thumbnail.getWidth();
inputHeight = thumbnail.getHeight();
thumbnail.recycle();
}
if (inputWidth > inputHeight){
if (mWidth < mHeight) {
int w = mWidth;
mWidth = mHeight;
mHeight = w;
}
} else {
if (mWidth > mHeight) {
int w = mWidth;
mWidth = mHeight;
mHeight = w;
}
}
MediaFormat outputVideoFormat =
MediaFormat.createVideoFormat(OUTPUT_VIDEO_MIME_TYPE, mWidth, mHeight);
outputVideoFormat.setInteger(
MediaFormat.KEY_COLOR_FORMAT, OUTPUT_VIDEO_COLOR_FORMAT);
outputVideoFormat.setInteger(MediaFormat.KEY_BIT_RATE, OUTPUT_VIDEO_BIT_RATE);
outputVideoFormat.setInteger(MediaFormat.KEY_FRAME_RATE, OUTPUT_VIDEO_FRAME_RATE);
outputVideoFormat.setInteger(
MediaFormat.KEY_I_FRAME_INTERVAL, OUTPUT_VIDEO_IFRAME_INTERVAL);
AtomicReference<Surface> inputSurfaceReference = new AtomicReference<Surface>();
videoEncoder = createVideoEncoder(
videoCodecInfo, outputVideoFormat, inputSurfaceReference);
inputSurface = new InputSurface(inputSurfaceReference.get());
inputSurface.makeCurrent();
outputSurface = new OutputSurface();
videoDecoder = createVideoDecoder(inputFormat, outputSurface.getSurface());
audioExtractor = createExtractor();
int audioInputTrack = getAndSelectAudioTrackIndex(audioExtractor);
MediaFormat inputAudioFormat = audioExtractor.getTrackFormat(audioInputTrack);
MediaFormat outputAudioFormat =
MediaFormat.createAudioFormat(inputAudioFormat.getString(MediaFormat.KEY_MIME),
inputAudioFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE),
inputAudioFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT));
outputAudioFormat.setInteger(MediaFormat.KEY_BIT_RATE, OUTPUT_AUDIO_BIT_RATE);
outputAudioFormat.setInteger(MediaFormat.KEY_AAC_PROFILE, OUTPUT_AUDIO_AAC_PROFILE);
audioEncoder = createAudioEncoder(audioCodecInfo, outputAudioFormat);
audioDecoder = createAudioDecoder(inputAudioFormat);
muxer = new MediaMuxer(mOutputFile, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
changeResolution(videoExtractor, audioExtractor,
videoDecoder, videoEncoder,
audioDecoder, audioEncoder,
muxer, inputSurface, outputSurface);
} finally {
try {
if (videoExtractor != null) {
videoExtractor.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (audioExtractor != null) {
audioExtractor.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (videoDecoder != null) {
videoDecoder.stop();
videoDecoder.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (outputSurface != null) {
outputSurface.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (videoEncoder != null) {
videoEncoder.stop();
videoEncoder.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (audioDecoder != null) {
audioDecoder.stop();
audioDecoder.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (audioEncoder != null) {
audioEncoder.stop();
audioEncoder.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (muxer != null) {
muxer.stop();
muxer.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
try {
if (inputSurface != null) {
inputSurface.release();
}
} catch(Exception e) {
if (exception == null) {
exception = e;
}
}
callBack.run();
}
if (exception != null) {
throw exception;
}
}
private MediaExtractor createExtractor() throws IOException {
MediaExtractor extractor;
extractor = new MediaExtractor();
extractor.setDataSource(mInputFile);
return extractor;
}
private MediaCodec createVideoDecoder(MediaFormat inputFormat, Surface surface) throws IOException {
MediaCodec decoder = MediaCodec.createDecoderByType(getMimeTypeFor(inputFormat));
decoder.configure(inputFormat, surface, null, 0);
decoder.start();
return decoder;
}
private MediaCodec createVideoEncoder(MediaCodecInfo codecInfo, MediaFormat format,
AtomicReference<Surface> surfaceReference) throws IOException {
MediaCodec encoder = MediaCodec.createByCodecName(codecInfo.getName());
encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
surfaceReference.set(encoder.createInputSurface());
encoder.start();
return encoder;
}
private MediaCodec createAudioDecoder(MediaFormat inputFormat) throws IOException {
MediaCodec decoder = MediaCodec.createDecoderByType(getMimeTypeFor(inputFormat));
decoder.configure(inputFormat, null, null, 0);
decoder.start();
return decoder;
}
private MediaCodec createAudioEncoder(MediaCodecInfo codecInfo, MediaFormat format) throws IOException {
MediaCodec encoder = MediaCodec.createByCodecName(codecInfo.getName());
encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
encoder.start();
return encoder;
}
private int getAndSelectVideoTrackIndex(MediaExtractor extractor) {
for (int index = 0; index < extractor.getTrackCount(); ++index) {
if (isVideoFormat(extractor.getTrackFormat(index))) {
extractor.selectTrack(index);
return index;
}
}
return -1;
}
private int getAndSelectAudioTrackIndex(MediaExtractor extractor) {
for (int index = 0; index < extractor.getTrackCount(); ++index) {
if (isAudioFormat(extractor.getTrackFormat(index))) {
extractor.selectTrack(index);
return index;
}
}
return -1;
}
private void changeResolution(MediaExtractor videoExtractor, MediaExtractor audioExtractor,
MediaCodec videoDecoder, MediaCodec videoEncoder,
MediaCodec audioDecoder, MediaCodec audioEncoder,
MediaMuxer muxer,
InputSurface inputSurface, OutputSurface outputSurface) {
ByteBuffer[] videoDecoderInputBuffers;
ByteBuffer[] videoDecoderOutputBuffers;
ByteBuffer[] videoEncoderOutputBuffers;
MediaCodec.BufferInfo videoDecoderOutputBufferInfo;
MediaCodec.BufferInfo videoEncoderOutputBufferInfo;
videoDecoderInputBuffers = videoDecoder.getInputBuffers();
videoDecoderOutputBuffers = videoDecoder.getOutputBuffers();
videoEncoderOutputBuffers = videoEncoder.getOutputBuffers();
videoDecoderOutputBufferInfo = new MediaCodec.BufferInfo();
videoEncoderOutputBufferInfo = new MediaCodec.BufferInfo();
ByteBuffer[] audioDecoderInputBuffers;
ByteBuffer[] audioDecoderOutputBuffers;
ByteBuffer[] audioEncoderInputBuffers;
ByteBuffer[] audioEncoderOutputBuffers;
MediaCodec.BufferInfo audioDecoderOutputBufferInfo;
MediaCodec.BufferInfo audioEncoderOutputBufferInfo;
audioDecoderInputBuffers = audioDecoder.getInputBuffers();
audioDecoderOutputBuffers = audioDecoder.getOutputBuffers();
audioEncoderInputBuffers = audioEncoder.getInputBuffers();
audioEncoderOutputBuffers = audioEncoder.getOutputBuffers();
audioDecoderOutputBufferInfo = new MediaCodec.BufferInfo();
audioEncoderOutputBufferInfo = new MediaCodec.BufferInfo();
MediaFormat decoderOutputVideoFormat = null;
MediaFormat decoderOutputAudioFormat = null;
MediaFormat encoderOutputVideoFormat = null;
MediaFormat encoderOutputAudioFormat = null;
int outputVideoTrack = -1;
int outputAudioTrack = -1;
boolean videoExtractorDone = false;
boolean videoDecoderDone = false;
boolean videoEncoderDone = false;
boolean audioExtractorDone = false;
boolean audioDecoderDone = false;
boolean audioEncoderDone = false;
int pendingAudioDecoderOutputBufferIndex = -1;
boolean muxing = false;
while ((!videoEncoderDone) || (!audioEncoderDone)) {
while (!videoExtractorDone
&& (encoderOutputVideoFormat == null || muxing)) {
int decoderInputBufferIndex = videoDecoder.dequeueInputBuffer(TIMEOUT_USEC);
if (decoderInputBufferIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
break;
}
ByteBuffer decoderInputBuffer = videoDecoderInputBuffers[decoderInputBufferIndex];
int size = videoExtractor.readSampleData(decoderInputBuffer, 0);
long presentationTime = videoExtractor.getSampleTime();
if (size >= 0) {
videoDecoder.queueInputBuffer(
decoderInputBufferIndex,
0,
size,
presentationTime,
videoExtractor.getSampleFlags());
}
videoExtractorDone = !videoExtractor.advance();
if (videoExtractorDone) {
videoDecoder.queueInputBuffer(decoderInputBufferIndex,
0, 0, 0, MediaCodec.BUFFER_FLAG_END_OF_STREAM);
}
break;
}
while (!audioExtractorDone
&& (encoderOutputAudioFormat == null || muxing)) {
int decoderInputBufferIndex = audioDecoder.dequeueInputBuffer(TIMEOUT_USEC);
if (decoderInputBufferIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
break;
}
ByteBuffer decoderInputBuffer = audioDecoderInputBuffers[decoderInputBufferIndex];
int size = audioExtractor.readSampleData(decoderInputBuffer, 0);
long presentationTime = audioExtractor.getSampleTime();
if (size >= 0) {
audioDecoder.queueInputBuffer(decoderInputBufferIndex, 0, size,
presentationTime, audioExtractor.getSampleFlags());
}
audioExtractorDone = !audioExtractor.advance();
if (audioExtractorDone) {
audioDecoder.queueInputBuffer(decoderInputBufferIndex, 0, 0,
0, MediaCodec.BUFFER_FLAG_END_OF_STREAM);
}
break;
}
while (!videoDecoderDone
&& (encoderOutputVideoFormat == null || muxing)) {
int decoderOutputBufferIndex =
videoDecoder.dequeueOutputBuffer(
videoDecoderOutputBufferInfo, TIMEOUT_USEC);
if (decoderOutputBufferIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
break;
}
if (decoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
videoDecoderOutputBuffers = videoDecoder.getOutputBuffers();
break;
}
if (decoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
decoderOutputVideoFormat = videoDecoder.getOutputFormat();
break;
}
ByteBuffer decoderOutputBuffer =
videoDecoderOutputBuffers[decoderOutputBufferIndex];
if ((videoDecoderOutputBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG)
!= 0) {
videoDecoder.releaseOutputBuffer(decoderOutputBufferIndex, false);
break;
}
boolean render = videoDecoderOutputBufferInfo.size != 0;
videoDecoder.releaseOutputBuffer(decoderOutputBufferIndex, render);
if (render) {
outputSurface.awaitNewImage();
outputSurface.drawImage();
inputSurface.setPresentationTime(
videoDecoderOutputBufferInfo.presentationTimeUs * 1000);
inputSurface.swapBuffers();
}
if ((videoDecoderOutputBufferInfo.flags
& MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
videoDecoderDone = true;
videoEncoder.signalEndOfInputStream();
}
break;
}
while (!audioDecoderDone && pendingAudioDecoderOutputBufferIndex == -1
&& (encoderOutputAudioFormat == null || muxing)) {
int decoderOutputBufferIndex =
audioDecoder.dequeueOutputBuffer(
audioDecoderOutputBufferInfo, TIMEOUT_USEC);
if (decoderOutputBufferIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
break;
}
if (decoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
audioDecoderOutputBuffers = audioDecoder.getOutputBuffers();
break;
}
if (decoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
decoderOutputAudioFormat = audioDecoder.getOutputFormat();
break;
}
ByteBuffer decoderOutputBuffer =
audioDecoderOutputBuffers[decoderOutputBufferIndex];
if ((audioDecoderOutputBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG)
!= 0) {
audioDecoder.releaseOutputBuffer(decoderOutputBufferIndex, false);
break;
}
pendingAudioDecoderOutputBufferIndex = decoderOutputBufferIndex;
break;
}
while (pendingAudioDecoderOutputBufferIndex != -1) {
int encoderInputBufferIndex = audioEncoder.dequeueInputBuffer(TIMEOUT_USEC);
ByteBuffer encoderInputBuffer = audioEncoderInputBuffers[encoderInputBufferIndex];
int size = audioDecoderOutputBufferInfo.size;
long presentationTime = audioDecoderOutputBufferInfo.presentationTimeUs;
if (size >= 0) {
ByteBuffer decoderOutputBuffer =
audioDecoderOutputBuffers[pendingAudioDecoderOutputBufferIndex]
.duplicate();
decoderOutputBuffer.position(audioDecoderOutputBufferInfo.offset);
decoderOutputBuffer.limit(audioDecoderOutputBufferInfo.offset + size);
encoderInputBuffer.position(0);
encoderInputBuffer.put(decoderOutputBuffer);
audioEncoder.queueInputBuffer(
encoderInputBufferIndex,
0,
size,
presentationTime,
audioDecoderOutputBufferInfo.flags);
}
audioDecoder.releaseOutputBuffer(pendingAudioDecoderOutputBufferIndex, false);
pendingAudioDecoderOutputBufferIndex = -1;
if ((audioDecoderOutputBufferInfo.flags
& MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
audioDecoderDone = true;
}
break;
}
while (!videoEncoderDone
&& (encoderOutputVideoFormat == null || muxing)) {
int encoderOutputBufferIndex = videoEncoder.dequeueOutputBuffer(
videoEncoderOutputBufferInfo, TIMEOUT_USEC);
if (encoderOutputBufferIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
break;
}
if (encoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
videoEncoderOutputBuffers = videoEncoder.getOutputBuffers();
break;
}
if (encoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
encoderOutputVideoFormat = videoEncoder.getOutputFormat();
break;
}
ByteBuffer encoderOutputBuffer =
videoEncoderOutputBuffers[encoderOutputBufferIndex];
if ((videoEncoderOutputBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG)
!= 0) {
videoEncoder.releaseOutputBuffer(encoderOutputBufferIndex, false);
break;
}
if (videoEncoderOutputBufferInfo.size != 0) {
muxer.writeSampleData(
outputVideoTrack, encoderOutputBuffer, videoEncoderOutputBufferInfo);
}
if ((videoEncoderOutputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM)
!= 0) {
videoEncoderDone = true;
}
videoEncoder.releaseOutputBuffer(encoderOutputBufferIndex, false);
break;
}
while (!audioEncoderDone
&& (encoderOutputAudioFormat == null || muxing)) {
int encoderOutputBufferIndex = audioEncoder.dequeueOutputBuffer(
audioEncoderOutputBufferInfo, TIMEOUT_USEC);
if (encoderOutputBufferIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
break;
}
if (encoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
audioEncoderOutputBuffers = audioEncoder.getOutputBuffers();
break;
}
if (encoderOutputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
encoderOutputAudioFormat = audioEncoder.getOutputFormat();
break;
}
ByteBuffer encoderOutputBuffer =
audioEncoderOutputBuffers[encoderOutputBufferIndex];
if ((audioEncoderOutputBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG)
!= 0) {
audioEncoder.releaseOutputBuffer(encoderOutputBufferIndex, false);
break;
}
if (audioEncoderOutputBufferInfo.size != 0) {
muxer.writeSampleData(
outputAudioTrack, encoderOutputBuffer, audioEncoderOutputBufferInfo);
}
if ((audioEncoderOutputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM)
!= 0) {
audioEncoderDone = true;
}
audioEncoder.releaseOutputBuffer(encoderOutputBufferIndex, false);
break;
}
if (!muxing && (encoderOutputAudioFormat != null)
&& (encoderOutputVideoFormat != null)) {
outputVideoTrack = muxer.addTrack(encoderOutputVideoFormat);
outputAudioTrack = muxer.addTrack(encoderOutputAudioFormat);
muxer.start();
muxing = true;
}
}
}
private static boolean isVideoFormat(MediaFormat format) {
return getMimeTypeFor(format).startsWith("video/");
}
private static boolean isAudioFormat(MediaFormat format) {
return getMimeTypeFor(format).startsWith("audio/");
}
private static String getMimeTypeFor(MediaFormat format) {
return format.getString(MediaFormat.KEY_MIME);
}
private static MediaCodecInfo selectCodec(String mimeType) {
int numCodecs = MediaCodecList.getCodecCount();
for (int i = 0; i < numCodecs; i++) {
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
if (!codecInfo.isEncoder()) {
continue;
}
String[] types = codecInfo.getSupportedTypes();
for (int j = 0; j < types.length; j++) {
if (types[j].equalsIgnoreCase(mimeType)) {
return codecInfo;
}
}
}
return null;
}
}
......@@ -54,12 +54,12 @@ public class FullscreenableChromeClient extends WebChromeClient {
this.onShowCustomView(view, callback);
}
@Override
public void onHideCustomView() {
if (mCustomView == null) {
return;
}
setFullscreen(false);
FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
decor.removeView(mFullscreenContainer);
......@@ -67,23 +67,20 @@ public class FullscreenableChromeClient extends WebChromeClient {
mCustomView = null;
mCustomViewCallback.onCustomViewHidden();
mActivity.setRequestedOrientation(mOriginalOrientation);
}
private void setFullscreen(boolean enabled) {
Window win = mActivity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
int resourceId = mActivity.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
if (enabled) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
if (mCustomView != null) {
mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
View decorView = win.getDecorView();
mCustomView.setPadding(0,0,0, mActivity.getResources().getDimensionPixelSize(resourceId));
ViewGroup.LayoutParams param = mCustomView.getLayoutParams();
param.width = ViewGroup.LayoutParams.MATCH_PARENT;
mCustomView.setLayoutParams(param);
}
win.setAttributes(winParams);
}
private static class FullscreenHolder extends FrameLayout {
......
package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentObjectLogLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
public class CommunicationWebViewActivity extends ABVAuthenticatedActivity {
private static final String TAG = "CommunicationWebViewActivity";
private LinearLayout historyLayout;
private ImageButton addSceneButton;
protected ImageButton promoteBtn;
protected ImageButton pauseBtn;
protected ImageButton mBtnRemoteStart;
protected Button historyListBtn;
protected ImageButton btnWebClose;
protected Button closeButton;
protected Button btnLinkOriginalBack;
protected Button btnWebBack;
protected Button btnWebForward;
private ProgressBar m_progress;
protected ContentDto mContentDto;
protected File mLocalFile;
public final static int ABOOK_CHECK_TASK_IMAGE = 103;
public final static int ABOOK_CHECK_TASK_VIDEO = 104;
@Override
protected void onDestroy() {
Logger.d(TAG, "onDestroy");
super.onDestroy();
}
protected Uri attachmentImageProcessing(Uri uri) throws Exception {
if (uri == null) {
return null;
}
String[] operationion = {MediaStore.MediaColumns.DATA};
Cursor cursor = getContentResolver().query(uri, operationion, null, null, null);
String photoFilePath = ABookCheckWebViewHelper.getInstance().contentSchemeUriToFilePath(cursor);
try {
int rotationAngle = ABookCheckWebViewHelper.getInstance().rotateBitmapOrientation(photoFilePath);
mLocalFile = new File(photoFilePath);
if (mLocalFile.exists()) {
return Uri.fromFile(mLocalFile);
}
} catch (FileNotFoundException e) {
Logger.e(TAG, "image file is not found", e);
}
return null;
}
}
......@@ -76,6 +76,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.concurrent.ConcurrentHashMap;
import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
......@@ -118,6 +119,7 @@ import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.launcher.android.R.id;
import jp.agentec.abook.abv.ui.common.activity.ABVAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppColor;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -135,6 +137,8 @@ import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVEditText;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.common.vo.Size;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationRelatedContentActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.Interface.MovePageInterface;
......@@ -333,6 +337,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
// 移動・タップモードのフラグ
public boolean mMoveTaskFlg = false;
/**
* スクロールステータス
*/
......@@ -347,6 +353,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
Logger.i(TAG, "[onCreate]:contentId=" + getContentId());
super.onCreate(savedInstanceState);
// 全画面表示
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
......@@ -704,6 +711,15 @@ public class ContentViewActivity extends ABVContentViewActivity {
setToolbarVisableForTask(true);
}
}
if (isCollaboration) {
if (mPageNumberLayout != null) {
mPageNumberLayout.setVisibility(View.GONE);
}
if (mSeekBarLayout != null) {
mSeekBarLayout.setVisibility(View.GONE);
}
}
}
private void configureSize() {
......@@ -941,6 +957,14 @@ public class ContentViewActivity extends ABVContentViewActivity {
showMeetingExitDialog();
}
});
if (isCollaboration) {
titleTxt.setVisibility(View.GONE);
pauseBtn.setVisibility(View.GONE);
exitMeetingBtn.setVisibility(View.GONE);
exitBtn.setVisibility(View.GONE);
promoteBtn.setVisibility(View.GONE);
}
}
private boolean addPageViewFinish;
......@@ -1390,6 +1414,16 @@ public class ContentViewActivity extends ABVContentViewActivity {
mBtnRemoteStart.setVisibility(View.GONE);
}
}
if (isCollaboration) {
mHistoryBtn.setVisibility(View.GONE);
indexBtn.setVisibility(View.GONE);
search.setVisibility(View.GONE);
marking.setVisibility(View.GONE);
bookmark.setVisibility(View.GONE);
subMenuBtn.setVisibility(View.GONE);
tvContentTitle.setVisibility(View.GONE);
}
}
private void setMarkingViewVisibility(boolean visible){
......@@ -1758,6 +1792,14 @@ public class ContentViewActivity extends ABVContentViewActivity {
// ページ番号を表示する
setCurrentPageNumber();
}
if (isCollaboration) {
bookmark.setVisibility(View.GONE);
if (hasMultiPages) {
mPageNumberLayout.setVisibility(View.GONE);
mSeekBarLayout.setVisibility(View.GONE);
}
}
}
else {
if (hasMultiPages) {
......@@ -1823,6 +1865,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
exitMeetingBtn.setVisibility(View.VISIBLE);
}
}
mToolBar.setVisibility(visability);
}
......@@ -1859,7 +1902,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
} else {
TranslateAnimation toolBarAnimation;
if (mToolBar.getVisibility() == View.GONE) {
if (mToolBar.getVisibility() == View.GONE && !(meetingManager.isSubscribed() && isCollaboration)) {
setToolbarVisable(true);
toolBarAnimation = new TranslateAnimation(0, 0, -mToolBar.getHeight(), 0);
Logger.d(TAG, "[singleTapMotion]:[mToolBar]:VISIBLE");
......@@ -2641,8 +2684,20 @@ public class ContentViewActivity extends ABVContentViewActivity {
break;
case ActionInfoJSON.CONTENTLINK_ACTION:
//コンテンツリンクに紐づいたAction Buttonのイベント
if (meetingManager.isCollaboration()) {
final ABookAlertDialog nonTargetMeetingContentDialog = AlertDialogUtil.createAlertDialog(ContentViewActivity.this, R.string.app_name);
nonTargetMeetingContentDialog.setCancelable(false);
nonTargetMeetingContentDialog.setMessage(isCollaboration? R.string.msg_non_target_document_collaboration_content : R.string.msg_non_target_meeting_content);
nonTargetMeetingContentDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
nonTargetMeetingContentDialog.dismiss();
}
});
nonTargetMeetingContentDialog.show();
break;
}
long linkContentId = actionInfoJSON.getContentId();
// プロジェクト関連資料なのかをチェック
if (ActivityHandlingHelper.getInstance().isExistCommonContent(getContentId())) {
if (!ActivityHandlingHelper.getInstance().isExistCommonContent(linkContentId)) {
......
......@@ -394,7 +394,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
printButtonActivityControl();
historyListBtn.setVisibility(View.GONE);
if (isLinkedContent) {
if (ContentJSON.KEY_MOVIE_TYPE.equals(mContentDto.contentType) || ContentJSON.KEY_MUSIC_TYPE.equals(mContentDto.contentType)
|| ContentJSON.KEY_PANO_IMAGE_TYPE.equals(mContentDto.contentType) || ContentJSON.KEY_PANO_MOVIE_TYPE.equals(mContentDto.contentType)
......@@ -427,7 +426,9 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
} else {
configureRemote();
}
if (meetingManager.isCollaboration()) {
exitMeetingBtn.setVisibility(View.GONE);
}
}
private class JsInf {
......
......@@ -86,8 +86,8 @@ is_check_invalid_passward_limit=true
repeat_default=true
#Setting Info(設定画面のABookについての設定情報)
version_name=1.3.101
release_date=2021/05/18
version_name=1.3.102
release_date=2021/06/11
copy_right=2016 AGENTEC Co.,Ltd. All rights reserved.
hope_page=http://www.agentec.jp
contact_email=abook-appsupport@agentec.jp
......
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