- Builder pattern
- Material design & Pre-made icons
- Webview listeners
- Custom themes & Custom transition animations
- Support collapsing toolbar & contextual actionbar
- SwipeRefreshLayout & Progressbar
- Device rotation
- Gradient divider
- Custom typeface & translation
- Supports Right to Left

You can download the latest sample APK from this repo here: sample-release.apk
It's also on Google Play:

Easily reference the library in your Android projects using this dependency in your module's build.gradle file.
dependencies {
compile'com.thefinestartist:finestwebview:1.2.7'
}FinestWebView is basically and Android activity with webview, toolbar and etc.
You have to add FinestWebViewActivity in your AndroidManifest.xml
<uses-permissionandroid:name="android.permission.INTERNET" />
<activityandroid:name="com.thefinestartist.finestwebview.FinestWebViewActivity"android:configChanges="keyboardHidden|orientation|screenSize"android:screenOrientation="sensor"android:theme="@style/FinestWebViewTheme.Light" />newFinestWebView.Builder(activity).show(url);You can use your own Theme for FinestWebView. If you want to use pre-defined theme, use android:theme="@style/FinestWebViewTheme" or android:theme="@style/FinestWebViewTheme.Fullscreen"
<stylename="AppTheme.NoActionBar"parent="Theme.AppCompat.Light.NoActionBar">
<itemname="colorPrimary">@color/primary</item>
<itemname="colorPrimaryDark">@color/primary_dark</item>
<itemname="colorAccent">@color/accent</item>
<itemname="android:textColorPrimary">@color/primary_text</item>
<itemname="android:textColorSecondary">@color/secondary_text</item>
<itemname="windowActionModeOverlay">true</item>
</style><activityandroid:name="com.thefinestartist.finestwebview.FinestWebViewActivity"android:theme="@style/AppTheme.NoActionBar" />Builder(@NonNullActivityactivity);
// If you use context instead of activity, FinestWebView enter animation won't workBuilder(@NonNullContextcontext);load(@StringResintdataRes);
load(Stringdata);
load(Stringdata, StringmimeType, Stringencoding);
show(@StringResinturlRes);
show(@NonNullStringurl);setWebViewListener(WebViewListenerlistener);
addWebViewListener(WebViewListenerlistener);
removeWebViewListener(WebViewListenerlistener);rtl(booleanrtl);theme(@StyleResinttheme);statusBarColor(@ColorIntintcolor);
statusBarColorRes(@ColorResintcolor);toolbarColor(@ColorIntintcolor);
toolbarColorRes(@ColorResintcolor);
toolbarScrollFlags(@ScrollFlagsintflags);iconDefaultColor(@ColorIntintcolor);
iconDefaultColorRes(@ColorResintcolor);
iconDisabledColor(@ColorIntintcolor);
iconDisabledColorRes(@ColorResintcolorRes);
iconPressedColor(@ColorIntintcolor);
iconPressedColorRes(@ColorResintcolorRes);
iconSelector(@DrawableResintselectorRes);showIconClose(booleanshowIconClose);
disableIconClose(booleandisableIconClose);
showIconBack(booleanshowIconBack);
disableIconBack(booleandisableIconBack);
showIconForward(booleanshowIconForward);
disableIconForward(booleandisableIconForward);
showIconMenu(booleanshowIconMenu);
disableIconMenu(booleandisableIconMenu);showSwipeRefreshLayout(booleanshowSwipeRefreshLayout);
swipeRefreshColor(@ColorIntintcolor);
swipeRefreshColorRes(@ColorResintcolorRes);
swipeRefreshColors(int[] colors);
swipeRefreshColorsRes(@ArrayResintcolorsRes);showDivider(booleanshowDivider);
gradientDivider(booleangradientDivider);
dividerColor(@ColorIntintcolor);
dividerColorRes(@ColorResintcolorRes);
dividerHeight(floatheight);
dividerHeight(intheight);
dividerHeightRes(@DimenResintheight);showProgressBar(booleanshowProgressBar);
progressBarColor(@ColorIntintcolor);
progressBarColorRes(@ColorResintcolorRes);
progressBarHeight(floatheight);
progressBarHeight(intheight);
progressBarHeightRes(@DimenResintheight);
progressBarPosition(@NonNullPositionposition);titleDefault(@NonNullStringtitle);
titleDefaultRes(@StringResintstringRes);
updateTitleFromHtml(booleanupdateTitleFromHtml);
titleSize(floattitleSize);
titleSize(inttitleSize);
titleSizeRes(@DimenResinttitleSize);
titleFont(StringtitleFont);
titleColor(@ColorIntintcolor);
titleColorRes(@ColorResintcolorRes);showUrl(booleanshowUrl);
urlSize(floaturlSize);
urlSize(inturlSize);
urlSizeRes(@DimenResinturlSize);
urlFont(StringurlFont);
urlColor(@ColorIntintcolor);
urlColorRes(@ColorResintcolorRes);menuColor(@ColorIntintcolor);
menuColorRes(@ColorResintcolorRes);
menuDropShadowColor(@ColorIntintcolor);
menuDropShadowColorRes(@ColorResintcolorRes);
menuDropShadowSize(floatmenuDropShadowSize);
menuDropShadowSize(intmenuDropShadowSize);
menuDropShadowSizeRes(@DimenResintmenuDropShadowSize);
menuSelector(@DrawableResintselectorRes);
menuTextSize(floatmenuTextSize);
menuTextSize(intmenuTextSize);
menuTextSizeRes(@DimenResintmenuTextSize);
menuTextFont(StringmenuTextFont);
menuTextColor(@ColorIntintcolor);
menuTextColorRes(@ColorResintcolorRes);
menuTextGravity(intgravity);
menuTextPaddingLeft(floatmenuTextPaddingLeft);
menuTextPaddingLeft(intmenuTextPaddingLeft);
menuTextPaddingLeftRes(@DimenResintmenuTextPaddingLeft);
menuTextPaddingRight(floatmenuTextPaddingRight);
menuTextPaddingRight(intmenuTextPaddingRight);
menuTextPaddingRightRes(@DimenResintmenuTextPaddingRight);
showMenuRefresh(booleanshowMenuRefresh);
stringResRefresh(@StringResintstringResRefresh);
showMenuFind(booleanshowMenuFind);
stringResFind(@StringResintstringResFind);
showMenuShareVia(booleanshowMenuShareVia);
stringResShareVia(@StringResintstringResShareVia);
showMenuCopyLink(booleanshowMenuCopyLink);
stringResCopyLink(@StringResintstringResCopyLink);
showMenuOpenWith(booleanshowMenuOpenWith);
stringResOpenWith(@StringResintstringResOpenWith);setCustomAnimations(@AnimResintanimationOpenEnter,
@AnimRes int animationOpenExit,
@AnimRes int animationCloseEnter,
@AnimRes int animationCloseExit)
backPressToClose(booleanbackPressToClose);
stringResCopiedToClipboard(@StringRes int stringResCopiedToClipboard);webViewSupportZoom(booleanwebViewSupportZoom);
webViewMediaPlaybackRequiresUserGesture (booleanwebViewMediaPlaybackRequiresUserGesture);
webViewBuiltInZoomControls (booleanwebViewBuiltInZoomControls);
webViewDisplayZoomControls (booleanwebViewDisplayZoomControls);
webViewAllowFileAccess (booleanwebViewAllowFileAccess);
webViewAllowContentAccess (booleanwebViewAllowContentAccess);
webViewLoadWithOverviewMode (booleanwebViewLoadWithOverviewMode);
webViewSaveFormData (booleanwebViewSaveFormData);
webViewTextZoom (intwebViewTextZoom);
webViewUseWideViewPort (booleanwebViewUseWideViewPort);
webViewSupportMultipleWindows (booleanwebViewSupportMultipleWindows);
webViewLayoutAlgorithm (WebSettings.LayoutAlgorithmwebViewLayoutAlgorithm);
webViewStandardFontFamily (StringwebViewStandardFontFamily);
webViewFixedFontFamily (StringwebViewFixedFontFamily);
webViewSansSerifFontFamily (StringwebViewSansSerifFontFamily);
webViewSerifFontFamily (StringwebViewSerifFontFamily);
webViewCursiveFontFamily (StringwebViewCursiveFontFamily);
webViewFantasyFontFamily (StringwebViewFantasyFontFamily);
webViewMinimumFontSize (intwebViewMinimumFontSize);
webViewMinimumLogicalFontSize (intwebViewMinimumLogicalFontSize);
webViewDefaultFontSize (intwebViewDefaultFontSize);
webViewDefaultFixedFontSize (intwebViewDefaultFixedFontSize);
webViewLoadsImagesAutomatically (booleanwebViewLoadsImagesAutomatically);
webViewBlockNetworkImage (booleanwebViewBlockNetworkImage);
webViewBlockNetworkLoads (booleanwebViewBlockNetworkLoads);
webViewJavaScriptEnabled (booleanwebViewJavaScriptEnabled);
webViewAllowUniversalAccessFromFileURLs (booleanwebViewAllowUniversalAccessFromFileURLs);
webViewAllowFileAccessFromFileURLs (booleanwebViewAllowFileAccessFromFileURLs);
webViewGeolocationDatabasePath (StringwebViewGeolocationDatabasePath);
webViewAppCacheEnabled (booleanwebViewAppCacheEnabled);
webViewAppCachePath (StringwebViewAppCachePath);
webViewDatabaseEnabled (booleanwebViewDatabaseEnabled);
webViewDomStorageEnabled (booleanwebViewDomStorageEnabled);
webViewGeolocationEnabled (booleanwebViewGeolocationEnabled);
webViewJavaScriptCanOpenWindowsAutomatically (booleanwebViewJavaScriptCanOpenWindowsAutomatically);
webViewDefaultTextEncodingName (StringwebViewDefaultTextEncodingName);
webViewUserAgentString (StringwebViewUserAgentString);
webViewNeedInitialFocus (booleanwebViewNeedInitialFocus);
webViewCacheMode (intwebViewCacheMode);
webViewMixedContentMode (intwebViewMixedContentMode);
webViewOffscreenPreRaster (booleanwebViewOffscreenPreRaster);
injectJavaScript(StringinjectJavaScript);newFinestWebView.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)
.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)
.show(url);FinestWebView has its own listeners to listen event from WebView
publicvoidonProgressChanged(intprogress);
publicvoidonReceivedTitle(Stringtitle);
publicvoidonReceivedTouchIconUrl(Stringurl, booleanprecomposed);
publicvoidonPageStarted(Stringurl);
publicvoidonPageFinished(Stringurl);
publicvoidonLoadResource(Stringurl);
publicvoidonPageCommitVisible(Stringurl);
publicvoidonDownloadStart(Stringurl, StringuserAgent, StringcontentDisposition, StringmimeType, longcontentLength)Status bar color will be set as colorPrimaryDark of FinestWebViewActivity's theme.
Toolbar color will be set as colorPrimary of FinestWebViewActivity's theme.
But, you can override theses settings using builder option statusBarColor, statusBarColorRes, toolbarColor, toolbarColorRes.
newFinestWebView.Builder(activity)
.toolbarScrollFlags(0) // By sending as 0, toolbar collapsing will be disabled
.show(url);If you enable BuiltInZoomControls webViewBuiltInZoomControls(true), it will automatically disable toolbar collapsing.
<stylename="AppTheme.NoActionBar.FullScreen"parent="AppTheme.NoActionBar">
<itemname="android:windowContentOverlay">@null</item>
<itemname="android:windowFullscreen">true</item>
</style>
<activityandroid:name="com.thefinestartist.finestwebview.FinestWebViewActivity"android:theme="@style/AppTheme.NoActionBar.FullScreen" />You can use some pre-defined animations from this library or your own animations.
newFinestWebView.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);Pre-defined animation sets
.setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit, R.anim.activity_close_enter, R.anim.activity_close_exit)
.setCustomAnimations(R.anim.fragment_open_enter, R.anim.fragment_open_exit, R.anim.fragment_close_enter, R.anim.fragment_close_exit)
.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)Use configChange, screenOrientation to customize your orientation options
<activityandroid:name="com.thefinestartist.finestwebview.FinestWebViewActivity"android:configChanges="keyboardHidden|orientation|screenSize"android:screenOrientation="sensor"android:theme="@style/FinestWebViewTheme" />You can make your divider gradient. If you do, webview will be under the gradient. If you disable gradient divider, webview will be below the divider.
newFinestWebView.Builder(activity)
.gradientDivider(false)
.show(url);You can use your own typeface for title, url, and menus. You have to add your font file in assets/fonts folder.
newFinestWebView.Builder(activity)
.titleFont("Roboto-Medium.ttf")
.urlFont("Roboto-Regular.ttf")
.menuTextFont("Roboto-Medium.ttf")
.show(url);You can use your own String resources to translate strings.
newFinestWebView.Builder(activity)
.stringResCopiedToClipboard(R.string.copied_to_clipboard)
.stringResRefresh(R.string.refresh)
.stringResShareVia(R.string.share_via)
.stringResCopyLink(R.string.copy_link)
.stringResOpenWith(R.string.open_with)
.show(url);You can support right to left by setting android:supportsRtl="true" in AndroidManifest.xml or rtl(true).
<application
...
android:supportsRtl="true">
</application>newFinestWebView.Builder(activity)
.rtl(true)
.show(url);You can force WebView to show in desktop mode by setting webViewUserAgentString("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0").
- User Interface Design
- Graphic Design
The MIT License (MIT)
Copyright (c) 2013 TheFinestArtist
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


