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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
119 additions
and
4 deletions
+119
-4
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
+0
-0
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 {
...
@@ -84,10 +84,18 @@ public interface ABookCommConstants {
Integer
DM
=
1
;
Integer
DM
=
1
;
Integer
ALL
=
2
;
Integer
ALL
=
2
;
}
}
interface
MESSAGE_TYPE
{
Integer
TEXT
=
0
;
Integer
PHOTO
=
1
;
Integer
VIDEO
=
2
;
Integer
SYSTEM
=
4
;
}
Integer
GROUP_REQUEST_ALL
=
0
;
Integer
GROUP_REQUEST_ALL
=
0
;
}
}
interface
SIZE
{
interface
SIZE
{
Integer
MAX_FAVORITE_COUNT
=
100
;
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
This diff is collapsed.
Click to expand it.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BitmapUtil.java
View file @
4a769161
package
jp
.
agentec
.
abook
.
abv
.
cl
.
util
;
package
jp
.
agentec
.
abook
.
abv
.
cl
.
util
;
import
java.io.ByteArrayOutputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -17,6 +18,7 @@ import android.graphics.BitmapFactory;
...
@@ -17,6 +18,7 @@ import android.graphics.BitmapFactory;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.media.MediaMetadataRetriever
;
import
android.media.MediaMetadataRetriever
;
import
android.media.MediaPlayer
;
import
android.media.MediaPlayer
;
import
android.util.Base64
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.WriterException
;
import
com.google.zxing.WriterException
;
...
@@ -433,4 +435,23 @@ public class BitmapUtil {
...
@@ -433,4 +435,23 @@ public class BitmapUtil {
return
bitmapList
;
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
;
package
jp
.
agentec
.
abook
.
abv
.
ui
.
home
.
activity
;
import
android.annotation.SuppressLint
;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
import
android.app.Dialog
;
import
android.app.Dialog
;
import
android.app.DownloadManager
;
import
android.app.DownloadManager
;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.ContentValues
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.IntentFilter
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -30,9 +35,12 @@ import android.widget.ImageView;
...
@@ -30,9 +35,12 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
org.json.adf.HTTP
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
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.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -209,6 +217,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
...
@@ -209,6 +217,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
setWebChromeClient
(
new
FullscreenableChromeClient
(
this
)
{
mChatWebView
.
setWebChromeClient
(
new
FullscreenableChromeClient
(
this
)
{
@Override
@Override
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
filePathCallback
,
FileChooserParams
fileChooserParams
)
{
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
filePathCallback
,
FileChooserParams
fileChooserParams
)
{
boolean
result
=
false
;
boolean
result
=
false
;
...
@@ -376,6 +386,32 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
...
@@ -376,6 +386,32 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
setWebViewClient
(
new
WebViewClient
()
{
mChatWebView
.
setWebViewClient
(
new
WebViewClient
()
{
@Override
@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
,
public
void
onReceivedError
(
WebView
view
,
int
errorCode
,
String
description
,
String
failingUrl
)
{
String
description
,
String
failingUrl
)
{
...
@@ -403,7 +439,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
...
@@ -403,7 +439,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
DownloadManager
mdDownloadManager
=
(
DownloadManager
)
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
DownloadManager
mdDownloadManager
=
(
DownloadManager
)
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
url
));
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
.
setNotificationVisibility
(
DownloadManager
.
Request
.
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);
request
.
setDestinationUri
(
Uri
.
fromFile
(
destinationFile
));
request
.
setDestinationUri
(
Uri
.
fromFile
(
destinationFile
));
assert
mdDownloadManager
!=
null
;
assert
mdDownloadManager
!=
null
;
...
@@ -1175,7 +1212,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
...
@@ -1175,7 +1212,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
intent
.
setClass
(
ChatWebviewActivity
.
this
,
OperationRelatedContentActivity
.
class
);
intent
.
setClass
(
ChatWebviewActivity
.
this
,
OperationRelatedContentActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
startActivity
(
intent
,
NaviConsts
.
Left
);
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 {
...
@@ -1185,4 +1221,54 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
showSetting
();
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