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
3ed63fe8
Commit
3ed63fe8
authored
Jul 13, 2021
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ChatWebViewクラスを作成。ChatWebViewActivityからViewを分離した。
parent
01d2dff2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
919 additions
and
988 deletions
+919
-988
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
+6
-0
ABVJE_UI_Android/res/layout/chat_webview.xml
+2
-38
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebViewActivity.java
+62
-950
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/view/ChatWebView.java
+849
-0
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
View file @
3ed63fe8
...
...
@@ -150,4 +150,10 @@ public interface ABookCommConstants {
}
String
FILE_SAVE_PATH
=
"/data/user/0/jp.co.agentec.abookplus.check/files/"
;
String
NETWORK_ERROR_PLACE_HOLDER
=
"file:///android_asset/chat/public_new/chat.html"
;
String
CHAT_PAGE_URL
=
"file:///android_asset/chat/public_new/chat.html"
;
String
CHAT_ROOM_PAGE_URL
=
"file:///android_asset/chat/public_new/chat_room.html"
;
String
COLLABORATION_PAGE_URL
=
"file:///android_asset/chat/public_new/collaboration.html"
;
String
DEFAULT_CHECKSUM
=
"0000000000"
;
}
ABVJE_UI_Android/res/layout/chat_webview.xml
View file @
3ed63fe8
...
...
@@ -6,49 +6,14 @@
android:layout_height=
"match_parent"
android:background=
"@color/background"
>
<!--
<RelativeLayout
android:id="@+id/toolbar_layout"
style="@style/OperationSearchToolBar"
android:layout_height="50dp"
android:layout_width="match_parent">
<TextView
android:id="@+id/title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/chat"
android:textColor="@color/edt_text"
android:textSize="18sp" />
<ImageButton
android:id="@+id/chat_close_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"/>
</RelativeLayout>
-->
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<WebView
android:id=
"@+id/chatWebview2"
<jp.agentec.abook.abv.ui.home.view.ChatWebView
android:id=
"@+id/chatWebview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebViewActivity.java
View file @
3ed63fe8
package
jp
.
agentec
.
abook
.
abv
.
ui
.
home
.
activity
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.app.Dialog
;
import
android.app.DownloadManager
;
import
android.app.PictureInPictureParams
;
import
android.content.BroadcastReceiver
;
...
...
@@ -18,10 +16,8 @@ import android.database.Cursor;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.net.ConnectivityManager
;
import
android.net.Network
;
import
android.net.NetworkInfo
;
import
android.net.Uri
;
import
android.net.http.SslError
;
import
android.net.wifi.WifiManager
;
import
android.os.AsyncTask
;
import
android.os.Build
;
...
...
@@ -30,24 +26,18 @@ import android.os.Environment;
import
android.provider.BaseColumns
;
import
android.provider.MediaStore
;
import
android.support.annotation.RequiresApi
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.
Window
;
import
android.view.
ViewGroup
;
import
android.webkit.CookieManager
;
import
android.webkit.DownloadListener
;
import
android.webkit.JavascriptInterface
;
import
android.webkit.JsResult
;
import
android.webkit.PermissionRequest
;
import
android.webkit.SslErrorHandler
;
import
android.webkit.ValueCallback
;
import
android.webkit.WebChromeClient
;
import
android.webkit.WebSettings
;
import
android.webkit.WebView
;
import
android.webkit.WebViewClient
;
import
android.widget.FrameLayout
;
import
android.widget.ImageButton
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
org.json.adf.JSONObject
;
...
...
@@ -60,26 +50,18 @@ import java.io.InputStream;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Stack
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.acms.client.json.ArchiveDetailJSON
;
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
;
...
...
@@ -88,11 +70,7 @@ 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.ChatGroupDto
;
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
;
...
...
@@ -107,14 +85,12 @@ 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.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.common.util.AlertDialogUtil
;
import
jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper
;
import
jp.agentec.abook.abv.ui.home.helper.VideoEncoder
;
import
jp.agentec.abook.abv.ui.home.view.ChatWebView
;
import
jp.agentec.abook.abv.ui.home.view.FullscreenableChromeClient
;
import
jp.agentec.abook.abv.ui.viewer.activity.CommunicationWebViewActivity
;
import
jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity
;
import
jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity
;
import
jp.agentec.adf.util.CollectionUtil
;
import
jp.agentec.adf.util.StringUtil
;
...
...
@@ -125,42 +101,34 @@ import static org.chromium.net.NetError.ERR_FAILED;
*/
public
class
ChatWebViewActivity
extends
CommunicationWebViewActivity
{
p
rivate
WebView
mChatWebView
;
p
ublic
Chat
WebView
mChatWebView
;
private
String
chatWebviewUrl
;
private
final
String
TAG
=
"ChatWebViewActivity"
;
private
final
String
NETWORK_ERROR_PLACE_HOLDER
=
"file:///android_asset/chat/public_new/chat.html"
;
private
final
String
CHAT_PAGE_URL
=
"file:///android_asset/chat/public_new/chat.html"
;
private
final
String
CHAT_ROOM_PAGE_URL
=
"file:///android_asset/chat/public_new/chat_room.html"
;
private
final
String
COLLABORATION_PAGE_URL
=
"file:///android_asset/chat/public_new/collaboration.html"
;
private
final
String
DEFAULT_CHECKSUM
=
"0000000000"
;
//AISDevelop
private
JsInf
jsInf
=
new
JsInf
();
private
ValueCallback
<
Uri
[]>
mUploadMessage
;
p
rivate
String
sid
;
p
rivate
String
roomName
;
p
rivate
String
loginId
;
p
ublic
String
sid
;
p
ublic
String
roomName
;
p
ublic
String
loginId
;
private
String
shopName
;
private
boolean
isOnline
;
p
rivate
Long
roomId
;
p
rivate
String
roomType
;
p
rivate
String
collaborationType
;
p
rivate
String
groupId
;
p
rivate
String
beforeRoomType
;
p
rivate
Integer
shopMemberId
;
p
rivate
String
selectedUserIdList
;
p
rivate
String
mSkey
;
p
rivate
Integer
joinMeetingId
;
p
ublic
Long
roomId
;
p
ublic
String
roomType
;
p
ublic
String
collaborationType
;
p
ublic
String
groupId
;
p
ublic
String
beforeRoomType
;
p
ublic
Integer
shopMemberId
;
p
ublic
String
selectedUserIdList
;
p
ublic
String
mSkey
;
p
ublic
Integer
joinMeetingId
;
private
boolean
isPIP
;
private
boolean
isStop
;
private
String
encodedFilePath
;
private
Uri
encodedVideoPath
;
// 0:協業生成, 1:協業参加
p
rivate
Integer
collaborationJoinFlg
=
0
;
p
rivate
MeetingManager
meetingManager
=
MeetingManager
.
getInstance
();
p
ublic
Integer
collaborationJoinFlg
=
0
;
p
ublic
MeetingManager
meetingManager
=
MeetingManager
.
getInstance
();
private
ActivityHandlingHelper
handlingHelper
=
ActivityHandlingHelper
.
getInstance
();
public
AlertDialog
myAlertDialog
;
...
...
@@ -170,18 +138,25 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
private
BroadcastReceiver
receiver
;
private
CommunicationLogic
communicationLogic
=
AbstractLogic
.
getLogic
(
CommunicationLogic
.
class
);
private
int
mCollaborationType
;
public
int
mCollaborationType
;
public
int
mHostRequestFlg
=
0
;
public
boolean
needHostAlert
=
false
;
private
int
mHostRequestFlg
=
0
;
private
boolean
needHostAlert
=
false
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
if
(
isNormalSize
())
{
setPortraitIfNormal
();
}
setContentView
(
R
.
layout
.
chat_webview
);
initializeWebView
();
//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
);
}
private
void
initializeWebView
()
{
...
...
@@ -207,13 +182,21 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
private
void
setupChatWebView
()
{
mChatWebView
=
new
ChatWebView
(
ChatWebViewActivity
.
this
);
//mChatWebView = findViewById(R.id.chatWebview);
mChatWebView
.
init
();
mChatWebView
.
setCommunicationLogic
(
communicationLogic
);
mChatWebView
.
setChatWebViewActivity
(
this
);
}
private
void
setupDefaultChatWebViewURL
()
{
//ネットワークがない場合専用のページを表示。
ShopMemberDto
myInfo
=
communicationLogic
.
getMyShopMemberDto
();
if
(
myInfo
!=
null
)
{
shopMemberId
=
myInfo
.
shopMemberId
;
}
chatWebviewUrl
=
NETWORK_ERROR_PLACE_HOLDER
;
chatWebviewUrl
=
ABookCommConstants
.
NETWORK_ERROR_PLACE_HOLDER
;
if
(!
ABVEnvironment
.
getInstance
().
networkAdapter
.
isNetworkConnected
())
{
registChatRoomPageLoader
();
Logger
.
d
(
"DEVICE_NOT_CONNECTED_NETWORK:"
);
...
...
@@ -229,7 +212,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
if
(!
isSIDValid
)
{
return
;
}
isOnline
=
true
;
chatWebviewUrl
=
CHAT_PAGE_URL
;
chatWebviewUrl
=
ABookCommConstants
.
CHAT_PAGE_URL
;
showProgressPopup
();
CommonExecutor
.
execute
(
new
Runnable
()
{
@Override
...
...
@@ -258,31 +241,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
});
}
private
void
setupChatWebView
()
{
mChatWebView
=
findViewById
(
R
.
id
.
chatWebview2
);
mChatWebView
.
setOverScrollMode
(
View
.
OVER_SCROLL_NEVER
);
//オーバースクロールしない。
mChatWebView
.
setVerticalScrollBarEnabled
(
false
);
//スクロールバーを消す。
mChatWebView
.
addJavascriptInterface
(
jsInf
,
"android"
);
WebSettings
settings
=
mChatWebView
.
getSettings
();
settings
.
setJavaScriptEnabled
(
true
);
//Javascriptを有効にする。
settings
.
setAppCacheEnabled
(
true
);
settings
.
setCacheMode
(
WebSettings
.
LOAD_NO_CACHE
);
settings
.
setMixedContentMode
(
WebSettings
.
MIXED_CONTENT_ALWAYS_ALLOW
);
settings
.
setDomStorageEnabled
(
true
);
settings
.
setDatabaseEnabled
(
true
);
settings
.
setMediaPlaybackRequiresUserGesture
(
false
);
settings
.
setAllowFileAccess
(
true
);
settings
.
setUseWideViewPort
(
true
);
settings
.
setAllowContentAccess
(
true
);
settings
.
setAllowFileAccessFromFileURLs
(
true
);
settings
.
setSaveFormData
(
false
);
settings
.
setAllowUniversalAccessFromFileURLs
(
true
);
if
(
Logger
.
isDebugEnabled
())
{
mChatWebView
.
setWebContentsDebuggingEnabled
(
true
);
//デバッグモード(chromeからinspect可)
}
}
private
void
registChatRoomPageLoader
()
{
// 最後のチャットのルーム名
String
lastRoomName
=
PreferenceUtil
.
getUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
""
);
...
...
@@ -293,7 +251,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
//ページをロード
if
(
roomId
!=
0
&&
roomName
!=
null
)
{
// by push message
try
{
jsInf
.
updateRoomList
();
mChatWebView
.
updateRoomList
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -303,7 +261,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
if
(
StringUtil
.
isNullOrEmpty
(
collaborationType
))
{
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
+
"&roomId="
+
roomId
+
"&roomName="
+
roomName
+
fixedParam
;
mChatWebView
.
postUrl
(
CHAT_ROOM_PAGE_URL
,
parameterData
.
getBytes
());
mChatWebView
.
postUrl
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
,
parameterData
.
getBytes
());
}
else
{
collaborationJoinFlg
=
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
INVITE
;
try
{
...
...
@@ -357,7 +315,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
// WebView内のAlert Dialogを処理する
@Override
public
boolean
onJsAlert
(
WebView
view
,
String
url
,
String
message
,
final
JsResult
result
)
{
if
(
mChatWebView
.
getUrl
()
!=
null
&&
mChatWebView
.
getUrl
().
equals
(
COLLABORATION_PAGE_URL
))
{
if
(
mChatWebView
.
getUrl
()
!=
null
&&
mChatWebView
.
getUrl
().
equals
(
ABookCommConstants
.
COLLABORATION_PAGE_URL
))
{
mChatWebView
.
loadUrl
(
"javascript:coview_api.HeartBeatUser(globalUserInfo.loginId);"
);
}
if
(
myAlertDialog
!=
null
&&
myAlertDialog
.
isShowing
())
{
...
...
@@ -431,7 +389,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
if
(
roomId
!=
null
)
{
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:CHAT_UI.joinRoom('%s', '%s');"
,
roomId
.
toString
(),
roomName
.
toString
()));
}
else
{
mChatWebView
.
loadUrl
(
CHAT_PAGE_URL
);
mChatWebView
.
loadUrl
(
ABookCommConstants
.
CHAT_PAGE_URL
);
}
}
else
if
(
tempMessage
.
equals
(
getString
(
R
.
string
.
error_fail_record
)))
{
mChatWebView
.
loadUrl
(
"javascript:recordFinished()"
);
...
...
@@ -588,7 +546,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
else
{
isOnline
=
true
;
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshForOnline();"
);
if
(
mChatWebView
.
getUrl
()
!=
null
&&
mChatWebView
.
getUrl
().
equals
(
CHAT_ROOM_PAGE_URL
))
{
if
(
mChatWebView
.
getUrl
()
!=
null
&&
mChatWebView
.
getUrl
().
equals
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
))
{
mChatWebView
.
loadUrl
(
"javascript:window.location.reload();"
);
}
}
...
...
@@ -639,7 +597,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mChatWebView
.
removeView
(
view
);
view
.
removeAllViews
();
mChatWebView
.
reload
();
mChatWebView
.
loadUrl
(
NETWORK_ERROR_PLACE_HOLDER
);
mChatWebView
.
loadUrl
(
ABookCommConstants
.
NETWORK_ERROR_PLACE_HOLDER
);
}
Logger
.
d
(
"WEB_VIEW_ERROR"
,
"error code:"
+
errorCode
+
" - "
+
description
);
}
...
...
@@ -699,87 +657,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
});
}
/**
* コミュニケーションメニューダイアログ
*/
public
void
showCommunicationMenuDialog2
()
{
mCommunicationMenuDialog
=
new
Dialog
(
this
);
mCommunicationMenuDialog
.
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
mCommunicationMenuDialog
.
setCanceledOnTouchOutside
(
false
);
mCommunicationMenuDialog
.
setContentView
(
R
.
layout
.
communication_menu_dialog
);
List
<
PushMessageDto
>
pushMessageDtoList
=
pushMessageLogic
.
getAllPushMessageList
();
boolean
existUnreadFlg
=
false
;
for
(
PushMessageDto
pushMessageDto
:
pushMessageDtoList
)
{
if
(!
pushMessageDto
.
readingFlg
)
{
existUnreadFlg
=
true
;
break
;
}
}
ImageView
ivIcon
=
(
ImageView
)
mCommunicationMenuDialog
.
findViewById
(
R
.
id
.
btn_push_message_list
);
if
(
existUnreadFlg
)
{
ivIcon
.
setBackgroundResource
(
R
.
drawable
.
ic_communication_push_message_list_with_badge
);
}
else
{
ivIcon
.
setBackgroundResource
(
R
.
drawable
.
ic_communication_push_message_list
);
}
LinearLayout
ll_menuItem_meeting
=
(
LinearLayout
)
mCommunicationMenuDialog
.
findViewById
(
R
.
id
.
ll_item_meeting
);
ll_menuItem_meeting
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
ActivityHandlingHelper
.
getInstance
().
startMeetingActivity
();
mCommunicationMenuDialog
.
dismiss
();
}
});
LinearLayout
ll_menuItem_push_message
=
(
LinearLayout
)
mCommunicationMenuDialog
.
findViewById
(
R
.
id
.
ll_item_push_message
);
ll_menuItem_push_message
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
// showOperationSelectDialog();
mCommunicationMenuDialog
.
dismiss
();
}
});
LinearLayout
ll_menuItem_push_message_list
=
(
LinearLayout
)
mCommunicationMenuDialog
.
findViewById
(
R
.
id
.
ll_item_push_message_list
);
ll_menuItem_push_message_list
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
// showPushMessageListDialog();
mCommunicationMenuDialog
.
dismiss
();
}
});
// chat
LinearLayout
ll_menuItem_chat
=
(
LinearLayout
)
mCommunicationMenuDialog
.
findViewById
(
R
.
id
.
ll_item_chat
);
ll_menuItem_chat
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
// チャット利用のはネットワークが繋がる時のみ
if
(
ABVEnvironment
.
getInstance
().
networkAdapter
.
isNetworkConnected
())
{
showProgressPopup
();
ActivityHandlingHelper
.
getInstance
().
startChatWebViewActivity
();
mCommunicationMenuDialog
.
dismiss
();
}
else
{
ABVToastUtil
.
showMakeText
(
ChatWebViewActivity
.
this
,
R
.
string
.
request_network_connection
,
Toast
.
LENGTH_SHORT
);
return
;
}
}
});
mCommunicationMenuDialog
.
findViewById
(
R
.
id
.
close_btn
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
mCommunicationMenuDialog
.
dismiss
();
}
});
mCommunicationMenuDialog
.
show
();
}
// 保存するファイルをjpgに固定する
public
String
getFileName
(
String
url
)
{
String
filenameWithoutExtension
=
""
;
...
...
@@ -948,775 +825,10 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
existUnreadFlg
;
}
private
class
JsInf
{
@JavascriptInterface
public
void
saveVisitRoomInfo
(
String
roomId
,
String
roomName
)
{
System
.
out
.
println
(
"roomName : "
+
roomName
);
System
.
out
.
println
(
"roomId : "
+
roomId
);
// 最後のチャットのルーム名
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
roomName
);
// 最後のチャットのルーム
PreferenceUtil
.
putUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
roomId
);
}
@JavascriptInterface
public
void
getLoginParameter
()
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
getLogin
();
}
});
}
@JavascriptInterface
public
void
getGlobalParameter
()
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
getQueryParam
();
}
});
}
@JavascriptInterface
public
void
goHome
()
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
backToHome
();
}
});
}
@JavascriptInterface
public
void
openOperationRelatedContent
()
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
showCommonContent
();
}
});
}
@JavascriptInterface
public
void
openCommunication
()
{
showCommunicationMenuDialog
();
}
@JavascriptInterface
public
void
openCommunicationHome
()
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
CHAT_PAGE_URL
);
}
});
}
@JavascriptInterface
public
void
reload
()
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
ActivityHandlingHelper
.
getInstance
().
startChatWebViewActivity
();
}
});
}
@JavascriptInterface
public
void
saveSelectedUserList
(
String
userIdList
)
{
Log
.
d
(
"userIdList "
,
userIdList
);
selectedUserIdList
=
userIdList
;
}
@JavascriptInterface
public
String
getSelectedUserList
()
{
String
userList
=
communicationLogic
.
getUserList
(
selectedUserIdList
);
Log
.
d
(
"getSelectedUserList "
,
userList
);
return
userList
;
}
@JavascriptInterface
public
String
getRoomList
(
String
roomType
,
String
keyword
)
{
String
chatRoomListStr
=
communicationLogic
.
getChatRoomList
(
Integer
.
parseInt
(
roomType
),
keyword
);
return
chatRoomListStr
;
}
@JavascriptInterface
public
void
test
()
{
OperationRelatedContentActivity
testact
=
ActivityHandlingHelper
.
getInstance
().
getActivity
(
OperationRelatedContentActivity
.
class
);
testact
.
finish
();
/*testact.System.runFinalization();
System.exit(0);*/
}
@JavascriptInterface
public
void
updateRoomList
()
throws
NetworkDisconnectedException
,
AcmsException
{
Map
<
String
,
Object
>
chatRoomList
;
RoomListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getRoomList
(
sid
);
communicationLogic
.
insertChatRoomList
(
resultJson
.
roomList
);
}
@JavascriptInterface
public
void
updateMyInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateMyInfoFromServer
();
}
@JavascriptInterface
public
void
updateGroupUser
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateGroupInfoFromServer
();
}
@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
(
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
));
}
});
}
}
@JavascriptInterface
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
);
}
@JavascriptInterface
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
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
CHAT_ROOM_PAGE_URL
);
}
});
}
@JavascriptInterface
public
void
roomDisplayOff
()
{
communicationLogic
.
roomDisplayOff
(
roomId
.
intValue
(),
ABookCommConstants
.
FLAG
.
ROOM_VIEW_FLAG
.
INVISIBLE
);
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
CHAT_PAGE_URL
);
}
});
}
@JavascriptInterface
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
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
CHAT_ROOM_PAGE_URL
);
}
});
}
}
else
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:CHAT_UI.displayExistRoom('%s');"
,
result
.
roomId
.
toString
()));
}
});
}
}
@JavascriptInterface
public
String
getRoomType
()
{
return
roomType
;
}
@JavascriptInterface
public
String
getBeforeRoomType
()
{
return
beforeRoomType
;
}
@JavascriptInterface
public
void
clearBeforeRoomType
()
{
beforeRoomType
=
null
;
}
@JavascriptInterface
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
();
}
@JavascriptInterface
public
String
getMessageList
(
String
roomId
)
{
String
messageListStr
=
communicationLogic
.
getMessages
(
Integer
.
parseInt
(
roomId
));
return
messageListStr
;
}
@JavascriptInterface
public
String
searchMessages
(
String
keyword
,
String
userList
)
{
String
messageListStr
=
communicationLogic
.
searMessages
(
roomId
.
intValue
(),
keyword
,
userList
);
return
messageListStr
;
}
@JavascriptInterface
public
String
getFavoriteUsers
()
{
String
favoriteUsersStr
=
communicationLogic
.
getFavoriteUsers
();
return
favoriteUsersStr
;
}
@JavascriptInterface
public
String
getFavoriteUsersNotInRoom
()
{
String
favoriteUsersStr
=
communicationLogic
.
getFavoriteUsersNotInRoom
(
roomId
.
intValue
());
return
favoriteUsersStr
;
}
@JavascriptInterface
public
String
getMyInfo
()
{
String
myInfoStr
=
communicationLogic
.
getMyInfo
();
return
myInfoStr
;
}
@JavascriptInterface
public
String
getUsersInRoom
(
String
roomId
)
{
String
attendUsers
=
communicationLogic
.
getUsersInRoom
(
Integer
.
parseInt
(
roomId
));
return
attendUsers
;
}
@JavascriptInterface
public
String
getMyGroupUsers
()
{
String
myGroupUsersStr
=
communicationLogic
.
getMyGroupUsers
();
return
myGroupUsersStr
;
}
@JavascriptInterface
public
String
getMyGroupUsersNotInRoom
()
{
String
myGroupUsersStr
=
communicationLogic
.
getMyGroupUsersNotInRoom
(
roomId
.
intValue
());
return
myGroupUsersStr
;
}
@JavascriptInterface
public
String
getMyGroupShopMemberByName
(
String
keyword
)
{
String
searchUserStr
=
communicationLogic
.
getMyGroupUserByName
(
keyword
);
return
searchUserStr
;
}
@JavascriptInterface
public
String
getMyGroupShopMemberNotInRoomByName
(
String
keywords
)
{
String
searchUserStr
=
communicationLogic
.
getMyGroupUserNotInRoomByName
(
keywords
,
roomId
.
intValue
());
return
searchUserStr
;
}
@JavascriptInterface
public
String
getAllGroupShopMemberByName
(
String
shopMemberName
)
{
String
searchUserStr
=
communicationLogic
.
getAllGroupShopMemberByName
(
shopMemberName
);
return
searchUserStr
;
}
@JavascriptInterface
public
String
getAllGroupShopMemberNotInRoomByName
(
String
keywords
)
{
String
searchUserStr
=
communicationLogic
.
getAllGroupShopMemberNotInRoomByName
(
keywords
,
roomId
.
intValue
());
return
searchUserStr
;
}
@JavascriptInterface
public
String
getGroupByName
(
String
keyword
)
{
String
searchGroupStr
=
communicationLogic
.
getGroupByName
(
keyword
);
return
searchGroupStr
;
}
@JavascriptInterface
public
String
getFavoriteGroups
()
{
String
favoriteGroupsStr
=
communicationLogic
.
getFavoriteGroups
();
return
favoriteGroupsStr
;
}
@JavascriptInterface
public
void
updateUserInfo
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
updateUserInfoFromServer
(
shopMemberId
);
}
@JavascriptInterface
public
String
getGroupInfo
(
String
groupId
)
{
String
groupInfoStr
=
communicationLogic
.
getGroupSearchData
(
Integer
.
parseInt
(
groupId
));
return
groupInfoStr
;
}
@JavascriptInterface
public
String
getGroupInfoForAddUser
(
String
groupId
)
{
String
groupInfoStr
=
communicationLogic
.
getGroupSearchDataForAddUser
(
Integer
.
parseInt
(
groupId
),
roomId
.
intValue
());
return
groupInfoStr
;
}
@JavascriptInterface
public
String
getNameCardData
(
String
shopMemberId
)
{
String
nameCardStr
=
communicationLogic
.
getNameCardInfo
(
Integer
.
parseInt
(
shopMemberId
));
return
nameCardStr
;
}
@JavascriptInterface
public
String
getFavoriteGroupsList
()
{
String
favoriteGroupsListStr
=
communicationLogic
.
getFavoriteGroups
();
return
favoriteGroupsListStr
;
}
@JavascriptInterface
public
boolean
addFavoriteUser
(
String
shopMemberId
)
throws
AcmsException
{
Integer
favoriteCount
=
communicationLogic
.
getFavoriteCount
();
if
(
favoriteCount
>=
ABookCommConstants
.
SIZE
.
MAX_FAVORITE_COUNT
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:alert('"
+
"お気に入りは最大100件までです。"
+
"');"
);
}
});
return
false
;
}
else
{
boolean
result
=
false
;
try
{
result
=
insertFavoriteUser
(
shopMemberId
);
if
(!
result
)
{
return
false
;
}
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
}
});
return
true
;
}
catch
(
NetworkDisconnectedException
e
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:alert('接続しているネットワークがありません。');"
);
}
});
}
}
return
false
;
}
@JavascriptInterface
public
boolean
removeFavoriteUser
(
String
shopMemberId
)
throws
AcmsException
{
try
{
boolean
result
=
deleteFavoriteUser
(
shopMemberId
);
if
(!
result
)
{
return
false
;
}
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
}
});
return
true
;
}
catch
(
NetworkDisconnectedException
e
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:alert('接続しているネットワークがありません。');"
);
}
});
}
return
false
;
}
@JavascriptInterface
public
boolean
addFavoriteGroup
(
String
groupId
)
throws
AcmsException
{
Integer
favoriteCount
=
communicationLogic
.
getFavoriteCount
();
if
(
favoriteCount
>=
ABookCommConstants
.
SIZE
.
MAX_FAVORITE_COUNT
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:alert('"
+
"お気に入りは最大100件までです。"
+
"');"
);
}
});
return
false
;
}
else
{
boolean
result
=
false
;
try
{
result
=
insertFavoriteGroup
(
groupId
);
if
(!
result
)
{
return
false
;
}
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
}
});
return
true
;
}
catch
(
NetworkDisconnectedException
e
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:alert('接続しているネットワークがありません。');"
);
}
});
}
}
return
false
;
}
@JavascriptInterface
public
boolean
removeFavoriteGroup
(
String
groupId
)
throws
AcmsException
{
boolean
result
=
false
;
try
{
result
=
deleteFavoriteGroup
(
groupId
);
if
(!
result
)
{
return
false
;
}
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
}
});
return
true
;
}
catch
(
NetworkDisconnectedException
e
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:alert('接続しているネットワークがありません。');"
);
}
});
}
return
false
;
}
@JavascriptInterface
public
void
updateFavorite
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateFavoriteInfo
();
}
@JavascriptInterface
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
();
}
@JavascriptInterface
public
String
getArchiveList
()
{
String
archiveListStr
=
communicationLogic
.
getAllArchive
();
return
archiveListStr
;
}
@JavascriptInterface
public
String
getArchiveListByName
(
String
keyword
)
{
String
archiveListStr
=
communicationLogic
.
getArchiveListByName
(
keyword
);
return
archiveListStr
;
}
@JavascriptInterface
public
String
getUserInfo
(
String
shopMemberId
)
{
String
archiveListStr
=
communicationLogic
.
getUserInfo
(
Integer
.
parseInt
(
shopMemberId
));
return
archiveListStr
;
}
@JavascriptInterface
public
String
getUserInfoList
(
String
shopMemberIds
)
{
String
userIds
=
shopMemberIds
;
String
UserInfoList
=
communicationLogic
.
getUserList
(
shopMemberIds
);
return
UserInfoList
;
}
@JavascriptInterface
public
String
getArchiveDetail
(
String
archiveId
)
{
String
archiveListStr
=
communicationLogic
.
getArchiveDetail
(
Integer
.
parseInt
(
archiveId
));
return
archiveListStr
;
}
@JavascriptInterface
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
);
}
@JavascriptInterface
public
void
joinCollaboration
(
String
collaborationType
,
String
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
joinMeetingId
=
Integer
.
parseInt
(
meetingId
);
collaborationJoinFlg
=
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
JOIN
;
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
joinCollaboration
(
sid
,
roomId
.
intValue
());
moveCollaborationScreen
(
Integer
.
parseInt
(
collaborationType
));
}
@JavascriptInterface
public
void
joinChangedCollaboration
(
String
collaborationType
,
String
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
joinMeetingId
=
Integer
.
parseInt
(
meetingId
);
collaborationJoinFlg
=
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
JOIN
;
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
joinCollaboration
(
sid
,
roomId
.
intValue
());
}
@JavascriptInterface
public
void
inviteCollaboration
(
String
inviteUserIds
,
String
collaborationType
)
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
inviteCollaboration
(
sid
,
roomId
.
intValue
(),
roomName
,
inviteUserIds
,
collaborationType
);
}
@JavascriptInterface
public
void
startCollaboration
(
String
collaborationType
)
{
collaborationJoinFlg
=
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
CREATE
;
moveCollaborationScreen
(
Integer
.
parseInt
(
collaborationType
));
}
@JavascriptInterface
public
void
finishCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishCollaboration
(
sid
,
roomId
.
intValue
());
}
@JavascriptInterface
public
void
finishAllCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishAllCollaboration
(
sid
,
roomId
.
intValue
());
}
@JavascriptInterface
public
String
getCollaborationJoinFlg
()
{
return
collaborationJoinFlg
.
toString
();
}
@JavascriptInterface
public
String
getCollaborationType
()
{
return
collaborationType
;
}
@JavascriptInterface
public
String
getToMoveGroupId
()
{
return
groupId
;
}
@JavascriptInterface
public
void
setToMoveGroupId
(
String
moveToGroupId
)
{
groupId
=
moveToGroupId
;
}
@JavascriptInterface
public
String
getContentList
()
{
return
communicationLogic
.
getContentList
();
}
@JavascriptInterface
public
String
getUserListByLoginId
(
String
loginIdList
)
{
return
communicationLogic
.
getUserListByLoginId
(
loginIdList
);
}
@JavascriptInterface
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('"
+
"会議室サーバに接続できませんでした。"
+
"');"
);
}
startContentListActivity
(
true
);
return
meetingId
.
intValue
();
}
@JavascriptInterface
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('"
+
"会議室サーバに接続できませんでした。"
+
"');"
);
}
startContentListActivity
(
false
);
}
@JavascriptInterface
public
void
joinMeetingRoom
(
int
newMeetingId
)
throws
InterruptedException
{
finishBeforeContentListActivity
();
PictureInPictureParams
.
Builder
mPipBuilder
=
new
PictureInPictureParams
.
Builder
();
enterPictureInPictureMode
(
mPipBuilder
.
build
());
meetingManager
.
close
();
try
{
connectMeetingServer
();
List
<
MeetingDto
>
meetingList
=
meetingManager
.
getMeetingList
(
mSkey
);
meetingManager
.
join
(
joinMeetingId
,
mSkey
,
roomId
.
toString
(),
false
);
meetingManager
.
setCollaboration
(
true
);
}
catch
(
Exception
e
)
{
mChatWebView
.
loadUrl
(
"javascript:alert('"
+
"会議室サーバに接続できませんでした。"
+
"');"
);
}
startContentListActivity
(
false
);
}
@JavascriptInterface
public
void
startPipMode
()
{
PictureInPictureParams
.
Builder
mPipBuilder
=
new
PictureInPictureParams
.
Builder
();
enterPictureInPictureMode
(
mPipBuilder
.
build
());
}
@JavascriptInterface
public
void
exitPIPmode
()
{
finishPIPmode
();
}
@JavascriptInterface
public
void
exitMeetingRoom
()
{
exitAndDeleteMeetingRoom
();
finishPIPmode
();
}
@JavascriptInterface
public
int
getJoinCollaborationType
()
{
return
mCollaborationType
;
}
@JavascriptInterface
public
void
setJoinCollaborationType
(
int
collaborationType
)
{
mCollaborationType
=
collaborationType
;
}
@JavascriptInterface
public
void
changeCollaboration
(
int
changeCollaborationType
,
int
meetingId
)
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
changeCollaboration
(
sid
,
roomId
.
intValue
(),
changeCollaborationType
,
meetingId
);
}
@JavascriptInterface
public
int
getAndroidVersion
()
{
return
Build
.
VERSION
.
SDK_INT
;
}
@JavascriptInterface
public
void
removeEncodedVideo
(
String
filePath
)
{
File
encodedVideo
=
new
File
(
filePath
);
if
(
encodedVideo
.
exists
())
{
encodedVideo
.
delete
();
}
}
@JavascriptInterface
public
void
setHostRequestFlg
(
int
hostRequestFlg
)
{
mHostRequestFlg
=
hostRequestFlg
;
}
@JavascriptInterface
public
int
getHostRequestFlg
()
{
return
mHostRequestFlg
;
}
@JavascriptInterface
public
void
finishPip
()
{
finishPIPmode
();
}
@JavascriptInterface
public
void
setExitHostAlert
()
{
needHostAlert
=
true
;
}
@JavascriptInterface
public
boolean
getExitHostAlert
()
{
if
(
needHostAlert
)
{
needHostAlert
=
false
;
return
true
;
}
return
needHostAlert
;
}
@JavascriptInterface
public
void
updatePreMessage
(
String
messageId
)
throws
NetworkDisconnectedException
,
AcmsException
{
if
(
messageId
.
equals
(
"0"
))
{
return
;
}
updateMessageFromMessageId
(
messageId
);
}
@JavascriptInterface
public
String
getMessageListFromMessageId
(
String
messageId
)
{
if
(
messageId
.
equals
(
"0"
))
{
return
""
;
}
String
messageListStr
=
communicationLogic
.
getMessagesFromMessageId
(
roomId
.
intValue
(),
messageId
);
return
messageListStr
;
}
}
/**
* 作業一覧へ遷移
*/
p
rivate
void
backToHome
()
{
p
ublic
void
backToHome
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT.leaveRoom()"
);
exitAndDeleteMeetingRoom
();
finish
();
...
...
@@ -1726,14 +838,14 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
startActivity
(
intent
,
NaviConsts
.
Left
);
}
p
rivate
void
finishBeforeContentListActivity
()
{
p
ublic
void
finishBeforeContentListActivity
()
{
OperationRelatedContentActivity
beforeActiryty
=
activityHandlingHelper
.
getActivity
(
OperationRelatedContentActivity
.
class
);
if
(
beforeActiryty
!=
null
)
{
beforeActiryty
.
finish
();
}
}
p
rivate
void
finishPIPmode
()
{
p
ublic
void
finishPIPmode
()
{
if
(
isPIP
)
{
getApplication
().
startActivity
(
new
Intent
(
this
,
ChatWebViewActivity
.
class
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
|
Intent
.
FLAG_ACTIVITY_NEW_TASK
));
...
...
@@ -1757,7 +869,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
handlingHelper
.
saveMeetingInfo
(
null
,
null
,
null
,
false
);
}
p
rivate
void
startContentListActivity
(
boolean
isOwner
)
{
p
ublic
void
startContentListActivity
(
boolean
isOwner
)
{
Activity
targetActivity
=
activityHandlingHelper
.
getCurrentActivity
();
if
(
targetActivity
instanceof
ChatWebViewActivity
)
{
Stack
<
ABVAuthenticatedActivity
>
stack
=
activityHandlingHelper
.
getCurrentActivityStack
();
...
...
@@ -1777,20 +889,20 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mSkey
=
meetingManager
.
getSessionKey
(
true
);
}
p
rivate
void
updateMyInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
void
updateMyInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getMyInfo
(
sid
);
if
(
resultJson
.
shopMemberDto
!=
null
)
{
communicationLogic
.
insertMyInfo
(
resultJson
.
shopMemberDto
);
}
}
p
rivate
void
updateUserInfoFromServer
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
void
updateUserInfoFromServer
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
getNameCard
(
sid
,
shopMemberId
);
communicationLogic
.
insertShopMember
(
resultJson
.
shopMemberDto
);
}
p
rivate
boolean
insertFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
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
<>();
...
...
@@ -1799,7 +911,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
result
;
}
p
rivate
boolean
deleteFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
boolean
deleteFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
deleteFavoriteUser
(
sid
,
Integer
.
parseInt
(
shopMemberId
));
if
(
result
)
{
...
...
@@ -1810,7 +922,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
result
;
}
p
rivate
boolean
insertFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
boolean
insertFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
insertFavoriteGroup
(
sid
,
Integer
.
parseInt
(
groupId
));
return
result
;
...
...
@@ -1821,7 +933,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
super
.
onBackPressed
();
}
p
rivate
void
moveCollaborationScreen
(
Integer
collaborationType
)
{
p
ublic
void
moveCollaborationScreen
(
Integer
collaborationType
)
{
if
(
collaborationType
.
equals
(
ABookCommConstants
.
FLAG
.
COLLABORATION_TYPE
.
DOCUMENT
)
&&
!
isValidVersion
())
{
mChatWebView
.
loadUrl
(
"javascript:alert(getLocalizedString('not_support_version'));"
);
return
;
...
...
@@ -1830,12 +942,12 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
COLLABORATION_PAGE_URL
);
mChatWebView
.
loadUrl
(
ABookCommConstants
.
COLLABORATION_PAGE_URL
);
}
});
}
p
rivate
boolean
deleteFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
boolean
deleteFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
)
.
deleteFavoriteGroup
(
sid
,
Integer
.
parseInt
(
groupId
));
...
...
@@ -1847,10 +959,10 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
true
;
}
p
rivate
void
updateGroupInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
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
,
DEFAULT_CHECKSUM
);
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
))
{
...
...
@@ -1881,7 +993,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
updateGroupInfoFromServer
();
}
p
rivate
void
updateFavoriteInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
p
ublic
void
updateFavoriteInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
updateFavoriteUser
();
updateFavoriteGroup
();
}
...
...
@@ -1922,7 +1034,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
// 共通資料画面表示
p
rivate
void
showCommonContent
()
{
p
ublic
void
showCommonContent
()
{
Intent
intent
=
new
Intent
();
intent
.
setClass
(
ChatWebViewActivity
.
this
,
OperationRelatedContentActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
...
...
@@ -1983,7 +1095,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
protected
void
onResume
()
{
isStop
=
false
;
super
.
onResume
();
if
(
mChatWebView
.
getUrl
()
!=
null
&&
mChatWebView
.
getUrl
().
equals
(
CHAT_ROOM_PAGE_URL
))
{
if
(
mChatWebView
.
getUrl
()
!=
null
&&
mChatWebView
.
getUrl
().
equals
(
ABookCommConstants
.
CHAT_ROOM_PAGE_URL
))
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_SOCKET.socketCheck();"
);
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/view/ChatWebView.java
0 → 100644
View file @
3ed63fe8
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
;
import
android.webkit.JavascriptInterface
;
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.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
;
public
ChatWebView
(
Context
context
)
{
super
(
context
);
this
.
context
=
context
;
}
public
void
init
()
{
setOverScrollMode
(
View
.
OVER_SCROLL_NEVER
);
//オーバースクロールしない。
setVerticalScrollBarEnabled
(
false
);
//スクロールバーを消す。
addJavascriptInterface
(
this
,
"android"
);
WebSettings
settings
=
getSettings
();
settings
.
setJavaScriptEnabled
(
true
);
//Javascriptを有効にする。
settings
.
setAppCacheEnabled
(
true
);
settings
.
setCacheMode
(
WebSettings
.
LOAD_NO_CACHE
);
settings
.
setMixedContentMode
(
WebSettings
.
MIXED_CONTENT_ALWAYS_ALLOW
);
settings
.
setDomStorageEnabled
(
true
);
settings
.
setDatabaseEnabled
(
true
);
settings
.
setMediaPlaybackRequiresUserGesture
(
false
);
settings
.
setAllowFileAccess
(
true
);
settings
.
setUseWideViewPort
(
true
);
settings
.
setAllowContentAccess
(
true
);
settings
.
setAllowFileAccessFromFileURLs
(
true
);
settings
.
setSaveFormData
(
false
);
settings
.
setAllowUniversalAccessFromFileURLs
(
true
);
if
(
Logger
.
isDebugEnabled
())
{
setWebContentsDebuggingEnabled
(
true
);
//デバッグモード(chromeからinspect可)
}
}
public
void
setCommunicationLogic
(
CommunicationLogic
communicationLogic
){
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
);
// 最後のチャットのルーム
PreferenceUtil
.
putUserPref
(
context
,
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
roomId
);
}
@JavascriptInterface
public
void
getLoginParameter
()
{
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
activity
.
getLogin
();
}
});
}
@JavascriptInterface
public
void
getGlobalParameter
()
{
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
activity
.
getQueryParam
();
}
});
}
@JavascriptInterface
public
void
goHome
()
{
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
activity
.
backToHome
();
}
});
}
@JavascriptInterface
public
void
openOperationRelatedContent
()
{
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
activity
.
showCommonContent
();
}
});
}
@JavascriptInterface
public
void
openCommunication
()
{
activity
.
showCommunicationMenuDialog
();
}
@JavascriptInterface
public
void
openCommunicationHome
()
{
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
loadUrl
(
ABookCommConstants
.
CHAT_PAGE_URL
);
}
});
}
@JavascriptInterface
public
void
reload
()
{
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
ActivityHandlingHelper
.
getInstance
().
startChatWebViewActivity
();
}
});
}
@JavascriptInterface
public
void
saveSelectedUserList
(
String
userIdList
)
{
Log
.
d
(
"userIdList "
,
userIdList
);
activity
.
selectedUserIdList
=
userIdList
;
}
@JavascriptInterface
public
String
getSelectedUserList
()
{
String
userList
=
communicationLogic
.
getUserList
(
activity
.
selectedUserIdList
);
Log
.
d
(
"getSelectedUserList "
,
userList
);
return
userList
;
}
@JavascriptInterface
public
String
getRoomList
(
String
roomType
,
String
keyword
)
{
String
chatRoomListStr
=
communicationLogic
.
getChatRoomList
(
Integer
.
parseInt
(
roomType
),
keyword
);
return
chatRoomListStr
;
}
@JavascriptInterface
public
void
test
()
{
OperationRelatedContentActivity
testact
=
ActivityHandlingHelper
.
getInstance
().
getActivity
(
OperationRelatedContentActivity
.
class
);
testact
.
finish
();
/*testact.System.runFinalization();
System.exit(0);*/
}
@JavascriptInterface
public
void
updateRoomList
()
throws
NetworkDisconnectedException
,
AcmsException
{
Map
<
String
,
Object
>
chatRoomList
;
RoomListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getRoomList
(
activity
.
sid
);
communicationLogic
.
insertChatRoomList
(
resultJson
.
roomList
);
}
@JavascriptInterface
public
void
updateMyInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
activity
.
updateMyInfoFromServer
();
}
@JavascriptInterface
public
void
updateGroupUser
()
throws
NetworkDisconnectedException
,
AcmsException
{
activity
.
updateGroupInfoFromServer
();
}
@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
));
}
});
}
}
@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
);
}
@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
);
}
});
}
@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
);
}
});
}
@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
()));
}
});
}
}
@JavascriptInterface
public
String
getRoomType
()
{
return
activity
.
roomType
;
}
@JavascriptInterface
public
String
getBeforeRoomType
()
{
return
activity
.
beforeRoomType
;
}
@JavascriptInterface
public
void
clearBeforeRoomType
()
{
activity
.
beforeRoomType
=
null
;
}
@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
);
}
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
();
}
@JavascriptInterface
public
String
getMessageList
(
String
roomId
)
{
String
messageListStr
=
communicationLogic
.
getMessages
(
Integer
.
parseInt
(
roomId
));
return
messageListStr
;
}
@JavascriptInterface
public
String
searchMessages
(
String
keyword
,
String
userList
)
{
String
messageListStr
=
communicationLogic
.
searMessages
(
activity
.
roomId
.
intValue
(),
keyword
,
userList
);
return
messageListStr
;
}
@JavascriptInterface
public
String
getFavoriteUsers
()
{
String
favoriteUsersStr
=
communicationLogic
.
getFavoriteUsers
();
return
favoriteUsersStr
;
}
@JavascriptInterface
public
String
getFavoriteUsersNotInRoom
()
{
String
favoriteUsersStr
=
communicationLogic
.
getFavoriteUsersNotInRoom
(
activity
.
roomId
.
intValue
());
return
favoriteUsersStr
;
}
@JavascriptInterface
public
String
getMyInfo
()
{
String
myInfoStr
=
communicationLogic
.
getMyInfo
();
return
myInfoStr
;
}
@JavascriptInterface
public
String
getUsersInRoom
(
String
roomId
)
{
String
attendUsers
=
communicationLogic
.
getUsersInRoom
(
Integer
.
parseInt
(
roomId
));
return
attendUsers
;
}
@JavascriptInterface
public
String
getMyGroupUsers
()
{
String
myGroupUsersStr
=
communicationLogic
.
getMyGroupUsers
();
return
myGroupUsersStr
;
}
@JavascriptInterface
public
String
getMyGroupUsersNotInRoom
()
{
String
myGroupUsersStr
=
communicationLogic
.
getMyGroupUsersNotInRoom
(
activity
.
roomId
.
intValue
());
return
myGroupUsersStr
;
}
@JavascriptInterface
public
String
getMyGroupShopMemberByName
(
String
keyword
)
{
String
searchUserStr
=
communicationLogic
.
getMyGroupUserByName
(
keyword
);
return
searchUserStr
;
}
@JavascriptInterface
public
String
getMyGroupShopMemberNotInRoomByName
(
String
keywords
)
{
String
searchUserStr
=
communicationLogic
.
getMyGroupUserNotInRoomByName
(
keywords
,
activity
.
roomId
.
intValue
());
return
searchUserStr
;
}
@JavascriptInterface
public
String
getAllGroupShopMemberByName
(
String
shopMemberName
)
{
String
searchUserStr
=
communicationLogic
.
getAllGroupShopMemberByName
(
shopMemberName
);
return
searchUserStr
;
}
@JavascriptInterface
public
String
getAllGroupShopMemberNotInRoomByName
(
String
keywords
)
{
String
searchUserStr
=
communicationLogic
.
getAllGroupShopMemberNotInRoomByName
(
keywords
,
activity
.
roomId
.
intValue
());
return
searchUserStr
;
}
@JavascriptInterface
public
String
getGroupByName
(
String
keyword
)
{
String
searchGroupStr
=
communicationLogic
.
getGroupByName
(
keyword
);
return
searchGroupStr
;
}
@JavascriptInterface
public
String
getFavoriteGroups
()
{
String
favoriteGroupsStr
=
communicationLogic
.
getFavoriteGroups
();
return
favoriteGroupsStr
;
}
@JavascriptInterface
public
void
updateUserInfo
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
activity
.
updateUserInfoFromServer
(
shopMemberId
);
}
@JavascriptInterface
public
String
getGroupInfo
(
String
groupId
)
{
String
groupInfoStr
=
communicationLogic
.
getGroupSearchData
(
Integer
.
parseInt
(
groupId
));
return
groupInfoStr
;
}
@JavascriptInterface
public
String
getGroupInfoForAddUser
(
String
groupId
)
{
String
groupInfoStr
=
communicationLogic
.
getGroupSearchDataForAddUser
(
Integer
.
parseInt
(
groupId
),
activity
.
roomId
.
intValue
());
return
groupInfoStr
;
}
@JavascriptInterface
public
String
getNameCardData
(
String
shopMemberId
)
{
String
nameCardStr
=
communicationLogic
.
getNameCardInfo
(
Integer
.
parseInt
(
shopMemberId
));
return
nameCardStr
;
}
@JavascriptInterface
public
String
getFavoriteGroupsList
()
{
String
favoriteGroupsListStr
=
communicationLogic
.
getFavoriteGroups
();
return
favoriteGroupsListStr
;
}
@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件までです。"
+
"');"
);
}
});
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
;
}
@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('接続しているネットワークがありません。');"
);
}
});
}
return
false
;
}
@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件までです。"
+
"');"
);
}
});
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
;
}
@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('接続しているネットワークがありません。');"
);
}
});
}
return
false
;
}
@JavascriptInterface
public
void
updateFavorite
()
throws
NetworkDisconnectedException
,
AcmsException
{
activity
.
updateFavoriteInfo
();
}
@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
();
}
@JavascriptInterface
public
String
getArchiveList
()
{
String
archiveListStr
=
communicationLogic
.
getAllArchive
();
return
archiveListStr
;
}
@JavascriptInterface
public
String
getArchiveListByName
(
String
keyword
)
{
String
archiveListStr
=
communicationLogic
.
getArchiveListByName
(
keyword
);
return
archiveListStr
;
}
@JavascriptInterface
public
String
getUserInfo
(
String
shopMemberId
)
{
String
archiveListStr
=
communicationLogic
.
getUserInfo
(
Integer
.
parseInt
(
shopMemberId
));
return
archiveListStr
;
}
@JavascriptInterface
public
String
getUserInfoList
(
String
shopMemberIds
)
{
String
userIds
=
shopMemberIds
;
String
UserInfoList
=
communicationLogic
.
getUserList
(
shopMemberIds
);
return
UserInfoList
;
}
@JavascriptInterface
public
String
getArchiveDetail
(
String
archiveId
)
{
String
archiveListStr
=
communicationLogic
.
getArchiveDetail
(
Integer
.
parseInt
(
archiveId
));
return
archiveListStr
;
}
@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
);
}
@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
));
}
@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
());
}
@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
);
}
@JavascriptInterface
public
void
startCollaboration
(
String
collaborationType
)
{
activity
.
collaborationJoinFlg
=
ABookCommConstants
.
FLAG
.
COLLABORATION_JOIN_FLG
.
CREATE
;
activity
.
moveCollaborationScreen
(
Integer
.
parseInt
(
collaborationType
));
}
@JavascriptInterface
public
void
finishCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishCollaboration
(
activity
.
sid
,
activity
.
roomId
.
intValue
());
}
@JavascriptInterface
public
void
finishAllCollaboration
()
throws
NetworkDisconnectedException
,
AcmsException
{
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
finishAllCollaboration
(
activity
.
sid
,
activity
.
roomId
.
intValue
());
}
@JavascriptInterface
public
String
getCollaborationJoinFlg
()
{
return
activity
.
collaborationJoinFlg
.
toString
();
}
@JavascriptInterface
public
String
getCollaborationType
()
{
return
activity
.
collaborationType
;
}
@JavascriptInterface
public
String
getToMoveGroupId
()
{
return
activity
.
groupId
;
}
@JavascriptInterface
public
void
setToMoveGroupId
(
String
moveToGroupId
)
{
activity
.
groupId
=
moveToGroupId
;
}
@JavascriptInterface
public
String
getContentList
()
{
return
communicationLogic
.
getContentList
();
}
@JavascriptInterface
public
String
getUserListByLoginId
(
String
loginIdList
)
{
return
communicationLogic
.
getUserListByLoginId
(
loginIdList
);
}
@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('"
+
"会議室サーバに接続できませんでした。"
+
"');"
);
}
activity
.
startContentListActivity
(
true
);
return
meetingId
.
intValue
();
}
@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('"
+
"会議室サーバに接続できませんでした。"
+
"');"
);
}
activity
.
startContentListActivity
(
false
);
}
@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('"
+
"会議室サーバに接続できませんでした。"
+
"');"
);
}
activity
.
startContentListActivity
(
false
);
}
@JavascriptInterface
public
void
startPipMode
()
{
PictureInPictureParams
.
Builder
mPipBuilder
=
new
PictureInPictureParams
.
Builder
();
activity
.
enterPictureInPictureMode
(
mPipBuilder
.
build
());
}
@JavascriptInterface
public
void
exitPIPmode
()
{
activity
.
finishPIPmode
();
}
@JavascriptInterface
public
void
exitMeetingRoom
()
{
activity
.
exitAndDeleteMeetingRoom
();
activity
.
finishPIPmode
();
}
@JavascriptInterface
public
int
getJoinCollaborationType
()
{
return
activity
.
mCollaborationType
;
}
@JavascriptInterface
public
void
setJoinCollaborationType
(
int
collaborationType
)
{
activity
.
mCollaborationType
=
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
);
}
@JavascriptInterface
public
int
getAndroidVersion
()
{
return
Build
.
VERSION
.
SDK_INT
;
}
@JavascriptInterface
public
void
removeEncodedVideo
(
String
filePath
)
{
File
encodedVideo
=
new
File
(
filePath
);
if
(
encodedVideo
.
exists
())
{
encodedVideo
.
delete
();
}
}
@JavascriptInterface
public
void
setHostRequestFlg
(
int
hostRequestFlg
)
{
activity
.
mHostRequestFlg
=
hostRequestFlg
;
}
@JavascriptInterface
public
int
getHostRequestFlg
()
{
return
activity
.
mHostRequestFlg
;
}
@JavascriptInterface
public
void
finishPip
()
{
activity
.
finishPIPmode
();
}
@JavascriptInterface
public
void
setExitHostAlert
()
{
activity
.
needHostAlert
=
true
;
}
@JavascriptInterface
public
boolean
getExitHostAlert
()
{
if
(
activity
.
needHostAlert
)
{
activity
.
needHostAlert
=
false
;
return
true
;
}
return
activity
.
needHostAlert
;
}
@JavascriptInterface
public
void
updatePreMessage
(
String
messageId
)
throws
NetworkDisconnectedException
,
AcmsException
{
if
(
messageId
.
equals
(
"0"
))
{
return
;
}
activity
.
updateMessageFromMessageId
(
messageId
);
}
@JavascriptInterface
public
String
getMessageListFromMessageId
(
String
messageId
)
{
if
(
messageId
.
equals
(
"0"
))
{
return
""
;
}
String
messageListStr
=
communicationLogic
.
getMessagesFromMessageId
(
activity
.
roomId
.
intValue
(),
messageId
);
return
messageListStr
;
}
}
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