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
4a769161
Commit
4a769161
authored
Apr 12, 2021
by
Lee Munkyeong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
オフライン対応
parent
5379e727
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
185 additions
and
20 deletions
+185
-20
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
+8
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
+66
-16
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BitmapUtil.java
+21
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
+90
-4
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
View file @
4a769161
...
...
@@ -84,10 +84,18 @@ public interface ABookCommConstants {
Integer
DM
=
1
;
Integer
ALL
=
2
;
}
interface
MESSAGE_TYPE
{
Integer
TEXT
=
0
;
Integer
PHOTO
=
1
;
Integer
VIDEO
=
2
;
Integer
SYSTEM
=
4
;
}
Integer
GROUP_REQUEST_ALL
=
0
;
}
interface
SIZE
{
Integer
MAX_FAVORITE_COUNT
=
100
;
}
String
FILE_SAVE_PATH
=
"/data/user/0/jp.co.agentec.abookplus.check/files/"
;
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
View file @
4a769161
...
...
@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.logic;
import
org.json.adf.JSONArray
;
import
org.json.adf.JSONObject
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -62,7 +63,11 @@ public class CommunicationLogic extends AbstractLogic {
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
TYPE
,
chatRoomDto
.
type
);
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
FAVORITE_REGISTER_DATE
,
chatRoomDto
.
favoriteRegisterDate
);
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
UNREAD_COUNT
,
chatRoomDto
.
unreadCount
);
if
(
ABookCommConstants
.
FLAG
.
MESSAGE_TYPE
.
PHOTO
.
equals
(
chatRoomDto
.
messageType
)
||
ABookCommConstants
.
FLAG
.
MESSAGE_TYPE
.
VIDEO
.
equals
(
chatRoomDto
.
messageType
))
{
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE
,
getFileUrlPath
(
chatRoomDto
.
message
));
}
else
{
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE
,
chatRoomDto
.
message
);
}
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE_TYPE
,
chatRoomDto
.
messageType
);
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
INSERT_DATE
,
chatRoomDto
.
insertDate
);
chatRoomMap
.
put
(
ABookCommConstants
.
KEY
.
USER_COUNT
,
chatRoomDto
.
userCount
);
...
...
@@ -73,7 +78,7 @@ public class CommunicationLogic extends AbstractLogic {
for
(
ShopMemberDto
user
:
userList
)
{
Map
<
String
,
Object
>
userMap
=
new
HashMap
<
String
,
Object
>();
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
user
.
shopMemberId
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
user
.
profileUrl
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
user
.
profileUrl
)
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
user
.
shopMemberName
);
JSONObject
jsonObject
=
new
JSONObject
(
userMap
);
attendUsers
.
put
(
jsonObject
);
...
...
@@ -93,7 +98,7 @@ public class CommunicationLogic extends AbstractLogic {
for
(
ShopMemberDto
user
:
userList
)
{
Map
<
String
,
Object
>
userMap
=
new
HashMap
<
String
,
Object
>();
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
user
.
shopMemberId
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
user
.
profileUrl
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
user
.
profileUrl
)
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
user
.
shopMemberName
);
JSONObject
jsonObject
=
new
JSONObject
(
userMap
);
attendUsers
.
put
(
jsonObject
);
...
...
@@ -111,10 +116,14 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
CHAT_ROOM_ID
,
chatMessageDto
.
chatRoomId
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
LOGIN_ID
,
chatMessageDto
.
shopMemberName
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
chatMessageDto
.
shopMemberId
);
if
(
ABookCommConstants
.
FLAG
.
MESSAGE_TYPE
.
PHOTO
.
equals
(
chatMessageDto
.
messageType
)
||
ABookCommConstants
.
FLAG
.
MESSAGE_TYPE
.
VIDEO
.
equals
(
chatMessageDto
.
messageType
))
{
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE
,
getFileUrlPath
(
chatMessageDto
.
message
));
}
else
{
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE
,
chatMessageDto
.
message
);
}
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE_TYPE
,
chatMessageDto
.
messageType
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
INSERT_DATE
,
chatMessageDto
.
insertDate
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
chatMessageDto
.
profileUrl
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
chatMessageDto
.
profileUrl
)
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
SELF_FLG
,
chatMessageDto
.
selfFlg
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
UNREAD_COUNT
,
chatMessageDto
.
unreadCount
);
JSONObject
jsonObject
=
new
JSONObject
(
chatMessageMap
);
...
...
@@ -134,10 +143,14 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
CHAT_ROOM_ID
,
chatMessageDto
.
chatRoomId
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
LOGIN_ID
,
chatMessageDto
.
shopMemberName
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
chatMessageDto
.
shopMemberId
);
if
(
ABookCommConstants
.
FLAG
.
MESSAGE_TYPE
.
PHOTO
.
equals
(
chatMessageDto
.
messageType
)
||
ABookCommConstants
.
FLAG
.
MESSAGE_TYPE
.
VIDEO
.
equals
(
chatMessageDto
.
messageType
))
{
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE
,
getFileUrlPath
(
chatMessageDto
.
message
));
}
else
{
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE
,
chatMessageDto
.
message
);
}
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE_TYPE
,
chatMessageDto
.
messageType
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
INSERT_DATE
,
chatMessageDto
.
insertDate
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
chatMessageDto
.
profileUrl
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
chatMessageDto
.
profileUrl
)
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
SELF_FLG
,
chatMessageDto
.
selfFlg
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
UNREAD_COUNT
,
chatMessageDto
.
unreadCount
);
JSONObject
jsonObject
=
new
JSONObject
(
chatMessageMap
);
...
...
@@ -166,7 +179,7 @@ public class CommunicationLogic extends AbstractLogic {
}
resultJson
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
shopMemberDto
.
shopMemberId
);
resultJson
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
shopMemberDto
.
shopMemberName
);
resultJson
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
shopMemberDto
.
profileUrl
);
resultJson
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
shopMemberDto
.
profileUrl
)
);
resultJson
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathJsonArray
);
boolean
hasRegisteredDate
=
StringUtil
.
isNullOrEmpty
(
shopMemberDto
.
favoriteRegisterDate
)
==
false
;
resultJson
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
hasRegisteredDate
);
...
...
@@ -180,7 +193,7 @@ public class CommunicationLogic extends AbstractLogic {
JSONObject
myInfoJson
=
new
JSONObject
();
myInfoJson
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
myInfo
.
shopMemberId
);
myInfoJson
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
myInfo
.
shopMemberName
);
myInfoJson
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
myInfo
.
profileUrl
);
myInfoJson
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
myInfo
.
profileUrl
)
);
myInfoJson
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathList
);
String
myInfoStr
=
myInfoJson
.
toString
();
return
myInfoStr
;
...
...
@@ -200,7 +213,7 @@ public class CommunicationLogic extends AbstractLogic {
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
groupUser
.
shopMemberId
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
groupUser
.
shopMemberName
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
CHECKED
,
""
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
g
roupUser
.
profileUrl
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
g
etProfileUrlPath
(
groupUser
.
profileUrl
)
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupUser
);
if
(
StringUtil
.
isNullOrEmpty
(
groupUser
.
favoriteRegisterDate
))
{
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
false
);
...
...
@@ -231,7 +244,7 @@ public class CommunicationLogic extends AbstractLogic {
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
groupUser
.
shopMemberId
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
groupUser
.
shopMemberName
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
CHECKED
,
""
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
g
roupUser
.
profileUrl
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
g
etProfileUrlPath
(
groupUser
.
profileUrl
)
);
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupUser
);
if
(
StringUtil
.
isNullOrEmpty
(
groupUser
.
favoriteRegisterDate
))
{
myGroupUserMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
false
);
...
...
@@ -267,7 +280,7 @@ public class CommunicationLogic extends AbstractLogic {
}
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
shopMember
.
shopMemberId
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
shopMember
.
shopMemberName
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
shopMember
.
profileUrl
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
shopMember
.
profileUrl
)
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathArray
);
if
(
StringUtil
.
isNullOrEmpty
(
shopMember
.
favoriteRegisterDate
))
{
userMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
false
);
...
...
@@ -301,7 +314,7 @@ public class CommunicationLogic extends AbstractLogic {
}
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
shopMember
.
shopMemberId
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
shopMember
.
shopMemberName
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
shopMember
.
profileUrl
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
shopMember
.
profileUrl
)
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathArray
);
if
(
StringUtil
.
isNullOrEmpty
(
shopMember
.
favoriteRegisterDate
))
{
userMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
false
);
...
...
@@ -334,7 +347,7 @@ public class CommunicationLogic extends AbstractLogic {
}
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
shopMember
.
shopMemberId
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
shopMember
.
shopMemberName
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
shopMember
.
profileUrl
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
shopMember
.
profileUrl
)
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathArray
);
if
(
StringUtil
.
isNullOrEmpty
(
shopMember
.
favoriteRegisterDate
))
{
userMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
false
);
...
...
@@ -369,7 +382,7 @@ public class CommunicationLogic extends AbstractLogic {
}
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
shopMember
.
shopMemberId
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
shopMember
.
shopMemberName
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
shopMember
.
profileUrl
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
shopMember
.
profileUrl
)
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathArray
);
if
(
StringUtil
.
isNullOrEmpty
(
shopMember
.
favoriteRegisterDate
))
{
userMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
false
);
...
...
@@ -444,7 +457,7 @@ public class CommunicationLogic extends AbstractLogic {
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
favoriteUser
.
shopMemberId
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
favoriteUser
.
shopMemberName
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
CHECKED
,
""
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
favoriteUser
.
profileUrl
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
favoriteUser
.
profileUrl
)
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathArray
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
true
);
JSONObject
jsonObject
=
new
JSONObject
(
favoriteUserMap
);
...
...
@@ -474,7 +487,7 @@ public class CommunicationLogic extends AbstractLogic {
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
favoriteUser
.
shopMemberId
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
favoriteUser
.
shopMemberName
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
CHECKED
,
""
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
favoriteUser
.
profileUrl
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
favoriteUser
.
profileUrl
)
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
groupPathArray
);
favoriteUserMap
.
put
(
ABookCommConstants
.
KEY
.
IS_FAVORITE
,
true
);
JSONObject
jsonObject
=
new
JSONObject
(
favoriteUserMap
);
...
...
@@ -568,7 +581,7 @@ public class CommunicationLogic extends AbstractLogic {
Map
<
String
,
Object
>
shopMemberMap
=
new
HashMap
<
String
,
Object
>();
shopMemberMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
shopMember
.
shopMemberId
);
shopMemberMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
shopMember
.
shopMemberName
);
shopMemberMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
shopMember
.
profileUrl
);
shopMemberMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
shopMember
.
profileUrl
)
);
shopMemberMap
.
put
(
ABookCommConstants
.
KEY
.
CHECKED
,
""
);
shopMemberMap
.
put
(
ABookCommConstants
.
KEY
.
GROUP_PATH_LIST
,
chatGroupDao
.
getUserGroupPathList
(
shopMember
.
shopMemberId
));
if
(
StringUtil
.
isNullOrEmpty
(
shopMember
.
favoriteRegisterDate
))
{
...
...
@@ -747,17 +760,54 @@ public class CommunicationLogic extends AbstractLogic {
public
void
roomDisplayOff
(
Integer
roomId
)
{
chatRoomDao
.
changeRoomViewFlg
(
roomId
);
}
public
String
getUserList
(
String
userIdList
)
{
List
<
ShopMemberDto
>
selectedUsers
=
shopMemberDao
.
getSelectedUsers
(
userIdList
);
JSONArray
attendUsers
=
new
JSONArray
();
for
(
ShopMemberDto
dto
:
selectedUsers
)
{
Map
<
String
,
Object
>
userMap
=
new
HashMap
<
String
,
Object
>();
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
dto
.
shopMemberId
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
dto
.
profileUrl
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
getProfileUrlPath
(
dto
.
profileUrl
)
);
userMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_NAME
,
dto
.
shopMemberName
);
JSONObject
jsonObject
=
new
JSONObject
(
userMap
);
attendUsers
.
put
(
jsonObject
);
}
return
attendUsers
.
toString
();
};
public
String
getProfileUrlPath
(
String
profileUrl
)
{
if
(
profileUrl
==
null
)
{
return
null
;
}
String
[]
filePaths
=
profileUrl
.
split
(
"/"
);
String
fileName
=
filePaths
[
filePaths
.
length
-
1
];
String
filePath
=
ABookCommConstants
.
FILE_SAVE_PATH
+
fileName
;
File
file
=
new
File
(
filePath
);
if
(
file
.
exists
())
{
String
uri
=
file
.
toURI
().
toString
();
return
uri
;
}
else
{
return
profileUrl
;
}
};
public
String
getFileUrlPath
(
String
fileUrlPath
)
{
if
(!
fileUrlPath
.
contains
(
"fileName="
))
{
return
fileUrlPath
;
}
String
fileName
=
fileUrlPath
.
split
(
"fileName="
)[
1
].
split
(
"&"
)[
0
];
String
filePath
=
ABookCommConstants
.
FILE_SAVE_PATH
+
fileName
;
File
file
=
new
File
(
filePath
);
if
(
file
.
exists
())
{
String
replaceTarget
=
"https"
+
fileUrlPath
.
split
(
"https"
)[
1
].
split
(
"\""
)[
0
];
String
uri
=
file
.
toURI
().
toString
();
String
resultPath
=
fileUrlPath
;
while
(
resultPath
.
contains
(
replaceTarget
))
{
resultPath
=
resultPath
.
replace
(
replaceTarget
,
uri
);
}
return
resultPath
;
}
else
{
return
fileUrlPath
;
}
};
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BitmapUtil.java
View file @
4a769161
package
jp
.
agentec
.
abook
.
abv
.
cl
.
util
;
import
java.io.ByteArrayOutputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
...
...
@@ -17,6 +18,7 @@ import android.graphics.BitmapFactory;
import
android.graphics.Color
;
import
android.media.MediaMetadataRetriever
;
import
android.media.MediaPlayer
;
import
android.util.Base64
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.WriterException
;
...
...
@@ -433,4 +435,23 @@ public class BitmapUtil {
return
bitmapList
;
}
public
static
Bitmap
convert
(
String
base64Str
)
throws
IllegalArgumentException
{
byte
[]
decodedBytes
=
Base64
.
decode
(
base64Str
.
substring
(
base64Str
.
indexOf
(
","
)
+
1
),
Base64
.
DEFAULT
);
return
BitmapFactory
.
decodeByteArray
(
decodedBytes
,
0
,
decodedBytes
.
length
);
}
public
static
String
convert
(
Bitmap
bitmap
)
{
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
100
,
outputStream
);
return
Base64
.
encodeToString
(
outputStream
.
toByteArray
(),
Base64
.
DEFAULT
);
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
View file @
4a769161
package
jp
.
agentec
.
abook
.
abv
.
ui
.
home
.
activity
;
import
android.annotation.SuppressLint
;
import
android.app.AlertDialog
;
import
android.app.Dialog
;
import
android.app.DownloadManager
;
import
android.content.BroadcastReceiver
;
import
android.content.ContentValues
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.SharedPreferences
;
import
android.content.res.Configuration
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.util.Log
;
...
...
@@ -30,9 +35,12 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
org.json.adf.HTTP
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -209,6 +217,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
setWebChromeClient
(
new
FullscreenableChromeClient
(
this
)
{
@Override
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
filePathCallback
,
FileChooserParams
fileChooserParams
)
{
boolean
result
=
false
;
...
...
@@ -376,6 +386,32 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
setWebViewClient
(
new
WebViewClient
()
{
@Override
public
void
onLoadResource
(
WebView
view
,
String
url
)
{
if
(
url
.
contains
(
"profileFileName"
))
{
Uri
uri
=
Uri
.
parse
(
url
);
String
fileName
=
uri
.
getQueryParameter
(
"profileFileName"
);
String
filePath
=
getFilesDir
().
getAbsolutePath
()
+
"/"
+
fileName
;
Logger
.
i
(
TAG
,
filePath
);
File
file
=
new
File
(
filePath
);
NetworkTask
networkTask
=
new
NetworkTask
(
url
,
filePath
);
networkTask
.
execute
();
}
else
if
(
url
.
contains
(
"/file/getImage"
))
{
Uri
uri
=
Uri
.
parse
(
url
);
String
fileName
=
uri
.
getQueryParameter
(
"fileName"
);
String
filePath
=
getFilesDir
().
getAbsolutePath
()
+
"/"
+
fileName
;
Logger
.
i
(
TAG
,
filePath
);
File
file
=
new
File
(
filePath
);
NetworkTask
networkTask
=
new
NetworkTask
(
url
,
filePath
);
networkTask
.
execute
();
}
else
{
super
.
onLoadResource
(
view
,
url
);
}
}
@Override
public
void
onReceivedError
(
WebView
view
,
int
errorCode
,
String
description
,
String
failingUrl
)
{
...
...
@@ -403,7 +439,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
DownloadManager
mdDownloadManager
=
(
DownloadManager
)
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
url
));
File
destinationFile
=
new
File
(
Environment
.
getExternalStorageDirectory
(),
fileName
);
request
.
setDescription
(
"Downloading ..."
);
File
destinationFile
=
new
File
(
Environment
.
getExternalStorageDirectory
(),
fileName
);
request
.
setDescription
(
"Downloading ..."
);
request
.
setNotificationVisibility
(
DownloadManager
.
Request
.
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);
request
.
setDestinationUri
(
Uri
.
fromFile
(
destinationFile
));
assert
mdDownloadManager
!=
null
;
...
...
@@ -1175,7 +1212,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
intent
.
setClass
(
ChatWebviewActivity
.
this
,
OperationRelatedContentActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
startActivity
(
intent
,
NaviConsts
.
Left
);
// overridePendingTransition(R.anim.viewin_left_to_right, R.anim.viewin_left_to_right);
}
// 設定画面へ遷移
...
...
@@ -1185,4 +1221,54 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
showSetting
();
}
public
class
NetworkTask
extends
AsyncTask
<
Void
,
Void
,
Bitmap
>
{
private
String
url
;
private
String
filePath
;
private
ContentValues
values
;
private
Bitmap
mBitmap
;
public
NetworkTask
(
String
url
,
String
filePath
)
{
this
.
url
=
url
;
this
.
filePath
=
filePath
;
}
@Override
protected
Bitmap
doInBackground
(
Void
...
params
)
{
try
{
mBitmap
=
BitmapFactory
.
decodeStream
((
InputStream
)
new
URL
(
url
).
getContent
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
mBitmap
;
}
@Override
protected
void
onPostExecute
(
Bitmap
resultBitmap
)
{
super
.
onPostExecute
(
resultBitmap
);
try
{
if
(
resultBitmap
==
null
)
{
return
;
}
File
f
=
new
File
(
filePath
);
f
.
createNewFile
();
Bitmap
bitmap
=
resultBitmap
;
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
0
,
bos
);
byte
[]
bitmapdata
=
bos
.
toByteArray
();
FileOutputStream
fos
=
new
FileOutputStream
(
f
);
fos
.
write
(
bitmapdata
);
fos
.
flush
();
fos
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
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