Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Flutter Inappwebview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
Flutter Inappwebview
Commits
001c95eb
Commit
001c95eb
authored
4 years ago
by
Lorenzo Pichilli
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #295 from wwwdata/fix-android-config-options
Fix config options for Android release builds
parents
9c7ac0da
a7100ae0
master
v3.0.0
v3.1.0
v3.2.0
v3.3.0
v3.3.0+3
v3.4.0
v3.4.0+1
v3.4.0+2
v4.0.0
v4.0.0+4
v4.0.0+6
v4.0.0+5
v4.0.0+4
v4.0.0
v3.4.0+2
v3.4.0+1
v.3.4.0
v3.3.0+3
v3.3.0
v3.2.0
v3.1.0
v3.0.0
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
474 additions
and
153 deletions
+474
-153
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/ChromeCustomTabs/ChromeCustomTabsOptions.java
...nappwebview/ChromeCustomTabs/ChromeCustomTabsOptions.java
+48
-1
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowserOptions.java
...illilorenzo/flutter_inappwebview/InAppBrowserOptions.java
+61
-1
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewOptions.java
...lutter_inappwebview/InAppWebView/InAppWebViewOptions.java
+363
-105
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/Options.java
...ava/com/pichillilorenzo/flutter_inappwebview/Options.java
+2
-46
No files found.
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/ChromeCustomTabs/ChromeCustomTabsOptions.java
View file @
001c95eb
...
@@ -2,7 +2,11 @@ package com.pichillilorenzo.flutter_inappwebview.ChromeCustomTabs;
...
@@ -2,7 +2,11 @@ package com.pichillilorenzo.flutter_inappwebview.ChromeCustomTabs;
import
com.pichillilorenzo.flutter_inappwebview.Options
;
import
com.pichillilorenzo.flutter_inappwebview.Options
;
public
class
ChromeCustomTabsOptions
extends
Options
{
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
public
class
ChromeCustomTabsOptions
implements
Options
{
final
static
String
LOG_TAG
=
"ChromeCustomTabsOptions"
;
final
static
String
LOG_TAG
=
"ChromeCustomTabsOptions"
;
...
@@ -12,4 +16,47 @@ public class ChromeCustomTabsOptions extends Options {
...
@@ -12,4 +16,47 @@ public class ChromeCustomTabsOptions extends Options {
public
boolean
enableUrlBarHiding
=
false
;
public
boolean
enableUrlBarHiding
=
false
;
public
boolean
instantAppsEnabled
=
false
;
public
boolean
instantAppsEnabled
=
false
;
ChromeCustomTabsOptions
parse
(
HashMap
<
String
,
Object
>
options
)
{
Iterator
it
=
options
.
entrySet
().
iterator
();
while
(
it
.
hasNext
())
{
Map
.
Entry
<
String
,
Object
>
pair
=
(
Map
.
Entry
<
String
,
Object
>)
it
.
next
();
String
key
=
pair
.
getKey
();
Object
value
=
pair
.
getValue
();
if
(
value
==
null
)
{
continue
;
}
switch
(
key
)
{
case
"addShareButton"
:
addShareButton
=
(
boolean
)
value
;
break
;
case
"showTitle"
:
showTitle
=
(
boolean
)
value
;
break
;
case
"toolbarBackgroundColor"
:
toolbarBackgroundColor
=
(
String
)
value
;
break
;
case
"enableUrlBarHiding"
:
enableUrlBarHiding
=
(
boolean
)
value
;
break
;
case
"instantAppsEnabled"
:
instantAppsEnabled
=
(
boolean
)
value
;
break
;
}
}
return
this
;
}
@Override
public
HashMap
<
String
,
Object
>
getHashMap
()
{
HashMap
<
String
,
Object
>
options
=
new
HashMap
<>();
options
.
put
(
"addShareButton"
,
addShareButton
);
options
.
put
(
"showTitle"
,
showTitle
);
options
.
put
(
"toolbarBackgroundColor"
,
toolbarBackgroundColor
);
options
.
put
(
"enableUrlBarHiding"
,
enableUrlBarHiding
);
options
.
put
(
"instantAppsEnabled"
,
instantAppsEnabled
);
return
options
;
}
}
}
This diff is collapsed.
Click to expand it.
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowserOptions.java
View file @
001c95eb
package
com.pichillilorenzo.flutter_inappwebview
;
package
com.pichillilorenzo.flutter_inappwebview
;
public
class
InAppBrowserOptions
extends
Options
{
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
public
class
InAppBrowserOptions
implements
Options
{
public
static
final
String
LOG_TAG
=
"InAppBrowserOptions"
;
public
static
final
String
LOG_TAG
=
"InAppBrowserOptions"
;
...
@@ -13,4 +17,60 @@ public class InAppBrowserOptions extends Options {
...
@@ -13,4 +17,60 @@ public class InAppBrowserOptions extends Options {
public
boolean
hideTitleBar
=
false
;
public
boolean
hideTitleBar
=
false
;
public
boolean
closeOnCannotGoBack
=
true
;
public
boolean
closeOnCannotGoBack
=
true
;
public
boolean
progressBar
=
true
;
public
boolean
progressBar
=
true
;
public
InAppBrowserOptions
parse
(
HashMap
<
String
,
Object
>
options
)
{
Iterator
it
=
options
.
entrySet
().
iterator
();
while
(
it
.
hasNext
())
{
Map
.
Entry
<
String
,
Object
>
pair
=
(
Map
.
Entry
<
String
,
Object
>)
it
.
next
();
String
key
=
pair
.
getKey
();
Object
value
=
pair
.
getValue
();
if
(
value
==
null
)
{
continue
;
}
switch
(
key
)
{
case
"hidden"
:
hidden
=
(
boolean
)
value
;
break
;
case
"toolbarTop"
:
toolbarTop
=
(
boolean
)
value
;
break
;
case
"toolbarTopBackgroundColor"
:
toolbarTopBackgroundColor
=
(
String
)
value
;
break
;
case
"toolbarTopFixedTitle"
:
toolbarTopFixedTitle
=
(
String
)
value
;
break
;
case
"hideUrlBar"
:
hideUrlBar
=
(
boolean
)
value
;
break
;
case
"hideTitleBar"
:
hideTitleBar
=
(
boolean
)
value
;
break
;
case
"closeOnCannotGoBack"
:
closeOnCannotGoBack
=
(
boolean
)
value
;
break
;
case
"progressBar"
:
progressBar
=
(
boolean
)
value
;
break
;
}
}
return
this
;
}
@Override
public
HashMap
<
String
,
Object
>
getHashMap
()
{
final
HashMap
<
String
,
Object
>
options
=
new
HashMap
<>();
options
.
put
(
"hidden"
,
hidden
);
options
.
put
(
"toolbarTop"
,
toolbarTop
);
options
.
put
(
"toolbarTopBackgroundColor"
,
toolbarTopBackgroundColor
);
options
.
put
(
"toolbarTopFixedTitle"
,
toolbarTopFixedTitle
);
options
.
put
(
"hideUrlBar"
,
hideUrlBar
);
options
.
put
(
"hideTitleBar"
,
hideTitleBar
);
options
.
put
(
"closeOnCannotGoBack"
,
closeOnCannotGoBack
);
options
.
put
(
"progressBar"
,
progressBar
);
return
options
;
}
}
}
This diff is collapsed.
Click to expand it.
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewOptions.java
View file @
001c95eb
...
@@ -8,12 +8,14 @@ import com.pichillilorenzo.flutter_inappwebview.Options;
...
@@ -8,12 +8,14 @@ import com.pichillilorenzo.flutter_inappwebview.Options;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
static
android
.
webkit
.
WebSettings
.
LayoutAlgorithm
.
NORMAL
;
import
static
android
.
webkit
.
WebSettings
.
LayoutAlgorithm
.
NORMAL
;
public
class
InAppWebViewOptions
extend
s
Options
{
public
class
InAppWebViewOptions
implement
s
Options
{
public
static
final
String
LOG_TAG
=
"InAppWebViewOptions"
;
public
static
final
String
LOG_TAG
=
"InAppWebViewOptions"
;
...
@@ -84,48 +86,304 @@ public class InAppWebViewOptions extends Options {
...
@@ -84,48 +86,304 @@ public class InAppWebViewOptions extends Options {
public
Boolean
supportMultipleWindows
=
false
;
public
Boolean
supportMultipleWindows
=
false
;
public
String
regexToCancelSubFramesLoading
;
public
String
regexToCancelSubFramesLoading
;
@Override
public
InAppWebViewOptions
parse
(
HashMap
<
String
,
Object
>
options
)
{
public
Object
onParse
(
Map
.
Entry
<
String
,
Object
>
pair
)
{
Iterator
it
=
options
.
entrySet
().
iterator
();
while
(
it
.
hasNext
())
{
Map
.
Entry
<
String
,
Object
>
pair
=
(
Map
.
Entry
<
String
,
Object
>)
it
.
next
();
String
key
=
pair
.
getKey
();
Object
value
=
pair
.
getValue
();
if
(
value
==
null
)
{
continue
;
}
switch
(
key
)
{
case
"useShouldOverrideUrlLoading"
:
useShouldOverrideUrlLoading
=
(
boolean
)
value
;
break
;
case
"useOnDownloadStart"
:
useOnDownloadStart
=
(
boolean
)
value
;
break
;
case
"useOnLoadResource"
:
useOnLoadResource
=
(
boolean
)
value
;
break
;
case
"clearCache"
:
clearCache
=
(
boolean
)
value
;
break
;
case
"userAgent"
:
userAgent
=
(
String
)
value
;
break
;
case
"applicationNameForUserAgent"
:
applicationNameForUserAgent
=
(
String
)
value
;
break
;
case
"javaScriptEnabled"
:
javaScriptEnabled
=
(
boolean
)
value
;
break
;
case
"debuggingEnabled"
:
debuggingEnabled
=
(
boolean
)
value
;
break
;
case
"javaScriptCanOpenWindowsAutomatically"
:
javaScriptCanOpenWindowsAutomatically
=
(
boolean
)
value
;
break
;
case
"mediaPlaybackRequiresUserGesture"
:
mediaPlaybackRequiresUserGesture
=
(
boolean
)
value
;
break
;
case
"minimumFontSize"
:
minimumFontSize
=
(
int
)
value
;
break
;
case
"verticalScrollBarEnabled"
:
verticalScrollBarEnabled
=
(
boolean
)
value
;
break
;
case
"horizontalScrollBarEnabled"
:
horizontalScrollBarEnabled
=
(
boolean
)
value
;
break
;
case
"resourceCustomSchemes"
:
resourceCustomSchemes
=
(
List
<
String
>)
value
;
break
;
case
"contentBlockers"
:
contentBlockers
=
(
List
<
Map
<
String
,
Map
<
String
,
Object
>>>)
value
;
break
;
case
"preferredContentMode"
:
preferredContentMode
=
(
int
)
value
;
break
;
case
"useShouldInterceptAjaxRequest"
:
useShouldInterceptAjaxRequest
=
(
boolean
)
value
;
break
;
case
"useShouldInterceptFetchRequest"
:
useShouldInterceptFetchRequest
=
(
boolean
)
value
;
break
;
case
"incognito"
:
incognito
=
(
boolean
)
value
;
break
;
case
"cacheEnabled"
:
cacheEnabled
=
(
boolean
)
value
;
break
;
case
"transparentBackground"
:
transparentBackground
=
(
boolean
)
value
;
break
;
case
"disableVerticalScroll"
:
disableVerticalScroll
=
(
boolean
)
value
;
break
;
case
"disableHorizontalScroll"
:
disableHorizontalScroll
=
(
boolean
)
value
;
break
;
case
"textZoom"
:
textZoom
=
(
int
)
value
;
break
;
case
"clearSessionCache"
:
clearSessionCache
=
(
boolean
)
value
;
break
;
case
"builtInZoomControls"
:
builtInZoomControls
=
(
boolean
)
value
;
break
;
case
"displayZoomControls"
:
displayZoomControls
=
(
boolean
)
value
;
break
;
case
"supportZoom"
:
supportZoom
=
(
boolean
)
value
;
break
;
case
"databaseEnabled"
:
databaseEnabled
=
(
boolean
)
value
;
break
;
case
"domStorageEnabled"
:
domStorageEnabled
=
(
boolean
)
value
;
break
;
case
"useWideViewPort"
:
useWideViewPort
=
(
boolean
)
value
;
break
;
case
"safeBrowsingEnabled"
:
safeBrowsingEnabled
=
(
boolean
)
value
;
break
;
case
"mixedContentMode"
:
mixedContentMode
=
(
int
)
value
;
break
;
case
"allowContentAccess"
:
allowContentAccess
=
(
boolean
)
value
;
break
;
case
"allowFileAccess"
:
allowFileAccess
=
(
boolean
)
value
;
break
;
case
"allowFileAccessFromFileURLs"
:
allowFileAccessFromFileURLs
=
(
boolean
)
value
;
break
;
case
"allowUniversalAccessFromFileURLs"
:
allowUniversalAccessFromFileURLs
=
(
boolean
)
value
;
break
;
case
"appCachePath"
:
appCachePath
=
(
String
)
value
;
break
;
case
"blockNetworkImage"
:
blockNetworkImage
=
(
boolean
)
value
;
break
;
case
"blockNetworkLoads"
:
blockNetworkLoads
=
(
boolean
)
value
;
break
;
case
"cacheMode"
:
cacheMode
=
(
int
)
value
;
break
;
case
"cursiveFontFamily"
:
cursiveFontFamily
=
(
String
)
value
;
break
;
case
"defaultFixedFontSize"
:
defaultFixedFontSize
=
(
int
)
value
;
break
;
case
"defaultFontSize"
:
defaultFontSize
=
(
int
)
value
;
break
;
case
"defaultTextEncodingName"
:
defaultTextEncodingName
=
(
String
)
value
;
break
;
case
"disabledActionModeMenuItems"
:
disabledActionModeMenuItems
=
(
int
)
value
;
break
;
case
"fantasyFontFamily"
:
fantasyFontFamily
=
(
String
)
value
;
break
;
case
"fixedFontFamily"
:
fixedFontFamily
=
(
String
)
value
;
break
;
case
"forceDark"
:
forceDark
=
(
int
)
value
;
break
;
case
"geolocationEnabled"
:
geolocationEnabled
=
(
boolean
)
value
;
break
;
case
"layoutAlgorithm"
:
setLayoutAlgorithm
(
pair
);
break
;
case
"loadWithOverviewMode"
:
loadWithOverviewMode
=
(
boolean
)
value
;
break
;
case
"loadsImagesAutomatically"
:
loadsImagesAutomatically
=
(
boolean
)
value
;
break
;
case
"minimumLogicalFontSize"
:
minimumLogicalFontSize
=
(
int
)
value
;
break
;
case
"initialScale"
:
initialScale
=
(
int
)
value
;
break
;
case
"needInitialFocus"
:
needInitialFocus
=
(
boolean
)
value
;
break
;
case
"offscreenPreRaster"
:
offscreenPreRaster
=
(
boolean
)
value
;
break
;
case
"sansSerifFontFamily"
:
sansSerifFontFamily
=
(
String
)
value
;
break
;
case
"serifFontFamily"
:
serifFontFamily
=
(
String
)
value
;
break
;
case
"standardFontFamily"
:
standardFontFamily
=
(
String
)
value
;
break
;
case
"saveFormData"
:
saveFormData
=
(
boolean
)
value
;
break
;
case
"thirdPartyCookiesEnabled"
:
thirdPartyCookiesEnabled
=
(
boolean
)
value
;
break
;
case
"hardwareAcceleration"
:
hardwareAcceleration
=
(
boolean
)
value
;
break
;
case
"supportMultipleWindows"
:
supportMultipleWindows
=
(
boolean
)
value
;
break
;
case
"regexToCancelSubFramesLoading"
:
regexToCancelSubFramesLoading
=
(
String
)
value
;
break
;
}
}
return
this
;
}
private
void
setLayoutAlgorithm
(
Map
.
Entry
<
String
,
Object
>
pair
)
{
if
(
pair
.
getKey
().
equals
(
"layoutAlgorithm"
))
{
if
(
pair
.
getKey
().
equals
(
"layoutAlgorithm"
))
{
String
value
=
(
String
)
pair
.
getValue
();
String
value
=
(
String
)
pair
.
getValue
();
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
switch
(
value
)
{
switch
(
value
)
{
case
"NORMAL"
:
case
"NORMAL"
:
pair
.
setValue
(
NORMAL
);
this
.
layoutAlgorithm
=
NORMAL
;
return
pair
;
case
"TEXT_AUTOSIZING"
:
case
"TEXT_AUTOSIZING"
:
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
return
pair
.
setValue
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
)
;
this
.
layoutAlgorithm
=
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
;
}
else
{
}
else
{
pair
.
setValue
(
NORMAL
)
;
layoutAlgorithm
=
NORMAL
;
}
}
return
pair
;
}
}
}
}
}
}
return
super
.
onParse
(
pair
);
}
}
@Override
@Override
public
Object
onGetHashMap
(
Field
field
)
{
public
HashMap
<
String
,
Object
>
getHashMap
()
{
if
(
field
.
getName
().
equals
(
"layoutAlgorithm"
))
{
HashMap
<
String
,
Object
>
options
=
new
HashMap
<>();
try
{
options
.
put
(
"useShouldOverrideUrlLoading"
,
useShouldOverrideUrlLoading
);
WebSettings
.
LayoutAlgorithm
value
=
(
WebSettings
.
LayoutAlgorithm
)
field
.
get
(
this
);
options
.
put
(
"useOnLoadResource"
,
useOnLoadResource
);
if
(
value
!=
null
)
{
options
.
put
(
"useOnDownloadStart"
,
useOnDownloadStart
);
switch
(
value
)
{
options
.
put
(
"clearCache"
,
clearCache
);
case
NORMAL:
options
.
put
(
"userAgent"
,
userAgent
);
return
"NORMAL"
;
options
.
put
(
"applicationNameForUserAgent"
,
applicationNameForUserAgent
);
default
:
options
.
put
(
"javaScriptEnabled"
,
javaScriptEnabled
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
&&
value
.
equals
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
))
{
options
.
put
(
"debuggingEnabled"
,
debuggingEnabled
);
return
"TEXT_AUTOSIZING"
;
options
.
put
(
"javaScriptCanOpenWindowsAutomatically"
,
javaScriptCanOpenWindowsAutomatically
);
}
options
.
put
(
"mediaPlaybackRequiresUserGesture"
,
mediaPlaybackRequiresUserGesture
);
return
"NORMAL"
;
options
.
put
(
"minimumFontSize"
,
minimumFontSize
);
}
options
.
put
(
"verticalScrollBarEnabled"
,
verticalScrollBarEnabled
);
}
options
.
put
(
"horizontalScrollBarEnabled"
,
horizontalScrollBarEnabled
);
}
catch
(
IllegalAccessException
e
)
{
options
.
put
(
"resourceCustomSchemes"
,
resourceCustomSchemes
);
Log
.
d
(
LOG_TAG
,
e
.
getMessage
());
options
.
put
(
"contentBlockers"
,
contentBlockers
);
}
options
.
put
(
"preferredContentMode"
,
preferredContentMode
);
}
options
.
put
(
"useShouldInterceptAjaxRequest"
,
useShouldInterceptAjaxRequest
);
return
super
.
onGetHashMap
(
field
);
options
.
put
(
"useShouldInterceptFetchRequest"
,
useShouldInterceptFetchRequest
);
options
.
put
(
"incognito"
,
incognito
);
options
.
put
(
"cacheEnabled"
,
cacheEnabled
);
options
.
put
(
"transparentBackground"
,
transparentBackground
);
options
.
put
(
"disableVerticalScroll"
,
disableVerticalScroll
);
options
.
put
(
"disableHorizontalScroll"
,
disableHorizontalScroll
);
options
.
put
(
"textZoom"
,
textZoom
);
options
.
put
(
"clearSessionCache"
,
clearSessionCache
);
options
.
put
(
"builtInZoomControls"
,
builtInZoomControls
);
options
.
put
(
"displayZoomControls"
,
displayZoomControls
);
options
.
put
(
"supportZoom"
,
supportZoom
);
options
.
put
(
"databaseEnabled"
,
databaseEnabled
);
options
.
put
(
"domStorageEnabled"
,
domStorageEnabled
);
options
.
put
(
"useWideViewPort"
,
useWideViewPort
);
options
.
put
(
"safeBrowsingEnabled"
,
safeBrowsingEnabled
);
options
.
put
(
"mixedContentMode"
,
mixedContentMode
);
options
.
put
(
"allowContentAccess"
,
allowContentAccess
);
options
.
put
(
"allowFileAccess"
,
allowFileAccess
);
options
.
put
(
"allowFileAccessFromFileURLs"
,
allowFileAccessFromFileURLs
);
options
.
put
(
"allowUniversalAccessFromFileURLs"
,
allowUniversalAccessFromFileURLs
);
options
.
put
(
"appCachePath"
,
appCachePath
);
options
.
put
(
"blockNetworkImage"
,
blockNetworkImage
);
options
.
put
(
"blockNetworkLoads"
,
blockNetworkLoads
);
options
.
put
(
"cacheMode"
,
cacheMode
);
options
.
put
(
"cursiveFontFamily"
,
cursiveFontFamily
);
options
.
put
(
"defaultFixedFontSize"
,
defaultFixedFontSize
);
options
.
put
(
"defaultFontSize"
,
defaultFontSize
);
options
.
put
(
"defaultTextEncodingName"
,
defaultTextEncodingName
);
options
.
put
(
"disabledActionModeMenuItems"
,
disabledActionModeMenuItems
);
options
.
put
(
"fantasyFontFamily"
,
fantasyFontFamily
);
options
.
put
(
"fixedFontFamily"
,
fixedFontFamily
);
options
.
put
(
"forceDark"
,
forceDark
);
options
.
put
(
"geolocationEnabled"
,
geolocationEnabled
);
options
.
put
(
"layoutAlgorithm"
,
layoutAlgorithm
);
options
.
put
(
"loadWithOverviewMode"
,
loadWithOverviewMode
);
options
.
put
(
"loadsImagesAutomatically"
,
loadsImagesAutomatically
);
options
.
put
(
"minimumLogicalFontSize"
,
minimumLogicalFontSize
);
options
.
put
(
"initialScale"
,
initialScale
);
options
.
put
(
"needInitialFocus"
,
needInitialFocus
);
options
.
put
(
"offscreenPreRaster"
,
offscreenPreRaster
);
options
.
put
(
"sansSerifFontFamily"
,
sansSerifFontFamily
);
options
.
put
(
"serifFontFamily"
,
serifFontFamily
);
options
.
put
(
"standardFontFamily"
,
standardFontFamily
);
options
.
put
(
"saveFormData"
,
saveFormData
);
options
.
put
(
"thirdPartyCookiesEnabled"
,
thirdPartyCookiesEnabled
);
options
.
put
(
"hardwareAcceleration"
,
hardwareAcceleration
);
options
.
put
(
"supportMultipleWindows"
,
supportMultipleWindows
);
options
.
put
(
"regexToCancelSubFramesLoading"
,
regexToCancelSubFramesLoading
);
return
options
;
}
}
}
}
This diff is collapsed.
Click to expand it.
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/Options.java
View file @
001c95eb
package
com.pichillilorenzo.flutter_inappwebview
;
package
com.pichillilorenzo.flutter_inappwebview
;
import
android.util.Log
;
import
java.lang.reflect.Field
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.util.HashMap
;
public
class
Options
{
public
interface
Options
{
HashMap
<
String
,
Object
>
getHashMap
();
static
String
LOG_TAG
=
"Options"
;
public
Options
parse
(
HashMap
<
String
,
Object
>
options
)
{
Iterator
it
=
options
.
entrySet
().
iterator
();
while
(
it
.
hasNext
())
{
Map
.
Entry
<
String
,
Object
>
pair
=
(
Map
.
Entry
<
String
,
Object
>)
it
.
next
();
Object
value
=
this
.
onParse
(
pair
);
try
{
this
.
getClass
().
getDeclaredField
(
pair
.
getKey
()).
set
(
this
,
value
);
}
catch
(
NoSuchFieldException
e
)
{
Log
.
d
(
LOG_TAG
,
e
.
getMessage
());
}
catch
(
IllegalAccessException
e
)
{
Log
.
d
(
LOG_TAG
,
e
.
getMessage
());
}
}
return
this
;
}
public
Object
onParse
(
Map
.
Entry
<
String
,
Object
>
pair
)
{
return
pair
.
getValue
();
}
public
HashMap
<
String
,
Object
>
getHashMap
()
{
HashMap
<
String
,
Object
>
options
=
new
HashMap
<>();
for
(
Field
field
:
this
.
getClass
().
getDeclaredFields
())
{
options
.
put
(
field
.
getName
(),
onGetHashMap
(
field
));
}
return
options
;
}
public
Object
onGetHashMap
(
Field
field
)
{
try
{
return
field
.
get
(
this
);
}
catch
(
IllegalAccessException
e
)
{
Log
.
d
(
LOG_TAG
,
e
.
getMessage
());
}
return
null
;
}
}
}
This diff is collapsed.
Click to expand it.
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