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
7a39bdf4
Commit
7a39bdf4
authored
Sep 17, 2019
by
Kim Jinsung
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'features/1.1.300_chat_prototype' into 'features/1.1.300_chat'
- 1.1.300_chat について修正 See merge request
!38
parents
3f8e9780
b47469e9
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
234 additions
and
21 deletions
+234
-21
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/AcmsClient.java
+6
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/ChatPushDataJSON.java
+7
-3
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/PushMessageDao.java
+16
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
+3
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/PushMessageLogic.java
+5
-0
ABVJE_Launcher_Android/AndroidManifest.xml
+4
-1
ABVJE_Launcher_Android/assets/chatPrototype/public/js/chat.js
+8
-5
ABVJE_Launcher_Android/build.gradle
+1
-1
ABVJE_Res_Default_Android/res/values-ja/strings.xml
+1
-1
ABVJE_Res_Default_Android/res/values-ko/strings.xml
+2
-1
ABVJE_UI_Android/res/layout/chat_webview.xml
+39
-2
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/appinfo/AppDefType.java
+3
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
+126
-7
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
+8
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ActivityHandlingHelper.java
+5
-0
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/AcmsClient.java
View file @
7a39bdf4
...
...
@@ -791,6 +791,12 @@ public class AcmsClient implements AcmsClientResponseListener {
String
apiUrl
=
AcmsApis
.
getApiUrl
(
env
.
acmsAddress
,
urlPath
,
methodName
);
//AISDevelop
if
(
apiUrl
.
equals
(
"https://abookcheckdemo.abook.bz/acms/aisinfo/abvapi/push/"
))
{
apiUrl
=
"http://192.168.1.6:8080/acms/aisinfo/chatapi/push/"
;
}
HttpResponse
response
=
send
(
apiUrl
,
methodName
,
param
);
// 最終アクセス時間更新
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/ChatPushDataJSON.java
View file @
7a39bdf4
...
...
@@ -5,6 +5,7 @@ import com.sun.org.apache.bcel.internal.generic.PUSH;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.common.exception.AcmsException
;
import
jp.agentec.abook.abv.bl.common.exception.JSONValidationException
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.common.util.JsonUtil
;
import
jp.agentec.abook.abv.bl.dto.PushMessageDto
;
import
jp.agentec.adf.util.DateTimeFormat
;
...
...
@@ -50,9 +51,12 @@ public class ChatPushDataJSON extends AcmsCommonJSON {
break
;
}
PushMessageDto
pushMessageDto
=
new
PushMessageDto
();
//pushMessageDto.pushMessageId = pushMessagetJsonArray.getJSONObject(k).getLong(PushMessageId);
pushMessageDto
.
pushMessageId
=
Long
.
valueOf
(
11
);
pushMessageDto
.
operationId
=
Long
.
valueOf
(
1111
);
String
tempDate
=
DateTimeUtil
.
toString
(
DateTimeUtil
.
toDate
(
pushMessagetJsonArray
.
getJSONObject
(
k
).
getString
(
PushSendDate
),
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
),
DateTimeFormat
.
yyyyMMddHHmmssSSS_none
);
Logger
.
d
(
"messageId"
,
"messageId : "
+
pushMessagetJsonArray
.
getJSONObject
(
k
).
getString
(
PushSendDate
));
Logger
.
d
(
"oerationId"
,
"oerationId : "
+
pushMessagetJsonArray
.
getJSONObject
(
k
).
getString
(
PushSendDate
)+
1
);
Logger
.
d
(
"date"
,
"date : "
+
tempDate
);
pushMessageDto
.
pushMessageId
=
Long
.
valueOf
(
tempDate
);
pushMessageDto
.
operationId
=
Long
.
valueOf
(
tempDate
+
1
);
pushMessageDto
.
pushSendLoginId
=
pushMessagetJsonArray
.
getJSONObject
(
k
).
getString
(
PushSendLoginId
);
pushMessageDto
.
pushSendDate
=
DateTimeUtil
.
toDate
(
pushMessagetJsonArray
.
getJSONObject
(
k
).
getString
(
PushSendDate
),
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
);
pushMessageDto
.
roomId
=
pushMessagetJsonArray
.
getJSONObject
(
k
).
getLong
(
RoomId
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/PushMessageDao.java
View file @
7a39bdf4
package
jp
.
agentec
.
abook
.
abv
.
bl
.
data
.
dao
;
import
java.util.Date
;
import
java.util.List
;
import
jp.agentec.abook.abv.bl.common.db.Cursor
;
...
...
@@ -122,4 +123,19 @@ public class PushMessageDao extends AbstractDao {
Logger
.
v
(
TAG
,
"sql=%s"
,
sql
);
return
rawQueryGetDto
(
sql
.
toString
(),
args
,
PushMessageDto
.
class
);
}
public
PushMessageDto
selectChat
(
long
pushMessageId
,
long
pushOperstoinId
,
Date
pushSendDate
)
{
String
[]
args
=
new
String
[]
{
""
+
pushMessageId
,
""
+
pushOperstoinId
,
""
+
pushSendDate
};
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name, tpm.room_id, tpm.room_name "
);
sql
.
append
(
" FROM t_push_message AS tpm "
);
sql
.
append
(
" INNER JOIN t_operation AS top "
);
sql
.
append
(
" ON tpm.operation_id = top.operation_id "
);
sql
.
append
(
" WHERE tpm.push_message_id = ? "
);
sql
.
append
(
" AND tpm.operation_id = ? "
);
sql
.
append
(
" AND tpm.push_send_date = ? "
);
Logger
.
v
(
TAG
,
"sql=%s"
,
sql
);
return
rawQueryGetDto
(
sql
.
toString
(),
args
,
PushMessageDto
.
class
);
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
View file @
7a39bdf4
...
...
@@ -119,8 +119,11 @@ public class OperationLogic extends AbstractLogic {
ChatPushDataJSON
chatPushJson
=
AcmsClient
.
getInstance
(
cache
.
getUrlPath
(),
networkAdapter
).
getChatPushList
(
param
);
for
(
PushMessageDto
dto
:
chatPushJson
.
pushMessageList
)
{
PushMessageDto
dtoTemp
=
mPushMessageDao
.
selectChat
(
dto
.
pushMessageId
,
dto
.
operationId
,
dto
.
pushSendDate
);
if
(
dtoTemp
==
null
)
{
mPushMessageDao
.
insert
(
dto
);
}
}
for
(
OperationDto
serverOperationDto
:
serverOperations
)
{
// 登録フラグ
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/PushMessageLogic.java
View file @
7a39bdf4
package
jp
.
agentec
.
abook
.
abv
.
bl
.
logic
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.List
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
...
...
@@ -62,4 +63,8 @@ public class PushMessageLogic extends AbstractLogic {
public
void
updateReadingFlg
(
long
pushMessageId
)
{
mPushMessageDao
.
updateReadingFlg
(
pushMessageId
);
}
public
PushMessageDto
getPushChatMessage
(
long
pushMessageId
,
long
pushOperationId
,
Date
pushSendDate
)
{
return
mPushMessageDao
.
selectChat
(
pushMessageId
,
pushOperationId
,
pushSendDate
);
}
}
ABVJE_Launcher_Android/AndroidManifest.xml
View file @
7a39bdf4
...
...
@@ -41,7 +41,8 @@
android:icon=
"@drawable/app_icon"
android:label=
"@string/app_name"
android:theme=
"@style/ABook"
android:largeHeap=
"true"
>
android:largeHeap=
"true"
android:usesCleartextTraffic=
"true"
>
<service
android:name=
"jp.agentec.abook.abv.cl.push.ABVFcmListenerService"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
></action>
...
...
@@ -210,5 +211,6 @@
<activity
android:name=
"jp.agentec.abook.abv.ui.viewer.activity.CheckOZDViewActivity"
android:configChanges=
"orientation|screenSize"
/>
<activity
android:name=
"jp.agentec.abook.abv.ui.home.activity.ChatWebviewActivity"
/>
</application>
</manifest>
\ No newline at end of file
ABVJE_Launcher_Android/assets/chatPrototype/public/js/chat.js
View file @
7a39bdf4
...
...
@@ -36,7 +36,7 @@ function formatDate(date) {
const
TODAY
=
REFERENCE
.
clone
().
startOf
(
'day'
);
const
YESTERDAY
=
REFERENCE
.
clone
().
subtract
(
1
,
'days'
).
startOf
(
'day'
);
let
createdAt
=
moment
(
date
);
const
createdAtDay
=
createdAt
.
isSame
(
TODAY
,
'd'
)
?
"Today"
:
createdAt
.
isSame
(
YESTERDAY
,
'd'
)
?
"Yesterday"
:
createdAt
.
format
(
'MMM DD'
);
const
createdAtDay
=
createdAt
.
format
(
'MMM DD'
);
const
createdAtTime
=
createdAt
.
format
(
'HH:mm'
);
if
(
createdAt
.
isSame
(
TODAY
,
'd'
)){
createdAt
=
createdAtTime
;
...
...
@@ -131,7 +131,7 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){
// チャットルーム名を変更する
jQuery
(
'.titleRoomName'
).
text
(
room
.
roomName
).
data
(
'roomName'
,
room
.
roomName
);
android
.
saveVisitRoomInfo
(
room
.
roomId
,
room
.
roomName
,
room
.
roomId
);
//javascriptInterface
android
.
saveVisitRoomInfo
(
room
.
roomId
,
room
.
roomName
);
});
}
});
...
...
@@ -165,7 +165,7 @@ jQuery('#roomDeleteButton').on('click', function(e){
let
roomName
=
jQuery
(
this
).
data
(
'roomName'
);
socket
.
emit
(
'joinRoom'
,
roomId
,
roomName
,
function
()
{
jQuery
(
'#messages'
).
html
(
''
);
jQuery
(
'.titleRoomName'
).
text
(
room
Name
).
data
(
'roomName'
,
roomName
);
jQuery
(
'.titleRoomName'
).
text
(
room
Id
).
data
(
'roomName'
,
roomName
);
jQuery
(
'#pills-chat-tab'
).
tab
(
'show'
);
});
});
...
...
@@ -182,10 +182,11 @@ jQuery('#roomDeleteButton').on('click', function(e){
// チャットルームの削除アイコンにクリックイベントを与える
jQuery
(
'.deleteBox'
).
off
(
'click'
);
jQuery
(
'.deleteBox'
).
on
(
'click'
,
function
(
e
){
if
(
window
.
confirm
(
'Do you want to leave this room?'
)){
if
(
window
.
confirm
(
'Do you want to leave this room?'
))
{
// 現在接続されているチャットルームを離れるとメッセージテップを初期化する
if
(
jQuery
(
this
).
data
(
'activeRoom'
)){
jQuery
(
'#messages'
).
html
(
''
);
android
.
saveVisitRoomInfo
(
''
,
''
);
}
// チャットルームから退場する
socket
.
emit
(
'exitRoom'
,
jQuery
(
this
).
data
(
'roomId'
));
...
...
@@ -424,6 +425,7 @@ jQuery('#chatKeyword').on('keypress', function(event) {
// Exit Room
jQuery
(
'#exitRoom'
).
on
(
'click'
,
function
(
event
){
android
.
saveVisitRoomInfo
(
''
,
''
);
socket
.
emit
(
'exitRoom'
);
jQuery
(
'#dismiss'
).
click
();
});
...
...
@@ -465,7 +467,7 @@ socket.on('updateUserList', function(users, onlineUsers) {
let
li
=
jQuery
(
'<li/>'
);
let
a
=
jQuery
(
'<a/>'
).
text
(
user
);
if
(
onlineUsers
.
includes
(
user
)){
//
접속해있는 유저라면 온라인 뱃지를 달아준다.
//
接続されているユーザにマークを付ける。
a
.
append
(
jQuery
(
'<span/>'
,{
class
:
'badge badge-success'
}).
text
(
'online'
));
}
li
.
append
(
a
);
...
...
@@ -566,6 +568,7 @@ socket.on('refreshUserListInGroup', function(users, isInvite){
socket
.
emit
(
'createNewRoom'
,
userIdList
,
newRoomName
,
function
(
newRoomId
)
{
socket
.
emit
(
'joinRoom'
,
newRoomId
,
newRoomName
,
function
()
{
jQuery
(
'#messages'
).
html
(
''
);
android
.
saveVisitRoomInfo
(
newRoomId
,
newRoomName
);
});
jQuery
(
'.titleRoomName'
).
text
(
newRoomName
).
data
(
'roomName'
,
newRoomName
);
jQuery
(
'#pills-chat-tab'
).
tab
(
'show'
);
...
...
ABVJE_Launcher_Android/build.gradle
View file @
7a39bdf4
...
...
@@ -17,7 +17,7 @@ dependencies {
}
android
{
compileSdkVersion
2
1
compileSdkVersion
2
3
buildToolsVersion
'27.0.3'
defaultConfig
{
...
...
ABVJE_Res_Default_Android/res/values-ja/strings.xml
View file @
7a39bdf4
...
...
@@ -1409,6 +1409,6 @@
<string
name=
"msg_error_edit_page_open"
>
編集画面の表示に失敗しました。
</string>
<!-- Chat -->
<string
name=
"chat"
>
Chat
</string>
<string
name=
"chat"
>
チャット
</string>
</resources>
ABVJE_Res_Default_Android/res/values-ko/strings.xml
View file @
7a39bdf4
...
...
@@ -1417,6 +1417,6 @@
<string
name=
"msg_error_edit_page_open"
>
편집창을 여는데 실패했습니다.
</string>
<!-- Chat -->
<string
name=
"chat"
>
Chat
</string>
<string
name=
"chat"
>
채팅
</string>
</resources>
\ No newline at end of file
ABVJE_UI_Android/res/layout/chat_webview.xml
View file @
7a39bdf4
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:orientation=
"vertical"
style=
"@style/Theme_CustomProgressDialog"
android:layout_width=
"match_parent"
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=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"top|right"
android:layout_marginRight=
"5dp"
android:layout_marginTop=
"10dp"
android:layout_alignParentRight=
"true"
android:background=
"@color/operation_search_button_color"
android:clickable=
"true"
android:src=
"@drawable/btn_close"
android:tint=
"@color/background"
/>
</RelativeLayout>
<WebView
android:id=
"@+id/chatWebview2"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/appinfo/AppDefType.java
View file @
7a39bdf4
...
...
@@ -67,6 +67,9 @@ public interface AppDefType {
String
OPERATION_GROUP_MASERT_ID
=
"operation_group_master_id"
;
// 作業種別のID
String
APERTURE_MASTER_DATA_FETCH_DATE
=
"apertureMasterDataFetchDate"
;
// 絞り検索マスタデータのFetchDate
String
CHAT_LAST_ROOMNAME
=
"chatLastRoom"
;
// 最後のルーム名
String
CHAT_LAST_ROOMID
=
"chatLastRoomId"
;
// 最後のルームID
}
/**
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
View file @
7a39bdf4
package
jp
.
agentec
.
abook
.
abv
.
ui
.
home
.
activity
;
import
android.app.AlertDialog
;
import
android.app.DownloadManager
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.Looper
;
import
android.security.NetworkSecurityPolicy
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.Window
;
import
android.webkit.DownloadListener
;
import
android.webkit.JavascriptInterface
;
import
android.webkit.JsResult
;
import
android.webkit.ValueCallback
;
import
android.webkit.WebChromeClient
;
import
android.webkit.WebView
;
import
android.webkit.WebViewClient
;
import
android.widget.ImageButton
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.util.List
;
import
jp.agentec.abook.abv.bl.common.constant.ABookKeys
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.data.ABVDataCache
;
import
jp.agentec.abook.abv.bl.dto.PushMessageDto
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.activity.ABVUIActivity
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
import
jp.agentec.abook.abv.ui.common.constant.ErrorCode
;
import
jp.agentec.abook.abv.ui.common.constant.ErrorMessage
;
import
jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity
;
...
...
@@ -44,8 +61,18 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
chatWebviewUrl
=
intent
.
getStringExtra
(
"chatWebviewUrl"
);
String
sid
=
intent
.
getStringExtra
(
"sid"
);
Long
roomId
=
intent
.
getLongExtra
(
"roomId"
,
0
);
String
loginId
=
intent
.
getStringExtra
(
"loginId"
);
String
roomName
=
intent
.
getStringExtra
(
"roomName"
);
// チャットViewのクローズボタン
final
ImageButton
imageButton
=
findViewById
(
R
.
id
.
chat_close_btn
);
imageButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
finish
();
}
});
mChatWebView
=
findViewById
(
R
.
id
.
chatWebview2
);
mChatWebView
.
setOverScrollMode
(
View
.
OVER_SCROLL_NEVER
);
//オーバースクロールしない。
mChatWebView
.
setVerticalScrollBarEnabled
(
false
);
//スクロールバーを消す。
...
...
@@ -53,16 +80,24 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
getSettings
().
setJavaScriptEnabled
(
true
);
//Javascriptを有効にする。
mChatWebView
.
setWebContentsDebuggingEnabled
(
true
);
// 最後のチャットのルーム名
String
lastRoomName
=
PreferenceUtil
.
getUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMNAME
,
""
);
// 最後のチャットのルーム
String
lastRoomId
=
PreferenceUtil
.
getUserPref
(
getApplicationContext
(),
AppDefType
.
UserPrefKey
.
CHAT_LAST_ROOMID
,
""
);
mChatWebView
.
addJavascriptInterface
(
jsInf
,
"android"
);
//ページをロード
if
(
roomId
!=
0
&&
roomName
!=
null
)
{
mChatWebView
.
loadUrl
(
chatWebviewUrl
+
"?sid="
+
sid
+
"&roomId="
+
roomId
+
"&roomName="
+
roomName
);
if
(
roomId
!=
0
&&
roomName
!=
null
)
{
// by push message
mChatWebView
.
loadUrl
(
chatWebviewUrl
+
"?sid="
+
sid
+
"&roomId="
+
roomId
+
"&roomName="
+
roomName
+
"&loginId="
+
loginId
);
}
else
{
// Chat
if
(
lastRoomName
.
length
()
>
0
&&
lastRoomId
.
length
()
>
0
)
{
mChatWebView
.
loadUrl
(
chatWebviewUrl
+
"?sid="
+
sid
+
"&roomId="
+
lastRoomId
+
"&roomName="
+
lastRoomName
+
"&loginId="
+
loginId
);
}
else
{
mChatWebView
.
loadUrl
(
chatWebviewUrl
+
"?sid="
+
sid
+
"&loginId="
+
loginId
);
}
else
{
mChatWebView
.
loadUrl
(
chatWebviewUrl
+
"?sid="
+
sid
);
}
mChatWebView
.
setWebChromeClient
(
new
WebChromeClient
()
{
@Override
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
filePathCallback
,
FileChooserParams
fileChooserParams
)
{
...
...
@@ -76,8 +111,52 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
return
result
;
}
});
// WebView内のAlert Dialogを処理する
@Override
public
boolean
onJsAlert
(
WebView
view
,
String
url
,
String
message
,
final
JsResult
result
)
{
AlertDialog
dialog
=
new
AlertDialog
.
Builder
(
view
.
getContext
()).
setTitle
(
"YourAlertTitle"
).
setMessage
(
message
).
setPositiveButton
(
"OK"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
//do nothing
}
}).
create
();
dialog
.
show
();
result
.
confirm
();
return
true
;
}
// WebView内のConfirm Dialogを処理する
@Override
public
boolean
onJsConfirm
(
WebView
view
,
String
url
,
String
message
,
final
JsResult
result
)
{
new
AlertDialog
.
Builder
(
view
.
getContext
())
// .setTitle("App Titler")
.
setMessage
(
message
)
.
setPositiveButton
(
android
.
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
result
.
confirm
();
}
})
.
setNegativeButton
(
android
.
R
.
string
.
cancel
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
result
.
cancel
();
}
})
.
create
()
.
show
();
return
true
;
}
});
mChatWebView
.
setDownloadListener
(
new
DownloadListener
()
{
@Override
...
...
@@ -89,6 +168,43 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
startActivity
(
i
);
}
});
mChatWebView
.
setWebViewClient
(
new
WebViewClient
()
{
@Override
public
void
onReceivedError
(
WebView
view
,
int
errorCode
,
String
description
,
String
failingUrl
)
{
Logger
.
d
(
"WEB_VIEW_TEST"
,
"error code:"
+
errorCode
+
" - "
+
description
);
}
@Override
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
Logger
.
d
(
"url"
,
"url : "
+
url
);
// イメージをダウンロードする(png, jpg, jpeg)
if
(
url
.
toLowerCase
().
endsWith
(
".png"
)
||
url
.
toLowerCase
().
endsWith
(
".jpg"
)
||
url
.
toLowerCase
().
endsWith
(
".jpeg"
))
{
DownloadManager
mdDownloadManager
=
(
DownloadManager
)
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
url
));
File
destinationFile
=
new
File
(
Environment
.
getExternalStorageDirectory
(),
getFileName
(
url
));
request
.
setDescription
(
"Downloading ..."
);
request
.
setNotificationVisibility
(
DownloadManager
.
Request
.
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);
request
.
setDestinationUri
(
Uri
.
fromFile
(
destinationFile
));
mdDownloadManager
.
enqueue
(
request
);
}
else
{
// その他のファイルはurlのみ確認
Logger
.
d
(
"download "
,
"download URL :"
+
url
);
}
return
true
;
}
});
}
// 保存するファイルをjpgに固定する
public
String
getFileName
(
String
url
)
{
String
filenameWithoutExtension
=
""
;
filenameWithoutExtension
=
String
.
valueOf
(
System
.
currentTimeMillis
()
+
".jpg"
);
return
filenameWithoutExtension
;
}
@Override
...
...
@@ -142,7 +258,10 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
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
);
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
View file @
7a39bdf4
...
...
@@ -1416,8 +1416,14 @@ public class OperationListActivity extends ABVUIActivity {
ll_menuItem_chat
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
// チャット利用のはネットワークが繋がる時のみ
if
(
ABVEnvironment
.
getInstance
().
networkAdapter
.
isNetworkConnected
())
{
ActivityHandlingHelper
.
getInstance
().
startChatWebviewActivity
();
mCommunicationMenuDialog
.
dismiss
();
}
else
{
ABVToastUtil
.
showMakeText
(
OperationListActivity
.
this
,
R
.
string
.
request_network_connection
,
Toast
.
LENGTH_SHORT
);
return
;
}
}
});
...
...
@@ -1483,7 +1489,9 @@ public class OperationListActivity extends ABVUIActivity {
public
void
onDetailView
(
final
PushMessageDto
dto
)
{
if
(
dto
.
roomName
!=
null
&&
dto
.
roomId
!=
0
)
{
mPushMessageLogic
.
updateReadingFlg
(
dto
.
pushMessageId
);
ActivityHandlingHelper
.
getInstance
().
startChatWebviewActivityWithPushMessage
(
dto
);
mPushMessageListDialog
.
dismiss
();
}
else
{
showPushMessageDetailView
(
dto
);
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ActivityHandlingHelper.java
View file @
7a39bdf4
...
...
@@ -1550,6 +1550,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent
.
putExtra
(
"chatWebviewUrl"
,
"file:///android_asset/chatPrototype/public/newstart.html"
);
String
sid
=
ABVDataCache
.
getInstance
().
getMemberInfo
().
sid
;
intent
.
putExtra
(
"sid"
,
sid
);
String
loginId
=
ABVDataCache
.
getInstance
().
getMemberInfo
().
loginId
;
intent
.
putExtra
(
"loginId"
,
loginId
);
if
(
dto
!=
null
)
{
intent
.
putExtra
(
"roomId"
,
dto
.
roomId
);
...
...
@@ -1561,6 +1563,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
activity
.
startActivity
(
intent
);
}
}
//チャットに入る
public
void
startChatWebviewActivity
()
{
String
className
=
ChatWebviewActivity
.
class
.
getName
();
...
...
@@ -1569,6 +1572,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent
.
putExtra
(
"chatWebviewUrl"
,
"file:///android_asset/chatPrototype/public/newstart.html"
);
String
sid
=
ABVDataCache
.
getInstance
().
getMemberInfo
().
sid
;
intent
.
putExtra
(
"sid"
,
sid
);
String
loginId
=
ABVDataCache
.
getInstance
().
getMemberInfo
().
loginId
;
intent
.
putExtra
(
"loginId"
,
loginId
);
intent
.
setClassName
(
mContext
.
getPackageName
(),
className
);
Activity
activity
=
getCurrentActivity
();
if
(
activity
!=
null
)
{
...
...
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