Merge pull request #186 from crazecoder/master

add initialScale in android
This commit is contained in:
Lorenzo Pichilli 2019-11-08 15:11:43 +01:00 committed by GitHub
commit 352dd02525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -560,6 +560,9 @@ final public class InAppWebView extends InputAwareWebView {
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);
@ -963,6 +966,9 @@ final public class InAppWebView extends InputAwareWebView {
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);

View File

@ -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";

View File

@ -174,6 +174,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
bool loadWithOverviewMode;
bool loadsImagesAutomatically;
int minimumLogicalFontSize;
int initialScale;
bool needInitialFocus;
bool offscreenPreRaster;
String sansSerifFontFamily;
@ -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
@ -227,6 +228,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
"loadWithOverviewMode": loadWithOverviewMode,
"loadsImagesAutomatically": loadsImagesAutomatically,
"minimumLogicalFontSize": minimumLogicalFontSize,
"initialScale": initialScale,
"needInitialFocus": needInitialFocus,
"offscreenPreRaster": offscreenPreRaster,
"sansSerifFontFamily": sansSerifFontFamily,
@ -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"];