Commit 02afc046 by onuma

文字列を外部リソースに移動、SQL修正他

parent 3ed63fe8
......@@ -70,7 +70,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
sql.append(" FROM m_chat_group mygroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on mygroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE mygroup.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1)");
sql.append(" WHERE mygroup.group_id IN (select group_id from m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1)");
return rawQueryGetStringList(sql.toString(), null);
}
......@@ -83,7 +83,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
sql.append(" END AS group_path, usergroup.group_id ");
sql.append(" FROM m_chat_group usergroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup ON parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE usergroup.group_id IN ");
sql.append(" (SELECT group_id ");
sql.append(" FROM m_shop_member sm INNER JOIN r_shop_member_group rsmg on sm.shop_member_id = rsmg.shop_member_id ");
......@@ -156,11 +156,11 @@ public class ChatGroupDao extends AbstractCommunicationDao {
}
public ChatGroupDto getGroup(int groupId) {
return rawQueryGetDto("select * from m_chat_group where group_id = " + groupId, null, ChatGroupDto.class);
return rawQueryGetDto("SELECT * from m_chat_group WHERE group_id = " + groupId, null, ChatGroupDto.class);
}
public List<ChatGroupDto> getFavoriteGroup() {
return rawQueryGetDtoList("select * from m_chat_group where favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, ChatGroupDto.class);
return rawQueryGetDtoList("SELECT * from m_chat_group WHERE favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, ChatGroupDto.class);
}
public List<ChatGroupDto> getGroupByName(String[] keywords) {
......@@ -187,10 +187,10 @@ public class ChatGroupDao extends AbstractCommunicationDao {
StringBuffer sql = new StringBuffer();
sql.append(" WITH group_loop AS ");
sql.append(" ( ");
sql.append(" SELECT 1 rownum, group_id, group_name, parent_group_id from m_chat_group where group_id = ? ");
sql.append(" SELECT 1 rownum, group_id, group_name, parent_group_id FROM m_chat_group WHERE group_id = ? ");
sql.append(" UNION ALL ");
sql.append(" SELECT rownum+1 rownum, parent.group_id, parent.group_name, parent.parent_group_id ");
sql.append(" FROM group_loop inner join m_chat_group parent on parent.group_id = group_loop.parent_group_id ");
sql.append(" FROM group_loop inner JOIN m_chat_group parent on parent.group_id = group_loop.parent_group_id ");
sql.append(" ) ");
sql.append(" SELECT * FROM group_loop ORDER BY group_loop.rownum DESC ");
......@@ -200,24 +200,24 @@ public class ChatGroupDao extends AbstractCommunicationDao {
public List<ChatGroupDto> getGroupChildList(int parentId) {
List<ChatGroupDto> list;
list = rawQueryGetDtoList("select * from m_chat_group mg where (mg.parent_group_id = ?) ORDER BY group_name", new String[]{""+ parentId}, ChatGroupDto.class);
list = rawQueryGetDtoList("SELECT * FROM m_chat_group mg WHERE (mg.parent_group_id = ?) ORDER BY group_name", new String[]{""+ parentId}, ChatGroupDto.class);
return list;
}
public ChatGroupDto getRootGroup() {
return rawQueryGetDto("select * from m_chat_group mg where (mg.parent_group_id = 0)",null, ChatGroupDto.class);
return rawQueryGetDto("SELECT * FROM m_chat_group mg WHERE (mg.parent_group_id = 0)",null, ChatGroupDto.class);
}
public ChatGroupDto getParentGroup(Integer childGroupId) {
return rawQueryGetDto("select parent.* from m_chat_group parent inner join m_chat_group child on child.parent_group_id = parent.group_id where child.group_id = ?", new String[]{""+ childGroupId}, ChatGroupDto.class);
return rawQueryGetDto("SELECT parent.* from m_chat_group parent INNER JOIN m_chat_group child on child.parent_group_id = parent.group_id WHERE child.group_id = ?", new String[]{""+ childGroupId}, ChatGroupDto.class);
}
public boolean isExistParent(int baseId) {
return rawQueryGetInt("select * from m_chat_group where parent_group_id = " + baseId, null) > 0;
return rawQueryGetInt("SELECT * FROM m_chat_group WHERE parent_group_id = " + baseId, null) > 0;
}
public List<ChatGroupDto> getMyGroups() {
return rawQueryGetDtoList("select * from m_chat_group where group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1) ORDER BY group_name ASC", null, ChatGroupDto.class);
return rawQueryGetDtoList("SELECT * FROM m_chat_group WHERE group_id IN (SELECT group_id from m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ORDER BY group_name ASC", null, ChatGroupDto.class);
}
public void insertGroupList(List<ChatGroupDto> groupList) {
......@@ -277,13 +277,13 @@ public class ChatGroupDao extends AbstractCommunicationDao {
public void deleteGroupList(List<ChatGroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" delete from m_chat_group ");
sql.append(" DELETE FROM m_chat_group ");
sql.append(" WHERE group_id = ? ");
try {
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 });
update("DELETE FROM r_shop_member_group WHERE group_id = ? ", new Object[] { groupDto.groupId });
}
commit();
} catch (Exception e) {
......@@ -292,6 +292,4 @@ public class ChatGroupDao extends AbstractCommunicationDao {
throw new RuntimeException(e);
}
}
}
......@@ -187,7 +187,7 @@ public class ChatMessageDao extends AbstractCommunicationDao {
}
public void insertChatMessage(ChatMessageDto dto) {
insert("insert or replace into t_chat_message (chat_message_id, chat_room_id, shop_member_id, login_id, message, message_type, image_name, download_file_name, save_path, insert_date, unread_count) values (?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
insert("INSERT OR replace INTO t_chat_message (chat_message_id, chat_room_id, shop_member_id, login_id, message, message_type, image_name, download_file_name, save_path, insert_date, unread_count) VALUES (?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) {
......@@ -205,15 +205,15 @@ public class ChatMessageDao extends AbstractCommunicationDao {
}
public boolean updateChatMessage(ChatMessageDto dto) {
long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, login_id=?,message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=?, unread_count where chat_message_id=?", dto.getUpdateValues());
long count = update("UPDATE t_chat_message set chat_room_id=?, shop_member_id=?, login_id=?,message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=?, unread_count WHERE chat_message_id=?", dto.getUpdateValues());
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});
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});
update("UPDATE t_chat_message set unread_count = ? WHERE chat_message_id=?", new String[]{"" + messageDto.unreadCount, "" + messageDto.chatMessageId});
}
commit();
}
......
......@@ -2,16 +2,12 @@ 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;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -58,22 +54,22 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public List<ShopMemberDto> getAllShopMember() {
List<ShopMemberDto> list = rawQueryGetDtoList("select * from m_shop_member", null, ShopMemberDto.class);
List<ShopMemberDto> list = rawQueryGetDtoList("SELECT * FROM m_shop_member", null, ShopMemberDto.class);
return list;
}
public ShopMemberDto getShopMember(int shopMemberId) {
return rawQueryGetDto("select * from m_shop_member where shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class);
return rawQueryGetDto("SELECT * FROM m_shop_member WHERE shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class);
}
public void insertShopMember(ShopMemberDto dto) {
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());
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});
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});
insert("INSERT OR REPLACE INTO r_shop_member_group (shop_member_id, group_id) VALUES ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
}
commit();
......@@ -89,10 +85,10 @@ public class ShopMemberDao extends AbstractCommunicationDao {
try {
beginTransaction();
for (ShopMemberDto dto : dtoList) {
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());
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) { continue; }
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});
insert("INSERT OR REPLACE INTO r_shop_member_group (shop_member_id, group_id) VALUES ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
}
commit();
......@@ -107,9 +103,9 @@ 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 });
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});
insert("INSERT OR REPLACE INTO r_shop_member_group (shop_member_id, group_id) VALUES ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
} catch (Exception e) {
rollback();
......@@ -120,11 +116,11 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public ShopMemberDto getMyInfo() {
return rawQueryGetDto("select * from m_shop_member where self_flg = 1", null, ShopMemberDto.class);
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[]{});
update("UPDATE m_shop_member SET self_flg = 0", new String[]{});
}
public List<ShopMemberDto> getUserInRoom(Integer chatRoomId) {
......@@ -196,7 +192,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public List<ShopMemberDto> getfavoriteUserList() {
return rawQueryGetDtoList("select * from m_shop_member where favorite_register_date NOT NULL", null, ShopMemberDto.class);
return rawQueryGetDtoList("SELECT * FROM m_shop_member WHERE favorite_register_date NOT NULL", null, ShopMemberDto.class);
}
public List<ShopMemberDto> getfavoriteUserListNotInRoom(Integer roomId) {
......@@ -257,7 +253,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append("WHERE rsmg.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1) ");
sql.append("WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ");
sql.append(" AND sm.self_flg != 1 ");
ArrayList<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
......@@ -286,7 +282,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1)");
sql.append(" WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1)");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_id NOT IN (SELECT shop_member_id FROM r_chat_room_shop_member WHERE chat_room_id = ?)");
ArrayList<String> whereSqlList = new ArrayList<String>();
......@@ -389,12 +385,12 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public boolean updateShopMember(ShopMemberDto dto) {
long count = update("update m_shop_member set shop_member_name=?, profile_url=? where shop_member_id=?", dto.getUpdateValues());
long count = update("UPDATE m_shop_member SET shop_member_name=?, profile_url=? WHERE shop_member_id=?", dto.getUpdateValues());
return count > 0;
}
public boolean deleteShopMember(ShopMemberDto dto) {
long count = update("delete from m_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
long count = update("DELETE FROM m_shop_member WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
return count > 0;
}
......@@ -402,9 +398,9 @@ public class ShopMemberDao extends AbstractCommunicationDao {
try {
beginTransaction();
for (ShopMemberDto dto : dtoList) {
update("delete from r_shop_member_group where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("delete from r_chat_room_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("delete from m_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("DELETE FROM r_shop_member_group WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("DELETE FROM r_chat_room_shop_member WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("DELETE FROM m_shop_member WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
}
commit();
} catch (Exception e) {
......@@ -417,7 +413,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public boolean updateFavoriteUser(ShopMemberDto dto) {
long count = update("update m_shop_member set favorite_register_date=? where shop_member_id=?", new Object[]{dto.favoriteRegisterDate, dto.shopMemberId});
long count = update("UPDATE m_shop_member SET favorite_register_date=? WHERE shop_member_id=?", new Object[]{dto.favoriteRegisterDate, dto.shopMemberId});
return count > 0;
}
......@@ -427,7 +423,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
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});
update("UPDATE m_shop_member SET favorite_register_date=? WHERE shop_member_id=?", new Object[]{favoriteUserDto.favoriteRegisterDate, favoriteUserDto.shopMemberId});
}
commit();
}
......
......@@ -1490,9 +1490,11 @@
<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>
<!-- Communication 会議室 -->
<string name="msg_error_favorites_100_over">お気に入りは最大100件までです。</string>
<string name="msg_eroor_network_offline">接続しているネットワークがありません。</string>
<string name="msg_error_connection_error_meeting_room">会議室サーバに接続できませんでした。</string>
</resources>
......@@ -1498,4 +1498,8 @@
<string name="not_found_camera">사용 가능한 카메라 기기를 찾을수 없습니다.</string>
<string name="msg_destroy_exist_collaboration">진행중인 협업이 존재합니다. 기존 협업을 종료하고 새로운 협업을 시작 하시겠습니까?</string>
<string name="error_fail_record">레코드에 실패했습니다. 관리자에게 문의해주세요.</string>
<!-- Communication 会議室 -->
<string name="msg_error_favorites_100_over">즐겨찾기는 최대 100개까지 입니다.</string>
<string name="msg_eroor_network_offline">연결된 네트워크가 없습니다.</string>
<string name="msg_error_connection_error_meeting_room">회의실 서버에 연결할 수 없습니다.</string>
</resources>
\ No newline at end of file
......@@ -1495,4 +1495,8 @@
<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>
<!-- Communication 会議室 -->
<string name="msg_error_favorites_100_over">You can have up to 100 favorites.</string>
<string name="msg_eroor_network_offline">There is no network connected.</string>
<string name="msg_error_connection_error_meeting_room">Could not connect to the meeting room server.</string>
</resources>
......@@ -26,6 +26,7 @@ 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.ViewGroup;
......@@ -56,12 +57,18 @@ 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.ArchiveListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChangeRoomNameJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteGroupJSON;
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;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
......@@ -70,7 +77,10 @@ import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.MeetingDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
......@@ -85,6 +95,7 @@ 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.constant.NaviConsts;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.Interface.ChatRoomEventListener;
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;
......@@ -94,13 +105,14 @@ import jp.agentec.abook.abv.ui.viewer.activity.CommunicationWebViewActivity;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil;
import static jp.agentec.abook.abv.bl.common.constant.ABookCommConstants.DEFAULT_CHECKSUM;
import static org.chromium.net.NetError.ERR_FAILED;
/**
* Created by AIS-NB-048 on 2019/07/31.
*/
public class ChatWebViewActivity extends CommunicationWebViewActivity {
public class ChatWebViewActivity extends CommunicationWebViewActivity implements ChatRoomEventListener {
public ChatWebView mChatWebView;
private String chatWebviewUrl;
......@@ -153,9 +165,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
//setContentView(R.layout.chat_webview);
FrameLayout layout = new FrameLayout(this);
FrameLayout.LayoutParams param = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
//layout.addView(mChatWebView, param);
//addContentView(disasterView_, param);
setContentView(mChatWebView, param);
}
......@@ -187,7 +196,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
//mChatWebView = findViewById(R.id.chatWebview);
mChatWebView.init();
mChatWebView.setCommunicationLogic(communicationLogic);
mChatWebView.setChatWebViewActivity(this);
mChatWebView.setChatRoomEventListener(this);
}
private void setupDefaultChatWebViewURL() {
......@@ -313,6 +322,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
// WebView内のAlert Dialogを処理する
// message.equals で、 fermi側のHTMLを解析して、処理を分けている。
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
if (mChatWebView.getUrl() != null && mChatWebView.getUrl().equals(ABookCommConstants.COLLABORATION_PAGE_URL)) {
......@@ -406,6 +416,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
// WebView内のConfirm Dialogを処理する
// message.equals で、 fermi側のHTMLを解析して、処理を分けている。
@Override
public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
if (message.equals("Do you want to leave this room?")) {
......@@ -657,6 +668,11 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
});
}
@Override
public void showCommunicationChatMenuDialog() {
showCommunicationMenuDialog();
}
// 保存するファイルをjpgに固定する
public String getFileName(String url) {
String filenameWithoutExtension = "";
......@@ -665,6 +681,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return filenameWithoutExtension;
}
@Override
public void getLogin() {
// ローカルの言語を確認する
String localLanguage = ActivityHandlingHelper.getInstance().getLocaleFileName();
......@@ -689,6 +706,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
}
@Override
public void getQueryParam() {
String chatServerUrl = ABVEnvironment.getInstance().websocketServerHttpUrl;
chatServerUrl= chatServerUrl.substring(0, chatServerUrl.length() - 3);
......@@ -828,6 +846,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
/**
* 作業一覧へ遷移
*/
@Override
public void backToHome() {
mChatWebView.loadUrl("javascript:CHAT.leaveRoom()");
exitAndDeleteMeetingRoom();
......@@ -1034,6 +1053,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
// 共通資料画面表示
@Override
public void showCommonContent() {
Intent intent = new Intent();
intent.setClass(ChatWebViewActivity.this, OperationRelatedContentActivity.class);
......@@ -1157,4 +1177,474 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
communicationLogic.insertShopMember(resultJson.shopMemberDtoArrayList);
updateUnreadCount();
}
@Override
public void setSelectedUserIdList(String userList) {
selectedUserIdList = userList;
}
@Override
public String getSelectedUserList() {
String userList = communicationLogic.getUserList(selectedUserIdList);
Log.d("getSelectedUserList " , userList );
return userList;
}
@Override
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
communicationLogic.insertChatRoomList(resultJson.roomList);
}
@Override
public void updateMyInfo() throws NetworkDisconnectedException, AcmsException {
updateMyInfoFromServer();
}
@Override
public void updateGroupUser() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer();
}
@Override
public void createChatRoom(String roomType, String userIdList, String encodedRoomName, String screenFlg, boolean isVoice) throws NetworkDisconnectedException, AcmsException {
CreatedRoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).createRoom(sid, roomType, userIdList, encodedRoomName, loginId);
if (ABookCommConstants.FLAG.SCREEN_FLG.MAKE_ROOM.equals(Integer.parseInt(screenFlg))) {
final ChatRoomDto chatRoomDto = communicationLogic.getChatRoom(resultJson.chatRoomDto.chatRoomId);
if (chatRoomDto != null) {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(String.format("javascript:CHAT_UI.displayExistRoom('%s');", chatRoomDto.chatRoomId.toString()));
}
});
return;
}
}
communicationLogic.insertChatRoom(resultJson.chatRoomDto);
communicationLogic.addUserInRoom(StringUtil.join(",", userIdList, shopMemberId.toString()), resultJson.chatRoomDto.chatRoomId);
final Integer chatRoomId = resultJson.chatRoomDto.chatRoomId;
final String chatRoomName = resultJson.chatRoomDto.chatRoomName;
if (isVoice) {
roomId = chatRoomId.longValue();
roomName = chatRoomName;
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(String.format("javascript:CHAT_UI.startCollaboration('%s');", ABookCommConstants.FLAG.COLLABORATION_TYPE.AUDIO));
}
});
} else {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(String.format("javascript:CHAT_UI.joinRoom('%s', '%s');", chatRoomId, chatRoomName));
}
});
}
}
@Override
public void changeRoomName(String changeRoomName) throws NetworkDisconnectedException, AcmsException {
ChangeRoomNameJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeRoomName(sid, changeRoomName, roomId.intValue());
if (resultJson.status != 200) { return; }
communicationLogic.updateChatRoomName(changeRoomName, roomId.intValue());
joinRoom(roomId.toString(), changeRoomName);
}
@Override
public void joinRoom(String joinRoomId, String joinRoomName) {
ChatRoomDto chatRoom = communicationLogic.getChatRoom(Integer.parseInt(joinRoomId));
roomId = chatRoom.chatRoomId.longValue();
roomName = chatRoom.chatRoomName;
roomType = chatRoom.type.toString();
beforeRoomType = chatRoom.type.toString();
communicationLogic.roomDisplayOff(roomId.intValue(), ABookCommConstants.FLAG.ROOM_VIEW_FLAG.VISIBLE);
mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL);
}
@Override
public void roomDisplayOff(){
communicationLogic.roomDisplayOff(roomId.intValue(), ABookCommConstants.FLAG.ROOM_VIEW_FLAG.INVISIBLE);
mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_PAGE_URL);
}
@Override
public void inviteUsers(String userIds, boolean isCollaboration) throws NetworkDisconnectedException, AcmsException {
final UserInviteResultJSON result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteUsers(sid, roomId.intValue(), roomName, userIds);
if (result.roomId == null) {
communicationLogic.addUserInRoom(userIds, roomId.intValue());
if (!isCollaboration) {
mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL);
}
} else {
mChatWebView.loadChatViewUrl(String.format("javascript:CHAT_UI.displayExistRoom('%s');", result.roomId.toString()));
}
}
@Override
public String getRoomType() {
return roomType;
}
@Override
public String getBeforeRoomType() {
return beforeRoomType;
}
@Override
public void clearBeforeRoomType() {
beforeRoomType = null;
}
@Override
public void updateMessages(String roomId) throws NetworkDisconnectedException, AcmsException {
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();
}
@Override
public String searchMessages(String keyword, String userList) {
String messageListStr = communicationLogic.searMessages(roomId.intValue(), keyword, userList);
return messageListStr;
}
@Override
public String getFavoriteUsersNotInRoom() {
String favoriteUsersStr = communicationLogic.getFavoriteUsersNotInRoom(roomId.intValue());
return favoriteUsersStr;
}
@Override
public String getMyGroupUsersNotInRoom() {
String myGroupUsersStr = communicationLogic.getMyGroupUsersNotInRoom(roomId.intValue());
return myGroupUsersStr;
}
@Override
public String getMyGroupShopMemberNotInRoomByName(String keywords) {
String searchUserStr = communicationLogic.getMyGroupUserNotInRoomByName(keywords, roomId.intValue());
return searchUserStr;
}
@Override
public String getAllGroupShopMemberNotInRoomByName(String keywords) {
String searchUserStr = communicationLogic.getAllGroupShopMemberNotInRoomByName(keywords, roomId.intValue());
return searchUserStr;
}
@Override
public void updateUserInfo(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
updateUserInfoFromServer(shopMemberId);
}
@Override
public String getGroupInfoForAddUser(String groupId) {
String groupInfoStr = communicationLogic.getGroupSearchDataForAddUser(Integer.parseInt(groupId), roomId.intValue());
return groupInfoStr;
}
@Override
public boolean addFavoriteUser(String shopMemberId) throws AcmsException {
Integer favoriteCount = communicationLogic.getFavoriteCount();
if (favoriteCount >= ABookCommConstants.SIZE.MAX_FAVORITE_COUNT ) {
mChatWebView.loadChatViewUrl("javascript:alert('" + getString(R.string.msg_error_favorites_100_over) + "');");
return false;
} else {
boolean result = false;
try {
result = insertFavoriteUser(shopMemberId);
if (!result) { return false; }
mChatWebView.loadChatViewUrl("javascript:CHAT_UI.refreshContactScreen();");
return true;
} catch (NetworkDisconnectedException e) {
mChatWebView.loadChatViewUrl("javascript:alert('" + getString(R.string.msg_eroor_network_offline) + "');");
}
}
return false;
}
@Override
public boolean removeFavoriteUser(String shopMemberId) throws AcmsException {
try {
boolean result = deleteFavoriteUser(shopMemberId);
if (!result) {
return false;
}
mChatWebView.loadChatViewUrl("javascript:CHAT_UI.refreshContactScreen();");
return true;
} catch (NetworkDisconnectedException e) {
mChatWebView.loadChatViewUrl("javascript:alert('" + getString(R.string.msg_eroor_network_offline) + "');");
}
return false;
}
@Override
public boolean addFavoriteGroup(String groupId) throws AcmsException {
Integer favoriteCount = communicationLogic.getFavoriteCount();
if (favoriteCount >= ABookCommConstants.SIZE.MAX_FAVORITE_COUNT) {
mChatWebView.loadChatViewUrl("javascript:alert('" + getString(R.string.msg_error_favorites_100_over) + "');");
return false;
} else {
boolean result = false;
try {
result = insertFavoriteGroup(groupId);
if (!result) {
return false;
}
mChatWebView.loadChatViewUrl("javascript:CHAT_UI.refreshContactScreen();");
return true;
} catch (NetworkDisconnectedException e) {
mChatWebView.loadChatViewUrl("javascript:alert('" + getString(R.string.msg_eroor_network_offline) + "');");
}
}
return false;
}
@Override
public boolean removeFavoriteGroup(String groupId) throws AcmsException {
boolean result = false;
try {
result = deleteFavoriteGroup(groupId);
if (!result) {
return false;
}
mChatWebView.loadChatViewUrl("javascript:CHAT_UI.refreshContactScreen();");
return true;
} catch (NetworkDisconnectedException e) {
mChatWebView.loadChatViewUrl("javascript:alert('" + getString(R.string.msg_eroor_network_offline) + "');");
}
return false;
}
@Override
public void updateFavorite() throws NetworkDisconnectedException, AcmsException {
updateFavoriteInfo();
}
@Override
public void updateArchiveList() throws NetworkDisconnectedException, AcmsException {
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
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_UPDATED_DATE, resultJson.archiveLastUpdateDate);
editor.commit();
}
@Override
public void updateArchiveDetail(String archiveId) throws NetworkDisconnectedException, AcmsException {
ArchiveDto archiveDto = communicationLogic.getArchive(Integer.parseInt(archiveId));
RoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoom(sid, archiveDto.roomId.toString());
archiveDto.roomName = resultJson.chatRoomDto.chatRoomName;
communicationLogic.updateArchiveDetial(archiveDto);
}
@Override
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));
}
@Override
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());
}
@Override
public void inviteCollaboration(String inviteUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteCollaboration(sid, roomId.intValue(), roomName, inviteUserIds, collaborationType);
}
@Override
public void startCollaboration(String collaborationType) {
collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.CREATE;
moveCollaborationScreen(Integer.parseInt(collaborationType));
}
@Override
public void finishCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishCollaboration(sid, roomId.intValue());
}
@Override
public void finishAllCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishAllCollaboration(sid, roomId.intValue());
}
@Override
public String getCollaborationJoinFlg() {
return collaborationJoinFlg.toString();
}
@Override
public String getCollaborationType() {
return collaborationType;
}
@Override
public String getToMoveGroupId() {
return groupId;
}
@Override
public void setToMoveGroupId(String moveToGroupId) {
groupId = moveToGroupId;
}
@Override
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);
for (MeetingDto meeting : meetingList) {
if (meeting.title.equals("Collaboration__" + roomId) && meetingManager.isOwner()) {
meetingManager.deleteMeeting(meeting.meetingId, mSkey);
}
}
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('" + getString(R.string.msg_error_connection_error_meeting_room) + "');");
}
startContentListActivity(true);
return meetingId.intValue();
}
@Override
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);
meetingManager.join(joinMeetingId, mSkey, roomId.toString(), false);
meetingManager.setCollaboration(true);
} catch (Exception e) {
mChatWebView.loadUrl("javascript:alert('" + getString(R.string.msg_error_connection_error_meeting_room) + "');");
}
startContentListActivity(false);
}
@Override
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('" + getString(R.string.msg_error_connection_error_meeting_room) + "');");
}
startContentListActivity(false);
}
@Override
public void startPipMode() {
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
}
@Override
public void exitPIPmode() {
finishPIPmode();
}
@Override
public void exitMeetingRoom() {
exitAndDeleteMeetingRoom();
finishPIPmode();
}
@Override
public int getJoinCollaborationType() {
return mCollaborationType;
}
@Override
public void setJoinCollaborationType(int collaborationType) {
mCollaborationType = collaborationType;
}
@Override
public void changeCollaboration(int changeCollaborationType, int meetingId) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeCollaboration(sid, roomId.intValue(), changeCollaborationType, meetingId);
}
@Override
public void setHostRequestFlg(int hostRequestFlg) {
mHostRequestFlg = hostRequestFlg;
}
@Override
public int getHostRequestFlg() {
return mHostRequestFlg;
}
@Override
public void finishPip() {
finishPIPmode();
}
@Override
public void setExitHostAlert() {
needHostAlert = true;
}
@Override
public boolean getExitHostAlert() {
if (needHostAlert) {
needHostAlert = false;
return true;
}
return needHostAlert;
}
@Override
public void updatePreMessage(String messageId) throws NetworkDisconnectedException, AcmsException {
if (messageId.equals("0")) {
return;
}
updateMessageFromMessageId(messageId);
}
@Override
public String getMessageListFromMessageId(String messageId) {
if (messageId.equals("0")) {
return "";
}
String messageListStr = communicationLogic.getMessagesFromMessageId(roomId.intValue(), messageId);
return messageListStr;
}
}
package jp.agentec.abook.abv.ui.home.view;
import android.app.PictureInPictureParams;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.util.Log;
import android.view.View;
......@@ -11,42 +9,24 @@ import android.webkit.WebSettings;
import android.webkit.WebView;
import java.io.File;
import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ArchiveListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChangeRoomNameJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON;
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.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
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.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.MeetingDto;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.Interface.ChatRoomEventListener;
import jp.agentec.abook.abv.ui.home.activity.OperationRelatedContentActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.StringUtil;
import static android.content.Context.MODE_PRIVATE;
import static jp.agentec.abook.abv.bl.common.constant.ABookCommConstants.DEFAULT_CHECKSUM;
public class ChatWebView extends WebView {
private Context context;
private CommunicationLogic communicationLogic;
private ChatWebViewActivity activity;
private ChatRoomEventListener listener = null;
public ChatWebView(Context context) {
super(context);
......@@ -81,14 +61,8 @@ public class ChatWebView extends WebView {
this.communicationLogic = communicationLogic;
}
public void setChatWebViewActivity(ChatWebViewActivity activity) {
this.activity = activity;
}
@JavascriptInterface
public void saveVisitRoomInfo(String roomId, String roomName) {
System.out.println("roomName : " + roomName);
System.out.println("roomId : " + roomId);
// 最後のチャットのルーム名
PreferenceUtil.putUserPref(context, AppDefType.UserPrefKey.CHAT_LAST_ROOMNAME, roomName);
// 最後のチャットのルーム
......@@ -96,30 +70,39 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void getLoginParameter() {
if (listener == null) {
return;
}
post(new Runnable() {
@Override
public void run() {
activity.getLogin();
listener.getLogin();
}
});
}
@JavascriptInterface
public void getGlobalParameter() {
if (listener == null) {
return;
}
post(new Runnable() {
@Override
public void run() {
activity.getQueryParam();
listener.getQueryParam();
}
});
}
@JavascriptInterface
public void goHome() {
if (listener == null) {
return;
}
post(new Runnable() {
@Override
public void run() {
activity.backToHome();
listener.backToHome();
}
});
......@@ -127,17 +110,23 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void openOperationRelatedContent() {
if (listener == null) {
return;
}
post(new Runnable() {
@Override
public void run() {
activity.showCommonContent();
listener.showCommonContent();
}
});
}
@JavascriptInterface
public void openCommunication() {
activity.showCommunicationMenuDialog();
if (listener == null) {
return;
}
listener.showCommunicationChatMenuDialog();
}
@JavascriptInterface
......@@ -150,6 +139,7 @@ public class ChatWebView extends WebView {
});
}
@Override
@JavascriptInterface
public void reload() {
post(new Runnable() {
......@@ -163,14 +153,18 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void saveSelectedUserList(String userIdList) {
Log.d("userIdList " , userIdList );
activity.selectedUserIdList = userIdList;
if (listener == null) {
return;
}
listener.setSelectedUserIdList(userIdList);
}
@JavascriptInterface
public String getSelectedUserList() {
String userList = communicationLogic.getUserList(activity.selectedUserIdList);
Log.d("getSelectedUserList " , userList );
return userList;
if (listener == null) {
return null;
}
return listener.getSelectedUserList();
}
@JavascriptInterface
......@@ -183,157 +177,104 @@ public class ChatWebView extends WebView {
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(activity.sid);
communicationLogic.insertChatRoomList(resultJson.roomList);
if (listener == null) {
return;
}
listener.updateRoomList();
}
@JavascriptInterface
public void updateMyInfo() throws NetworkDisconnectedException, AcmsException {
activity.updateMyInfoFromServer();
if (listener == null) {
return;
}
listener.updateMyInfo();
}
@JavascriptInterface
public void updateGroupUser() throws NetworkDisconnectedException, AcmsException {
activity.updateGroupInfoFromServer();
if (listener == null) {
return;
}
listener.updateGroupUser();
}
@JavascriptInterface
public void createChatRoom(String roomType, String userIdList, String encodedRoomName, String screenFlg, boolean isVoice) throws NetworkDisconnectedException, AcmsException {
CreatedRoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).createRoom(activity.sid, roomType, userIdList, encodedRoomName, activity.loginId);
if (ABookCommConstants.FLAG.SCREEN_FLG.MAKE_ROOM.equals(Integer.parseInt(screenFlg))) {
final ChatRoomDto chatRoomDto = communicationLogic.getChatRoom(resultJson.chatRoomDto.chatRoomId);
if (chatRoomDto != null) {
post(new Runnable() {
@Override
public void run() {
loadUrl(String.format("javascript:CHAT_UI.displayExistRoom('%s');", chatRoomDto.chatRoomId.toString()));
}
});
return;
}
}
communicationLogic.insertChatRoom(resultJson.chatRoomDto);
communicationLogic.addUserInRoom(StringUtil.join(",", userIdList, activity.shopMemberId.toString()), resultJson.chatRoomDto.chatRoomId);
final Integer chatRoomId = resultJson.chatRoomDto.chatRoomId;
final String chatRoomName = resultJson.chatRoomDto.chatRoomName;
if (isVoice) {
activity.roomId = chatRoomId.longValue();
activity.roomName = chatRoomName;
post(new Runnable() {
@Override
public void run() {
loadUrl(String.format("javascript:CHAT_UI.startCollaboration('%s');", ABookCommConstants.FLAG.COLLABORATION_TYPE.AUDIO));
}
});
} else {
post(new Runnable() {
@Override
public void run() {
loadUrl(String.format("javascript:CHAT_UI.joinRoom('%s', '%s');", chatRoomId, chatRoomName));
}
});
if (listener == null) {
return;
}
listener.createChatRoom(roomType, userIdList, encodedRoomName, screenFlg, isVoice);
}
@JavascriptInterface
public void changeRoomName(String changeRoomName) throws NetworkDisconnectedException, AcmsException {
ChangeRoomNameJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeRoomName(activity.sid, changeRoomName, activity.roomId.intValue());
if (resultJson.status != 200) { return; }
communicationLogic.updateChatRoomName(changeRoomName, activity.roomId.intValue());
joinRoom(activity.roomId.toString(), changeRoomName);
if (listener == null) {
return;
}
listener.changeRoomName(changeRoomName);
}
@JavascriptInterface
public void joinRoom(String joinRoomId, String joinRoomName) {
ChatRoomDto chatRoom = communicationLogic.getChatRoom(Integer.parseInt(joinRoomId));
activity.roomId = chatRoom.chatRoomId.longValue();
activity.roomName = chatRoom.chatRoomName;
activity.roomType = chatRoom.type.toString();
activity.beforeRoomType = chatRoom.type.toString();
communicationLogic.roomDisplayOff(activity.roomId.intValue(), ABookCommConstants.FLAG.ROOM_VIEW_FLAG.VISIBLE);
post(new Runnable() {
@Override
public void run() {
loadUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL);
}
});
if (listener == null) {
return;
}
listener.joinRoom(joinRoomId, joinRoomName);
}
@JavascriptInterface
public void roomDisplayOff() {
communicationLogic.roomDisplayOff(activity.roomId.intValue(), ABookCommConstants.FLAG.ROOM_VIEW_FLAG.INVISIBLE);
post(new Runnable() {
@Override
public void run() {
loadUrl(ABookCommConstants.CHAT_PAGE_URL);
}
});
if (listener == null) {
return;
}
listener.roomDisplayOff();
}
@JavascriptInterface
public void inviteUsers(String userIds, boolean isCollaboration) throws NetworkDisconnectedException, AcmsException {
final UserInviteResultJSON result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteUsers(activity.sid, activity.roomId.intValue(), activity.roomName, userIds);
if (result.roomId == null) {
communicationLogic.addUserInRoom(userIds, activity.roomId.intValue());
if (!isCollaboration) {
post(new Runnable() {
@Override
public void run() {
loadUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL);
}
});
}
} else {
post(new Runnable() {
@Override
public void run() {
loadUrl(String.format("javascript:CHAT_UI.displayExistRoom('%s');", result.roomId.toString()));
}
});
if (listener == null) {
return;
}
listener.inviteUsers(userIds,isCollaboration);
}
@JavascriptInterface
public String getRoomType() {
return activity.roomType;
if (listener == null) {
return null;
}
return listener.getRoomType();
}
@JavascriptInterface
public String getBeforeRoomType() {
return activity.beforeRoomType;
if (listener == null) {
return null;
}
return listener.getBeforeRoomType();
}
@JavascriptInterface
public void clearBeforeRoomType() {
activity.beforeRoomType = null;
if (listener == null) {
return;
}
listener.clearBeforeRoomType();
}
@JavascriptInterface
public void updateMessages(String roomId) throws NetworkDisconnectedException, AcmsException {
SharedPreferences pref = context.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(activity.sid, roomId, null, lastUpdatedDate);
for (ChatMessageDto chatMessageDto : resultJson.chatMessageDtoArrayList) {
chatMessageDto.chatRoomId = Integer.parseInt(roomId);
if (listener == null) {
return;
}
communicationLogic.insertMessageList(resultJson.chatMessageDtoArrayList);
communicationLogic.insertShopMember(resultJson.shopMemberDtoArrayList);
activity.updateUnreadCount();
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.MESSAGE_UPDATED_DATE + roomId, resultJson.updateDate);
editor.commit();
listener.updateMessages(roomId);
}
@JavascriptInterface
......@@ -344,8 +285,10 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public String searchMessages(String keyword, String userList) {
String messageListStr = communicationLogic.searMessages(activity.roomId.intValue(), keyword, userList);
return messageListStr;
if (listener == null) {
return null;
}
return listener.searchMessages(keyword, userList);
}
@JavascriptInterface
......@@ -356,8 +299,10 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public String getFavoriteUsersNotInRoom() {
String favoriteUsersStr = communicationLogic.getFavoriteUsersNotInRoom(activity.roomId.intValue());
return favoriteUsersStr;
if (listener == null) {
return null;
}
return listener.getFavoriteUsersNotInRoom();
}
@JavascriptInterface
......@@ -380,8 +325,10 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public String getMyGroupUsersNotInRoom() {
String myGroupUsersStr = communicationLogic.getMyGroupUsersNotInRoom(activity.roomId.intValue());
return myGroupUsersStr;
if (listener == null) {
return null;
}
return listener.getMyGroupUsersNotInRoom();
}
@JavascriptInterface
......@@ -392,8 +339,10 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public String getMyGroupShopMemberNotInRoomByName(String keywords) {
String searchUserStr = communicationLogic.getMyGroupUserNotInRoomByName(keywords, activity.roomId.intValue());
return searchUserStr;
if (listener == null) {
return null;
}
return listener.getMyGroupShopMemberNotInRoomByName(keywords);
}
@JavascriptInterface
......@@ -404,8 +353,10 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public String getAllGroupShopMemberNotInRoomByName(String keywords) {
String searchUserStr = communicationLogic.getAllGroupShopMemberNotInRoomByName(keywords, activity.roomId.intValue());
return searchUserStr;
if (listener == null) {
return null;
}
return listener.getAllGroupShopMemberNotInRoomByName(keywords);
}
@JavascriptInterface
......@@ -421,7 +372,10 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void updateUserInfo(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
activity.updateUserInfoFromServer(shopMemberId);
if (listener == null) {
return ;
}
listener.updateUserInfo(shopMemberId);
}
@JavascriptInterface
......@@ -432,8 +386,10 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public String getGroupInfoForAddUser(String groupId) {
String groupInfoStr = communicationLogic.getGroupSearchDataForAddUser(Integer.parseInt(groupId), activity.roomId.intValue());
return groupInfoStr;
if (listener == null) {
return null;
}
return listener.getGroupInfoForAddUser(groupId);
}
@JavascriptInterface
......@@ -450,145 +406,50 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public boolean addFavoriteUser(String shopMemberId) throws AcmsException {
Integer favoriteCount = communicationLogic.getFavoriteCount();
if (favoriteCount >= ABookCommConstants.SIZE.MAX_FAVORITE_COUNT ) {
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:alert('" + "お気に入りは最大100件までです。" + "');");
}
});
if (listener == null) {
return false;
} else {
boolean result = false;
try {
result = activity.insertFavoriteUser(shopMemberId);
if (!result) { return false; }
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
return true;
} catch (NetworkDisconnectedException e) {
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:alert('接続しているネットワークがありません。');");
}
});
}
}
return false;
return listener.addFavoriteUser(shopMemberId);
}
@JavascriptInterface
public boolean removeFavoriteUser(String shopMemberId) throws AcmsException {
try {
boolean result = activity.deleteFavoriteUser(shopMemberId);
if (!result) {
return false;
}
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
return true;
} catch (NetworkDisconnectedException e) {
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:alert('接続しているネットワークがありません。');");
}
});
if (listener == null) {
return false;
}
return false;
return listener.removeFavoriteUser(shopMemberId);
}
@JavascriptInterface
public boolean addFavoriteGroup(String groupId) throws AcmsException {
Integer favoriteCount = communicationLogic.getFavoriteCount();
if (favoriteCount >= ABookCommConstants.SIZE.MAX_FAVORITE_COUNT) {
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:alert('" + "お気に入りは最大100件までです。" + "');");
}
});
if (listener == null) {
return false;
} else {
boolean result = false;
try {
result = activity.insertFavoriteGroup(groupId);
if (!result) {
return false;
}
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
return true;
} catch (NetworkDisconnectedException e) {
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:alert('接続しているネットワークがありません。');");
}
});
}
}
return false;
return listener.addFavoriteGroup(groupId);
}
@JavascriptInterface
public boolean removeFavoriteGroup(String groupId) throws AcmsException {
boolean result = false;
try {
result = activity.deleteFavoriteGroup(groupId);
if (!result) {
return false;
}
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
return true;
} catch (NetworkDisconnectedException e) {
post(new Runnable() {
@Override
public void run() {
loadUrl("javascript:alert('接続しているネットワークがありません。');");
}
});
if (listener == null) {
return false;
}
return false;
return listener.removeFavoriteGroup(groupId);
}
@JavascriptInterface
public void updateFavorite() throws NetworkDisconnectedException, AcmsException {
activity.updateFavoriteInfo();
if (listener == null) {
return;
}
listener.updateFavorite();
}
@JavascriptInterface
public void updateArchiveList() throws NetworkDisconnectedException, AcmsException {
SharedPreferences pref = context.getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
String updateDate = pref.getString(ABookCommConstants.KEY.ARCHIVE_UPDATED_DATE, DEFAULT_CHECKSUM);
ArchiveListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchives(activity.sid, updateDate);
communicationLogic.updateArchives(resultJson.archiveList);
if (StringUtil.isNullOrEmpty(resultJson.archiveLastUpdateDate)) { return; }
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.ARCHIVE_UPDATED_DATE, resultJson.archiveLastUpdateDate);
editor.commit();
if (listener == null) {
return;
}
listener.updateArchiveList();
}
@JavascriptInterface
......@@ -624,66 +485,87 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void updateArchiveDetail(String archiveId) throws NetworkDisconnectedException, AcmsException {
ArchiveDto archiveDto = communicationLogic.getArchive(Integer.parseInt(archiveId));
RoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoom(activity.sid, archiveDto.roomId.toString());
archiveDto.roomName = resultJson.chatRoomDto.chatRoomName;
communicationLogic.updateArchiveDetial(archiveDto);
if (listener == null) {
return;
}
listener.updateArchiveDetail(archiveId);
}
@JavascriptInterface
public void joinCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
activity.joinMeetingId = Integer.parseInt(meetingId);
activity.collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.JOIN;
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).joinCollaboration(activity.sid, activity.roomId.intValue());
activity.moveCollaborationScreen(Integer.parseInt(collaborationType));
if (listener == null) {
return;
}
listener.joinCollaboration(collaborationType, meetingId);
}
@JavascriptInterface
public void joinChangedCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
activity.joinMeetingId = Integer.parseInt(meetingId);
activity.collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.JOIN;
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).joinCollaboration(activity.sid, activity.roomId.intValue());
if (listener == null) {
return;
}
listener.joinChangedCollaboration(collaborationType, meetingId);
}
@JavascriptInterface
public void inviteCollaboration(String inviteUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteCollaboration(activity.sid, activity.roomId.intValue(), activity.roomName, inviteUserIds, collaborationType);
if (listener == null) {
return;
}
listener.inviteCollaboration(inviteUserIds, collaborationType);
}
@JavascriptInterface
public void startCollaboration(String collaborationType) {
activity.collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.CREATE;
activity.moveCollaborationScreen(Integer.parseInt(collaborationType));
if (listener == null) {
return;
}
listener.startCollaboration(collaborationType);
}
@JavascriptInterface
public void finishCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishCollaboration(activity.sid, activity.roomId.intValue());
if (listener == null) {
return;
}
listener.finishCollaboration();
}
@JavascriptInterface
public void finishAllCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishAllCollaboration(activity.sid, activity.roomId.intValue());
if (listener == null) {
return;
}
listener.finishAllCollaboration();
}
@JavascriptInterface
public String getCollaborationJoinFlg() {
return activity.collaborationJoinFlg.toString();
if (listener == null) {
return null;
}
return listener.getCollaborationJoinFlg();
}
@JavascriptInterface
public String getCollaborationType() {
return activity.collaborationType;
if (listener == null) {
return null;
}
return listener.getCollaborationType();
}
@JavascriptInterface
public String getToMoveGroupId() {
return activity.groupId;
if (listener == null) {
return null;
}
return listener.getToMoveGroupId();
}
@JavascriptInterface
public void setToMoveGroupId(String moveToGroupId) {
activity.groupId = moveToGroupId;
listener.setToMoveGroupId(moveToGroupId);
}
@JavascriptInterface
......@@ -699,93 +581,74 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public int createContentView() {
activity.finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
activity.enterPictureInPictureMode(mPipBuilder.build());
Integer meetingId = null;
activity.meetingManager.close();
try {
activity.connectMeetingServer();
List<MeetingDto> meetingList= activity.meetingManager.getMeetingList(activity.mSkey);
for (MeetingDto meeting : meetingList) {
if (meeting.title.equals("Collaboration__" + activity.roomId) && activity.meetingManager.isOwner()) {
activity.meetingManager.deleteMeeting(meeting.meetingId, activity.mSkey);
}
}
meetingId = activity.meetingManager.createMeeting(activity.mSkey, "Collaboration_" + activity.roomId, activity.roomId.toString());
activity.meetingManager.join(meetingId, activity.mSkey, activity.roomId.toString(), true);
activity.meetingManager.setCollaboration(true);
} catch (Exception e) {
loadUrl("javascript:alert('" + "会議室サーバに接続できませんでした。" + "');");
if (listener == null) {
return 0;
}
activity.startContentListActivity(true);
return meetingId.intValue();
return listener.createContentView();
}
@JavascriptInterface
public void startContentView() throws InterruptedException {
activity.finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
activity.enterPictureInPictureMode(mPipBuilder.build());
activity.meetingManager.close();
try {
activity.connectMeetingServer();
List<MeetingDto> meetingList= activity.meetingManager.getMeetingList(activity.mSkey);
activity.meetingManager.join(activity.joinMeetingId, activity.mSkey, activity.roomId.toString(), false);
activity.meetingManager.setCollaboration(true);
} catch (Exception e) {
loadUrl("javascript:alert('" + "会議室サーバに接続できませんでした。" + "');");
if (listener == null) {
return;
}
activity.startContentListActivity(false);
listener.startContentView();
}
@JavascriptInterface
public void joinMeetingRoom(int newMeetingId) throws InterruptedException {
activity.finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
activity.enterPictureInPictureMode(mPipBuilder.build());
activity.meetingManager.close();
try {
activity.connectMeetingServer();
List<MeetingDto> meetingList= activity.meetingManager.getMeetingList(activity.mSkey);
activity.meetingManager.join(activity.joinMeetingId, activity.mSkey, activity.roomId.toString(), false);
activity.meetingManager.setCollaboration(true);
} catch (Exception e) {
loadUrl("javascript:alert('" + "会議室サーバに接続できませんでした。" + "');");
if (listener == null) {
return;
}
activity.startContentListActivity(false);
listener.joinMeetingRoom(newMeetingId);
}
@JavascriptInterface
public void startPipMode() {
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
activity.enterPictureInPictureMode(mPipBuilder.build());
if (listener == null) {
return;
}
listener.startPipMode();
}
@JavascriptInterface
public void exitPIPmode() {
activity.finishPIPmode();
if (listener == null) {
return;
}
listener.exitPIPmode();
}
@JavascriptInterface
public void exitMeetingRoom() {
activity.exitAndDeleteMeetingRoom();
activity.finishPIPmode();
if (listener == null) {
return;
}
listener.exitMeetingRoom();
}
@JavascriptInterface
public int getJoinCollaborationType() {
return activity.mCollaborationType;
if (listener == null) {
return 0;
}
return listener.getJoinCollaborationType();
}
@JavascriptInterface
public void setJoinCollaborationType(int collaborationType) {
activity.mCollaborationType = collaborationType;
if (listener == null) {
return;
}
listener.setJoinCollaborationType(collaborationType);
}
@JavascriptInterface
public void changeCollaboration(int changeCollaborationType, int meetingId) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeCollaboration(activity.sid, activity.roomId.intValue(), changeCollaborationType, meetingId);
if (listener == null) {
return;
}
listener.changeCollaboration(changeCollaborationType, meetingId);
}
@JavascriptInterface
......@@ -803,47 +666,74 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void setHostRequestFlg(int hostRequestFlg) {
activity.mHostRequestFlg = hostRequestFlg;
if (listener == null) {
return;
}
listener.setHostRequestFlg(hostRequestFlg);
}
@JavascriptInterface
public int getHostRequestFlg() {
return activity.mHostRequestFlg;
if (listener == null) {
return 0;
}
return listener.getHostRequestFlg();
}
@JavascriptInterface
public void finishPip() {
activity.finishPIPmode();
if (listener == null) {
return;
}
listener.finishPip();
}
@JavascriptInterface
public void setExitHostAlert() {
activity.needHostAlert = true;
if (listener == null) {
return;
}
listener.setExitHostAlert();
}
@JavascriptInterface
public boolean getExitHostAlert() {
if (activity.needHostAlert) {
activity.needHostAlert = false;
return true;
if (listener == null) {
return false;
}
return activity.needHostAlert;
return listener.getExitHostAlert();
}
@JavascriptInterface
public void updatePreMessage(String messageId) throws NetworkDisconnectedException, AcmsException {
if (messageId.equals("0")) {
if (listener == null) {
return;
}
activity.updateMessageFromMessageId(messageId);
listener.updatePreMessage(messageId);
}
@JavascriptInterface
public String getMessageListFromMessageId(String messageId) {
if (messageId.equals("0")) {
return "";
if (listener == null) {
return null;
}
String messageListStr = communicationLogic.getMessagesFromMessageId(activity.roomId.intValue(), messageId);
return messageListStr;
return listener.getMessageListFromMessageId(messageId);
}
public void setChatRoomEventListener(ChatRoomEventListener listener) {
this.listener = listener;
}
public void removeChatRoomEventListener() {
this.listener = null;
}
public void loadChatViewUrl(final String urlString) {
post(new Runnable() {
@Override
public void run() {
loadUrl(urlString);
}
});
}
}
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