From 339bf379b9b4173f5114d5cc34ec8d6d862a6520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=88=E4=B8=91=E5=8F=88=E4=B8=8D=E8=AF=BB=E4=B9=A6?= <664996919@qq.com> Date: Tue, 14 Feb 2017 16:57:55 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0addJavascriptInterface?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E8=AE=A9JS=E8=83=BD=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E5=AE=89=E5=8D=93=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- .../finestwebview/FinestWebView.java | 6 + .../finestwebview/FinestWebViewActivity.java | 2276 +++++++++-------- sample/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + sample/gradlew | 160 ++ sample/gradlew.bat | 90 + .../finestwebview/sample/MainActivity.java | 35 +- 8 files changed, 1450 insertions(+), 1125 deletions(-) create mode 100644 sample/gradle/wrapper/gradle-wrapper.jar create mode 100644 sample/gradle/wrapper/gradle-wrapper.properties create mode 100644 sample/gradlew create mode 100644 sample/gradlew.bat diff --git a/build.gradle b/build.gradle index 4fdd43f..7ee1255 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.3' + classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.novoda:bintray-release:0.3.4' } diff --git a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java index 70440e8..c80554e 100644 --- a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java +++ b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java @@ -158,6 +158,7 @@ public static class Builder implements Serializable { protected Boolean webViewOffscreenPreRaster; protected String injectJavaScript; + protected Object jsInteration; protected String mimeType; protected String encoding; @@ -190,6 +191,11 @@ public Builder addWebViewListener(WebViewListener listener) { return this; } + public Builder addJavascriptInterface(Object jsInteration) { + this.jsInteration=jsInteration; + return this; + } + public Builder removeWebViewListener(WebViewListener listener) { listeners.remove(listener); return this; diff --git a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java index 725a8bf..99371a0 100644 --- a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java +++ b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java @@ -23,6 +23,7 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.AppCompatImageButton; import android.support.v7.widget.Toolbar; +import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.View; @@ -33,6 +34,7 @@ import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.webkit.DownloadListener; +import android.webkit.JavascriptInterface; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; @@ -43,6 +45,7 @@ import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; + import com.nineoldandroids.view.ViewHelper; import com.thefinestartist.converters.UnitConverter; import com.thefinestartist.finestwebview.enums.Position; @@ -57,1187 +60,1224 @@ import com.thefinestartist.utils.ui.DisplayUtil; import com.thefinestartist.utils.ui.ViewUtil; +import java.io.Serializable; + //MailTo Imports /** * Created by Leonardo on 11/14/15. */ public class FinestWebViewActivity extends AppCompatActivity - implements AppBarLayout.OnOffsetChangedListener, View.OnClickListener { - - protected int key; - - protected boolean rtl; - protected int theme; - - protected int statusBarColor; - - protected int toolbarColor; - protected int toolbarScrollFlags; - - protected int iconDefaultColor; - protected int iconDisabledColor; - protected int iconPressedColor; - protected int iconSelector; - - protected boolean showIconClose; - protected boolean disableIconClose; - protected boolean showIconBack; - protected boolean disableIconBack; - protected boolean showIconForward; - protected boolean disableIconForward; - protected boolean showIconMenu; - protected boolean disableIconMenu; - - protected boolean showSwipeRefreshLayout; - protected int swipeRefreshColor; - protected int[] swipeRefreshColors; - - protected boolean showDivider; - protected boolean gradientDivider; - protected int dividerColor; - protected float dividerHeight; - - protected boolean showProgressBar; - protected int progressBarColor; - protected float progressBarHeight; - protected Position progressBarPosition; - - protected String titleDefault; - protected boolean updateTitleFromHtml; - protected float titleSize; - protected String titleFont; - protected int titleColor; - - protected boolean showUrl; - protected float urlSize; - protected String urlFont; - protected int urlColor; - - protected int menuColor; - protected int menuDropShadowColor; - protected float menuDropShadowSize; - protected int menuSelector; - - protected float menuTextSize; - protected String menuTextFont; - protected int menuTextColor; - - protected int menuTextGravity; - protected float menuTextPaddingLeft; - protected float menuTextPaddingRight; - - protected boolean showMenuRefresh; - protected int stringResRefresh; - protected boolean showMenuFind; - protected int stringResFind; - protected boolean showMenuShareVia; - protected int stringResShareVia; - protected boolean showMenuCopyLink; - protected int stringResCopyLink; - protected boolean showMenuOpenWith; - protected int stringResOpenWith; - - protected int animationCloseEnter; - protected int animationCloseExit; - - protected boolean backPressToClose; - protected int stringResCopiedToClipboard; - - protected Boolean webViewSupportZoom; - protected Boolean webViewMediaPlaybackRequiresUserGesture; - protected Boolean webViewBuiltInZoomControls; - protected Boolean webViewDisplayZoomControls; - protected Boolean webViewAllowFileAccess; - protected Boolean webViewAllowContentAccess; - protected Boolean webViewLoadWithOverviewMode; - protected Boolean webViewSaveFormData; - protected Integer webViewTextZoom; - protected Boolean webViewUseWideViewPort; - protected Boolean webViewSupportMultipleWindows; - protected WebSettings.LayoutAlgorithm webViewLayoutAlgorithm; - protected String webViewStandardFontFamily; - protected String webViewFixedFontFamily; - protected String webViewSansSerifFontFamily; - protected String webViewSerifFontFamily; - protected String webViewCursiveFontFamily; - protected String webViewFantasyFontFamily; - protected Integer webViewMinimumFontSize; - protected Integer webViewMinimumLogicalFontSize; - protected Integer webViewDefaultFontSize; - protected Integer webViewDefaultFixedFontSize; - protected Boolean webViewLoadsImagesAutomatically; - protected Boolean webViewBlockNetworkImage; - protected Boolean webViewBlockNetworkLoads; - protected Boolean webViewJavaScriptEnabled; - protected Boolean webViewAllowUniversalAccessFromFileURLs; - protected Boolean webViewAllowFileAccessFromFileURLs; - protected String webViewGeolocationDatabasePath; - protected Boolean webViewAppCacheEnabled; - protected String webViewAppCachePath; - protected Boolean webViewDatabaseEnabled; - protected Boolean webViewDomStorageEnabled; - protected Boolean webViewGeolocationEnabled; - protected Boolean webViewJavaScriptCanOpenWindowsAutomatically; - protected String webViewDefaultTextEncodingName; - protected String webViewUserAgentString; - protected Boolean webViewNeedInitialFocus; - protected Integer webViewCacheMode; - protected Integer webViewMixedContentMode; - protected Boolean webViewOffscreenPreRaster; - - protected String injectJavaScript; - - protected String mimeType; - protected String encoding; - protected String data; - protected String url; - protected CoordinatorLayout coordinatorLayout; - protected AppBarLayout appBar; - protected Toolbar toolbar; - protected RelativeLayout toolbarLayout; - protected TextView title; - protected TextView urlTv; - protected AppCompatImageButton close; - protected AppCompatImageButton back; - protected AppCompatImageButton forward; - protected AppCompatImageButton more; - protected SwipeRefreshLayout swipeRefreshLayout; - protected WebView webView; - protected View gradient; - protected View divider; - protected ProgressBar progressBar; - protected RelativeLayout menuLayout; - protected ShadowLayout shadowLayout; - protected LinearLayout menuBackground; - protected LinearLayout menuRefresh; - protected TextView menuRefreshTv; - protected LinearLayout menuFind; - protected TextView menuFindTv; - protected LinearLayout menuShareVia; - protected TextView menuShareViaTv; - protected LinearLayout menuCopyLink; - protected TextView menuCopyLinkTv; - protected LinearLayout menuOpenWith; - protected TextView menuOpenWithTv; - protected FrameLayout webLayout; - DownloadListener downloadListener = new DownloadListener() { - @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, - String mimetype, long contentLength) { - BroadCastManager.onDownloadStart(FinestWebViewActivity.this, key, url, userAgent, - contentDisposition, mimetype, contentLength); - } - }; - - protected void initializeOptions() { - Intent intent = getIntent(); - if (intent == null) return; - - FinestWebView.Builder builder = (FinestWebView.Builder) intent.getSerializableExtra("builder"); - - // set theme before resolving attributes depending on those - setTheme(builder.theme != null ? builder.theme : 0); - - // resolve themed attributes - TypedValue typedValue = new TypedValue(); - TypedArray typedArray = obtainStyledAttributes(typedValue.data, new int[] { - R.attr.colorPrimaryDark, R.attr.colorPrimary, R.attr.colorAccent, - android.R.attr.textColorPrimary, android.R.attr.textColorSecondary, - android.R.attr.selectableItemBackground, android.R.attr.selectableItemBackgroundBorderless - }); - int colorPrimaryDark = typedArray.getColor(0, ContextCompat.getColor(this, R.color.finestGray)); - int colorPrimary = typedArray.getColor(1, ContextCompat.getColor(this, R.color.finestWhite)); - int colorAccent = typedArray.getColor(2, ContextCompat.getColor(this, R.color.finestBlack)); - int textColorPrimary = - typedArray.getColor(3, ContextCompat.getColor(this, R.color.finestBlack)); - int textColorSecondary = - typedArray.getColor(4, ContextCompat.getColor(this, R.color.finestSilver)); - int selectableItemBackground = - Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? typedArray.getResourceId(5, 0) - : R.drawable.selector_light_theme; - int selectableItemBackgroundBorderless = - Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? typedArray.getResourceId(6, 0) - : R.drawable.selector_light_theme; - typedArray.recycle(); - - key = builder.key; - - rtl = builder.rtl != null ? builder.rtl : getResources().getBoolean(R.bool.is_right_to_left); - - statusBarColor = builder.statusBarColor != null ? builder.statusBarColor : colorPrimaryDark; - - toolbarColor = builder.toolbarColor != null ? builder.toolbarColor : colorPrimary; - toolbarScrollFlags = builder.toolbarScrollFlags != null ? builder.toolbarScrollFlags : - AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL - | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS; - - iconDefaultColor = builder.iconDefaultColor != null ? builder.iconDefaultColor : colorAccent; - iconDisabledColor = builder.iconDisabledColor != null ? builder.iconDisabledColor - : ColorHelper.disableColor(iconDefaultColor); - iconPressedColor = - builder.iconPressedColor != null ? builder.iconPressedColor : iconDefaultColor; - iconSelector = - builder.iconSelector != null ? builder.iconSelector : selectableItemBackgroundBorderless; - - showIconClose = builder.showIconClose != null ? builder.showIconClose : true; - disableIconClose = builder.disableIconClose != null ? builder.disableIconClose : false; - showIconBack = builder.showIconBack != null ? builder.showIconBack : true; - disableIconBack = builder.disableIconBack != null ? builder.disableIconBack : false; - showIconForward = builder.showIconForward != null ? builder.showIconForward : true; - disableIconForward = builder.disableIconForward != null ? builder.disableIconForward : false; - showIconMenu = builder.showIconMenu != null ? builder.showIconMenu : true; - disableIconMenu = builder.disableIconMenu != null ? builder.disableIconMenu : false; - - showSwipeRefreshLayout = - builder.showSwipeRefreshLayout != null ? builder.showSwipeRefreshLayout : true; - swipeRefreshColor = builder.swipeRefreshColor != null ? builder.swipeRefreshColor : colorAccent; - if (builder.swipeRefreshColors != null) { - int[] colors = new int[builder.swipeRefreshColors.length]; - for (int i = 0; i < builder.swipeRefreshColors.length; i++) - colors[i] = builder.swipeRefreshColors[i]; - swipeRefreshColors = colors; - } + implements AppBarLayout.OnOffsetChangedListener, View.OnClickListener { + + protected int key; + + protected boolean rtl; + protected int theme; + + protected int statusBarColor; + + protected int toolbarColor; + protected int toolbarScrollFlags; + + protected int iconDefaultColor; + protected int iconDisabledColor; + protected int iconPressedColor; + protected int iconSelector; + + protected boolean showIconClose; + protected boolean disableIconClose; + protected boolean showIconBack; + protected boolean disableIconBack; + protected boolean showIconForward; + protected boolean disableIconForward; + protected boolean showIconMenu; + protected boolean disableIconMenu; + + protected boolean showSwipeRefreshLayout; + protected int swipeRefreshColor; + protected int[] swipeRefreshColors; + + protected boolean showDivider; + protected boolean gradientDivider; + protected int dividerColor; + protected float dividerHeight; + + protected boolean showProgressBar; + protected int progressBarColor; + protected float progressBarHeight; + protected Position progressBarPosition; + + protected String titleDefault; + protected boolean updateTitleFromHtml; + protected float titleSize; + protected String titleFont; + protected int titleColor; + + protected boolean showUrl; + protected float urlSize; + protected String urlFont; + protected int urlColor; + + protected int menuColor; + protected int menuDropShadowColor; + protected float menuDropShadowSize; + protected int menuSelector; + + protected float menuTextSize; + protected String menuTextFont; + protected int menuTextColor; + + protected int menuTextGravity; + protected float menuTextPaddingLeft; + protected float menuTextPaddingRight; + + protected boolean showMenuRefresh; + protected int stringResRefresh; + protected boolean showMenuFind; + protected int stringResFind; + protected boolean showMenuShareVia; + protected int stringResShareVia; + protected boolean showMenuCopyLink; + protected int stringResCopyLink; + protected boolean showMenuOpenWith; + protected int stringResOpenWith; + + protected int animationCloseEnter; + protected int animationCloseExit; + + protected boolean backPressToClose; + protected int stringResCopiedToClipboard; + + protected Boolean webViewSupportZoom; + protected Boolean webViewMediaPlaybackRequiresUserGesture; + protected Boolean webViewBuiltInZoomControls; + protected Boolean webViewDisplayZoomControls; + protected Boolean webViewAllowFileAccess; + protected Boolean webViewAllowContentAccess; + protected Boolean webViewLoadWithOverviewMode; + protected Boolean webViewSaveFormData; + protected Integer webViewTextZoom; + protected Boolean webViewUseWideViewPort; + protected Boolean webViewSupportMultipleWindows; + protected WebSettings.LayoutAlgorithm webViewLayoutAlgorithm; + protected String webViewStandardFontFamily; + protected String webViewFixedFontFamily; + protected String webViewSansSerifFontFamily; + protected String webViewSerifFontFamily; + protected String webViewCursiveFontFamily; + protected String webViewFantasyFontFamily; + protected Integer webViewMinimumFontSize; + protected Integer webViewMinimumLogicalFontSize; + protected Integer webViewDefaultFontSize; + protected Integer webViewDefaultFixedFontSize; + protected Boolean webViewLoadsImagesAutomatically; + protected Boolean webViewBlockNetworkImage; + protected Boolean webViewBlockNetworkLoads; + protected Boolean webViewJavaScriptEnabled; + protected Boolean webViewAllowUniversalAccessFromFileURLs; + protected Boolean webViewAllowFileAccessFromFileURLs; + protected String webViewGeolocationDatabasePath; + protected Boolean webViewAppCacheEnabled; + protected String webViewAppCachePath; + protected Boolean webViewDatabaseEnabled; + protected Boolean webViewDomStorageEnabled; + protected Boolean webViewGeolocationEnabled; + protected Boolean webViewJavaScriptCanOpenWindowsAutomatically; + protected String webViewDefaultTextEncodingName; + protected String webViewUserAgentString; + protected Boolean webViewNeedInitialFocus; + protected Integer webViewCacheMode; + protected Integer webViewMixedContentMode; + protected Boolean webViewOffscreenPreRaster; + + protected String injectJavaScript; + protected Object jsInteration; + protected String mimeType; + protected String encoding; + protected String data; + protected String url; + protected CoordinatorLayout coordinatorLayout; + protected AppBarLayout appBar; + protected Toolbar toolbar; + protected RelativeLayout toolbarLayout; + protected TextView title; + protected TextView urlTv; + protected AppCompatImageButton close; + protected AppCompatImageButton back; + protected AppCompatImageButton forward; + protected AppCompatImageButton more; + protected SwipeRefreshLayout swipeRefreshLayout; + protected WebView webView; + protected View gradient; + protected View divider; + protected ProgressBar progressBar; + protected RelativeLayout menuLayout; + protected ShadowLayout shadowLayout; + protected LinearLayout menuBackground; + protected LinearLayout menuRefresh; + protected TextView menuRefreshTv; + protected LinearLayout menuFind; + protected TextView menuFindTv; + protected LinearLayout menuShareVia; + protected TextView menuShareViaTv; + protected LinearLayout menuCopyLink; + protected TextView menuCopyLinkTv; + protected LinearLayout menuOpenWith; + protected TextView menuOpenWithTv; + protected FrameLayout webLayout; + DownloadListener downloadListener = new DownloadListener() { + @Override + public void onDownloadStart(String url, String userAgent, String contentDisposition, + String mimetype, long contentLength) { + BroadCastManager.onDownloadStart(FinestWebViewActivity.this, key, url, userAgent, + contentDisposition, mimetype, contentLength); + } + }; - showDivider = builder.showDivider != null ? builder.showDivider : true; - gradientDivider = builder.gradientDivider != null ? builder.gradientDivider : true; - dividerColor = builder.dividerColor != null ? builder.dividerColor - : ContextCompat.getColor(this, R.color.finestBlack10); - dividerHeight = builder.dividerHeight != null ? builder.dividerHeight - : getResources().getDimension(R.dimen.defaultDividerHeight); - - showProgressBar = builder.showProgressBar != null ? builder.showProgressBar : true; - progressBarColor = builder.progressBarColor != null ? builder.progressBarColor : colorAccent; - progressBarHeight = builder.progressBarHeight != null ? builder.progressBarHeight - : getResources().getDimension(R.dimen.defaultProgressBarHeight); - progressBarPosition = builder.progressBarPosition != null ? builder.progressBarPosition - : Position.BOTTON_OF_TOOLBAR; - - titleDefault = builder.titleDefault; - updateTitleFromHtml = builder.updateTitleFromHtml != null ? builder.updateTitleFromHtml : true; - titleSize = builder.titleSize != null ? builder.titleSize - : getResources().getDimension(R.dimen.defaultTitleSize); - titleFont = builder.titleFont != null ? builder.titleFont : "Roboto-Medium.ttf"; - titleColor = builder.titleColor != null ? builder.titleColor : textColorPrimary; - - showUrl = builder.showUrl != null ? builder.showUrl : true; - urlSize = builder.urlSize != null ? builder.urlSize - : getResources().getDimension(R.dimen.defaultUrlSize); - urlFont = builder.urlFont != null ? builder.urlFont : "Roboto-Regular.ttf"; - urlColor = builder.urlColor != null ? builder.urlColor : textColorSecondary; - - menuColor = builder.menuColor != null ? builder.menuColor - : ContextCompat.getColor(this, R.color.finestWhite); - menuDropShadowColor = builder.menuDropShadowColor != null ? builder.menuDropShadowColor - : ContextCompat.getColor(this, R.color.finestBlack10); - menuDropShadowSize = builder.menuDropShadowSize != null ? builder.menuDropShadowSize - : getResources().getDimension(R.dimen.defaultMenuDropShadowSize); - menuSelector = builder.menuSelector != null ? builder.menuSelector : selectableItemBackground; - - menuTextSize = builder.menuTextSize != null ? builder.menuTextSize - : getResources().getDimension(R.dimen.defaultMenuTextSize); - menuTextFont = builder.menuTextFont != null ? builder.menuTextFont : "Roboto-Regular.ttf"; - menuTextColor = builder.menuTextColor != null ? builder.menuTextColor - : ContextCompat.getColor(this, R.color.finestBlack); - - menuTextGravity = builder.menuTextGravity != null ? builder.menuTextGravity - : Gravity.CENTER_VERTICAL | Gravity.START; - menuTextPaddingLeft = builder.menuTextPaddingLeft != null ? builder.menuTextPaddingLeft - : rtl ? getResources().getDimension(R.dimen.defaultMenuTextPaddingRight) - : getResources().getDimension(R.dimen.defaultMenuTextPaddingLeft); - menuTextPaddingRight = builder.menuTextPaddingRight != null ? builder.menuTextPaddingRight - : rtl ? getResources().getDimension(R.dimen.defaultMenuTextPaddingLeft) - : getResources().getDimension(R.dimen.defaultMenuTextPaddingRight); - - showMenuRefresh = builder.showMenuRefresh != null ? builder.showMenuRefresh : true; - stringResRefresh = - builder.stringResRefresh != null ? builder.stringResRefresh : R.string.refresh; - showMenuFind = builder.showMenuFind != null ? builder.showMenuFind : false; - stringResFind = builder.stringResFind != null ? builder.stringResFind : R.string.find; - showMenuShareVia = builder.showMenuShareVia != null ? builder.showMenuShareVia : true; - stringResShareVia = - builder.stringResShareVia != null ? builder.stringResShareVia : R.string.share_via; - showMenuCopyLink = builder.showMenuCopyLink != null ? builder.showMenuCopyLink : true; - stringResCopyLink = - builder.stringResCopyLink != null ? builder.stringResCopyLink : R.string.copy_link; - showMenuOpenWith = builder.showMenuOpenWith != null ? builder.showMenuOpenWith : true; - stringResOpenWith = - builder.stringResOpenWith != null ? builder.stringResOpenWith : R.string.open_with; - - animationCloseEnter = builder.animationCloseEnter != null ? builder.animationCloseEnter - : R.anim.modal_activity_close_enter; - animationCloseExit = builder.animationCloseExit != null ? builder.animationCloseExit - : R.anim.modal_activity_close_exit; - - backPressToClose = builder.backPressToClose != null ? builder.backPressToClose : false; - stringResCopiedToClipboard = - builder.stringResCopiedToClipboard != null ? builder.stringResCopiedToClipboard - : R.string.copied_to_clipboard; - - webViewSupportZoom = builder.webViewSupportZoom; - webViewMediaPlaybackRequiresUserGesture = builder.webViewMediaPlaybackRequiresUserGesture; - webViewBuiltInZoomControls = - builder.webViewBuiltInZoomControls != null ? builder.webViewBuiltInZoomControls : false; - webViewDisplayZoomControls = - builder.webViewDisplayZoomControls != null ? builder.webViewDisplayZoomControls : false; - webViewAllowFileAccess = - builder.webViewAllowFileAccess != null ? builder.webViewAllowFileAccess : true; - webViewAllowContentAccess = builder.webViewAllowContentAccess; - webViewLoadWithOverviewMode = - builder.webViewLoadWithOverviewMode != null ? builder.webViewLoadWithOverviewMode : true; - webViewSaveFormData = builder.webViewSaveFormData; - webViewTextZoom = builder.webViewTextZoom; - webViewUseWideViewPort = builder.webViewUseWideViewPort; - webViewSupportMultipleWindows = builder.webViewSupportMultipleWindows; - webViewLayoutAlgorithm = builder.webViewLayoutAlgorithm; - webViewStandardFontFamily = builder.webViewStandardFontFamily; - webViewFixedFontFamily = builder.webViewFixedFontFamily; - webViewSansSerifFontFamily = builder.webViewSansSerifFontFamily; - webViewSerifFontFamily = builder.webViewSerifFontFamily; - webViewCursiveFontFamily = builder.webViewCursiveFontFamily; - webViewFantasyFontFamily = builder.webViewFantasyFontFamily; - webViewMinimumFontSize = builder.webViewMinimumFontSize; - webViewMinimumLogicalFontSize = builder.webViewMinimumLogicalFontSize; - webViewDefaultFontSize = builder.webViewDefaultFontSize; - webViewDefaultFixedFontSize = builder.webViewDefaultFixedFontSize; - webViewLoadsImagesAutomatically = builder.webViewLoadsImagesAutomatically; - webViewBlockNetworkImage = builder.webViewBlockNetworkImage; - webViewBlockNetworkLoads = builder.webViewBlockNetworkLoads; - webViewJavaScriptEnabled = - builder.webViewJavaScriptEnabled != null ? builder.webViewJavaScriptEnabled : true; - webViewAllowUniversalAccessFromFileURLs = builder.webViewAllowUniversalAccessFromFileURLs; - webViewAllowFileAccessFromFileURLs = builder.webViewAllowFileAccessFromFileURLs; - webViewGeolocationDatabasePath = builder.webViewGeolocationDatabasePath; - webViewAppCacheEnabled = - builder.webViewAppCacheEnabled != null ? builder.webViewAppCacheEnabled : true; - webViewAppCachePath = builder.webViewAppCachePath; - webViewDatabaseEnabled = builder.webViewDatabaseEnabled; - webViewDomStorageEnabled = - builder.webViewDomStorageEnabled != null ? builder.webViewDomStorageEnabled : true; - webViewGeolocationEnabled = builder.webViewGeolocationEnabled; - webViewJavaScriptCanOpenWindowsAutomatically = - builder.webViewJavaScriptCanOpenWindowsAutomatically; - webViewDefaultTextEncodingName = builder.webViewDefaultTextEncodingName; - webViewUserAgentString = builder.webViewUserAgentString; - webViewNeedInitialFocus = builder.webViewNeedInitialFocus; - webViewCacheMode = builder.webViewCacheMode; - webViewMixedContentMode = builder.webViewMixedContentMode; - webViewOffscreenPreRaster = builder.webViewOffscreenPreRaster; - - injectJavaScript = builder.injectJavaScript; - - mimeType = builder.mimeType; - encoding = builder.encoding; - data = builder.data; - url = builder.url; - } - - protected void bindViews() { - coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorLayout); - - appBar = (AppBarLayout) findViewById(R.id.appBar); - toolbar = (Toolbar) findViewById(R.id.toolbar); - toolbarLayout = (RelativeLayout) findViewById(R.id.toolbarLayout); - - title = (TextView) findViewById(R.id.title); - urlTv = (TextView) findViewById(R.id.url); - - close = (AppCompatImageButton) findViewById(R.id.close); - back = (AppCompatImageButton) findViewById(R.id.back); - forward = (AppCompatImageButton) findViewById(R.id.forward); - more = (AppCompatImageButton) findViewById(R.id.more); - - close.setOnClickListener(this); - back.setOnClickListener(this); - forward.setOnClickListener(this); - more.setOnClickListener(this); - - swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout); - - gradient = findViewById(R.id.gradient); - divider = findViewById(R.id.divider); - progressBar = (ProgressBar) findViewById(R.id.progressBar); - - menuLayout = (RelativeLayout) findViewById(R.id.menuLayout); - shadowLayout = (ShadowLayout) findViewById(R.id.shadowLayout); - menuBackground = (LinearLayout) findViewById(R.id.menuBackground); - - menuRefresh = (LinearLayout) findViewById(R.id.menuRefresh); - menuRefreshTv = (TextView) findViewById(R.id.menuRefreshTv); - menuFind = (LinearLayout) findViewById(R.id.menuFind); - menuFindTv = (TextView) findViewById(R.id.menuFindTv); - menuShareVia = (LinearLayout) findViewById(R.id.menuShareVia); - menuShareViaTv = (TextView) findViewById(R.id.menuShareViaTv); - menuCopyLink = (LinearLayout) findViewById(R.id.menuCopyLink); - menuCopyLinkTv = (TextView) findViewById(R.id.menuCopyLinkTv); - menuOpenWith = (LinearLayout) findViewById(R.id.menuOpenWith); - menuOpenWithTv = (TextView) findViewById(R.id.menuOpenWithTv); - - webLayout = (FrameLayout) findViewById(R.id.webLayout); - webView = new WebView(this); - webLayout.addView(webView); - } - - protected void layoutViews() { - setSupportActionBar(toolbar); - - { // AppBar - float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); - if (!gradientDivider) toolbarHeight += dividerHeight; - CoordinatorLayout.LayoutParams params = - new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - (int) toolbarHeight); - appBar.setLayoutParams(params); - coordinatorLayout.requestLayout(); - } + protected void initializeOptions() { + Intent intent = getIntent(); + if (intent == null) return; - { // Toolbar - float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); - LinearLayout.LayoutParams params = - new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) toolbarHeight); - toolbarLayout.setMinimumHeight((int) toolbarHeight); - toolbarLayout.setLayoutParams(params); - coordinatorLayout.requestLayout(); - } + FinestWebView.Builder builder = (FinestWebView.Builder) intent.getSerializableExtra("builder"); - { // TextViews - int maxWidth = getMaxWidth(); - title.setMaxWidth(maxWidth); - urlTv.setMaxWidth(maxWidth); - requestCenterLayout(); - } + // set theme before resolving attributes depending on those + setTheme(builder.theme != null ? builder.theme : 0); - { // Icons - updateIcon(close, rtl ? R.drawable.more : R.drawable.close); - updateIcon(back, R.drawable.back); - updateIcon(forward, R.drawable.forward); - updateIcon(more, rtl ? R.drawable.close : R.drawable.more); - } + // resolve themed attributes + TypedValue typedValue = new TypedValue(); + TypedArray typedArray = obtainStyledAttributes(typedValue.data, new int[]{ + R.attr.colorPrimaryDark, R.attr.colorPrimary, R.attr.colorAccent, + android.R.attr.textColorPrimary, android.R.attr.textColorSecondary, + android.R.attr.selectableItemBackground, android.R.attr.selectableItemBackgroundBorderless + }); + int colorPrimaryDark = typedArray.getColor(0, ContextCompat.getColor(this, R.color.finestGray)); + int colorPrimary = typedArray.getColor(1, ContextCompat.getColor(this, R.color.finestWhite)); + int colorAccent = typedArray.getColor(2, ContextCompat.getColor(this, R.color.finestBlack)); + int textColorPrimary = + typedArray.getColor(3, ContextCompat.getColor(this, R.color.finestBlack)); + int textColorSecondary = + typedArray.getColor(4, ContextCompat.getColor(this, R.color.finestSilver)); + int selectableItemBackground = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? typedArray.getResourceId(5, 0) + : R.drawable.selector_light_theme; + int selectableItemBackgroundBorderless = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? typedArray.getResourceId(6, 0) + : R.drawable.selector_light_theme; + typedArray.recycle(); + + key = builder.key; + + rtl = builder.rtl != null ? builder.rtl : getResources().getBoolean(R.bool.is_right_to_left); + + statusBarColor = builder.statusBarColor != null ? builder.statusBarColor : colorPrimaryDark; + + toolbarColor = builder.toolbarColor != null ? builder.toolbarColor : colorPrimary; + toolbarScrollFlags = builder.toolbarScrollFlags != null ? builder.toolbarScrollFlags : + AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL + | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS; + + iconDefaultColor = builder.iconDefaultColor != null ? builder.iconDefaultColor : colorAccent; + iconDisabledColor = builder.iconDisabledColor != null ? builder.iconDisabledColor + : ColorHelper.disableColor(iconDefaultColor); + iconPressedColor = + builder.iconPressedColor != null ? builder.iconPressedColor : iconDefaultColor; + iconSelector = + builder.iconSelector != null ? builder.iconSelector : selectableItemBackgroundBorderless; + + showIconClose = builder.showIconClose != null ? builder.showIconClose : true; + disableIconClose = builder.disableIconClose != null ? builder.disableIconClose : false; + showIconBack = builder.showIconBack != null ? builder.showIconBack : true; + disableIconBack = builder.disableIconBack != null ? builder.disableIconBack : false; + showIconForward = builder.showIconForward != null ? builder.showIconForward : true; + disableIconForward = builder.disableIconForward != null ? builder.disableIconForward : false; + showIconMenu = builder.showIconMenu != null ? builder.showIconMenu : true; + disableIconMenu = builder.disableIconMenu != null ? builder.disableIconMenu : false; + + showSwipeRefreshLayout = + builder.showSwipeRefreshLayout != null ? builder.showSwipeRefreshLayout : true; + swipeRefreshColor = builder.swipeRefreshColor != null ? builder.swipeRefreshColor : colorAccent; + if (builder.swipeRefreshColors != null) { + int[] colors = new int[builder.swipeRefreshColors.length]; + for (int i = 0; i < builder.swipeRefreshColors.length; i++) + colors[i] = builder.swipeRefreshColors[i]; + swipeRefreshColors = colors; + } - { // Divider - if (gradientDivider) { - float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); - CoordinatorLayout.LayoutParams params = - (CoordinatorLayout.LayoutParams) gradient.getLayoutParams(); - params.setMargins(0, (int) toolbarHeight, 0, 0); - gradient.setLayoutParams(params); - } + showDivider = builder.showDivider != null ? builder.showDivider : true; + gradientDivider = builder.gradientDivider != null ? builder.gradientDivider : true; + dividerColor = builder.dividerColor != null ? builder.dividerColor + : ContextCompat.getColor(this, R.color.finestBlack10); + dividerHeight = builder.dividerHeight != null ? builder.dividerHeight + : getResources().getDimension(R.dimen.defaultDividerHeight); + + showProgressBar = builder.showProgressBar != null ? builder.showProgressBar : true; + progressBarColor = builder.progressBarColor != null ? builder.progressBarColor : colorAccent; + progressBarHeight = builder.progressBarHeight != null ? builder.progressBarHeight + : getResources().getDimension(R.dimen.defaultProgressBarHeight); + progressBarPosition = builder.progressBarPosition != null ? builder.progressBarPosition + : Position.BOTTON_OF_TOOLBAR; + + titleDefault = builder.titleDefault; + updateTitleFromHtml = builder.updateTitleFromHtml != null ? builder.updateTitleFromHtml : true; + titleSize = builder.titleSize != null ? builder.titleSize + : getResources().getDimension(R.dimen.defaultTitleSize); + titleFont = builder.titleFont != null ? builder.titleFont : "Roboto-Medium.ttf"; + titleColor = builder.titleColor != null ? builder.titleColor : textColorPrimary; + + showUrl = builder.showUrl != null ? builder.showUrl : true; + urlSize = builder.urlSize != null ? builder.urlSize + : getResources().getDimension(R.dimen.defaultUrlSize); + urlFont = builder.urlFont != null ? builder.urlFont : "Roboto-Regular.ttf"; + urlColor = builder.urlColor != null ? builder.urlColor : textColorSecondary; + + menuColor = builder.menuColor != null ? builder.menuColor + : ContextCompat.getColor(this, R.color.finestWhite); + menuDropShadowColor = builder.menuDropShadowColor != null ? builder.menuDropShadowColor + : ContextCompat.getColor(this, R.color.finestBlack10); + menuDropShadowSize = builder.menuDropShadowSize != null ? builder.menuDropShadowSize + : getResources().getDimension(R.dimen.defaultMenuDropShadowSize); + menuSelector = builder.menuSelector != null ? builder.menuSelector : selectableItemBackground; + + menuTextSize = builder.menuTextSize != null ? builder.menuTextSize + : getResources().getDimension(R.dimen.defaultMenuTextSize); + menuTextFont = builder.menuTextFont != null ? builder.menuTextFont : "Roboto-Regular.ttf"; + menuTextColor = builder.menuTextColor != null ? builder.menuTextColor + : ContextCompat.getColor(this, R.color.finestBlack); + + menuTextGravity = builder.menuTextGravity != null ? builder.menuTextGravity + : Gravity.CENTER_VERTICAL | Gravity.START; + menuTextPaddingLeft = builder.menuTextPaddingLeft != null ? builder.menuTextPaddingLeft + : rtl ? getResources().getDimension(R.dimen.defaultMenuTextPaddingRight) + : getResources().getDimension(R.dimen.defaultMenuTextPaddingLeft); + menuTextPaddingRight = builder.menuTextPaddingRight != null ? builder.menuTextPaddingRight + : rtl ? getResources().getDimension(R.dimen.defaultMenuTextPaddingLeft) + : getResources().getDimension(R.dimen.defaultMenuTextPaddingRight); + + showMenuRefresh = builder.showMenuRefresh != null ? builder.showMenuRefresh : true; + stringResRefresh = + builder.stringResRefresh != null ? builder.stringResRefresh : R.string.refresh; + showMenuFind = builder.showMenuFind != null ? builder.showMenuFind : false; + stringResFind = builder.stringResFind != null ? builder.stringResFind : R.string.find; + showMenuShareVia = builder.showMenuShareVia != null ? builder.showMenuShareVia : true; + stringResShareVia = + builder.stringResShareVia != null ? builder.stringResShareVia : R.string.share_via; + showMenuCopyLink = builder.showMenuCopyLink != null ? builder.showMenuCopyLink : true; + stringResCopyLink = + builder.stringResCopyLink != null ? builder.stringResCopyLink : R.string.copy_link; + showMenuOpenWith = builder.showMenuOpenWith != null ? builder.showMenuOpenWith : true; + stringResOpenWith = + builder.stringResOpenWith != null ? builder.stringResOpenWith : R.string.open_with; + + animationCloseEnter = builder.animationCloseEnter != null ? builder.animationCloseEnter + : R.anim.modal_activity_close_enter; + animationCloseExit = builder.animationCloseExit != null ? builder.animationCloseExit + : R.anim.modal_activity_close_exit; + + backPressToClose = builder.backPressToClose != null ? builder.backPressToClose : false; + stringResCopiedToClipboard = + builder.stringResCopiedToClipboard != null ? builder.stringResCopiedToClipboard + : R.string.copied_to_clipboard; + + webViewSupportZoom = builder.webViewSupportZoom; + webViewMediaPlaybackRequiresUserGesture = builder.webViewMediaPlaybackRequiresUserGesture; + webViewBuiltInZoomControls = + builder.webViewBuiltInZoomControls != null ? builder.webViewBuiltInZoomControls : false; + webViewDisplayZoomControls = + builder.webViewDisplayZoomControls != null ? builder.webViewDisplayZoomControls : false; + webViewAllowFileAccess = + builder.webViewAllowFileAccess != null ? builder.webViewAllowFileAccess : true; + webViewAllowContentAccess = builder.webViewAllowContentAccess; + webViewLoadWithOverviewMode = + builder.webViewLoadWithOverviewMode != null ? builder.webViewLoadWithOverviewMode : true; + webViewSaveFormData = builder.webViewSaveFormData; + webViewTextZoom = builder.webViewTextZoom; + webViewUseWideViewPort = builder.webViewUseWideViewPort; + webViewSupportMultipleWindows = builder.webViewSupportMultipleWindows; + webViewLayoutAlgorithm = builder.webViewLayoutAlgorithm; + webViewStandardFontFamily = builder.webViewStandardFontFamily; + webViewFixedFontFamily = builder.webViewFixedFontFamily; + webViewSansSerifFontFamily = builder.webViewSansSerifFontFamily; + webViewSerifFontFamily = builder.webViewSerifFontFamily; + webViewCursiveFontFamily = builder.webViewCursiveFontFamily; + webViewFantasyFontFamily = builder.webViewFantasyFontFamily; + webViewMinimumFontSize = builder.webViewMinimumFontSize; + webViewMinimumLogicalFontSize = builder.webViewMinimumLogicalFontSize; + webViewDefaultFontSize = builder.webViewDefaultFontSize; + webViewDefaultFixedFontSize = builder.webViewDefaultFixedFontSize; + webViewLoadsImagesAutomatically = builder.webViewLoadsImagesAutomatically; + webViewBlockNetworkImage = builder.webViewBlockNetworkImage; + webViewBlockNetworkLoads = builder.webViewBlockNetworkLoads; + webViewJavaScriptEnabled = + builder.webViewJavaScriptEnabled != null ? builder.webViewJavaScriptEnabled : true; + webViewAllowUniversalAccessFromFileURLs = builder.webViewAllowUniversalAccessFromFileURLs; + webViewAllowFileAccessFromFileURLs = builder.webViewAllowFileAccessFromFileURLs; + webViewGeolocationDatabasePath = builder.webViewGeolocationDatabasePath; + webViewAppCacheEnabled = + builder.webViewAppCacheEnabled != null ? builder.webViewAppCacheEnabled : true; + webViewAppCachePath = builder.webViewAppCachePath; + webViewDatabaseEnabled = builder.webViewDatabaseEnabled; + webViewDomStorageEnabled = + builder.webViewDomStorageEnabled != null ? builder.webViewDomStorageEnabled : true; + webViewGeolocationEnabled = builder.webViewGeolocationEnabled; + webViewJavaScriptCanOpenWindowsAutomatically = + builder.webViewJavaScriptCanOpenWindowsAutomatically; + webViewDefaultTextEncodingName = builder.webViewDefaultTextEncodingName; + webViewUserAgentString = builder.webViewUserAgentString; + webViewNeedInitialFocus = builder.webViewNeedInitialFocus; + webViewCacheMode = builder.webViewCacheMode; + webViewMixedContentMode = builder.webViewMixedContentMode; + webViewOffscreenPreRaster = builder.webViewOffscreenPreRaster; + + injectJavaScript = builder.injectJavaScript; + jsInteration = builder.jsInteration; + mimeType = builder.mimeType; + encoding = builder.encoding; + data = builder.data; + url = builder.url; } - { // ProgressBar - progressBar.setMinimumHeight((int) progressBarHeight); - CoordinatorLayout.LayoutParams params = - new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - (int) progressBarHeight); - float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); - switch (progressBarPosition) { - case TOP_OF_TOOLBAR: - params.setMargins(0, 0, 0, 0); - break; - case BOTTON_OF_TOOLBAR: - params.setMargins(0, (int) toolbarHeight - (int) progressBarHeight, 0, 0); - break; - case TOP_OF_WEBVIEW: - params.setMargins(0, (int) toolbarHeight, 0, 0); - break; - case BOTTOM_OF_WEBVIEW: - params.setMargins(0, DisplayUtil.getHeight() - (int) progressBarHeight, 0, 0); - break; - } - progressBar.setLayoutParams(params); + protected void bindViews() { + coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorLayout); + + appBar = (AppBarLayout) findViewById(R.id.appBar); + toolbar = (Toolbar) findViewById(R.id.toolbar); + toolbarLayout = (RelativeLayout) findViewById(R.id.toolbarLayout); + + title = (TextView) findViewById(R.id.title); + urlTv = (TextView) findViewById(R.id.url); + + close = (AppCompatImageButton) findViewById(R.id.close); + back = (AppCompatImageButton) findViewById(R.id.back); + forward = (AppCompatImageButton) findViewById(R.id.forward); + more = (AppCompatImageButton) findViewById(R.id.more); + + close.setOnClickListener(this); + back.setOnClickListener(this); + forward.setOnClickListener(this); + more.setOnClickListener(this); + + swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout); + + gradient = findViewById(R.id.gradient); + divider = findViewById(R.id.divider); + progressBar = (ProgressBar) findViewById(R.id.progressBar); + + menuLayout = (RelativeLayout) findViewById(R.id.menuLayout); + shadowLayout = (ShadowLayout) findViewById(R.id.shadowLayout); + menuBackground = (LinearLayout) findViewById(R.id.menuBackground); + + menuRefresh = (LinearLayout) findViewById(R.id.menuRefresh); + menuRefreshTv = (TextView) findViewById(R.id.menuRefreshTv); + menuFind = (LinearLayout) findViewById(R.id.menuFind); + menuFindTv = (TextView) findViewById(R.id.menuFindTv); + menuShareVia = (LinearLayout) findViewById(R.id.menuShareVia); + menuShareViaTv = (TextView) findViewById(R.id.menuShareViaTv); + menuCopyLink = (LinearLayout) findViewById(R.id.menuCopyLink); + menuCopyLinkTv = (TextView) findViewById(R.id.menuCopyLinkTv); + menuOpenWith = (LinearLayout) findViewById(R.id.menuOpenWith); + menuOpenWithTv = (TextView) findViewById(R.id.menuOpenWithTv); + + webLayout = (FrameLayout) findViewById(R.id.webLayout); + webView = new WebView(this); + webLayout.addView(webView); } - { // WebLayout - float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); - int statusBarHeight = DisplayUtil.getStatusBarHeight(); - int screenHeight = DisplayUtil.getHeight(); - float webLayoutMinimumHeight = screenHeight - toolbarHeight - statusBarHeight; - if (showDivider && !gradientDivider) webLayoutMinimumHeight -= dividerHeight; - webLayout.setMinimumHeight((int) webLayoutMinimumHeight); - } - } - - @SuppressLint("SetJavaScriptEnabled") protected void initializeViews() { - setSupportActionBar(toolbar); - - { // StatusBar - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = getWindow(); - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - window.setStatusBarColor(statusBarColor); - } - } + protected void layoutViews() { + setSupportActionBar(toolbar); + + { // AppBar + float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); + if (!gradientDivider) toolbarHeight += dividerHeight; + CoordinatorLayout.LayoutParams params = + new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + (int) toolbarHeight); + appBar.setLayoutParams(params); + coordinatorLayout.requestLayout(); + } - { // AppBar - appBar.addOnOffsetChangedListener(this); - } + { // Toolbar + float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); + LinearLayout.LayoutParams params = + new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) toolbarHeight); + toolbarLayout.setMinimumHeight((int) toolbarHeight); + toolbarLayout.setLayoutParams(params); + coordinatorLayout.requestLayout(); + } - { // Toolbar - toolbar.setBackgroundColor(toolbarColor); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams(); - params.setScrollFlags(toolbarScrollFlags); - toolbar.setLayoutParams(params); - } + { // TextViews + int maxWidth = getMaxWidth(); + title.setMaxWidth(maxWidth); + urlTv.setMaxWidth(maxWidth); + requestCenterLayout(); + } - { // TextViews - title.setText(titleDefault); - title.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); - title.setTypeface(TypefaceHelper.get(this, titleFont)); - title.setTextColor(titleColor); + { // Icons + updateIcon(close, rtl ? R.drawable.more : R.drawable.close); + updateIcon(back, R.drawable.back); + updateIcon(forward, R.drawable.forward); + updateIcon(more, rtl ? R.drawable.close : R.drawable.more); + } - urlTv.setVisibility(showUrl ? View.VISIBLE : View.GONE); - urlTv.setText(UrlParser.getHost(url)); - urlTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, urlSize); - urlTv.setTypeface(TypefaceHelper.get(this, urlFont)); - urlTv.setTextColor(urlColor); + { // Divider + if (gradientDivider) { + float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); + CoordinatorLayout.LayoutParams params = + (CoordinatorLayout.LayoutParams) gradient.getLayoutParams(); + params.setMargins(0, (int) toolbarHeight, 0, 0); + gradient.setLayoutParams(params); + } + } - requestCenterLayout(); - } + { // ProgressBar + progressBar.setMinimumHeight((int) progressBarHeight); + CoordinatorLayout.LayoutParams params = + new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + (int) progressBarHeight); + float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); + switch (progressBarPosition) { + case TOP_OF_TOOLBAR: + params.setMargins(0, 0, 0, 0); + break; + case BOTTON_OF_TOOLBAR: + params.setMargins(0, (int) toolbarHeight - (int) progressBarHeight, 0, 0); + break; + case TOP_OF_WEBVIEW: + params.setMargins(0, (int) toolbarHeight, 0, 0); + break; + case BOTTOM_OF_WEBVIEW: + params.setMargins(0, DisplayUtil.getHeight() - (int) progressBarHeight, 0, 0); + break; + } + progressBar.setLayoutParams(params); + } - { // Icons - close.setBackgroundResource(iconSelector); - back.setBackgroundResource(iconSelector); - forward.setBackgroundResource(iconSelector); - more.setBackgroundResource(iconSelector); - - close.setVisibility(showIconClose ? View.VISIBLE : View.GONE); - close.setEnabled(!disableIconClose); - - if ((showMenuRefresh - || showMenuFind - || showMenuShareVia - || showMenuCopyLink - || showMenuOpenWith) && showIconMenu) { - more.setVisibility(View.VISIBLE); - } else { - more.setVisibility(View.GONE); - } - more.setEnabled(!disableIconMenu); + { // WebLayout + float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); + int statusBarHeight = DisplayUtil.getStatusBarHeight(); + int screenHeight = DisplayUtil.getHeight(); + float webLayoutMinimumHeight = screenHeight - toolbarHeight - statusBarHeight; + if (showDivider && !gradientDivider) webLayoutMinimumHeight -= dividerHeight; + webLayout.setMinimumHeight((int) webLayoutMinimumHeight); + } } - { // WebView - webView.setWebChromeClient(new MyWebChromeClient()); - webView.setWebViewClient(new MyWebViewClient()); - webView.setDownloadListener(downloadListener); - - WebSettings settings = webView.getSettings(); - - if (webViewSupportZoom != null) settings.setSupportZoom(webViewSupportZoom); - if (webViewMediaPlaybackRequiresUserGesture != null - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - settings.setMediaPlaybackRequiresUserGesture(webViewMediaPlaybackRequiresUserGesture); - } - if (webViewBuiltInZoomControls != null) { - settings.setBuiltInZoomControls(webViewBuiltInZoomControls); - - if (webViewBuiltInZoomControls) { - // Remove NestedScrollView to enable BuiltInZoomControls - ((ViewGroup) webView.getParent()).removeAllViews(); - swipeRefreshLayout.addView(webView); - swipeRefreshLayout.removeViewAt(1); + @SuppressLint("SetJavaScriptEnabled") + protected void initializeViews() { + setSupportActionBar(toolbar); + + { // StatusBar + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = getWindow(); + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(statusBarColor); + } } - } - if (webViewDisplayZoomControls != null - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - settings.setDisplayZoomControls(webViewDisplayZoomControls); - } - - if (webViewAllowFileAccess != null) settings.setAllowFileAccess(webViewAllowFileAccess); - if (webViewAllowContentAccess != null - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - settings.setAllowContentAccess(webViewAllowContentAccess); - } - if (webViewLoadWithOverviewMode != null) { - settings.setLoadWithOverviewMode(webViewLoadWithOverviewMode); - } - if (webViewSaveFormData != null) settings.setSaveFormData(webViewSaveFormData); - if (webViewTextZoom != null - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - settings.setTextZoom(webViewTextZoom); - } - if (webViewUseWideViewPort != null) settings.setUseWideViewPort(webViewUseWideViewPort); - if (webViewSupportMultipleWindows != null) { - settings.setSupportMultipleWindows(webViewSupportMultipleWindows); - } - if (webViewLayoutAlgorithm != null) settings.setLayoutAlgorithm(webViewLayoutAlgorithm); - if (webViewStandardFontFamily != null) { - settings.setStandardFontFamily(webViewStandardFontFamily); - } - if (webViewFixedFontFamily != null) settings.setFixedFontFamily(webViewFixedFontFamily); - if (webViewSansSerifFontFamily != null) { - settings.setSansSerifFontFamily(webViewSansSerifFontFamily); - } - if (webViewSerifFontFamily != null) settings.setSerifFontFamily(webViewSerifFontFamily); - if (webViewCursiveFontFamily != null) settings.setCursiveFontFamily(webViewCursiveFontFamily); - if (webViewFantasyFontFamily != null) settings.setFantasyFontFamily(webViewFantasyFontFamily); - if (webViewMinimumFontSize != null) settings.setMinimumFontSize(webViewMinimumFontSize); - if (webViewMinimumLogicalFontSize != null) { - settings.setMinimumLogicalFontSize(webViewMinimumLogicalFontSize); - } - if (webViewDefaultFontSize != null) settings.setDefaultFontSize(webViewDefaultFontSize); - if (webViewDefaultFixedFontSize != null) { - settings.setDefaultFixedFontSize(webViewDefaultFixedFontSize); - } - if (webViewLoadsImagesAutomatically != null) { - settings.setLoadsImagesAutomatically(webViewLoadsImagesAutomatically); - } - if (webViewBlockNetworkImage != null) settings.setBlockNetworkImage(webViewBlockNetworkImage); - if (webViewBlockNetworkLoads != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { - settings.setBlockNetworkLoads(webViewBlockNetworkLoads); - } - if (webViewJavaScriptEnabled != null) settings.setJavaScriptEnabled(webViewJavaScriptEnabled); - if (webViewAllowUniversalAccessFromFileURLs != null - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - settings.setAllowUniversalAccessFromFileURLs(webViewAllowUniversalAccessFromFileURLs); - } - if (webViewAllowFileAccessFromFileURLs != null - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - settings.setAllowFileAccessFromFileURLs(webViewAllowFileAccessFromFileURLs); - } - if (webViewGeolocationDatabasePath != null) { - settings.setGeolocationDatabasePath(webViewGeolocationDatabasePath); - } - if (webViewAppCacheEnabled != null) settings.setAppCacheEnabled(webViewAppCacheEnabled); - if (webViewAppCachePath != null) settings.setAppCachePath(webViewAppCachePath); - if (webViewDatabaseEnabled != null) settings.setDatabaseEnabled(webViewDatabaseEnabled); - if (webViewDomStorageEnabled != null) settings.setDomStorageEnabled(webViewDomStorageEnabled); - if (webViewGeolocationEnabled != null) { - settings.setGeolocationEnabled(webViewGeolocationEnabled); - } - if (webViewJavaScriptCanOpenWindowsAutomatically != null) { - settings.setJavaScriptCanOpenWindowsAutomatically( - webViewJavaScriptCanOpenWindowsAutomatically); - } - if (webViewDefaultTextEncodingName != null) { - settings.setDefaultTextEncodingName(webViewDefaultTextEncodingName); - } - if (webViewUserAgentString != null) settings.setUserAgentString(webViewUserAgentString); - if (webViewNeedInitialFocus != null) settings.setNeedInitialFocus(webViewNeedInitialFocus); - if (webViewCacheMode != null) settings.setCacheMode(webViewCacheMode); - if (webViewMixedContentMode != null - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - settings.setMixedContentMode(webViewMixedContentMode); - } - if (webViewOffscreenPreRaster != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - settings.setOffscreenPreRaster(webViewOffscreenPreRaster); - } - - // // Other webview options - // webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); - // webView.setScrollbarFadingEnabled(false); - // //Additional Webview Properties - // webView.setSoundEffectsEnabled(true); - // webView.setHorizontalFadingEdgeEnabled(false); - // webView.setKeepScreenOn(true); - // webView.setScrollbarFadingEnabled(true); - // webView.setVerticalFadingEdgeEnabled(false); - - if (data != null) { - webView.loadData(data, mimeType, encoding); - } else if (url != null) webView.loadUrl(url); - } - { // SwipeRefreshLayout - swipeRefreshLayout.setEnabled(showSwipeRefreshLayout); - if (showSwipeRefreshLayout) { - swipeRefreshLayout.post(new Runnable() { - @Override public void run() { - swipeRefreshLayout.setRefreshing(true); - } - }); - } + { // AppBar + appBar.addOnOffsetChangedListener(this); + } + + { // Toolbar + toolbar.setBackgroundColor(toolbarColor); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams(); + params.setScrollFlags(toolbarScrollFlags); + toolbar.setLayoutParams(params); + } + + { // TextViews + title.setText(titleDefault); + title.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); + title.setTypeface(TypefaceHelper.get(this, titleFont)); + title.setTextColor(titleColor); + + urlTv.setVisibility(showUrl ? View.VISIBLE : View.GONE); + urlTv.setText(UrlParser.getHost(url)); + urlTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, urlSize); + urlTv.setTypeface(TypefaceHelper.get(this, urlFont)); + urlTv.setTextColor(urlColor); + + requestCenterLayout(); + } + + { // Icons + close.setBackgroundResource(iconSelector); + back.setBackgroundResource(iconSelector); + forward.setBackgroundResource(iconSelector); + more.setBackgroundResource(iconSelector); + + close.setVisibility(showIconClose ? View.VISIBLE : View.GONE); + close.setEnabled(!disableIconClose); + + if ((showMenuRefresh + || showMenuFind + || showMenuShareVia + || showMenuCopyLink + || showMenuOpenWith) && showIconMenu) { + more.setVisibility(View.VISIBLE); + } else { + more.setVisibility(View.GONE); + } + more.setEnabled(!disableIconMenu); + } + + { // WebView + webView.setWebChromeClient(new MyWebChromeClient()); + webView.setWebViewClient(new MyWebViewClient()); + webView.setDownloadListener(downloadListener); + + WebSettings settings = webView.getSettings(); + + if (webViewSupportZoom != null) settings.setSupportZoom(webViewSupportZoom); + if (webViewMediaPlaybackRequiresUserGesture != null + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + settings.setMediaPlaybackRequiresUserGesture(webViewMediaPlaybackRequiresUserGesture); + } + if (webViewBuiltInZoomControls != null) { + settings.setBuiltInZoomControls(webViewBuiltInZoomControls); + + if (webViewBuiltInZoomControls) { + // Remove NestedScrollView to enable BuiltInZoomControls + ((ViewGroup) webView.getParent()).removeAllViews(); + swipeRefreshLayout.addView(webView); + swipeRefreshLayout.removeViewAt(1); + } + } + if (webViewDisplayZoomControls != null + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + settings.setDisplayZoomControls(webViewDisplayZoomControls); + } + + if (webViewAllowFileAccess != null) settings.setAllowFileAccess(webViewAllowFileAccess); + if (webViewAllowContentAccess != null + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + settings.setAllowContentAccess(webViewAllowContentAccess); + } + if (webViewLoadWithOverviewMode != null) { + settings.setLoadWithOverviewMode(webViewLoadWithOverviewMode); + } + if (webViewSaveFormData != null) settings.setSaveFormData(webViewSaveFormData); + if (webViewTextZoom != null + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { + settings.setTextZoom(webViewTextZoom); + } + if (webViewUseWideViewPort != null) settings.setUseWideViewPort(webViewUseWideViewPort); + if (webViewSupportMultipleWindows != null) { + settings.setSupportMultipleWindows(webViewSupportMultipleWindows); + } + if (webViewLayoutAlgorithm != null) settings.setLayoutAlgorithm(webViewLayoutAlgorithm); + if (webViewStandardFontFamily != null) { + settings.setStandardFontFamily(webViewStandardFontFamily); + } + if (webViewFixedFontFamily != null) settings.setFixedFontFamily(webViewFixedFontFamily); + if (webViewSansSerifFontFamily != null) { + settings.setSansSerifFontFamily(webViewSansSerifFontFamily); + } + if (webViewSerifFontFamily != null) settings.setSerifFontFamily(webViewSerifFontFamily); + if (webViewCursiveFontFamily != null) + settings.setCursiveFontFamily(webViewCursiveFontFamily); + if (webViewFantasyFontFamily != null) + settings.setFantasyFontFamily(webViewFantasyFontFamily); + if (webViewMinimumFontSize != null) settings.setMinimumFontSize(webViewMinimumFontSize); + if (webViewMinimumLogicalFontSize != null) { + settings.setMinimumLogicalFontSize(webViewMinimumLogicalFontSize); + } + if (webViewDefaultFontSize != null) settings.setDefaultFontSize(webViewDefaultFontSize); + if (webViewDefaultFixedFontSize != null) { + settings.setDefaultFixedFontSize(webViewDefaultFixedFontSize); + } + if (webViewLoadsImagesAutomatically != null) { + settings.setLoadsImagesAutomatically(webViewLoadsImagesAutomatically); + } + if (webViewBlockNetworkImage != null) + settings.setBlockNetworkImage(webViewBlockNetworkImage); + if (webViewBlockNetworkLoads != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { + settings.setBlockNetworkLoads(webViewBlockNetworkLoads); + } + if (webViewJavaScriptEnabled != null) + settings.setJavaScriptEnabled(webViewJavaScriptEnabled); + if (webViewAllowUniversalAccessFromFileURLs != null + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + settings.setAllowUniversalAccessFromFileURLs(webViewAllowUniversalAccessFromFileURLs); + } + if (webViewAllowFileAccessFromFileURLs != null + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + settings.setAllowFileAccessFromFileURLs(webViewAllowFileAccessFromFileURLs); + } + if (webViewGeolocationDatabasePath != null) { + settings.setGeolocationDatabasePath(webViewGeolocationDatabasePath); + } + if (webViewAppCacheEnabled != null) settings.setAppCacheEnabled(webViewAppCacheEnabled); + if (webViewAppCachePath != null) settings.setAppCachePath(webViewAppCachePath); + if (webViewDatabaseEnabled != null) settings.setDatabaseEnabled(webViewDatabaseEnabled); + if (webViewDomStorageEnabled != null) + settings.setDomStorageEnabled(webViewDomStorageEnabled); + if (webViewGeolocationEnabled != null) { + settings.setGeolocationEnabled(webViewGeolocationEnabled); + } + if (webViewJavaScriptCanOpenWindowsAutomatically != null) { + settings.setJavaScriptCanOpenWindowsAutomatically( + webViewJavaScriptCanOpenWindowsAutomatically); + } + if (webViewDefaultTextEncodingName != null) { + settings.setDefaultTextEncodingName(webViewDefaultTextEncodingName); + } + if (webViewUserAgentString != null) settings.setUserAgentString(webViewUserAgentString); + if (webViewNeedInitialFocus != null) + settings.setNeedInitialFocus(webViewNeedInitialFocus); + if (webViewCacheMode != null) settings.setCacheMode(webViewCacheMode); + if (webViewMixedContentMode != null + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + settings.setMixedContentMode(webViewMixedContentMode); + } + if (webViewOffscreenPreRaster != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + settings.setOffscreenPreRaster(webViewOffscreenPreRaster); + } + if (jsInteration != null) { + settings.setJavaScriptEnabled(true); + webView.addJavascriptInterface(jsInteration, "android"); + } + + // // Other webview options + // webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); + // webView.setScrollbarFadingEnabled(false); + // //Additional Webview Properties + // webView.setSoundEffectsEnabled(true); + // webView.setHorizontalFadingEdgeEnabled(false); + // webView.setKeepScreenOn(true); + // webView.setScrollbarFadingEnabled(true); + // webView.setVerticalFadingEdgeEnabled(false); + + if (data != null) { + webView.loadData(data, mimeType, encoding); + } else if (url != null) webView.loadUrl(url); + } + + { // SwipeRefreshLayout + swipeRefreshLayout.setEnabled(showSwipeRefreshLayout); + if (showSwipeRefreshLayout) { + swipeRefreshLayout.post(new Runnable() { + @Override + public void run() { + swipeRefreshLayout.setRefreshing(true); + } + }); + } + + if (swipeRefreshColors == null) { + swipeRefreshLayout.setColorSchemeColors(swipeRefreshColor); + } else { + swipeRefreshLayout.setColorSchemeColors(swipeRefreshColors); + } + + swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + webView.reload(); + } + }); + } + + { // Divider + gradient.setVisibility(showDivider && gradientDivider ? View.VISIBLE : View.GONE); + divider.setVisibility(showDivider && !gradientDivider ? View.VISIBLE : View.GONE); + if (gradientDivider) { + int dividerWidth = DisplayUtil.getWidth(); + Bitmap bitmap = + BitmapHelper.getGradientBitmap(dividerWidth, (int) dividerHeight, dividerColor); + BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); + ViewUtil.setBackground(gradient, drawable); + + CoordinatorLayout.LayoutParams params = + (CoordinatorLayout.LayoutParams) gradient.getLayoutParams(); + params.height = (int) dividerHeight; + gradient.setLayoutParams(params); + } else { + divider.setBackgroundColor(dividerColor); + + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) divider.getLayoutParams(); + params.height = (int) dividerHeight; + divider.setLayoutParams(params); + } + } + + { // ProgressBar + progressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE); + progressBar.getProgressDrawable().setColorFilter(progressBarColor, PorterDuff.Mode.SRC_IN); + progressBar.setMinimumHeight((int) progressBarHeight); + CoordinatorLayout.LayoutParams params = + new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + (int) progressBarHeight); + float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); + switch (progressBarPosition) { + case TOP_OF_TOOLBAR: + params.setMargins(0, 0, 0, 0); + break; + case BOTTON_OF_TOOLBAR: + params.setMargins(0, (int) toolbarHeight - (int) progressBarHeight, 0, 0); + break; + case TOP_OF_WEBVIEW: + params.setMargins(0, (int) toolbarHeight, 0, 0); + break; + case BOTTOM_OF_WEBVIEW: + params.setMargins(0, DisplayUtil.getHeight() - (int) progressBarHeight, 0, 0); + break; + } + progressBar.setLayoutParams(params); + } - if (swipeRefreshColors == null) { - swipeRefreshLayout.setColorSchemeColors(swipeRefreshColor); - } else { - swipeRefreshLayout.setColorSchemeColors(swipeRefreshColors); - } + { // Menu + GradientDrawable drawable = new GradientDrawable(); + drawable.setCornerRadius(getResources().getDimension(R.dimen.defaultMenuCornerRadius)); + drawable.setColor(menuColor); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + menuBackground.setBackground(drawable); + } else { + menuBackground.setBackgroundDrawable(drawable); + } - swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { - @Override public void onRefresh() { - webView.reload(); + shadowLayout.setShadowColor(menuDropShadowColor); + shadowLayout.setShadowSize(menuDropShadowSize); + + RelativeLayout.LayoutParams params = + new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT); + int margin = + (int) (getResources().getDimension(R.dimen.defaultMenuLayoutMargin) - menuDropShadowSize); + params.setMargins(0, margin, margin, 0); + params.addRule(RelativeLayout.ALIGN_PARENT_TOP); + params.addRule(rtl ? RelativeLayout.ALIGN_PARENT_LEFT : RelativeLayout.ALIGN_PARENT_RIGHT); + shadowLayout.setLayoutParams(params); + + menuRefresh.setVisibility(showMenuRefresh ? View.VISIBLE : View.GONE); + menuRefresh.setBackgroundResource(menuSelector); + menuRefresh.setGravity(menuTextGravity); + menuRefreshTv.setText(stringResRefresh); + menuRefreshTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); + menuRefreshTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); + menuRefreshTv.setTextColor(menuTextColor); + menuRefreshTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); + + menuFind.setVisibility(showMenuFind ? View.VISIBLE : View.GONE); + menuFind.setBackgroundResource(menuSelector); + menuFind.setGravity(menuTextGravity); + menuFindTv.setText(stringResFind); + menuFindTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); + menuFindTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); + menuFindTv.setTextColor(menuTextColor); + menuFindTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); + + menuShareVia.setVisibility(showMenuShareVia ? View.VISIBLE : View.GONE); + menuShareVia.setBackgroundResource(menuSelector); + menuShareVia.setGravity(menuTextGravity); + menuShareViaTv.setText(stringResShareVia); + menuShareViaTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); + menuShareViaTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); + menuShareViaTv.setTextColor(menuTextColor); + menuShareViaTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); + + menuCopyLink.setVisibility(showMenuCopyLink ? View.VISIBLE : View.GONE); + menuCopyLink.setBackgroundResource(menuSelector); + menuCopyLink.setGravity(menuTextGravity); + menuCopyLinkTv.setText(stringResCopyLink); + menuCopyLinkTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); + menuCopyLinkTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); + menuCopyLinkTv.setTextColor(menuTextColor); + menuCopyLinkTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); + + menuOpenWith.setVisibility(showMenuOpenWith ? View.VISIBLE : View.GONE); + menuOpenWith.setBackgroundResource(menuSelector); + menuOpenWith.setGravity(menuTextGravity); + menuOpenWithTv.setText(stringResOpenWith); + menuOpenWithTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); + menuOpenWithTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); + menuOpenWithTv.setTextColor(menuTextColor); + menuOpenWithTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); } - }); } - { // Divider - gradient.setVisibility(showDivider && gradientDivider ? View.VISIBLE : View.GONE); - divider.setVisibility(showDivider && !gradientDivider ? View.VISIBLE : View.GONE); - if (gradientDivider) { - int dividerWidth = DisplayUtil.getWidth(); - Bitmap bitmap = - BitmapHelper.getGradientBitmap(dividerWidth, (int) dividerHeight, dividerColor); - BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); - ViewUtil.setBackground(gradient, drawable); - - CoordinatorLayout.LayoutParams params = - (CoordinatorLayout.LayoutParams) gradient.getLayoutParams(); - params.height = (int) dividerHeight; - gradient.setLayoutParams(params); - } else { - divider.setBackgroundColor(dividerColor); - - LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) divider.getLayoutParams(); - params.height = (int) dividerHeight; - divider.setLayoutParams(params); - } + protected int getMaxWidth() { + if (forward.getVisibility() == View.VISIBLE) { + return DisplayUtil.getWidth() - UnitConverter.dpToPx(100); + } else { + return DisplayUtil.getWidth() - UnitConverter.dpToPx(52); + } } - { // ProgressBar - progressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE); - progressBar.getProgressDrawable().setColorFilter(progressBarColor, PorterDuff.Mode.SRC_IN); - progressBar.setMinimumHeight((int) progressBarHeight); - CoordinatorLayout.LayoutParams params = - new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - (int) progressBarHeight); - float toolbarHeight = getResources().getDimension(R.dimen.toolbarHeight); - switch (progressBarPosition) { - case TOP_OF_TOOLBAR: - params.setMargins(0, 0, 0, 0); - break; - case BOTTON_OF_TOOLBAR: - params.setMargins(0, (int) toolbarHeight - (int) progressBarHeight, 0, 0); - break; - case TOP_OF_WEBVIEW: - params.setMargins(0, (int) toolbarHeight, 0, 0); - break; - case BOTTOM_OF_WEBVIEW: - params.setMargins(0, DisplayUtil.getHeight() - (int) progressBarHeight, 0, 0); - break; - } - progressBar.setLayoutParams(params); + protected void updateIcon(ImageButton icon, @DrawableRes int drawableRes) { + StateListDrawable states = new StateListDrawable(); + { + Bitmap bitmap = BitmapHelper.getColoredBitmap(this, drawableRes, iconPressedColor); + BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); + states.addState(new int[]{android.R.attr.state_pressed}, drawable); + } + { + Bitmap bitmap = BitmapHelper.getColoredBitmap(this, drawableRes, iconDisabledColor); + BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); + states.addState(new int[]{-android.R.attr.state_enabled}, drawable); + } + { + Bitmap bitmap = BitmapHelper.getColoredBitmap(this, drawableRes, iconDefaultColor); + BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); + states.addState(new int[]{}, drawable); + } + icon.setImageDrawable(states); + + // int[][] states = new int[][]{ + // new int[]{-android.R.attr.state_enabled}, // disabled + // new int[]{android.R.attr.state_pressed}, // pressed + // new int[]{} // default + // }; + // + // int[] colors = new int[]{ + // iconDisabledColor, + // iconPressedColor, + // iconDefaultColor + // }; + // + // ColorStateList colorStateList = new ColorStateList(states, colors); + // + // Drawable drawable = ContextCompat.getDrawable(this, drawableRes); + // if (APILevel.require(21)) { + // VectorDrawable vectorDrawable = (VectorDrawable) drawable; + // vectorDrawable.setTintList(colorStateList); + // icon.setImageDrawable(vectorDrawable); + // } else { + // VectorDrawableCompat vectorDrawable = (VectorDrawableCompat) drawable; + // vectorDrawable.setTintList(colorStateList); + // icon.setImageDrawable(vectorDrawable); + // } } - { // Menu - GradientDrawable drawable = new GradientDrawable(); - drawable.setCornerRadius(getResources().getDimension(R.dimen.defaultMenuCornerRadius)); - drawable.setColor(menuColor); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - menuBackground.setBackground(drawable); - } else { - menuBackground.setBackgroundDrawable(drawable); - } - - shadowLayout.setShadowColor(menuDropShadowColor); - shadowLayout.setShadowSize(menuDropShadowSize); - - RelativeLayout.LayoutParams params = - new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.WRAP_CONTENT); - int margin = - (int) (getResources().getDimension(R.dimen.defaultMenuLayoutMargin) - menuDropShadowSize); - params.setMargins(0, margin, margin, 0); - params.addRule(RelativeLayout.ALIGN_PARENT_TOP); - params.addRule(rtl ? RelativeLayout.ALIGN_PARENT_LEFT : RelativeLayout.ALIGN_PARENT_RIGHT); - shadowLayout.setLayoutParams(params); - - menuRefresh.setVisibility(showMenuRefresh ? View.VISIBLE : View.GONE); - menuRefresh.setBackgroundResource(menuSelector); - menuRefresh.setGravity(menuTextGravity); - menuRefreshTv.setText(stringResRefresh); - menuRefreshTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); - menuRefreshTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); - menuRefreshTv.setTextColor(menuTextColor); - menuRefreshTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); - - menuFind.setVisibility(showMenuFind ? View.VISIBLE : View.GONE); - menuFind.setBackgroundResource(menuSelector); - menuFind.setGravity(menuTextGravity); - menuFindTv.setText(stringResFind); - menuFindTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); - menuFindTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); - menuFindTv.setTextColor(menuTextColor); - menuFindTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); - - menuShareVia.setVisibility(showMenuShareVia ? View.VISIBLE : View.GONE); - menuShareVia.setBackgroundResource(menuSelector); - menuShareVia.setGravity(menuTextGravity); - menuShareViaTv.setText(stringResShareVia); - menuShareViaTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); - menuShareViaTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); - menuShareViaTv.setTextColor(menuTextColor); - menuShareViaTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); - - menuCopyLink.setVisibility(showMenuCopyLink ? View.VISIBLE : View.GONE); - menuCopyLink.setBackgroundResource(menuSelector); - menuCopyLink.setGravity(menuTextGravity); - menuCopyLinkTv.setText(stringResCopyLink); - menuCopyLinkTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); - menuCopyLinkTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); - menuCopyLinkTv.setTextColor(menuTextColor); - menuCopyLinkTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); - - menuOpenWith.setVisibility(showMenuOpenWith ? View.VISIBLE : View.GONE); - menuOpenWith.setBackgroundResource(menuSelector); - menuOpenWith.setGravity(menuTextGravity); - menuOpenWithTv.setText(stringResOpenWith); - menuOpenWithTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize); - menuOpenWithTv.setTypeface(TypefaceHelper.get(this, menuTextFont)); - menuOpenWithTv.setTextColor(menuTextColor); - menuOpenWithTv.setPadding((int) menuTextPaddingLeft, 0, (int) menuTextPaddingRight, 0); + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + initializeOptions(); + + setContentView(R.layout.finest_web_view); + bindViews(); + layoutViews(); + initializeViews(); } - } - protected int getMaxWidth() { - if (forward.getVisibility() == View.VISIBLE) { - return DisplayUtil.getWidth() - UnitConverter.dpToPx(100); - } else { - return DisplayUtil.getWidth() - UnitConverter.dpToPx(52); + @Override + public void onBackPressed() { + if (menuLayout.getVisibility() == View.VISIBLE) { + hideMenu(); + } else if (backPressToClose || !webView.canGoBack()) { + exitActivity(); + } else { + webView.goBack(); + } } - } - - protected void updateIcon(ImageButton icon, @DrawableRes int drawableRes) { - StateListDrawable states = new StateListDrawable(); - { - Bitmap bitmap = BitmapHelper.getColoredBitmap(this, drawableRes, iconPressedColor); - BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); - states.addState(new int[] { android.R.attr.state_pressed }, drawable); + + @Override + public void onClick(View v) { + int viewId = v.getId(); + if (viewId == R.id.close) { + if (rtl) { + showMenu(); + } else { + exitActivity(); + } + } else if (viewId == R.id.back) { + if (rtl) { + webView.goForward(); + } else { + webView.goBack(); + } + } else if (viewId == R.id.forward) { + if (rtl) { + webView.goBack(); + } else { + webView.goForward(); + } + } else if (viewId == R.id.more) { + if (rtl) { + exitActivity(); + } else { + showMenu(); + } + } else if (viewId == R.id.menuLayout) { + hideMenu(); + } else if (viewId == R.id.menuRefresh) { + webView.reload(); + hideMenu(); + } else if (viewId == R.id.menuFind) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) + webView.showFindDialog("", true); + hideMenu(); + } else if (viewId == R.id.menuShareVia) { + Intent sendIntent = new Intent(); + sendIntent.setAction(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); + sendIntent.setType("text/plain"); + startActivity(Intent.createChooser(sendIntent, getResources().getString(stringResShareVia))); + + hideMenu(); + } else if (viewId == R.id.menuCopyLink) { + ClipboardManagerUtil.setText(webView.getUrl()); + + Snackbar snackbar = Snackbar.make(coordinatorLayout, getString(stringResCopiedToClipboard), + Snackbar.LENGTH_LONG); + View snackbarView = snackbar.getView(); + snackbarView.setBackgroundColor(toolbarColor); + if (snackbarView instanceof ViewGroup) updateChildTextView((ViewGroup) snackbarView); + snackbar.show(); + + hideMenu(); + } else if (viewId == R.id.menuOpenWith) { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webView.getUrl())); + startActivity(browserIntent); + + hideMenu(); + } } - { - Bitmap bitmap = BitmapHelper.getColoredBitmap(this, drawableRes, iconDisabledColor); - BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); - states.addState(new int[] { -android.R.attr.state_enabled }, drawable); + + protected void updateChildTextView(ViewGroup viewGroup) { + if (viewGroup == null || viewGroup.getChildCount() == 0) return; + + for (int i = 0; i < viewGroup.getChildCount(); i++) { + View view = viewGroup.getChildAt(i); + if (view instanceof TextView) { + TextView textView = (TextView) view; + textView.setTextColor(titleColor); + textView.setTypeface(TypefaceHelper.get(this, titleFont)); + textView.setLineSpacing(0, 1.1f); + textView.setIncludeFontPadding(false); + } + + if (view instanceof ViewGroup) updateChildTextView((ViewGroup) view); + } } - { - Bitmap bitmap = BitmapHelper.getColoredBitmap(this, drawableRes, iconDefaultColor); - BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap); - states.addState(new int[] {}, drawable); + + protected void showMenu() { + menuLayout.setVisibility(View.VISIBLE); + Animation popupAnim = AnimationUtils.loadAnimation(this, R.anim.popup_flyout_show); + shadowLayout.startAnimation(popupAnim); + } + + protected void hideMenu() { + Animation popupAnim = AnimationUtils.loadAnimation(this, R.anim.popup_flyout_hide); + shadowLayout.startAnimation(popupAnim); + popupAnim.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + } + + @Override + public void onAnimationEnd(Animation animation) { + menuLayout.setVisibility(View.GONE); + } + + @Override + public void onAnimationRepeat(Animation animation) { + } + }); } - icon.setImageDrawable(states); - - // int[][] states = new int[][]{ - // new int[]{-android.R.attr.state_enabled}, // disabled - // new int[]{android.R.attr.state_pressed}, // pressed - // new int[]{} // default - // }; - // - // int[] colors = new int[]{ - // iconDisabledColor, - // iconPressedColor, - // iconDefaultColor - // }; - // - // ColorStateList colorStateList = new ColorStateList(states, colors); - // - // Drawable drawable = ContextCompat.getDrawable(this, drawableRes); - // if (APILevel.require(21)) { - // VectorDrawable vectorDrawable = (VectorDrawable) drawable; - // vectorDrawable.setTintList(colorStateList); - // icon.setImageDrawable(vectorDrawable); - // } else { - // VectorDrawableCompat vectorDrawable = (VectorDrawableCompat) drawable; - // vectorDrawable.setTintList(colorStateList); - // icon.setImageDrawable(vectorDrawable); - // } - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - initializeOptions(); - - setContentView(R.layout.finest_web_view); - bindViews(); - layoutViews(); - initializeViews(); - } - - @Override public void onBackPressed() { - if (menuLayout.getVisibility() == View.VISIBLE) { - hideMenu(); - } else if (backPressToClose || !webView.canGoBack()) { - exitActivity(); - } else { - webView.goBack(); + + protected void exitActivity() { + super.onBackPressed(); + overridePendingTransition(animationCloseEnter, animationCloseExit); } - } - - @Override public void onClick(View v) { - int viewId = v.getId(); - if (viewId == R.id.close) { - if (rtl) { - showMenu(); - } else { - exitActivity(); - } - } else if (viewId == R.id.back) { - if (rtl) { - webView.goForward(); - } else { - webView.goBack(); - } - } else if (viewId == R.id.forward) { - if (rtl) { - webView.goBack(); - } else { - webView.goForward(); - } - } else if (viewId == R.id.more) { - if (rtl) { - exitActivity(); - } else { - showMenu(); - } - } else if (viewId == R.id.menuLayout) { - hideMenu(); - } else if (viewId == R.id.menuRefresh) { - webView.reload(); - hideMenu(); - } else if (viewId == R.id.menuFind) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) webView.showFindDialog("", true); - hideMenu(); - } else if (viewId == R.id.menuShareVia) { - Intent sendIntent = new Intent(); - sendIntent.setAction(Intent.ACTION_SEND); - sendIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); - sendIntent.setType("text/plain"); - startActivity(Intent.createChooser(sendIntent, getResources().getString(stringResShareVia))); - - hideMenu(); - } else if (viewId == R.id.menuCopyLink) { - ClipboardManagerUtil.setText(webView.getUrl()); - - Snackbar snackbar = Snackbar.make(coordinatorLayout, getString(stringResCopiedToClipboard), - Snackbar.LENGTH_LONG); - View snackbarView = snackbar.getView(); - snackbarView.setBackgroundColor(toolbarColor); - if (snackbarView instanceof ViewGroup) updateChildTextView((ViewGroup) snackbarView); - snackbar.show(); - - hideMenu(); - } else if (viewId == R.id.menuOpenWith) { - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webView.getUrl())); - startActivity(browserIntent); - - hideMenu(); + + @Override + public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { + if (toolbarScrollFlags == 0) return; + + ViewHelper.setTranslationY(gradient, verticalOffset); + ViewHelper.setAlpha(gradient, + 1 - (float) Math.abs(verticalOffset) / (float) appBarLayout.getTotalScrollRange()); + + switch (progressBarPosition) { + case BOTTON_OF_TOOLBAR: + ViewHelper.setTranslationY(progressBar, + Math.max(verticalOffset, progressBarHeight - appBarLayout.getTotalScrollRange())); + break; + case TOP_OF_WEBVIEW: + ViewHelper.setTranslationY(progressBar, verticalOffset); + break; + case TOP_OF_TOOLBAR: + case BOTTOM_OF_WEBVIEW: + default: + break; + } + + if (menuLayout.getVisibility() == View.VISIBLE + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + ViewHelper.setTranslationY(menuLayout, + Math.max(verticalOffset, -getResources().getDimension(R.dimen.defaultMenuLayoutMargin))); + } } - } - - protected void updateChildTextView(ViewGroup viewGroup) { - if (viewGroup == null || viewGroup.getChildCount() == 0) return; - - for (int i = 0; i < viewGroup.getChildCount(); i++) { - View view = viewGroup.getChildAt(i); - if (view instanceof TextView) { - TextView textView = (TextView) view; - textView.setTextColor(titleColor); - textView.setTypeface(TypefaceHelper.get(this, titleFont)); - textView.setLineSpacing(0, 1.1f); - textView.setIncludeFontPadding(false); - } - - if (view instanceof ViewGroup) updateChildTextView((ViewGroup) view); + + protected void requestCenterLayout() { + int maxWidth; + if (webView.canGoBack() || webView.canGoForward()) { + maxWidth = DisplayUtil.getWidth() - UnitConverter.dpToPx(48) * 4; + } else { + maxWidth = DisplayUtil.getWidth() - UnitConverter.dpToPx(48) * 2; + } + + title.setMaxWidth(maxWidth); + urlTv.setMaxWidth(maxWidth); + title.requestLayout(); + urlTv.requestLayout(); } - } - - protected void showMenu() { - menuLayout.setVisibility(View.VISIBLE); - Animation popupAnim = AnimationUtils.loadAnimation(this, R.anim.popup_flyout_show); - shadowLayout.startAnimation(popupAnim); - } - - protected void hideMenu() { - Animation popupAnim = AnimationUtils.loadAnimation(this, R.anim.popup_flyout_hide); - shadowLayout.startAnimation(popupAnim); - popupAnim.setAnimationListener(new Animation.AnimationListener() { - @Override public void onAnimationStart(Animation animation) { - } - - @Override public void onAnimationEnd(Animation animation) { - menuLayout.setVisibility(View.GONE); - } - - @Override public void onAnimationRepeat(Animation animation) { - } - }); - } - - protected void exitActivity() { - super.onBackPressed(); - overridePendingTransition(animationCloseEnter, animationCloseExit); - } - - @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { - if (toolbarScrollFlags == 0) return; - - ViewHelper.setTranslationY(gradient, verticalOffset); - ViewHelper.setAlpha(gradient, - 1 - (float) Math.abs(verticalOffset) / (float) appBarLayout.getTotalScrollRange()); - - switch (progressBarPosition) { - case BOTTON_OF_TOOLBAR: - ViewHelper.setTranslationY(progressBar, - Math.max(verticalOffset, progressBarHeight - appBarLayout.getTotalScrollRange())); - break; - case TOP_OF_WEBVIEW: - ViewHelper.setTranslationY(progressBar, verticalOffset); - break; - case TOP_OF_TOOLBAR: - case BOTTOM_OF_WEBVIEW: - default: - break; + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { + layoutViews(); + } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { + layoutViews(); + } } - if (menuLayout.getVisibility() == View.VISIBLE - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - ViewHelper.setTranslationY(menuLayout, - Math.max(verticalOffset, -getResources().getDimension(R.dimen.defaultMenuLayoutMargin))); + @Override + protected void onDestroy() { + super.onDestroy(); + BroadCastManager.unregister(FinestWebViewActivity.this, key); + if (webView == null) return; + if (APILevel.require(11)) webView.onPause(); + destroyWebView(); } - } - - protected void requestCenterLayout() { - int maxWidth; - if (webView.canGoBack() || webView.canGoForward()) { - maxWidth = DisplayUtil.getWidth() - UnitConverter.dpToPx(48) * 4; - } else { - maxWidth = DisplayUtil.getWidth() - UnitConverter.dpToPx(48) * 2; + + // Wait for zoom control to fade away + // https://code.google.com/p/android/issues/detail?id=15694 + // http://stackoverflow.com/a/5966151/1797648 + private void destroyWebView() { + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (webView != null) webView.destroy(); + } + }, ViewConfiguration.getZoomControlsTimeout() + 1000L); } - title.setMaxWidth(maxWidth); - urlTv.setMaxWidth(maxWidth); - title.requestLayout(); - urlTv.requestLayout(); - } + public class MyWebChromeClient extends WebChromeClient { + + @Override + public void onProgressChanged(WebView view, int progress) { + BroadCastManager.onProgressChanged(FinestWebViewActivity.this, key, progress); + + if (showSwipeRefreshLayout) { + if (swipeRefreshLayout.isRefreshing() && progress == 100) { + swipeRefreshLayout.post(new Runnable() { + @Override + public void run() { + swipeRefreshLayout.setRefreshing(false); + } + }); + } + + if (!swipeRefreshLayout.isRefreshing() && progress != 100) { + swipeRefreshLayout.post(new Runnable() { + @Override + public void run() { + swipeRefreshLayout.setRefreshing(true); + } + }); + } + } - @Override public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); + if (progress == 100) progress = 0; + progressBar.setProgress(progress); + } + + @Override + public void onReceivedTitle(WebView view, String title) { + BroadCastManager.onReceivedTitle(FinestWebViewActivity.this, key, title); + } - if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { - layoutViews(); - } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { - layoutViews(); + @Override + public void onReceivedTouchIconUrl(WebView view, String url, boolean precomposed) { + BroadCastManager.onReceivedTouchIconUrl(FinestWebViewActivity.this, key, url, precomposed); + } } - } - - @Override protected void onDestroy() { - super.onDestroy(); - BroadCastManager.unregister(FinestWebViewActivity.this, key); - if (webView == null) return; - if (APILevel.require(11)) webView.onPause(); - destroyWebView(); - } - - // Wait for zoom control to fade away - // https://code.google.com/p/android/issues/detail?id=15694 - // http://stackoverflow.com/a/5966151/1797648 - private void destroyWebView() { - new Handler().postDelayed(new Runnable() { - @Override public void run() { - if (webView != null) webView.destroy(); - } - }, ViewConfiguration.getZoomControlsTimeout() + 1000L); - } - - public class MyWebChromeClient extends WebChromeClient { - - @Override public void onProgressChanged(WebView view, int progress) { - BroadCastManager.onProgressChanged(FinestWebViewActivity.this, key, progress); - - if (showSwipeRefreshLayout) { - if (swipeRefreshLayout.isRefreshing() && progress == 100) { - swipeRefreshLayout.post(new Runnable() { - @Override public void run() { - swipeRefreshLayout.setRefreshing(false); + + public class MyWebViewClient extends WebViewClient { + + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + BroadCastManager.onPageStarted(FinestWebViewActivity.this, key, url); + if (!url.contains("docs.google.com") && url.endsWith(".pdf")) { + webView.loadUrl("http://docs.google.com/gview?embedded=true&url=" + url); } - }); } - if (!swipeRefreshLayout.isRefreshing() && progress != 100) { - swipeRefreshLayout.post(new Runnable() { - @Override public void run() { - swipeRefreshLayout.setRefreshing(true); + @Override + public void onPageFinished(WebView view, String url) { + BroadCastManager.onPageFinished(FinestWebViewActivity.this, key, url); + + if (updateTitleFromHtml) title.setText(view.getTitle()); + urlTv.setText(UrlParser.getHost(url)); + requestCenterLayout(); + + if (view.canGoBack() || view.canGoForward()) { + back.setVisibility(showIconBack ? View.VISIBLE : View.GONE); + forward.setVisibility(showIconForward ? View.VISIBLE : View.GONE); + back.setEnabled(!disableIconBack && (rtl ? view.canGoForward() : view.canGoBack())); + forward.setEnabled(!disableIconForward && (rtl ? view.canGoBack() : view.canGoForward())); + } else { + back.setVisibility(View.GONE); + forward.setVisibility(View.GONE); + } + + if (injectJavaScript != null) { + webView.evaluateJavascript(injectJavaScript, null); } - }); } - } - if (progress == 100) progress = 0; - progressBar.setProgress(progress); - } + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + if (url.endsWith(".mp4")) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(Uri.parse(url), "video/*"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + view.getContext().startActivity(intent); + // If we return true, onPageStarted, onPageFinished won't be called. + return true; + } else if (url.startsWith("tel:") || url.startsWith("sms:") || url.startsWith("smsto:") || url + .startsWith("mms:") || url.startsWith("mmsto:")) { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + view.getContext().startActivity(intent); + return true; // If we return true, onPageStarted, onPageFinished won't be called. + } + /******************************************************* + * Added in support for mailto: + *******************************************************/ + else if (url.startsWith("mailto:")) { - @Override public void onReceivedTitle(WebView view, String title) { - BroadCastManager.onReceivedTitle(FinestWebViewActivity.this, key, title); - } + MailTo mt = MailTo.parse(url); - @Override public void onReceivedTouchIconUrl(WebView view, String url, boolean precomposed) { - BroadCastManager.onReceivedTouchIconUrl(FinestWebViewActivity.this, key, url, precomposed); - } - } + Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); - public class MyWebViewClient extends WebViewClient { + emailIntent.setType("text/html"); + emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{mt.getTo()}); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject()); + emailIntent.putExtra(Intent.EXTRA_CC, mt.getCc()); + emailIntent.putExtra(Intent.EXTRA_TEXT, mt.getBody()); - @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { - BroadCastManager.onPageStarted(FinestWebViewActivity.this, key, url); - if (!url.contains("docs.google.com") && url.endsWith(".pdf")) { - webView.loadUrl("http://docs.google.com/gview?embedded=true&url=" + url); - } - } + startActivity(emailIntent); - @Override public void onPageFinished(WebView view, String url) { - BroadCastManager.onPageFinished(FinestWebViewActivity.this, key, url); - - if (updateTitleFromHtml) title.setText(view.getTitle()); - urlTv.setText(UrlParser.getHost(url)); - requestCenterLayout(); - - if (view.canGoBack() || view.canGoForward()) { - back.setVisibility(showIconBack ? View.VISIBLE : View.GONE); - forward.setVisibility(showIconForward ? View.VISIBLE : View.GONE); - back.setEnabled(!disableIconBack && (rtl ? view.canGoForward() : view.canGoBack())); - forward.setEnabled(!disableIconForward && (rtl ? view.canGoBack() : view.canGoForward())); - } else { - back.setVisibility(View.GONE); - forward.setVisibility(View.GONE); - } - - if (injectJavaScript != null) { - webView.evaluateJavascript(injectJavaScript, null); - } - } - - @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (url.endsWith(".mp4")) { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.parse(url), "video/*"); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - view.getContext().startActivity(intent); - // If we return true, onPageStarted, onPageFinished won't be called. - return true; - } else if (url.startsWith("tel:") || url.startsWith("sms:") || url.startsWith("smsto:") || url - .startsWith("mms:") || url.startsWith("mmsto:")) { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - view.getContext().startActivity(intent); - return true; // If we return true, onPageStarted, onPageFinished won't be called. - } - /******************************************************* - * Added in support for mailto: - *******************************************************/ - else if (url.startsWith("mailto:")) { - - MailTo mt = MailTo.parse(url); - - Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); - - emailIntent.setType("text/html"); - emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { mt.getTo() }); - emailIntent.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject()); - emailIntent.putExtra(Intent.EXTRA_CC, mt.getCc()); - emailIntent.putExtra(Intent.EXTRA_TEXT, mt.getBody()); - - startActivity(emailIntent); - - return true; - } else { - return super.shouldOverrideUrlLoading(view, url); - } - } + return true; + } else { + return super.shouldOverrideUrlLoading(view, url); + } + } - @Override public void onLoadResource(WebView view, String url) { - BroadCastManager.onLoadResource(FinestWebViewActivity.this, key, url); - } + @Override + public void onLoadResource(WebView view, String url) { + BroadCastManager.onLoadResource(FinestWebViewActivity.this, key, url); + } - @Override public void onPageCommitVisible(WebView view, String url) { - BroadCastManager.onPageCommitVisible(FinestWebViewActivity.this, key, url); + @Override + public void onPageCommitVisible(WebView view, String url) { + BroadCastManager.onPageCommitVisible(FinestWebViewActivity.this, key, url); + } } - } } diff --git a/sample/gradle/wrapper/gradle-wrapper.jar b/sample/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659 GIT binary patch literal 53636 zcmafaW0a=B^559DjdyHo$F^PVt zzd|cWgMz^T0YO0lQ8%TE1O06v|NZl~LH{LLQ58WtNjWhFP#}eWVO&eiP!jmdp!%24 z{&z-MK{-h=QDqf+S+Pgi=_wg$I{F28X*%lJ>A7Yl#$}fMhymMu?R9TEB?#6@|Q^e^AHhxcRL$z1gsc`-Q`3j+eYAd<4@z^{+?JM8bmu zSVl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7X8kkeFyO8 z{XOq^07=u|7*P2`m;>PIFf=i80MKUxsN{d2cX0M+REsE*20+WQ79T9&cqT>=I_U% z{=8~^Isg(Nzo~`4iQfIb_#CVCD>#5h>=-Z#5dH}WxYzn%0)GAm6L2WdUdP=0_h>7f z(jh&7%1i(ZOn+}D8$iGK4Vs{pmHl_w4Qm-46H9>4^{3dz^DZDh+dw)6Xd@CpQNK$j z{CU;-cmpK=egplZ3y3%y=sEnCJ^eYVKXzV8H2_r*fJ*%*B;a1_lOpt6)IT1IAK2eB z{rie|uDJUrbgfUE>~C>@RO|m5ex55F{=~Bb4Cucp{ok7Yf9V}QuZ`#Gc|WaqsQlK- zKaV)iMRR__&Ak2Z=IM9R9g5$WM4u{a^C-7uX*!myEym z#_#p^T!P~#Dx$%^K>Y_nj_3J*E_LwJ60-5Xu=LkJAwcP@|0;a&+|+ZX`Jbj9P5;T% z|KOc}4*#4o{U?09`9Hz`Xo-I!P=9XfIrr*MQ}y=$!qgv?_J38^bNb4kM&_OVg^_=Eu-qG5U(fw0KMgH){C8pazq~51rN97hf#20-7=aK0)N|UM H-+%o-(+5aQ literal 0 HcmV?d00001 diff --git a/sample/gradle/wrapper/gradle-wrapper.properties b/sample/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..04e285f --- /dev/null +++ b/sample/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Dec 28 10:00:20 PST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/sample/gradlew b/sample/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/sample/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/sample/gradlew.bat b/sample/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/sample/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java b/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java index e88cdeb..241bea0 100644 --- a/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java +++ b/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java @@ -2,11 +2,16 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; +import android.util.Log; import android.view.Gravity; import android.view.View; +import android.webkit.JavascriptInterface; + import com.thefinestartist.finestwebview.FinestWebView; -public class MainActivity extends AppCompatActivity { +import java.io.Serializable; + +public class MainActivity extends AppCompatActivity implements Serializable{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -31,12 +36,11 @@ public void onClick(View view) { .webViewDisplayZoomControls(true) .dividerHeight(0) .gradientDivider(false) + .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 + .addJavascriptInterface(new JsInteration())//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, R.anim.activity_close_enter, R.anim.activity_close_exit) - .injectJavaScript("javascript: document.getElementById('msg').innerHTML='Hello " - + "TheFinestArtist" - + "!';") - .show("http://www.blessthisstuff.com"); + .show("http://test.2000new.com/nyd/water/index.html"); } else if (view.getId() == R.id.blueTheme) { new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme) .titleDefault("Vimeo") @@ -47,6 +51,8 @@ public void onClick(View view) { .urlColorRes(R.color.bluePrimaryLight) .iconDefaultColorRes(R.color.finestWhite) .progressBarColorRes(R.color.finestWhite) + .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 + .addJavascriptInterface(this)//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable .stringResCopiedToClipboard(R.string.copied_to_clipboard) .stringResCopiedToClipboard(R.string.copied_to_clipboard) .stringResCopiedToClipboard(R.string.copied_to_clipboard) @@ -57,8 +63,9 @@ public void onClick(View view) { .menuTextPaddingRightRes(R.dimen.defaultMenuTextPaddingLeft) .dividerHeight(0) .gradientDivider(false) + .setCustomAnimations(R.anim.slide_up, R.anim.hold, R.anim.hold, R.anim.slide_down) - .show("http://example.com"); + .show("http://test.2000new.com/nyd/water/index.html"); } else if (view.getId() == R.id.blackTheme) { new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme) .titleDefault("Dribbble") @@ -86,4 +93,20 @@ public void onClick(View view) { .show("https://dribbble.com"); } } + @JavascriptInterface + public String kk() { + Log.e("aaa", "bbbbb"); + return "kkkkk00ggaa"; + } + class JsInteration implements Serializable{ + JsInteration() { + Log.e("aaa", "JsInteration"); + } + + @JavascriptInterface + public String kk() { + Log.e("aaa", "bbbbb"); + return "kkkkk00gg"; + } + } } From f6c33f8cdb05f4af7d1fe8251b2de81a82c672cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=88=E4=B8=91=E5=8F=88=E4=B8=8D=E8=AF=BB=E4=B9=A6?= <664996919@qq.com> Date: Wed, 15 Feb 2017 14:26:07 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=89=E5=8D=93?= =?UTF-8?q?=E8=B0=83=E7=94=A8JS=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../finestwebview/FinestWebView.java | 13 +- .../finestwebview/FinestWebViewActivity.java | 12 +- .../finestwebview/sample/MainActivity.java | 188 +++++++++--------- 3 files changed, 119 insertions(+), 94 deletions(-) diff --git a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java index c80554e..9fc2992 100644 --- a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java +++ b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java @@ -14,6 +14,8 @@ import android.support.annotation.StyleRes; import android.support.design.widget.AppBarLayout.LayoutParams.ScrollFlags; import android.webkit.WebSettings; +import android.webkit.WebView; + import com.thefinestartist.Base; import com.thefinestartist.finestwebview.enums.Position; import com.thefinestartist.finestwebview.listeners.BroadCastManager; @@ -164,7 +166,7 @@ public static class Builder implements Serializable { protected String encoding; protected String data; protected String url; - + protected WebView webView; public Builder(@NonNull Activity activity) { this.context = activity; Base.initialize(activity); @@ -898,6 +900,15 @@ public Builder injectJavaScript(String injectJavaScript) { return this; } + public WebView getWebView() { +// webView.getSettings().setJavaScriptEnabled(true); + return webView; + } + + public void setWebView(WebView webView) { + this.webView = webView; + } + public void load(@StringRes int dataRes) { load(Res.getString(dataRes)); } diff --git a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java index 99371a0..b4484af 100644 --- a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java +++ b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java @@ -226,6 +226,7 @@ public class FinestWebViewActivity extends AppCompatActivity protected LinearLayout menuOpenWith; protected TextView menuOpenWithTv; protected FrameLayout webLayout; + protected FinestWebView.Builder builder; DownloadListener downloadListener = new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, @@ -239,7 +240,7 @@ protected void initializeOptions() { Intent intent = getIntent(); if (intent == null) return; - FinestWebView.Builder builder = (FinestWebView.Builder) intent.getSerializableExtra("builder"); + builder = (FinestWebView.Builder) intent.getSerializableExtra("builder"); // set theme before resolving attributes depending on those setTheme(builder.theme != null ? builder.theme : 0); @@ -481,6 +482,7 @@ protected void bindViews() { webLayout = (FrameLayout) findViewById(R.id.webLayout); webView = new WebView(this); webLayout.addView(webView); + } protected void layoutViews() { @@ -748,10 +750,14 @@ protected void initializeViews() { // webView.setKeepScreenOn(true); // webView.setScrollbarFadingEnabled(true); // webView.setVerticalFadingEdgeEnabled(false); - + builder.setWebView(webView); if (data != null) { webView.loadData(data, mimeType, encoding); - } else if (url != null) webView.loadUrl(url); + } else if (url != null) { + webView.loadUrl(url); + } + + } { // SwipeRefreshLayout diff --git a/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java b/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java index 241bea0..1820635 100644 --- a/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java +++ b/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java @@ -6,107 +6,115 @@ import android.view.Gravity; import android.view.View; import android.webkit.JavascriptInterface; +import android.webkit.WebView; import com.thefinestartist.finestwebview.FinestWebView; import java.io.Serializable; -public class MainActivity extends AppCompatActivity implements Serializable{ - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - } +public class MainActivity extends AppCompatActivity implements Serializable { - public void onClick(View view) { - if (view.getId() == R.id.defaultTheme) { - new FinestWebView.Builder(this).titleDefault("The Finest Artist") - .show("http://thefinestartist.com"); - //// .toolbarScrollFlags(0) - // .webViewJavaScriptEnabled(true) - // .webViewUseWideViewPort(false) - //// .show("http://andrewliu.in/2016/01/30/聊聊Redis的订阅发布/"); - // .show("http://www.youtube.com"); - } else if (view.getId() == R.id.redTheme) { - // Intent intent = new Intent(this, WebViewActivity.class); - // startActivity(intent); - new FinestWebView.Builder(this).theme(R.style.RedTheme) - .titleDefault("Bless This Stuff") - .webViewBuiltInZoomControls(true) - .webViewDisplayZoomControls(true) - .dividerHeight(0) - .gradientDivider(false) - .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 - .addJavascriptInterface(new JsInteration())//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable - .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, - R.anim.activity_close_enter, R.anim.activity_close_exit) - .show("http://test.2000new.com/nyd/water/index.html"); - } else if (view.getId() == R.id.blueTheme) { - new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme) - .titleDefault("Vimeo") - .showUrl(false) - .statusBarColorRes(R.color.bluePrimaryDark) - .toolbarColorRes(R.color.bluePrimary) - .titleColorRes(R.color.finestWhite) - .urlColorRes(R.color.bluePrimaryLight) - .iconDefaultColorRes(R.color.finestWhite) - .progressBarColorRes(R.color.finestWhite) - .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 - .addJavascriptInterface(this)//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable - .stringResCopiedToClipboard(R.string.copied_to_clipboard) - .stringResCopiedToClipboard(R.string.copied_to_clipboard) - .stringResCopiedToClipboard(R.string.copied_to_clipboard) - .showSwipeRefreshLayout(true) - .swipeRefreshColorRes(R.color.bluePrimaryDark) - .menuSelector(R.drawable.selector_light_theme) - .menuTextGravity(Gravity.CENTER) - .menuTextPaddingRightRes(R.dimen.defaultMenuTextPaddingLeft) - .dividerHeight(0) - .gradientDivider(false) + private FinestWebView.Builder builder; - .setCustomAnimations(R.anim.slide_up, R.anim.hold, R.anim.hold, R.anim.slide_down) - .show("http://test.2000new.com/nyd/water/index.html"); - } else if (view.getId() == R.id.blackTheme) { - new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme) - .titleDefault("Dribbble") - .toolbarScrollFlags(0) - .statusBarColorRes(R.color.blackPrimaryDark) - .toolbarColorRes(R.color.blackPrimary) - .titleColorRes(R.color.finestWhite) - .urlColorRes(R.color.blackPrimaryLight) - .iconDefaultColorRes(R.color.finestWhite) - .progressBarColorRes(R.color.finestWhite) - .swipeRefreshColorRes(R.color.blackPrimaryDark) - .menuSelector(R.drawable.selector_light_theme) - .menuTextGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT) - .menuTextPaddingRightRes(R.dimen.defaultMenuTextPaddingLeft) - .dividerHeight(0) - .gradientDivider(false) - // .setCustomAnimations(R.anim.slide_up, R.anim.hold, R.anim.hold, R.anim.slide_down) - .setCustomAnimations(R.anim.slide_left_in, R.anim.hold, R.anim.hold, - R.anim.slide_right_out) - // .setCustomAnimations(R.anim.fade_in_fast, R.anim.fade_out_medium, R.anim.fade_in_medium, R.anim.fade_out_fast) - .disableIconBack(true) - .disableIconClose(true) - .disableIconForward(true) - .disableIconMenu(true) - .show("https://dribbble.com"); + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); } - } - @JavascriptInterface - public String kk() { - Log.e("aaa", "bbbbb"); - return "kkkkk00ggaa"; - } - class JsInteration implements Serializable{ - JsInteration() { - Log.e("aaa", "JsInteration"); + + public void onClick(View view) { + if (view.getId() == R.id.defaultTheme) { + new FinestWebView.Builder(this).titleDefault("The Finest Artist") + .show("http://thefinestartist.com"); + //// .toolbarScrollFlags(0) + // .webViewJavaScriptEnabled(true) + // .webViewUseWideViewPort(false) + //// .show("http://andrewliu.in/2016/01/30/聊聊Redis的订阅发布/"); + // .show("http://www.youtube.com"); + } else if (view.getId() == R.id.redTheme) { + // Intent intent = new Intent(this, WebViewActivity.class); + // startActivity(intent); + new FinestWebView.Builder(this).theme(R.style.RedTheme) + .titleDefault("Bless This Stuff") + .webViewBuiltInZoomControls(true) + .webViewDisplayZoomControls(true) + .dividerHeight(0) + .gradientDivider(false) + .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 + .addJavascriptInterface(new JsInteration())//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable + .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, + R.anim.activity_close_enter, R.anim.activity_close_exit) + .show("http://test.2000new.com/nyd/water/index.html"); + } else if (view.getId() == R.id.blueTheme) { + builder = new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme) + .titleDefault("Vimeo") + .showUrl(false) + .statusBarColorRes(R.color.bluePrimaryDark) + .toolbarColorRes(R.color.bluePrimary) + .titleColorRes(R.color.finestWhite) + .urlColorRes(R.color.bluePrimaryLight) + .iconDefaultColorRes(R.color.finestWhite) + .progressBarColorRes(R.color.finestWhite) +// .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 + .addJavascriptInterface(this)//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable + .stringResCopiedToClipboard(R.string.copied_to_clipboard) + .stringResCopiedToClipboard(R.string.copied_to_clipboard) + .stringResCopiedToClipboard(R.string.copied_to_clipboard) + .showSwipeRefreshLayout(true) + .swipeRefreshColorRes(R.color.bluePrimaryDark) + .menuSelector(R.drawable.selector_light_theme) + .menuTextGravity(Gravity.CENTER) + .menuTextPaddingRightRes(R.dimen.defaultMenuTextPaddingLeft) + .dividerHeight(0) + .gradientDivider(false) + + .setCustomAnimations(R.anim.slide_up, R.anim.hold, R.anim.hold, R.anim.slide_down); + builder.show("http://test.2000new.com/nyd/water/index.html"); + } else if (view.getId() == R.id.blackTheme) { + new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme) + .titleDefault("Dribbble") + .toolbarScrollFlags(0) + .statusBarColorRes(R.color.blackPrimaryDark) + .toolbarColorRes(R.color.blackPrimary) + .titleColorRes(R.color.finestWhite) + .urlColorRes(R.color.blackPrimaryLight) + .iconDefaultColorRes(R.color.finestWhite) + .progressBarColorRes(R.color.finestWhite) + .swipeRefreshColorRes(R.color.blackPrimaryDark) + .menuSelector(R.drawable.selector_light_theme) + .menuTextGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT) + .menuTextPaddingRightRes(R.dimen.defaultMenuTextPaddingLeft) + .dividerHeight(0) + .gradientDivider(false) + // .setCustomAnimations(R.anim.slide_up, R.anim.hold, R.anim.hold, R.anim.slide_down) + .setCustomAnimations(R.anim.slide_left_in, R.anim.hold, R.anim.hold, + R.anim.slide_right_out) + // .setCustomAnimations(R.anim.fade_in_fast, R.anim.fade_out_medium, R.anim.fade_in_medium, R.anim.fade_out_fast) + .disableIconBack(true) + .disableIconClose(true) + .disableIconForward(true) + .disableIconMenu(true) + .show("https://dribbble.com"); + } } @JavascriptInterface - public String kk() { - Log.e("aaa", "bbbbb"); - return "kkkkk00gg"; + public String jsToAndroid() { + runOnUiThread(new Runnable() { + @Override + public void run() { + builder.getWebView().evaluateJavascript("javascript:anroidToJs('安卓调用JS ')", null);//调用JAVA中的方法 + } + }); + return "JS调用安卓"; + } + + class JsInteration implements Serializable { + + @JavascriptInterface + public String jsToAndroid() { + return "JS调用安卓"; + } } - } } From a355847b0c9eac0105758e2fbbe9838467a7fa16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Wed, 15 Feb 2017 15:03:29 +0800 Subject: [PATCH 03/12] Add javascript interactive Add javascript interactive --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/README.md b/README.md index 48f5ef4..dd7a107 100644 --- a/README.md +++ b/README.md @@ -343,6 +343,60 @@ new FinestWebView.Builder(activity) .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, R.anim.activity_close_enter, R.anim.activity_close_exit) .show(url); ``` +#javascrpit interactive# +you class must to implements Serializable: + ```java + MainActivity extends AppCompatActivity implements Serializable + ``` + +```java +builder=new FinestWebView.Builder(activity) + .titleDefault("Default Title") + .toolbarScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS) + .gradientDivider(false) + .dividerHeight(100) + .toolbarColorRes(R.color.accent) + .dividerColorRes(R.color.black_30) + .iconDefaultColorRes(R.color.accent) + .iconDisabledColorRes(R.color.gray) + .addJavascriptInterface(this)//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable + .iconPressedColorRes(R.color.black) + .progressBarHeight(DipPixelHelper.getPixel(context, 3)) + .progressBarColorRes(R.color.accent) + .backPressToClose(false) + .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, R.anim.activity_close_enter, R.anim.activity_close_exit); + builder.show(url); +``` +if yout want your js invok android,you need use @JavascriptInterface you metohd; +```java +@JavascriptInterface + public String jsToAndroid() { + runOnUiThread(new Runnable() { + @Override + public void run() { +                //这是安卓调用JS中的方法,JS中必须声明了对应androidToJs(param)函数,第二个参数为回调,如果你需要该方法的返回值就加上回调接口 +                //该方法必须在UIThread中调用。如果你是在Fragment中可以用getActivity.runOnUiThread +                builder.getWebView().evaluateJavascript("javascript:anroidToJs('Android invok JS ')", null); +            } + }); + return "JS invok Android"; + } +``` +in yout html code: +```java + + +``` ## More customizations From d01e82c41c2971089cb01828e4db704255c12f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Fri, 17 Feb 2017 09:48:05 +0800 Subject: [PATCH 04/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd7a107..65128c7 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Easily reference the library in your Android projects using this dependency in y ```java dependencies { - compile 'com.thefinestartist:finestwebview:1.2.7' + compile 'aom.andan:webview:1.0.0' } ``` From 6486868d9483bf1ce4cb795e1f893d561b975a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=88=E4=B8=91=E5=8F=88=E4=B8=8D=E8=AF=BB=E4=B9=A6?= <664996919@qq.com> Date: Fri, 17 Feb 2017 11:51:29 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E7=B1=BB=E6=97=A0=E6=B3=95Serializable=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=92=8Cjavascript=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../finestwebview/BaseJsInteration.java | 29 ++++++++++++++ .../finestwebview/FinestWebView.java | 4 +- .../finestwebview/FinestWebViewActivity.java | 5 ++- sample/src/main/AndroidManifest.xml | 1 + .../finestwebview/sample/JsInteration.java | 40 +++++++++++++++++++ .../finestwebview/sample/MainActivity.java | 16 +------- .../finestwebview/sample/TestActivity.java | 16 ++++++++ 7 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 library/src/main/java/com/thefinestartist/finestwebview/BaseJsInteration.java create mode 100644 sample/src/main/java/com/thefinestartist/finestwebview/sample/JsInteration.java create mode 100644 sample/src/main/java/com/thefinestartist/finestwebview/sample/TestActivity.java diff --git a/library/src/main/java/com/thefinestartist/finestwebview/BaseJsInteration.java b/library/src/main/java/com/thefinestartist/finestwebview/BaseJsInteration.java new file mode 100644 index 0000000..7e62b1f --- /dev/null +++ b/library/src/main/java/com/thefinestartist/finestwebview/BaseJsInteration.java @@ -0,0 +1,29 @@ +package com.thefinestartist.finestwebview; + +import android.app.Activity; +import android.webkit.WebView; + +/** + * Created by Administrator on 2017/2/17. + */ + +public class BaseJsInteration { + + protected Activity instance; + protected WebView webView; + + public void setContext(Activity activity){ + instance=activity; + } + public Activity getContext(){ + return instance; + } + + public WebView getWebView() { + return webView; + } + + public void setWebView(WebView webView) { + this.webView = webView; + } +} diff --git a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java index 9fc2992..ee53678 100644 --- a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java +++ b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java @@ -160,7 +160,7 @@ public static class Builder implements Serializable { protected Boolean webViewOffscreenPreRaster; protected String injectJavaScript; - protected Object jsInteration; + protected BaseJsInteration jsInteration; protected String mimeType; protected String encoding; @@ -193,7 +193,7 @@ public Builder addWebViewListener(WebViewListener listener) { return this; } - public Builder addJavascriptInterface(Object jsInteration) { + public Builder addJavascriptInterface(BaseJsInteration jsInteration) { this.jsInteration=jsInteration; return this; } diff --git a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java index b4484af..b57e6de 100644 --- a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java +++ b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java @@ -33,6 +33,7 @@ import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.view.animation.BaseInterpolator; import android.webkit.DownloadListener; import android.webkit.JavascriptInterface; import android.webkit.WebChromeClient; @@ -192,7 +193,7 @@ public class FinestWebViewActivity extends AppCompatActivity protected Boolean webViewOffscreenPreRaster; protected String injectJavaScript; - protected Object jsInteration; + protected BaseJsInteration jsInteration; protected String mimeType; protected String encoding; protected String data; @@ -738,6 +739,7 @@ protected void initializeViews() { } if (jsInteration != null) { settings.setJavaScriptEnabled(true); + jsInteration.setContext(this); webView.addJavascriptInterface(jsInteration, "android"); } @@ -751,6 +753,7 @@ protected void initializeViews() { // webView.setScrollbarFadingEnabled(true); // webView.setVerticalFadingEdgeEnabled(false); builder.setWebView(webView); + jsInteration.setWebView(webView); if (data != null) { webView.loadData(data, mimeType, encoding); } else if (url != null) { diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 7865d3d..b1dfc56 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -30,6 +30,7 @@ android:theme="@style/FinestWebViewTheme.Light"/> + diff --git a/sample/src/main/java/com/thefinestartist/finestwebview/sample/JsInteration.java b/sample/src/main/java/com/thefinestartist/finestwebview/sample/JsInteration.java new file mode 100644 index 0000000..5aea6f9 --- /dev/null +++ b/sample/src/main/java/com/thefinestartist/finestwebview/sample/JsInteration.java @@ -0,0 +1,40 @@ +package com.thefinestartist.finestwebview.sample; + +import android.content.Intent; +import android.webkit.JavascriptInterface; + +import com.thefinestartist.finestwebview.BaseJsInteration; +import com.thefinestartist.utils.log.L; + +import java.io.Serializable; + +/** + * Created by Administrator on 2017/2/17. + */ + +public class JsInteration extends BaseJsInteration implements Serializable { + + + @JavascriptInterface + public void toActivity() { + Intent intent = new Intent(instance, TestActivity.class); + instance.startActivity(intent); + } + + @JavascriptInterface + public String jsToAndroid() { + instance.runOnUiThread(new Runnable() { + @Override + public void run() { + //这是安卓调用JS中的方法,JS中必须声明了对应androidToJs(param)函数,第二个参数为回调,如果你需要该方法的返回值就加上回调接口 + //该方法必须在UIThread中调用。如果你是在Fragment中可以用getActivity.runOnUiThread + if(webView!=null){ + webView.evaluateJavascript("javascript:anroidToJs('Android invok JS ')", null); + }else{ + L.e("webview is null"); + } + } + }); + return "JS invok Android"; + } +} diff --git a/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java b/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java index 1820635..833456a 100644 --- a/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java +++ b/sample/src/main/java/com/thefinestartist/finestwebview/sample/MainActivity.java @@ -2,18 +2,14 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; -import android.util.Log; import android.view.Gravity; import android.view.View; import android.webkit.JavascriptInterface; -import android.webkit.WebView; import com.thefinestartist.finestwebview.FinestWebView; -import java.io.Serializable; - -public class MainActivity extends AppCompatActivity implements Serializable { +public class MainActivity extends AppCompatActivity{ private FinestWebView.Builder builder; @@ -56,8 +52,6 @@ public void onClick(View view) { .urlColorRes(R.color.bluePrimaryLight) .iconDefaultColorRes(R.color.finestWhite) .progressBarColorRes(R.color.finestWhite) -// .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 - .addJavascriptInterface(this)//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable .stringResCopiedToClipboard(R.string.copied_to_clipboard) .stringResCopiedToClipboard(R.string.copied_to_clipboard) .stringResCopiedToClipboard(R.string.copied_to_clipboard) @@ -109,12 +103,4 @@ public void run() { }); return "JS调用安卓"; } - - class JsInteration implements Serializable { - - @JavascriptInterface - public String jsToAndroid() { - return "JS调用安卓"; - } - } } diff --git a/sample/src/main/java/com/thefinestartist/finestwebview/sample/TestActivity.java b/sample/src/main/java/com/thefinestartist/finestwebview/sample/TestActivity.java new file mode 100644 index 0000000..fdc5946 --- /dev/null +++ b/sample/src/main/java/com/thefinestartist/finestwebview/sample/TestActivity.java @@ -0,0 +1,16 @@ +package com.thefinestartist.finestwebview.sample; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.FragmentActivity; + +/** + * Created by Administrator on 2017/2/17. + */ + +public class TestActivity extends FragmentActivity { + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } +} From 1181696cb9638e5f6983f1c44d64087c373a1549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Fri, 17 Feb 2017 12:48:35 +0800 Subject: [PATCH 06/12] Update README.md --- README.md | 68 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 65128c7..01d42d2 100644 --- a/README.md +++ b/README.md @@ -344,44 +344,50 @@ new FinestWebView.Builder(activity) .show(url); ``` #javascrpit interactive# -you class must to implements Serializable: - ```java - MainActivity extends AppCompatActivity implements Serializable - ``` - -```java -builder=new FinestWebView.Builder(activity) - .titleDefault("Default Title") - .toolbarScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS) - .gradientDivider(false) - .dividerHeight(100) - .toolbarColorRes(R.color.accent) - .dividerColorRes(R.color.black_30) - .iconDefaultColorRes(R.color.accent) - .iconDisabledColorRes(R.color.gray) - .addJavascriptInterface(this)//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable - .iconPressedColorRes(R.color.black) - .progressBarHeight(DipPixelHelper.getPixel(context, 3)) - .progressBarColorRes(R.color.accent) - .backPressToClose(false) - .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, R.anim.activity_close_enter, R.anim.activity_close_exit); - builder.show(url); -``` -if yout want your js invok android,you need use @JavascriptInterface you metohd; -```java -@JavascriptInterface +you need to new class like: + ```java   +public class JsInteration extends BaseJsInteration implements Serializable { + + + @JavascriptInterface + public void toActivity() { + Intent intent = new Intent(instance, TestActivity.class); + instance.startActivity(intent); + } + + @JavascriptInterface public String jsToAndroid() { - runOnUiThread(new Runnable() { + instance.runOnUiThread(new Runnable() { @Override public void run() { -                //这是安卓调用JS中的方法,JS中必须声明了对应androidToJs(param)函数,第二个参数为回调,如果你需要该方法的返回值就加上回调接口 -                //该方法必须在UIThread中调用。如果你是在Fragment中可以用getActivity.runOnUiThread -                builder.getWebView().evaluateJavascript("javascript:anroidToJs('Android invok JS ')", null); -            } + //这是安卓调用JS中的方法,JS中必须声明了对应androidToJs(param)函数,第二个参数为回调,如果你需要该方法的返回值就加上回调接口 + //该方法必须在UIThread中调用。如果你是在Fragment中可以用getActivity.runOnUiThread + if(webView!=null){ + webView.evaluateJavascript("javascript:anroidToJs('Android invok JS ')", null); + }else{ + L.e("webview is null"); + } + } }); return "JS invok Android"; } +} + ``` + +```java +new FinestWebView.Builder(this).theme(R.style.RedTheme) + .titleDefault("Bless This Stuff") + .webViewBuiltInZoomControls(true) + .webViewDisplayZoomControls(true) + .dividerHeight(0) + .gradientDivider(false) + .webViewJavaScriptEnabled(true)//设置可以和JAVA交互 + .addJavascriptInterface(new JsInteration())//JS将可以调用该类下面的@JavascriptInterface修饰的方法,此类须implements Serializable + .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, + R.anim.activity_close_enter, R.anim.activity_close_exit) + .show("http://test.2000new.com/nyd/water/index.html"); ``` + in yout html code: ```java From e86758578fd41de618d5126f30f744895781e1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Fri, 17 Feb 2017 12:55:55 +0800 Subject: [PATCH 07/12] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 01d42d2..bdd1731 100644 --- a/README.md +++ b/README.md @@ -344,11 +344,9 @@ new FinestWebView.Builder(activity) .show(url); ``` #javascrpit interactive# -you need to new class like: +you need to new a class like ```java   public class JsInteration extends BaseJsInteration implements Serializable { - - @JavascriptInterface public void toActivity() { Intent intent = new Intent(instance, TestActivity.class); From 80301bf7ae33a6c159aa4308525bb8f35541c56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Fri, 17 Feb 2017 13:55:09 +0800 Subject: [PATCH 08/12] Update README.md --- README.md | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index bdd1731..f359903 100644 --- a/README.md +++ b/README.md @@ -344,33 +344,33 @@ new FinestWebView.Builder(activity) .show(url); ``` #javascrpit interactive# -you need to new a class like - ```java   -public class JsInteration extends BaseJsInteration implements Serializable { - @JavascriptInterface - public void toActivity() { - Intent intent = new Intent(instance, TestActivity.class); - instance.startActivity(intent); - } - - @JavascriptInterface - public String jsToAndroid() { - instance.runOnUiThread(new Runnable() { - @Override - public void run() { - //这是安卓调用JS中的方法,JS中必须声明了对应androidToJs(param)函数,第二个参数为回调,如果你需要该方法的返回值就加上回调接口 - //该方法必须在UIThread中调用。如果你是在Fragment中可以用getActivity.runOnUiThread - if(webView!=null){ - webView.evaluateJavascript("javascript:anroidToJs('Android invok JS ')", null); - }else{ - L.e("webview is null"); - } - } - }); - return "JS invok Android"; - } -} - ``` +  + public class JsInteration extends BaseJsInteration implements Serializable { + @JavascriptInterface + public void toActivity() { + Intent intent = new Intent(instance, TestActivity.class); + instance.startActivity(intent); + } + + @JavascriptInterface + public String jsToAndroid() { + instance.runOnUiThread(new Runnable() { + @Override + public void run() { + //这是安卓调用JS中的方法,JS中必须声明了对应androidToJs(param)函数, + //第二个参数为回调,如果你需要该方法的返回值就加上回调接口 + //该方法必须在UIThread中调用。如果你是在Fragment中可以用getActivity.runOnUiThread + if(webView!=null){ + webView.evaluateJavascript("javascript:anroidToJs('Android invok JS ')", null); + }else{ + L.e("webview is null"); + } + } + }); + return "JS invok Android"; + } + } + ```java new FinestWebView.Builder(this).theme(R.style.RedTheme) From da67669ed39adcd49420d86eefcb9844328d4969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Fri, 17 Feb 2017 14:10:23 +0800 Subject: [PATCH 09/12] Update README.md --- README.md | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/README.md b/README.md index f359903..0c3c6e4 100644 --- a/README.md +++ b/README.md @@ -344,32 +344,7 @@ new FinestWebView.Builder(activity) .show(url); ``` #javascrpit interactive# -  - public class JsInteration extends BaseJsInteration implements Serializable { - @JavascriptInterface - public void toActivity() { - Intent intent = new Intent(instance, TestActivity.class); - instance.startActivity(intent); - } - - @JavascriptInterface - public String jsToAndroid() { - instance.runOnUiThread(new Runnable() { - @Override - public void run() { - //这是安卓调用JS中的方法,JS中必须声明了对应androidToJs(param)函数, - //第二个参数为回调,如果你需要该方法的返回值就加上回调接口 - //该方法必须在UIThread中调用。如果你是在Fragment中可以用getActivity.runOnUiThread - if(webView!=null){ - webView.evaluateJavascript("javascript:anroidToJs('Android invok JS ')", null); - }else{ - L.e("webview is null"); - } - } - }); - return "JS invok Android"; - } - } +**important**you need to new a class like [JsInteration.java](sample/src/main/java/com/thefinestartist/finestwebview/sample/JsInteration.java) ```java From 254b3aa5fcf4ea137759bf94ccf7c674a9371b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Fri, 17 Feb 2017 14:12:14 +0800 Subject: [PATCH 10/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c3c6e4..dfa01d7 100644 --- a/README.md +++ b/README.md @@ -344,7 +344,7 @@ new FinestWebView.Builder(activity) .show(url); ``` #javascrpit interactive# -**important**you need to new a class like [JsInteration.java](sample/src/main/java/com/thefinestartist/finestwebview/sample/JsInteration.java) +**important** you need to new a class like [JsInteration.java](sample/src/main/java/com/thefinestartist/finestwebview/sample/JsInteration.java) ```java From 37e71769914041bdff43581bfee63b41b7bd0b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=88=E4=B8=91=E5=8F=88=E4=B8=8D=E8=AF=BB=E4=B9=A6?= <664996919@qq.com> Date: Wed, 22 Feb 2017 10:16:05 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0.addJavascriptInterface(new=20JsInteration())=E5=B0=B1?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thefinestartist/finestwebview/FinestWebViewActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java index b57e6de..283dcd8 100644 --- a/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java +++ b/library/src/main/java/com/thefinestartist/finestwebview/FinestWebViewActivity.java @@ -741,6 +741,7 @@ protected void initializeViews() { settings.setJavaScriptEnabled(true); jsInteration.setContext(this); webView.addJavascriptInterface(jsInteration, "android"); + jsInteration.setWebView(webView); } // // Other webview options @@ -753,7 +754,6 @@ protected void initializeViews() { // webView.setScrollbarFadingEnabled(true); // webView.setVerticalFadingEdgeEnabled(false); builder.setWebView(webView); - jsInteration.setWebView(webView); if (data != null) { webView.loadData(data, mimeType, encoding); } else if (url != null) { From d926d8ab4f660732dfea7ca1e9868e4d47093e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=97=E6=B7=A1?= <664996919@qq.com> Date: Wed, 22 Feb 2017 10:56:08 +0800 Subject: [PATCH 12/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfa01d7..96aeed9 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Easily reference the library in your Android projects using this dependency in y ```java dependencies { - compile 'aom.andan:webview:1.0.0' + compile 'aom.andan:webview:1.2.1' } ```