Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
66352a60
Commit
66352a60
authored
Jul 15, 2021
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ActivityからDataクラスを分離した。
parent
0cd2a8de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
515 additions
and
315 deletions
+515
-315
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
+9
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/data/ChatData.java
+375
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebViewActivity.java
+101
-277
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/view/ChatWebView.java
+30
-38
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
View file @
66352a60
...
...
@@ -93,6 +93,15 @@ public interface ABookCommConstants {
String
FILE
=
"file"
;
String
COLLABORATION
=
"collaboration"
;
}
String
SHOP_NAME
=
"shopName"
;
String
LANGUAGE_CODE
=
"languageCode"
;
String
SID
=
"sid"
;
String
ROOM_ID_UPPERCASE_D
=
"roomID"
;
String
CHAT_URL
=
"chatURL"
;
String
CMS_URL
=
"cmsURL"
;
String
IS_ONLINE
=
"isOnline"
;
String
IS_MOBILE
=
"isMobile"
;
String
PLATFORM
=
"platform"
;
}
interface
FLAG
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/data/ChatData.java
0 → 100644
View file @
66352a60
package
jp
.
agentec
.
abook
.
abv
.
data
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
org.json.adf.JSONObject
;
import
java.util.ArrayList
;
import
java.util.List
;
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.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.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.dto.ArchiveDto
;
import
jp.agentec.abook.abv.bl.dto.ChatMessageDto
;
import
jp.agentec.abook.abv.bl.dto.ChatRoomDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.CommunicationLogic
;
import
jp.agentec.adf.util.CollectionUtil
;
import
jp.agentec.adf.util.StringUtil
;
public
class
ChatData
{
private
Context
context
;
public
String
sid
;
public
String
roomName
;
public
String
loginId
;
public
String
shopName
;
public
Integer
shopMemberId
;
private
boolean
isOnline
;
public
String
groupId
;
public
Long
roomId
;
public
String
roomType
;
private
String
strCollaborationType
;
private
String
beforeRoomType
;
public
Integer
joinMeetingId
;
private
boolean
isMobile
;
// 0:協業生成, 1:協業参加
private
Integer
collaborationJoinFlg
=
0
;
private
String
languageCode
;
// サーバー情報
private
String
chatServerUrl
;
private
String
cmsServerUrl
;
private
int
mHostRequestFlg
=
0
;
private
CommunicationLogic
communicationLogic
=
AbstractLogic
.
getLogic
(
CommunicationLogic
.
class
);
private
static
ChatData
instance
=
null
;
// シングルトン
public
static
synchronized
ChatData
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
ChatData
();
}
return
instance
;
}
private
ChatData
()
{
}
public
void
setContext
(
Context
context
)
{
this
.
context
=
context
;
}
public
void
setSid
(
String
sid
)
{
this
.
sid
=
sid
;
}
public
String
getSid
()
{
return
sid
;
}
public
void
setRoomID
(
Long
roomID
)
{
this
.
roomId
=
roomID
;
}
public
Long
getRoomID
()
{
return
roomId
;
}
public
void
setBeforeRoomType
(
String
beforeRoomType
)
{
this
.
beforeRoomType
=
beforeRoomType
;
}
public
String
getBeforeRoomType
()
{
return
beforeRoomType
;
}
public
void
setCollaborationJoinFlg
(
Integer
collaborationJoinFlg
)
{
this
.
collaborationJoinFlg
=
collaborationJoinFlg
;
}
public
void
setStrCollaborationType
(
String
strCollaborationType
)
{
this
.
strCollaborationType
=
strCollaborationType
;
}
public
void
setLanguageCode
(
String
code
)
{
languageCode
=
code
;
}
public
String
getLanguageCode
()
{
return
languageCode
;
}
public
String
getChatServerUrl
()
{
return
chatServerUrl
;
}
public
void
setChatServerUrl
(
String
chatServerUrl
)
{
this
.
chatServerUrl
=
chatServerUrl
;
}
public
String
getCmsServerUrl
()
{
return
cmsServerUrl
;
}
public
void
setCmsServerUrl
(
String
cmsServerUrl
)
{
this
.
cmsServerUrl
=
cmsServerUrl
;
}
public
void
setIsOnline
(
boolean
isOnline
)
{
this
.
isOnline
=
isOnline
;
}
public
boolean
getIsOnline
()
{
return
isOnline
;
}
public
void
setIsMobile
(
boolean
isMobile
)
{
this
.
isMobile
=
isMobile
;
}
public
void
updateMyInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getMyInfo
(
sid
);
if
(
resultJson
.
shopMemberDto
!=
null
)
{
communicationLogic
.
insertMyInfo
(
resultJson
.
shopMemberDto
);
}
}
public
void
updateUserInfoFromServer
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
getNameCard
(
sid
,
shopMemberId
);
communicationLogic
.
insertShopMember
(
resultJson
.
shopMemberDto
);
}
public
boolean
insertFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
insertFavoriteUser
(
sid
,
Integer
.
parseInt
(
shopMemberId
));
if
(!
result
)
{
return
false
;
}
List
<
Integer
>
shopMeberIds
=
new
ArrayList
<>();
shopMeberIds
.
add
(
Integer
.
parseInt
(
shopMemberId
));
communicationLogic
.
updateFavoriteUser
(
shopMeberIds
);
return
result
;
}
public
boolean
deleteFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
deleteFavoriteUser
(
sid
,
Integer
.
parseInt
(
shopMemberId
));
if
(
result
)
{
List
<
Integer
>
deleteFavoriteList
=
new
ArrayList
<
Integer
>();
deleteFavoriteList
.
add
(
Integer
.
parseInt
(
shopMemberId
));
communicationLogic
.
deleteavoriteUser
(
deleteFavoriteList
);
}
return
result
;
}
public
boolean
insertFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
insertFavoriteGroup
(
sid
,
Integer
.
parseInt
(
groupId
));
return
result
;
}
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
();
}
public
void
updateRoomList
()
throws
NetworkDisconnectedException
,
AcmsException
{
RoomListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getRoomList
(
sid
);
communicationLogic
.
insertChatRoomList
(
resultJson
.
roomList
);
}
/**
*
* @param changeRoomName
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
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);
}
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
);
}
public
void
updateArchiveList
()
throws
NetworkDisconnectedException
,
AcmsException
{
SharedPreferences
pref
=
context
.
getSharedPreferences
(
ABookCommConstants
.
TAG
,
Context
.
MODE_PRIVATE
);
String
updateDate
=
pref
.
getString
(
ABookCommConstants
.
KEY
.
ARCHIVE_UPDATED_DATE
,
ABookCommConstants
.
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
();
}
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
);
}
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
());
}
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
());
}
public
void
inviteCollaboration
(
String
inviteUserIds
,
String
collaborationType
)
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
inviteCollaboration
(
sid
,
roomId
.
intValue
(),
roomName
,
inviteUserIds
,
collaborationType
);
}
public
void
finishCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishCollaboration
(
sid
,
roomId
.
intValue
());
}
public
void
finishAllCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishAllCollaboration
(
sid
,
roomId
.
intValue
());
}
private
void
updateFavoriteUser
()
throws
NetworkDisconnectedException
,
AcmsException
{
GetFavoriteUserJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getFavoriteUser
(
sid
);
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
();
}
public
void
updateFavoriteInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateFavoriteUser
();
updateFavoriteGroup
();
}
public
void
updateGroupInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
ArrayList
<
String
>
checkSumList
=
new
ArrayList
<
String
>();
SharedPreferences
pref
=
context
.
getSharedPreferences
(
ABookCommConstants
.
TAG
,
Context
.
MODE_PRIVATE
);
String
lastUpdatedDate
=
pref
.
getString
(
ABookCommConstants
.
KEY
.
GROUP_MEMBER_UPDATED_DATE
,
ABookCommConstants
.
DEFAULT_CHECKSUM
);
try
{
GroupListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getGroupInfo
(
sid
,
lastUpdatedDate
);
if
(
CollectionUtil
.
isNotEmpty
(
resultJson
.
groupList
))
{
communicationLogic
.
updateGroup
(
resultJson
.
groupList
);
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
editor
.
putString
(
ABookCommConstants
.
KEY
.
GROUP_MEMBER_UPDATED_DATE
,
resultJson
.
lastRequestDate
);
editor
.
commit
();
}
}
catch
(
AcmsException
e
)
{
e
.
printStackTrace
();
}
}
public
void
changeCollaboration
(
int
changeCollaborationType
,
int
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
changeCollaboration
(
sid
,
roomId
.
intValue
(),
changeCollaborationType
,
meetingId
);
}
public
void
updatePreMessage
(
String
messageId
)
throws
NetworkDisconnectedException
,
AcmsException
{
if
(
messageId
.
equals
(
"0"
))
{
return
;
}
updateMessageFromMessageId
(
messageId
);
}
public
String
getMessageListFromMessageId
(
String
messageId
)
{
if
(
messageId
.
equals
(
"0"
))
{
return
""
;
}
return
communicationLogic
.
getMessagesFromMessageId
(
roomId
.
intValue
(),
messageId
);
}
public
String
getCollaborationJoinFlg
()
{
return
this
.
collaborationJoinFlg
.
toString
();
}
public
String
getStrCollaborationType
()
{
return
this
.
getStrCollaborationType
();
}
public
String
getToMoveGroupId
()
{
return
groupId
;
}
public
void
setToMoveGroupId
(
String
moveToGroupId
)
{
groupId
=
moveToGroupId
;
}
public
void
setHostRequestFlg
(
int
hostRequestFlg
)
{
mHostRequestFlg
=
hostRequestFlg
;
}
public
int
getHostRequestFlg
()
{
return
mHostRequestFlg
;
}
public
String
getServerInfo
()
{
JSONObject
jsonObj
=
new
JSONObject
();
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
CHAT_URL
,
chatServerUrl
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
CMS_URL
,
cmsServerUrl
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
IS_ONLINE
,
isOnline
);
return
jsonObj
.
toString
();
}
public
String
getMyUserInfo
()
{
JSONObject
jsonObj
=
new
JSONObject
();
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
SID
,
sid
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
LOGIN_ID
,
loginId
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
SHOP_NAME
,
shopName
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
shopMemberId
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
LANGUAGE_CODE
,
languageCode
);
return
jsonObj
.
toString
();
}
public
String
getRoomInfo
()
{
JSONObject
jsonObj
=
new
JSONObject
();
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
ROOM_ID_UPPERCASE_D
,
roomId
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
ROOM_NAME
,
roomName
);
return
jsonObj
.
toString
();
}
public
String
getDeviceInfo
()
{
JSONObject
jsonObj
=
new
JSONObject
();
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
IS_MOBILE
,
isMobile
);
jsonObj
.
put
(
ABookCommConstants
.
KEY
.
PLATFORM
,
"android"
);
return
jsonObj
.
toString
();
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebViewActivity.java
View file @
66352a60
...
...
@@ -55,17 +55,10 @@ 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
;
...
...
@@ -75,7 +68,6 @@ 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
;
...
...
@@ -85,6 +77,7 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import
jp.agentec.abook.abv.bl.logic.CommunicationLogic
;
import
jp.agentec.abook.abv.bl.websocket.MeetingManager
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.data.ChatData
;
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
;
...
...
@@ -99,7 +92,6 @@ import jp.agentec.abook.abv.ui.home.helper.VideoEncoder;
import
jp.agentec.abook.abv.ui.home.view.ChatWebView
;
import
jp.agentec.abook.abv.ui.home.view.FullscreenableChromeClient
;
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
;
...
...
@@ -116,28 +108,15 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
private
final
String
TAG
=
"ChatWebViewActivity"
;
private
ValueCallback
<
Uri
[]>
mUploadMessage
;
public
String
sid
;
public
String
roomName
;
public
String
loginId
;
private
String
shopName
;
private
boolean
isOnline
;
public
Long
roomId
;
public
String
roomType
;
public
String
strCollaborationType
;
public
String
groupId
;
public
String
beforeRoomType
;
public
Integer
shopMemberId
;
public
ChatData
chatData
;
public
String
selectedUserIdList
;
public
String
mSkey
;
public
Integer
joinMeetingId
;
private
boolean
isPIP
;
private
boolean
isStop
;
private
String
encodedFilePath
;
// 0:協業生成, 1:協業参加
public
Integer
collaborationJoinFlg
=
0
;
public
MeetingManager
meetingManager
=
MeetingManager
.
getInstance
();
private
ActivityHandlingHelper
handlingHelper
=
ActivityHandlingHelper
.
getInstance
();
public
AlertDialog
myAlertDialog
;
private
BroadcastReceiver
receiver
;
...
...
@@ -145,7 +124,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
private
CommunicationLogic
communicationLogic
=
AbstractLogic
.
getLogic
(
CommunicationLogic
.
class
);
public
int
mCollaborationType
;
public
int
mHostRequestFlg
=
0
;
public
boolean
needHostAlert
=
false
;
@Override
...
...
@@ -161,7 +139,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
private
void
initializeWebView
()
{
initiateDatas
(
getIntent
());
initiateDatas
(
getIntent
());
// intentのデータから、chatDataを作成
setupChatWebView
();
registJSReactor
();
addDownloadListener
();
...
...
@@ -172,28 +150,29 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
private
void
initiateDatas
(
Intent
intent
)
{
communicationLogic
.
setPackagePath
(
getFilesDir
().
getAbsolutePath
()
+
"/"
);
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"
);
strCollaborationType
=
intent
.
getStringExtra
(
"collaborationType"
);
isOnline
=
false
;
chatData
=
ChatData
.
getInstance
();
chatData
.
setSid
(
intent
.
getStringExtra
(
"sid"
));
chatData
.
setRoomID
(
intent
.
getLongExtra
(
"roomId"
,
0
));
chatData
.
roomName
=
intent
.
getStringExtra
(
"roomName"
);
chatData
.
roomType
=
intent
.
getStringExtra
(
"roomType"
);
chatData
.
loginId
=
intent
.
getStringExtra
(
"loginId"
);
chatData
.
shopName
=
intent
.
getStringExtra
(
"shopName"
);
chatData
.
setStrCollaborationType
(
intent
.
getStringExtra
(
"collaborationType"
));
chatData
.
setIsOnline
(
false
);
chatData
.
setContext
(
ChatWebViewActivity
.
this
);
chatData
.
setIsMobile
(!
isNormalSize
());
}
private
void
setupChatWebView
()
{
mChatWebView
=
new
ChatWebView
(
ChatWebViewActivity
.
this
);
mChatWebView
.
init
();
mChatWebView
.
setCommunicationLogic
(
communicationLogic
);
mChatWebView
.
init
(
chatData
);
}
private
void
setupDefaultChatWebViewURL
()
{
//ネットワークがない場合専用のページを表示。
ShopMemberDto
myInfo
=
communicationLogic
.
getMyShopMemberDto
();
if
(
myInfo
!=
null
)
{
shopMemberId
=
myInfo
.
shopMemberId
;
chatData
.
shopMemberId
=
myInfo
.
shopMemberId
;
}
chatWebviewUrl
=
ABookCommConstants
.
NETWORK_ERROR_PLACE_HOLDER
;
if
(!
ABVEnvironment
.
getInstance
().
networkAdapter
.
isNetworkConnected
())
{
...
...
@@ -203,24 +182,24 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
boolean
isSIDValid
=
false
;
try
{
isSIDValid
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
checkSid
(
sid
);
isSIDValid
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
checkSid
(
chatData
.
sid
);
}
catch
(
Exception
e
)
{
Logger
.
d
(
"SID_CHECK_ERROR"
);
}
if
(!
isSIDValid
)
{
return
;
}
isOnline
=
true
;
chatData
.
setIsOnline
(
true
)
;
chatWebviewUrl
=
ABookCommConstants
.
CHAT_PAGE_URL
;
showProgressPopup
();
CommonExecutor
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
updateMyInfoFromServer
();
chatData
.
updateMyInfoFromServer
();
updateAllGroupInfo
();
updateFavoriteInfo
();
shopMemberId
=
communicationLogic
.
getMyShopMemberDto
().
shopMemberId
;
chatData
.
shopMemberId
=
communicationLogic
.
getMyShopMemberDto
().
shopMemberId
;
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -248,36 +227,36 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
String
fixedParam
=
"&platform=android&isMobile=true&chatServerUrl="
+
ABVEnvironment
.
getInstance
().
websocketServerHttpUrl
;
//ページをロード
if
(
roomId
!=
0
&&
roomName
!=
null
)
{
// by push message
if
(
chatData
.
roomId
!=
0
&&
chatData
.
roomName
!=
null
)
{
// by push message
try
{
mChatWebView
.
updateRoomList
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
Integer
integerRoomId
=
Integer
.
parseInt
(
roomId
.
toString
());
if
(
StringUtil
.
isNullOrEmpty
(
roomType
))
{
roomType
=
communicationLogic
.
getChatRoom
(
integerRoomId
).
type
.
toString
();
Integer
integerRoomId
=
Integer
.
parseInt
(
chatData
.
roomId
.
toString
());
if
(
StringUtil
.
isNullOrEmpty
(
chatData
.
roomType
))
{
chatData
.
roomType
=
communicationLogic
.
getChatRoom
(
integerRoomId
).
type
.
toString
();
}
if
(
StringUtil
.
isNullOrEmpty
(
strCollaborationType
))
{
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
+
"&roomId="
+
roomId
+
"&roomName="
+
roomName
+
fixedParam
;
if
(
StringUtil
.
isNullOrEmpty
(
chatData
.
getStrCollaborationType
()
))
{
String
parameterData
=
"sid="
+
chatData
.
sid
+
"&loginId="
+
chatData
.
loginId
+
"&shopName="
+
chatData
.
shopName
+
"&roomId="
+
chatData
.
roomId
+
"&roomName="
+
chatData
.
roomName
+
fixedParam
;
mChatWebView
.
postUrl
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
,
parameterData
.
getBytes
());
}
else
{
c
ollaborationJoinFlg
=
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
INVITE
;
c
hatData
.
setCollaborationJoinFlg
(
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
INVITE
)
;
try
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
joinCollaboration
(
sid
,
roomId
.
intValue
());
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
joinCollaboration
(
chatData
.
sid
,
chatData
.
roomId
.
intValue
());
}
catch
(
NetworkDisconnectedException
e
)
{
e
.
printStackTrace
();
}
catch
(
AcmsException
e
)
{
e
.
printStackTrace
();
}
moveCollaborationScreen
(
Integer
.
parseInt
(
strCollaborationType
));
moveCollaborationScreen
(
Integer
.
parseInt
(
chatData
.
getStrCollaborationType
()
));
}
}
else
{
// Chat
if
(
lastRoomName
.
length
()
>
0
&&
lastRoomId
.
length
()
>
0
)
{
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
+
"&roomId="
+
lastRoomId
+
"&roomName="
+
lastRoomName
+
fixedParam
;
String
parameterData
=
"sid="
+
chatData
.
sid
+
"&loginId="
+
chatData
.
loginId
+
"&shopName="
+
chatData
.
shopName
+
"&roomId="
+
lastRoomId
+
"&roomName="
+
lastRoomName
+
fixedParam
;
mChatWebView
.
postUrl
(
chatWebviewUrl
,
parameterData
.
getBytes
());
}
else
{
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
+
fixedParam
;
String
parameterData
=
"sid="
+
chatData
.
sid
+
"&loginId="
+
chatData
.
loginId
+
"&shopName="
+
chatData
.
shopName
+
fixedParam
;
mChatWebView
.
postUrl
(
chatWebviewUrl
,
parameterData
.
getBytes
());
}
}
...
...
@@ -386,8 +365,8 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
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
()));
if
(
chatData
.
roomId
!=
null
)
{
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:CHAT_UI.joinRoom('%s', '%s');"
,
chatData
.
roomId
.
toString
(),
chatData
.
roomName
.
toString
()));
}
else
{
mChatWebView
.
loadUrl
(
ABookCommConstants
.
CHAT_PAGE_URL
);
}
...
...
@@ -420,7 +399,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
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
)
{
if
(
chatData
.
getHostRequestFlg
()
==
1
)
{
mChatWebView
.
loadUrl
(
"javascript:penOff();"
);
mChatWebView
.
loadUrl
(
"javascript:$('#hostRequestModal').modal('hide');"
);
mChatWebView
.
loadUrl
(
"javascript:$('#userNameCardInCollaboration').modal('hide');"
);
...
...
@@ -542,10 +521,10 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
if
(
intent
.
getAction
().
equals
(
ConnectivityManager
.
CONNECTIVITY_ACTION
))
{
NetworkInfo
networkInfo
=
connectivityManager
.
getActiveNetworkInfo
();
if
(
networkInfo
==
null
||
!
networkInfo
.
isConnectedOrConnecting
())
{
isOnline
=
false
;
chatData
.
setIsOnline
(
false
)
;
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshForOffline();"
);
}
else
{
isOnline
=
true
;
chatData
.
setIsOnline
(
true
)
;
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshForOnline();"
);
if
(
mChatWebView
.
getUrl
()
!=
null
&&
mChatWebView
.
getUrl
().
equals
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
))
{
mChatWebView
.
loadUrl
(
"javascript:window.location.reload();"
);
...
...
@@ -636,6 +615,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
if
(
isNormalSize
())
{
setPortraitIfNormal
();
}
chatData
.
setIsMobile
(!
isNormalSize
());
}
public
void
showCommunicationChatMenuDialog
()
{
...
...
@@ -652,24 +632,24 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
public
void
getLogin
()
{
// ローカルの言語を確認する
String
localLanguage
=
ActivityHandlingHelper
.
getInstance
().
getLocaleFileName
(
);
chatData
.
setLanguageCode
(
ActivityHandlingHelper
.
getInstance
().
getLocaleFileName
()
);
// 最後のチャットのルーム名
String
lastRoomName
=
PreferenceUtil
.
getUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
""
);
// 最後のチャットのルーム
String
lastRoomId
=
PreferenceUtil
.
getUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
""
);
if
(
roomId
!=
0
&&
roomName
!=
null
)
{
if
(
chatData
.
roomId
!=
0
&&
chatData
.
roomName
!=
null
)
{
// 最後のチャットのルーム名
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
roomName
);
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
chatData
.
roomName
);
// 最後のチャットのルーム
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
String
.
valueOf
(
roomId
));
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
String
.
valueOf
(
chatData
.
roomId
));
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getLoginParameter('%s', '%s', '%s', '%s', '%s', '%s', '%s');"
,
sid
,
loginId
,
shopName
,
roomId
,
roomName
,
localLanguage
,
shopMemberId
));
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getLoginParameter('%s', '%s', '%s', '%s', '%s', '%s', '%s');"
,
chatData
.
sid
,
chatData
.
loginId
,
chatData
.
shopName
,
chatData
.
roomId
,
chatData
.
roomName
,
chatData
.
getLanguageCode
(),
chatData
.
shopMemberId
));
}
else
{
if
(
lastRoomName
.
length
()
>
0
&&
lastRoomId
.
length
()
>
0
)
{
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getLoginParameter('%s', '%s', '%s', '%s', '%s', '%s', '%s');"
,
sid
,
loginId
,
shopName
,
lastRoomId
,
lastRoomName
,
localLanguage
,
shopMemberId
));
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getLoginParameter('%s', '%s', '%s', '%s', '%s', '%s', '%s');"
,
chatData
.
sid
,
chatData
.
loginId
,
chatData
.
shopName
,
lastRoomId
,
lastRoomName
,
chatData
.
getLanguageCode
(),
chatData
.
shopMemberId
));
}
else
{
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getLoginParameter('%s', '%s', '%s', undefined, undefined, '%s', '%s');"
,
sid
,
loginId
,
shopName
,
localLanguage
,
shopMemberId
));
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getLoginParameter('%s', '%s', '%s', undefined, undefined, '%s', '%s');"
,
chatData
.
sid
,
chatData
.
loginId
,
chatData
.
shopName
,
chatData
.
getLanguageCode
(),
chatData
.
shopMemberId
));
}
}
}
...
...
@@ -679,7 +659,10 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
chatServerUrl
=
chatServerUrl
.
substring
(
0
,
chatServerUrl
.
length
()
-
3
);
String
cmsServerUrl
=
ABVEnvironment
.
getInstance
().
acmsAddress
+
ABVDataCache
.
getInstance
().
getUrlPath
();
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getGlobalParam('%s', '%s', '%s', '%s', '%s');"
,
chatServerUrl
,
cmsServerUrl
,
"android"
,
true
,
isOnline
));
chatData
.
setChatServerUrl
(
chatServerUrl
);
chatData
.
setCmsServerUrl
(
cmsServerUrl
);
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:getGlobalParam('%s', '%s', '%s', '%s', '%s');"
,
chatServerUrl
,
cmsServerUrl
,
"android"
,
true
,
chatData
.
getIsOnline
()));
}
@Override
...
...
@@ -845,7 +828,8 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
}
meetingManager
.
close
();
handlingHelper
.
saveMeetingInfo
(
null
,
null
,
null
,
false
);
//handlingHelper.saveMeetingInfo(null, null, null, false);
activityHandlingHelper
.
saveMeetingInfo
(
null
,
null
,
null
,
false
);
}
public
void
startContentListActivity
(
boolean
isOwner
)
{
...
...
@@ -868,45 +852,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mSkey
=
meetingManager
.
getSessionKey
(
true
);
}
public
void
updateMyInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getMyInfo
(
sid
);
if
(
resultJson
.
shopMemberDto
!=
null
)
{
communicationLogic
.
insertMyInfo
(
resultJson
.
shopMemberDto
);
}
}
public
void
updateUserInfoFromServer
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
getNameCard
(
sid
,
shopMemberId
);
communicationLogic
.
insertShopMember
(
resultJson
.
shopMemberDto
);
}
public
boolean
insertFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
insertFavoriteUser
(
sid
,
Integer
.
parseInt
(
shopMemberId
));
if
(!
result
)
{
return
false
;
}
List
<
Integer
>
shopMeberIds
=
new
ArrayList
<>();
shopMeberIds
.
add
(
Integer
.
parseInt
(
shopMemberId
));
communicationLogic
.
updateFavoriteUser
(
shopMeberIds
);
return
result
;
}
public
boolean
deleteFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
deleteFavoriteUser
(
sid
,
Integer
.
parseInt
(
shopMemberId
));
if
(
result
)
{
List
<
Integer
>
deleteFavoriteList
=
new
ArrayList
<
Integer
>();
deleteFavoriteList
.
add
(
Integer
.
parseInt
(
shopMemberId
));
communicationLogic
.
deleteavoriteUser
(
deleteFavoriteList
);
}
return
result
;
}
public
boolean
insertFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
insertFavoriteGroup
(
sid
,
Integer
.
parseInt
(
groupId
));
return
result
;
}
@Override
public
void
onBackPressed
()
{
super
.
onBackPressed
();
...
...
@@ -923,7 +868,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
public
boolean
deleteFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
deleteFavoriteGroup
(
sid
,
Integer
.
parseInt
(
groupId
));
.
deleteFavoriteGroup
(
chatData
.
sid
,
Integer
.
parseInt
(
groupId
));
if
(!
result
)
{
return
false
;
}
...
...
@@ -933,38 +878,18 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
true
;
}
public
void
updateGroupInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
ArrayList
<
String
>
checkSumList
=
new
ArrayList
<
String
>();
SharedPreferences
pref
=
getSharedPreferences
(
ABookCommConstants
.
TAG
,
MODE_PRIVATE
);
String
lastUpdatedDate
=
pref
.
getString
(
ABookCommConstants
.
KEY
.
GROUP_MEMBER_UPDATED_DATE
,
ABookCommConstants
.
DEFAULT_CHECKSUM
);
try
{
GroupListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getGroupInfo
(
sid
,
lastUpdatedDate
);
if
(
CollectionUtil
.
isNotEmpty
(
resultJson
.
groupList
))
{
communicationLogic
.
updateGroup
(
resultJson
.
groupList
);
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
editor
.
putString
(
ABookCommConstants
.
KEY
.
GROUP_MEMBER_UPDATED_DATE
,
resultJson
.
lastRequestDate
);
editor
.
commit
();
}
}
catch
(
AcmsException
e
)
{
e
.
printStackTrace
();
}
}
private
void
updateFavoriteUser
()
throws
NetworkDisconnectedException
,
AcmsException
{
GetFavoriteUserJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getFavoriteUser
(
sid
);
GetFavoriteUserJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getFavoriteUser
(
chatData
.
sid
);
communicationLogic
.
updateFavoriteUser
(
resultJson
.
favoriteUserIds
);
}
private
void
updateFavoriteGroup
()
throws
NetworkDisconnectedException
,
AcmsException
{
GetFavoriteGroupJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getFavoriteGroup
(
sid
);
GetFavoriteGroupJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getFavoriteGroup
(
chatData
.
sid
);
communicationLogic
.
updateFavoriteGroup
(
resultJson
.
favoriteGroupIds
);
}
private
void
updateAllGroupInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateGroupInfoFromServer
();
chatData
.
updateGroupInfoFromServer
();
}
public
void
updateFavoriteInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
...
...
@@ -1103,21 +1028,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
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
();
}
public
void
setSelectedUserIdList
(
String
userList
)
{
selectedUserIdList
=
userList
;
}
...
...
@@ -1128,21 +1038,16 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
userList
;
}
public
void
updateRoomList
()
throws
NetworkDisconnectedException
,
AcmsException
{
RoomListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getRoomList
(
sid
);
communicationLogic
.
insertChatRoomList
(
resultJson
.
roomList
);
}
public
void
updateMyInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateMyInfoFromServer
();
chatData
.
updateMyInfoFromServer
();
}
public
void
updateGroupUser
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateGroupInfoFromServer
();
chatData
.
updateGroupInfoFromServer
();
}
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
);
CreatedRoomJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
createRoom
(
chatData
.
sid
,
roomType
,
userIdList
,
encodedRoomName
,
chatData
.
loginId
);
if
(
ABookCommConstants
.
FLAG
.
SCREEN_FLG
.
MAKE_ROOM
.
equals
(
Integer
.
parseInt
(
screenFlg
)))
{
final
ChatRoomDto
chatRoomDto
=
communicationLogic
.
getChatRoom
(
resultJson
.
chatRoomDto
.
chatRoomId
);
if
(
chatRoomDto
!=
null
)
{
...
...
@@ -1151,12 +1056,12 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
}
communicationLogic
.
insertChatRoom
(
resultJson
.
chatRoomDto
);
communicationLogic
.
addUserInRoom
(
StringUtil
.
join
(
","
,
userIdList
,
shopMemberId
.
toString
()),
resultJson
.
chatRoomDto
.
chatRoomId
);
communicationLogic
.
addUserInRoom
(
StringUtil
.
join
(
","
,
userIdList
,
chatData
.
shopMemberId
.
toString
()),
resultJson
.
chatRoomDto
.
chatRoomId
);
final
Integer
chatRoomId
=
resultJson
.
chatRoomDto
.
chatRoomId
;
final
String
chatRoomName
=
resultJson
.
chatRoomDto
.
chatRoomName
;
if
(
isVoice
)
{
roomId
=
chatRoomId
.
longValue
();
roomName
=
chatRoomName
;
chatData
.
roomId
=
chatRoomId
.
longValue
();
chatData
.
roomName
=
chatRoomName
;
mChatWebView
.
loadChatViewUrl
(
String
.
format
(
"javascript:CHAT_UI.startCollaboration('%s');"
,
ABookCommConstants
.
FLAG
.
COLLABORATION_TYPE
.
AUDIO
));
}
else
{
mChatWebView
.
loadChatViewUrl
(
String
.
format
(
"javascript:CHAT_UI.joinRoom('%s', '%s');"
,
chatRoomId
,
chatRoomName
));
...
...
@@ -1164,33 +1069,25 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
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
);
chatData
.
changeRoomName
(
changeRoomName
);
chatData
.
joinRoom
(
chatData
.
roomId
.
toString
(),
changeRoomName
);
mChatWebView
.
loadChatViewUrl
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
);
}
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
);
chatData
.
joinRoom
(
joinRoomId
,
joinRoomName
);
mChatWebView
.
loadChatViewUrl
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
);
}
public
void
roomDisplayOff
(){
communicationLogic
.
roomDisplayOff
(
roomId
.
intValue
(),
ABookCommConstants
.
FLAG
.
ROOM_VIEW_FLAG
.
INVISIBLE
);
communicationLogic
.
roomDisplayOff
(
chatData
.
roomId
.
intValue
(),
ABookCommConstants
.
FLAG
.
ROOM_VIEW_FLAG
.
INVISIBLE
);
mChatWebView
.
loadChatViewUrl
(
ABookCommConstants
.
CHAT_PAGE_URL
);
}
public
void
inviteUsers
(
String
userIds
,
boolean
isCollaboration
)
throws
NetworkDisconnectedException
,
AcmsException
{
final
UserInviteResultJSON
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
inviteUsers
(
sid
,
roomId
.
intValue
(),
roomName
,
userIds
);
final
UserInviteResultJSON
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
inviteUsers
(
chatData
.
sid
,
chatData
.
roomId
.
intValue
(),
chatData
.
roomName
,
userIds
);
if
(
result
.
roomId
==
null
)
{
communicationLogic
.
addUserInRoom
(
userIds
,
roomId
.
intValue
());
communicationLogic
.
addUserInRoom
(
userIds
,
chatData
.
roomId
.
intValue
());
if
(!
isCollaboration
)
{
mChatWebView
.
loadChatViewUrl
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
);
}
...
...
@@ -1200,58 +1097,58 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
public
String
getRoomType
()
{
return
roomType
;
return
chatData
.
roomType
;
}
public
String
getBeforeRoomType
()
{
return
beforeRoomType
;
return
chatData
.
getBeforeRoomType
()
;
}
public
void
clearBeforeRoomType
()
{
beforeRoomType
=
null
;
chatData
.
setBeforeRoomType
(
null
)
;
}
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
);
MessageInfoListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getMessages
(
chatData
.
sid
,
roomId
,
null
,
lastUpdatedDate
);
for
(
ChatMessageDto
chatMessageDto
:
resultJson
.
chatMessageDtoArrayList
)
{
chatMessageDto
.
chatRoomId
=
Integer
.
parseInt
(
roomId
);
}
communicationLogic
.
insertMessageList
(
resultJson
.
chatMessageDtoArrayList
);
communicationLogic
.
insertShopMember
(
resultJson
.
shopMemberDtoArrayList
);
updateUnreadCount
();
chatData
.
updateUnreadCount
();
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
editor
.
putString
(
ABookCommConstants
.
KEY
.
MESSAGE_UPDATED_DATE
+
roomId
,
resultJson
.
updateDate
);
editor
.
commit
();
}
public
String
searchMessages
(
String
keyword
,
String
userList
)
{
return
communicationLogic
.
searMessages
(
roomId
.
intValue
(),
keyword
,
userList
);
return
communicationLogic
.
searMessages
(
chatData
.
roomId
.
intValue
(),
keyword
,
userList
);
}
public
String
getFavoriteUsersNotInRoom
()
{
return
communicationLogic
.
getFavoriteUsersNotInRoom
(
roomId
.
intValue
());
return
communicationLogic
.
getFavoriteUsersNotInRoom
(
chatData
.
roomId
.
intValue
());
}
public
String
getMyGroupUsersNotInRoom
()
{
return
communicationLogic
.
getMyGroupUsersNotInRoom
(
roomId
.
intValue
());
return
communicationLogic
.
getMyGroupUsersNotInRoom
(
chatData
.
roomId
.
intValue
());
}
public
String
getMyGroupShopMemberNotInRoomByName
(
String
keywords
)
{
return
communicationLogic
.
getMyGroupUserNotInRoomByName
(
keywords
,
roomId
.
intValue
());
return
communicationLogic
.
getMyGroupUserNotInRoomByName
(
keywords
,
chatData
.
roomId
.
intValue
());
}
public
String
getAllGroupShopMemberNotInRoomByName
(
String
keywords
)
{
return
communicationLogic
.
getAllGroupShopMemberNotInRoomByName
(
keywords
,
roomId
.
intValue
());
return
communicationLogic
.
getAllGroupShopMemberNotInRoomByName
(
keywords
,
chatData
.
roomId
.
intValue
());
}
public
void
updateUserInfo
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
updateUserInfoFromServer
(
shopMemberId
);
chatData
.
updateUserInfoFromServer
(
shopMemberId
);
}
public
String
getGroupInfoForAddUser
(
String
groupId
)
{
return
communicationLogic
.
getGroupSearchDataForAddUser
(
Integer
.
parseInt
(
groupId
),
roomId
.
intValue
());
return
communicationLogic
.
getGroupSearchDataForAddUser
(
Integer
.
parseInt
(
groupId
),
chatData
.
roomId
.
intValue
());
}
public
boolean
addFavoriteUser
(
String
shopMemberId
)
throws
AcmsException
{
...
...
@@ -1262,7 +1159,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
else
{
boolean
result
=
false
;
try
{
result
=
insertFavoriteUser
(
shopMemberId
);
result
=
chatData
.
insertFavoriteUser
(
shopMemberId
);
if
(!
result
)
{
return
false
;
}
mChatWebView
.
loadChatViewUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
return
true
;
...
...
@@ -1275,7 +1172,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
public
boolean
removeFavoriteUser
(
String
shopMemberId
)
throws
AcmsException
{
try
{
boolean
result
=
deleteFavoriteUser
(
shopMemberId
);
boolean
result
=
chatData
.
deleteFavoriteUser
(
shopMemberId
);
if
(!
result
)
{
return
false
;
}
...
...
@@ -1295,7 +1192,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
else
{
boolean
result
=
false
;
try
{
result
=
insertFavoriteGroup
(
groupId
);
result
=
chatData
.
insertFavoriteGroup
(
groupId
);
if
(!
result
)
{
return
false
;
}
...
...
@@ -1327,70 +1224,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
updateFavoriteInfo
();
}
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
();
}
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
);
}
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
));
}
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
());
}
public
void
inviteCollaboration
(
String
inviteUserIds
,
String
collaborationType
)
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
inviteCollaboration
(
sid
,
roomId
.
intValue
(),
roomName
,
inviteUserIds
,
collaborationType
);
}
public
void
startCollaboration
(
String
collaborationType
)
{
collaborationJoinFlg
=
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
CREATE
;
moveCollaborationScreen
(
Integer
.
parseInt
(
collaborationType
));
}
public
void
finishCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishCollaboration
(
sid
,
roomId
.
intValue
());
}
public
void
finishAllCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishAllCollaboration
(
sid
,
roomId
.
intValue
());
}
public
String
getCollaborationJoinFlg
()
{
return
collaborationJoinFlg
.
toString
();
}
public
String
getStrCollaborationType
()
{
return
strCollaborationType
;
}
public
String
getToMoveGroupId
()
{
return
groupId
;
}
public
void
setToMoveGroupId
(
String
moveToGroupId
)
{
groupId
=
moveToGroupId
;
}
public
int
createContentView
()
{
finishBeforeContentListActivity
();
PictureInPictureParams
.
Builder
mPipBuilder
=
new
PictureInPictureParams
.
Builder
();
...
...
@@ -1401,12 +1234,12 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
connectMeetingServer
();
List
<
MeetingDto
>
meetingList
=
meetingManager
.
getMeetingList
(
mSkey
);
for
(
MeetingDto
meeting
:
meetingList
)
{
if
(
meeting
.
title
.
equals
(
"Collaboration__"
+
roomId
)
&&
meetingManager
.
isOwner
())
{
if
(
meeting
.
title
.
equals
(
"Collaboration__"
+
chatData
.
roomId
)
&&
meetingManager
.
isOwner
())
{
meetingManager
.
deleteMeeting
(
meeting
.
meetingId
,
mSkey
);
}
}
meetingId
=
meetingManager
.
createMeeting
(
mSkey
,
"Collaboration_"
+
roomId
,
roomId
.
toString
());
meetingManager
.
join
(
meetingId
,
mSkey
,
roomId
.
toString
(),
true
);
meetingId
=
meetingManager
.
createMeeting
(
mSkey
,
"Collaboration_"
+
chatData
.
roomId
,
chatData
.
roomId
.
toString
());
meetingManager
.
join
(
meetingId
,
mSkey
,
chatData
.
roomId
.
toString
(),
true
);
meetingManager
.
setCollaboration
(
true
);
}
catch
(
Exception
e
)
{
mChatWebView
.
loadUrl
(
"javascript:alert('"
+
getString
(
R
.
string
.
msg_error_connection_error_meeting_room
)
+
"');"
);
...
...
@@ -1423,7 +1256,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
try
{
connectMeetingServer
();
List
<
MeetingDto
>
meetingList
=
meetingManager
.
getMeetingList
(
mSkey
);
meetingManager
.
join
(
joinMeetingId
,
mSkey
,
roomId
.
toString
(),
false
);
meetingManager
.
join
(
chatData
.
joinMeetingId
,
mSkey
,
chatData
.
roomId
.
toString
(),
false
);
meetingManager
.
setCollaboration
(
true
);
}
catch
(
Exception
e
)
{
mChatWebView
.
loadUrl
(
"javascript:alert('"
+
getString
(
R
.
string
.
msg_error_connection_error_meeting_room
)
+
"');"
);
...
...
@@ -1440,7 +1273,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
try
{
connectMeetingServer
();
List
<
MeetingDto
>
meetingList
=
meetingManager
.
getMeetingList
(
mSkey
);
meetingManager
.
join
(
joinMeetingId
,
mSkey
,
roomId
.
toString
(),
false
);
meetingManager
.
join
(
chatData
.
joinMeetingId
,
mSkey
,
chatData
.
roomId
.
toString
(),
false
);
meetingManager
.
setCollaboration
(
true
);
}
catch
(
Exception
e
)
{
mChatWebView
.
loadUrl
(
"javascript:alert('"
+
getString
(
R
.
string
.
msg_error_connection_error_meeting_room
)
+
"');"
);
...
...
@@ -1470,18 +1303,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mCollaborationType
=
collaborationType
;
}
public
void
changeCollaboration
(
int
changeCollaborationType
,
int
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
changeCollaboration
(
sid
,
roomId
.
intValue
(),
changeCollaborationType
,
meetingId
);
}
public
void
setHostRequestFlg
(
int
hostRequestFlg
)
{
mHostRequestFlg
=
hostRequestFlg
;
}
public
int
getHostRequestFlg
()
{
return
mHostRequestFlg
;
}
public
void
finishPip
()
{
finishPIPmode
();
}
...
...
@@ -1498,17 +1319,20 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
needHostAlert
;
}
public
void
updatePreMessage
(
String
messageId
)
throws
NetworkDisconnectedException
,
AcmsException
{
if
(
messageId
.
equals
(
"0"
))
{
return
;
}
updateMessageFromMessageId
(
messageId
);
public
void
joinCollaboration
(
String
collaborationType
,
String
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
chatData
.
joinCollaboration
(
collaborationType
,
meetingId
);
moveCollaborationScreen
(
Integer
.
parseInt
(
collaborationType
));
}
public
String
getMessageListFromMessageId
(
String
messageId
)
{
if
(
messageId
.
equals
(
"0"
))
{
return
""
;
}
return
communicationLogic
.
getMessagesFromMessageId
(
roomId
.
intValue
(),
messageId
);
public
void
startCollaboration
(
String
collaborationType
)
{
chatData
.
setCollaborationJoinFlg
(
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
CREATE
);
moveCollaborationScreen
(
Integer
.
parseInt
(
collaborationType
));
}
public
void
saveVisitRoomInfo
(
String
roomId
,
String
roomName
)
{
// 最後のチャットのルーム名
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
roomName
);
// 最後のチャットのルーム
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
roomId
);
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/view/ChatWebView.java
View file @
66352a60
...
...
@@ -13,26 +13,25 @@ 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.logic.AbstractLogic
;
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.data.ChatData
;
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.ActivityHandlingHelper
;
public
class
ChatWebView
extends
WebView
{
private
Context
context
;
private
CommunicationLogic
communicationLogic
;
private
CommunicationLogic
communicationLogic
=
AbstractLogic
.
getLogic
(
CommunicationLogic
.
class
);
private
ChatWebViewActivity
chatActivity
;
private
ChatData
chatData
;
public
ChatWebView
(
Context
context
)
{
super
(
context
);
this
.
context
=
context
;
chatActivity
=
(
ChatWebViewActivity
)
context
;
}
public
void
init
()
{
public
void
init
(
ChatData
chatData
)
{
setOverScrollMode
(
View
.
OVER_SCROLL_NEVER
);
//オーバースクロールしない。
setVerticalScrollBarEnabled
(
false
);
//スクロールバーを消す。
addJavascriptInterface
(
this
,
"android"
);
...
...
@@ -54,19 +53,14 @@ public class ChatWebView extends WebView {
if
(
Logger
.
isDebugEnabled
())
{
setWebContentsDebuggingEnabled
(
true
);
//デバッグモード(chromeからinspect可)
}
}
public
void
setCommunicationLogic
(
CommunicationLogic
communicationLogic
){
this
.
communicationLogic
=
communicationLogic
;
this
.
chatData
=
chatData
;
}
@JavascriptInterface
public
void
saveVisitRoomInfo
(
String
roomId
,
String
roomName
)
{
// 最後のチャットのルーム名
PreferenceUtil
.
putUserPref
(
context
,
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
roomName
);
// 最後のチャットのルーム
PreferenceUtil
.
putUserPref
(
context
,
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
roomId
);
chatActivity
.
saveVisitRoomInfo
(
roomId
,
roomName
);
}
@JavascriptInterface
public
void
getLoginParameter
()
{
post
(
new
Runnable
()
{
...
...
@@ -145,8 +139,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
String
getRoomList
(
String
roomType
,
String
keyword
)
{
String
chatRoomListStr
=
communicationLogic
.
getChatRoomList
(
Integer
.
parseInt
(
roomType
),
keyword
);
return
chatRoomListStr
;
return
communicationLogic
.
getChatRoomList
(
Integer
.
parseInt
(
roomType
),
keyword
);
}
@JavascriptInterface
...
...
@@ -157,7 +150,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
updateRoomList
()
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
updateRoomList
();
chat
Data
.
updateRoomList
();
}
@JavascriptInterface
...
...
@@ -336,7 +329,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
updateArchiveList
()
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
updateArchiveList
();
chat
Data
.
updateArchiveList
();
}
@JavascriptInterface
...
...
@@ -366,7 +359,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
updateArchiveDetail
(
String
archiveId
)
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
updateArchiveDetail
(
archiveId
);
chat
Data
.
updateArchiveDetail
(
archiveId
);
}
@JavascriptInterface
...
...
@@ -376,12 +369,12 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
joinChangedCollaboration
(
String
collaborationType
,
String
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
joinChangedCollaboration
(
collaborationType
,
meetingId
);
chat
Data
.
joinChangedCollaboration
(
collaborationType
,
meetingId
);
}
@JavascriptInterface
public
void
inviteCollaboration
(
String
inviteUserIds
,
String
collaborationType
)
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
inviteCollaboration
(
inviteUserIds
,
collaborationType
);
chat
Data
.
inviteCollaboration
(
inviteUserIds
,
collaborationType
);
}
@JavascriptInterface
...
...
@@ -391,32 +384,32 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
finishCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
finishCollaboration
();
chat
Data
.
finishCollaboration
();
}
@JavascriptInterface
public
void
finishAllCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
finishAllCollaboration
();
chat
Data
.
finishAllCollaboration
();
}
@JavascriptInterface
public
String
getCollaborationJoinFlg
()
{
return
chat
Activity
.
getCollaborationJoinFlg
();
return
chat
Data
.
getCollaborationJoinFlg
();
}
@JavascriptInterface
public
String
getCollaborationType
()
{
return
chat
Activity
.
getStrCollaborationType
();
return
chat
Data
.
getStrCollaborationType
();
}
@JavascriptInterface
public
String
getToMoveGroupId
()
{
return
chat
Activity
.
getToMoveGroupId
();
return
chat
Data
.
getToMoveGroupId
();
}
@JavascriptInterface
public
void
setToMoveGroupId
(
String
moveToGroupId
)
{
chat
Activity
.
setToMoveGroupId
(
moveToGroupId
);
chat
Data
.
setToMoveGroupId
(
moveToGroupId
);
}
@JavascriptInterface
...
...
@@ -472,7 +465,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
changeCollaboration
(
int
changeCollaborationType
,
int
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
changeCollaboration
(
changeCollaborationType
,
meetingId
);
chat
Data
.
changeCollaboration
(
changeCollaborationType
,
meetingId
);
}
@JavascriptInterface
...
...
@@ -490,12 +483,12 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
setHostRequestFlg
(
int
hostRequestFlg
)
{
chat
Activity
.
setHostRequestFlg
(
hostRequestFlg
);
chat
Data
.
setHostRequestFlg
(
hostRequestFlg
);
}
@JavascriptInterface
public
int
getHostRequestFlg
()
{
return
chat
Activity
.
getHostRequestFlg
();
return
chat
Data
.
getHostRequestFlg
();
}
@JavascriptInterface
...
...
@@ -515,33 +508,32 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public
void
updatePreMessage
(
String
messageId
)
throws
NetworkDisconnectedException
,
AcmsException
{
chat
Activity
.
updatePreMessage
(
messageId
);
chat
Data
.
updatePreMessage
(
messageId
);
}
@JavascriptInterface
public
String
getMessageListFromMessageId
(
String
messageId
)
{
return
chat
Activity
.
getMessageListFromMessageId
(
messageId
);
return
chat
Data
.
getMessageListFromMessageId
(
messageId
);
}
@JavascriptInterface
public
boolean
getDeviceInfo
()
{
return
true
;
public
String
getDeviceInfo
()
{
return
chatData
.
getDeviceInfo
()
;
}
@JavascriptInterface
public
String
getServerInfo
()
{
String
json
=
"{\"chatURL\":\"hoge\", \"cmsURL\":\"fuga\", \"isOnline\": true }"
;
return
json
;
return
chatData
.
getServerInfo
();
}
@JavascriptInterface
public
String
getMyUserInfo
()
{
return
"hogehoge"
;
return
chatData
.
getMyUserInfo
()
;
}
@JavascriptInterface
public
String
getRoomInfo
()
{
return
"fugafuga"
;
return
chatData
.
getRoomInfo
()
;
}
public
void
loadChatViewUrl
(
final
String
urlString
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment