Skip to content

Commit

Permalink
Merge pull request #186 from crazecoder/master
Browse files Browse the repository at this point in the history
add initialScale in android
  • Loading branch information
pichillilorenzo authored Nov 8, 2019
2 parents f80bf88 + 971ac88 commit 352dd02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@ else if (options.clearSessionCache)
settings.setLoadsImagesAutomatically(options.loadsImagesAutomatically);
settings.setMinimumFontSize(options.minimumFontSize);
settings.setMinimumLogicalFontSize(options.minimumLogicalFontSize);
if(options.initialScale != null)
setInitialScale(options.initialScale);

settings.setNeedInitialFocus(options.needInitialFocus);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
settings.setOffscreenPreRaster(options.offscreenPreRaster);
Expand Down Expand Up @@ -963,6 +966,9 @@ else if (newOptionsMap.get("clearSessionCache") != null && newOptions.clearSessi
if (newOptionsMap.get("minimumLogicalFontSize") != null && !options.minimumLogicalFontSize.equals(newOptions.minimumLogicalFontSize))
settings.setMinimumLogicalFontSize(newOptions.minimumLogicalFontSize);

if (newOptionsMap.get("initialScale") != null && !options.initialScale.equals(newOptions.initialScale))
setInitialScale(newOptions.initialScale);

if (newOptionsMap.get("needInitialFocus") != null && options.needInitialFocus != newOptions.needInitialFocus)
settings.setNeedInitialFocus(newOptions.needInitialFocus);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class InAppWebViewOptions extends Options {
public Boolean loadWithOverviewMode = true;
public Boolean loadsImagesAutomatically = true;
public Integer minimumLogicalFontSize = 8;
public Integer initialScale;
public Boolean needInitialFocus = true;
public Boolean offscreenPreRaster = false;
public String sansSerifFontFamily = "sans-serif";
Expand Down
5 changes: 4 additions & 1 deletion lib/src/webview_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
bool loadWithOverviewMode;
bool loadsImagesAutomatically;
int minimumLogicalFontSize;
int initialScale;
bool needInitialFocus;
bool offscreenPreRaster;
String sansSerifFontFamily;
Expand All @@ -191,7 +192,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
this.disabledActionModeMenuItems, this.fantasyFontFamily = "fantasy", this.fixedFontFamily = "monospace", this.forceDark = AndroidInAppWebViewForceDark.FORCE_DARK_OFF,
this.geolocationEnabled = true, this.layoutAlgorithm, this.loadWithOverviewMode = true, this.loadsImagesAutomatically = true,
this.minimumLogicalFontSize = 8, this.needInitialFocus = true, this.offscreenPreRaster = false, this.sansSerifFontFamily = "sans-serif", this.serifFontFamily = "sans-serif",
this.standardFontFamily = "sans-serif", this.saveFormData = true, this.thirdPartyCookiesEnabled = true, this.hardwareAcceleration = true
this.standardFontFamily = "sans-serif", this.saveFormData = true, this.thirdPartyCookiesEnabled = true, this.hardwareAcceleration = true, this.initialScale
});

@override
Expand Down Expand Up @@ -227,6 +228,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
"loadWithOverviewMode": loadWithOverviewMode,
"loadsImagesAutomatically": loadsImagesAutomatically,
"minimumLogicalFontSize": minimumLogicalFontSize,
"initialScale": initialScale,
"needInitialFocus": needInitialFocus,
"offscreenPreRaster": offscreenPreRaster,
"sansSerifFontFamily": sansSerifFontFamily,
Expand Down Expand Up @@ -271,6 +273,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
options.loadWithOverviewMode = map["loadWithOverviewMode"];
options.loadsImagesAutomatically = map["loadsImagesAutomatically"];
options.minimumLogicalFontSize = map["minimumLogicalFontSize"];
options.initialScale = map["initialScale"];
options.needInitialFocus = map["needInitialFocus"];
options.offscreenPreRaster = map["offscreenPreRaster"];
options.sansSerifFontFamily = map["sansSerifFontFamily"];
Expand Down

0 comments on commit 352dd02

Please # to comment.