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
beaf139b
Commit
beaf139b
authored
Aug 20, 2021
by
Kim Eunchul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#42998 I/O 帳票出力画面改善
parent
ba2ea601
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
0 deletions
+84
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/HTMLWebViewActivity.java
+40
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/HTMLXWalkWebViewActivity.java
+44
-0
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/HTMLWebViewActivity.java
View file @
beaf139b
...
...
@@ -23,9 +23,20 @@ import android.widget.AdapterView.OnItemClickListener;
import
android.widget.ImageButton
;
import
android.widget.RelativeLayout
;
import
android.widget.Toast
;
import
android.app.DownloadManager
;
import
android.webkit.URLUtil
;
import
android.webkit.CookieManager
;
import
android.webkit.DownloadListener
;
import
android.os.Environment
;
import
android.webkit.WebViewClient
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.util.Objects
;
import
jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON
;
import
jp.agentec.abook.abv.bl.acms.type.AcmsApis
;
...
...
@@ -128,6 +139,35 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
settings
.
setAllowUniversalAccessFromFileURLs
(
true
);
settings
.
setMixedContentMode
(
WebSettings
.
MIXED_CONTENT_ALWAYS_ALLOW
);
webView
.
setDownloadListener
(
new
DownloadListener
()
{
@Override
public
void
onDownloadStart
(
String
url
,
String
userAgent
,
String
contentDisposition
,
String
mimetype
,
long
contentLength
)
{
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
url
));
final
String
fileName
=
URLUtil
.
guessFileName
(
url
,
contentDisposition
,
mimetype
);
request
.
setMimeType
(
mimetype
);
//------------------------COOKIE!!------------------------
String
cookies
=
CookieManager
.
getInstance
().
getCookie
(
url
);
request
.
addRequestHeader
(
"cookie"
,
cookies
);
//------------------------COOKIE!!------------------------
request
.
addRequestHeader
(
"User-Agent"
,
userAgent
);
request
.
setTitle
(
fileName
);
request
.
allowScanningByMediaScanner
();
request
.
setNotificationVisibility
(
DownloadManager
.
Request
.
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);
//Notify client once download is completed!
request
.
setDestinationInExternalPublicDir
(
Environment
.
DIRECTORY_DOWNLOADS
,
fileName
);
DownloadManager
dm
=
(
DownloadManager
)
getSystemService
(
DOWNLOAD_SERVICE
);
if
(
dm
!=
null
)
{
dm
.
enqueue
(
request
);
}
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
download_start
),
//To notify the Client that the file is being downloaded
Toast
.
LENGTH_LONG
).
show
();
}
});
final
RelativeLayout
fl
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
frameTopbar
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/HTMLXWalkWebViewActivity.java
View file @
beaf139b
...
...
@@ -17,6 +17,14 @@ import android.widget.FrameLayout;
import
android.widget.ImageButton
;
import
android.widget.RelativeLayout
;
import
android.widget.Toast
;
import
android.app.DownloadManager
;
import
android.webkit.URLUtil
;
import
android.webkit.CookieManager
;
import
android.webkit.DownloadListener
;
import
android.os.Environment
;
import
android.webkit.WebViewClient
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
org.xwalk.core.XWalkNavigationHistory
;
import
org.xwalk.core.XWalkPreferences
;
...
...
@@ -26,11 +34,17 @@ import org.xwalk.core.XWalkUIClient;
import
org.xwalk.core.XWalkView
;
import
org.xwalk.core.XWalkWebResourceRequest
;
import
org.xwalk.core.XWalkWebResourceResponse
;
import
org.xwalk.core.XWalkDownloadListener
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.util.Objects
;
import
jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
...
...
@@ -122,6 +136,36 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
if
(
Logger
.
isDebugEnabled
())
{
XWalkPreferences
.
setValue
(
XWalkPreferences
.
REMOTE_DEBUGGING
,
true
);
//デバッグモード(chromeからinspect可)
}
webView
.
setDownloadListener
(
new
XWalkDownloadListener
(
this
)
{
@Override
public
void
onDownloadStart
(
String
url
,
String
userAgent
,
String
contentDisposition
,
String
mimetype
,
long
contentLength
)
{
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
url
));
final
String
fileName
=
URLUtil
.
guessFileName
(
url
,
contentDisposition
,
mimetype
);
request
.
setMimeType
(
mimetype
);
//------------------------COOKIE!!------------------------
String
cookies
=
CookieManager
.
getInstance
().
getCookie
(
url
);
request
.
addRequestHeader
(
"cookie"
,
cookies
);
//------------------------COOKIE!!------------------------
request
.
addRequestHeader
(
"User-Agent"
,
userAgent
);
request
.
setTitle
(
fileName
);
request
.
allowScanningByMediaScanner
();
request
.
setNotificationVisibility
(
DownloadManager
.
Request
.
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);
//Notify client once download is completed!
request
.
setDestinationInExternalPublicDir
(
Environment
.
DIRECTORY_DOWNLOADS
,
fileName
);
DownloadManager
dm
=
(
DownloadManager
)
getSystemService
(
DOWNLOAD_SERVICE
);
if
(
dm
!=
null
)
{
dm
.
enqueue
(
request
);
}
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
download_start
),
//To notify the Client that the file is being downloaded
Toast
.
LENGTH_LONG
).
show
();
}
});
final
RelativeLayout
fl
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
frameTopbar
);
...
...
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