|
13 | 13 | import android.support.annotation.StyleRes; |
14 | 14 | import android.support.design.widget.AppBarLayout.LayoutParams.ScrollFlags; |
15 | 15 | import android.support.v4.content.ContextCompat; |
| 16 | +import android.webkit.WebSettings; |
16 | 17 |
|
17 | 18 | import com.thefinestartist.finestwebview.enums.Position; |
18 | 19 |
|
@@ -104,15 +105,47 @@ public static class Builder implements Serializable { |
104 | 105 | protected Boolean backPressToClose; |
105 | 106 | protected Integer stringResCopiedToClipboard; |
106 | 107 |
|
107 | | - protected Boolean webViewJavaScriptEnabled; |
108 | | - protected Boolean webViewAppCacheEnabled; |
| 108 | + protected Boolean webViewSupportZoom; |
| 109 | + protected Boolean webViewMediaPlaybackRequiresUserGesture; |
| 110 | + protected Boolean webViewBuiltInZoomControls; |
| 111 | + protected Boolean webViewDisplayZoomControls; |
109 | 112 | protected Boolean webViewAllowFileAccess; |
110 | | - protected Boolean webViewUseWideViewPort; |
| 113 | + protected Boolean webViewAllowContentAccess; |
111 | 114 | protected Boolean webViewLoadWithOverviewMode; |
| 115 | + protected Boolean webViewSaveFormData; |
| 116 | + protected Integer webViewTextZoom; |
| 117 | + protected Boolean webViewUseWideViewPort; |
| 118 | + protected Boolean webViewSupportMultipleWindows; |
| 119 | + protected WebSettings.LayoutAlgorithm webViewLayoutAlgorithm; |
| 120 | + protected String webViewStandardFontFamily; |
| 121 | + protected String webViewFixedFontFamily; |
| 122 | + protected String webViewSansSerifFontFamily; |
| 123 | + protected String webViewSerifFontFamily; |
| 124 | + protected String webViewCursiveFontFamily; |
| 125 | + protected String webViewFantasyFontFamily; |
| 126 | + protected Integer webViewMinimumFontSize; |
| 127 | + protected Integer webViewMinimumLogicalFontSize; |
| 128 | + protected Integer webViewDefaultFontSize; |
| 129 | + protected Integer webViewDefaultFixedFontSize; |
| 130 | + protected Boolean webViewLoadsImagesAutomatically; |
| 131 | + protected Boolean webViewBlockNetworkImage; |
| 132 | + protected Boolean webViewBlockNetworkLoads; |
| 133 | + protected Boolean webViewJavaScriptEnabled; |
| 134 | + protected Boolean webViewAllowUniversalAccessFromFileURLs; |
| 135 | + protected Boolean webViewAllowFileAccessFromFileURLs; |
| 136 | + protected String webViewGeolocationDatabasePath; |
| 137 | + protected Boolean webViewAppCacheEnabled; |
| 138 | + protected String webViewAppCachePath; |
| 139 | + protected Boolean webViewDatabaseEnabled; |
112 | 140 | protected Boolean webViewDomStorageEnabled; |
113 | | - protected Boolean webViewBuiltInZoomControls; |
114 | | - protected Boolean webViewDisplayZoomControls; |
115 | | - protected Boolean webViewDesktopMode; |
| 141 | + protected Boolean webViewGeolocationEnabled; |
| 142 | + protected Boolean webViewJavaScriptCanOpenWindowsAutomatically; |
| 143 | + protected String webViewDefaultTextEncodingName; |
| 144 | + protected String webViewUserAgentString; |
| 145 | + protected Boolean webViewNeedInitialFocus; |
| 146 | + protected Integer webViewCacheMode; |
| 147 | + protected Integer webViewMixedContentMode; |
| 148 | + protected Boolean webViewOffscreenPreRaster; |
116 | 149 |
|
117 | 150 | protected String injectJavaScript; |
118 | 151 |
|
@@ -586,51 +619,219 @@ public Builder stringResCopiedToClipboard(@StringRes int stringResCopiedToClipbo |
586 | 619 | return this; |
587 | 620 | } |
588 | 621 |
|
589 | | - public Builder webViewJavaScriptEnabled(boolean webViewJavaScriptEnabled) { |
590 | | - this.webViewJavaScriptEnabled = webViewJavaScriptEnabled; |
| 622 | + public Builder webViewSupportZoom(boolean webViewSupportZoom) { |
| 623 | + this.webViewSupportZoom = webViewSupportZoom; |
591 | 624 | return this; |
592 | 625 | } |
593 | 626 |
|
594 | | - public Builder webViewAppCacheEnabled(boolean webViewAppCacheEnabled) { |
595 | | - this.webViewAppCacheEnabled = webViewAppCacheEnabled; |
| 627 | + public Builder webViewMediaPlaybackRequiresUserGesture (boolean webViewMediaPlaybackRequiresUserGesture) { |
| 628 | + this.webViewMediaPlaybackRequiresUserGesture = webViewMediaPlaybackRequiresUserGesture; |
| 629 | + return this; |
| 630 | + } |
| 631 | + |
| 632 | + public Builder webViewBuiltInZoomControls (boolean webViewBuiltInZoomControls) { |
| 633 | + this.webViewBuiltInZoomControls = webViewBuiltInZoomControls; |
596 | 634 | return this; |
597 | 635 | } |
598 | 636 |
|
599 | | - public Builder webViewAllowFileAccess(boolean webViewAllowFileAccess) { |
| 637 | + public Builder webViewDisplayZoomControls (boolean webViewDisplayZoomControls) { |
| 638 | + this.webViewDisplayZoomControls = webViewDisplayZoomControls; |
| 639 | + return this; |
| 640 | + } |
| 641 | + |
| 642 | + public Builder webViewAllowFileAccess (boolean webViewAllowFileAccess) { |
600 | 643 | this.webViewAllowFileAccess = webViewAllowFileAccess; |
601 | 644 | return this; |
602 | 645 | } |
603 | 646 |
|
604 | | - public Builder webViewUseWideViewPort(boolean webViewUseWideViewPort) { |
605 | | - this.webViewUseWideViewPort = webViewUseWideViewPort; |
| 647 | + public Builder webViewAllowContentAccess (boolean webViewAllowContentAccess) { |
| 648 | + this.webViewAllowContentAccess = webViewAllowContentAccess; |
606 | 649 | return this; |
607 | 650 | } |
608 | 651 |
|
609 | | - public Builder webViewLoadWithOverviewMode(boolean webViewLoadWithOverviewMode) { |
| 652 | + public Builder webViewLoadWithOverviewMode (boolean webViewLoadWithOverviewMode) { |
610 | 653 | this.webViewLoadWithOverviewMode = webViewLoadWithOverviewMode; |
611 | 654 | return this; |
612 | 655 | } |
613 | 656 |
|
614 | | - public Builder webViewDomStorageEnabled(boolean webViewDomStorageEnabled) { |
| 657 | + public Builder webViewSaveFormData (boolean webViewSaveFormData) { |
| 658 | + this.webViewSaveFormData = webViewSaveFormData; |
| 659 | + return this; |
| 660 | + } |
| 661 | + |
| 662 | + public Builder webViewTextZoom (int webViewTextZoom) { |
| 663 | + this.webViewTextZoom = webViewTextZoom; |
| 664 | + return this; |
| 665 | + } |
| 666 | + |
| 667 | + public Builder webViewUseWideViewPort (boolean webViewUseWideViewPort) { |
| 668 | + this.webViewUseWideViewPort = webViewUseWideViewPort; |
| 669 | + return this; |
| 670 | + } |
| 671 | + |
| 672 | + public Builder webViewSupportMultipleWindows (boolean webViewSupportMultipleWindows) { |
| 673 | + this.webViewSupportMultipleWindows = webViewSupportMultipleWindows; |
| 674 | + return this; |
| 675 | + } |
| 676 | + |
| 677 | + public Builder webViewLayoutAlgorithm (WebSettings.LayoutAlgorithm webViewLayoutAlgorithm) { |
| 678 | + this.webViewLayoutAlgorithm = webViewLayoutAlgorithm; |
| 679 | + return this; |
| 680 | + } |
| 681 | + |
| 682 | + public Builder webViewStandardFontFamily (String webViewStandardFontFamily) { |
| 683 | + this.webViewStandardFontFamily = webViewStandardFontFamily; |
| 684 | + return this; |
| 685 | + } |
| 686 | + |
| 687 | + public Builder webViewFixedFontFamily (String webViewFixedFontFamily) { |
| 688 | + this.webViewFixedFontFamily = webViewFixedFontFamily; |
| 689 | + return this; |
| 690 | + } |
| 691 | + |
| 692 | + public Builder webViewSansSerifFontFamily (String webViewSansSerifFontFamily) { |
| 693 | + this.webViewSansSerifFontFamily = webViewSansSerifFontFamily; |
| 694 | + return this; |
| 695 | + } |
| 696 | + |
| 697 | + public Builder webViewSerifFontFamily (String webViewSerifFontFamily) { |
| 698 | + this.webViewSerifFontFamily = webViewSerifFontFamily; |
| 699 | + return this; |
| 700 | + } |
| 701 | + |
| 702 | + public Builder webViewCursiveFontFamily (String webViewCursiveFontFamily) { |
| 703 | + this.webViewCursiveFontFamily = webViewCursiveFontFamily; |
| 704 | + return this; |
| 705 | + } |
| 706 | + |
| 707 | + public Builder webViewFantasyFontFamily (String webViewFantasyFontFamily) { |
| 708 | + this.webViewFantasyFontFamily = webViewFantasyFontFamily; |
| 709 | + return this; |
| 710 | + } |
| 711 | + |
| 712 | + public Builder webViewMinimumFontSize (int webViewMinimumFontSize) { |
| 713 | + this.webViewMinimumFontSize = webViewMinimumFontSize; |
| 714 | + return this; |
| 715 | + } |
| 716 | + |
| 717 | + public Builder webViewMinimumLogicalFontSize (int webViewMinimumLogicalFontSize) { |
| 718 | + this.webViewMinimumLogicalFontSize = webViewMinimumLogicalFontSize; |
| 719 | + return this; |
| 720 | + } |
| 721 | + |
| 722 | + public Builder webViewDefaultFontSize (int webViewDefaultFontSize) { |
| 723 | + this.webViewDefaultFontSize = webViewDefaultFontSize; |
| 724 | + return this; |
| 725 | + } |
| 726 | + |
| 727 | + public Builder webViewDefaultFixedFontSize (int webViewDefaultFixedFontSize) { |
| 728 | + this.webViewDefaultFixedFontSize = webViewDefaultFixedFontSize; |
| 729 | + return this; |
| 730 | + } |
| 731 | + |
| 732 | + public Builder webViewLoadsImagesAutomatically (boolean webViewLoadsImagesAutomatically) { |
| 733 | + this.webViewLoadsImagesAutomatically = webViewLoadsImagesAutomatically; |
| 734 | + return this; |
| 735 | + } |
| 736 | + |
| 737 | + public Builder webViewBlockNetworkImage (boolean webViewBlockNetworkImage) { |
| 738 | + this.webViewBlockNetworkImage = webViewBlockNetworkImage; |
| 739 | + return this; |
| 740 | + } |
| 741 | + |
| 742 | + public Builder webViewBlockNetworkLoads (boolean webViewBlockNetworkLoads) { |
| 743 | + this.webViewBlockNetworkLoads = webViewBlockNetworkLoads; |
| 744 | + return this; |
| 745 | + } |
| 746 | + |
| 747 | + public Builder webViewJavaScriptEnabled (boolean webViewJavaScriptEnabled) { |
| 748 | + this.webViewJavaScriptEnabled = webViewJavaScriptEnabled; |
| 749 | + return this; |
| 750 | + } |
| 751 | + |
| 752 | + public Builder webViewAllowUniversalAccessFromFileURLs (boolean webViewAllowUniversalAccessFromFileURLs) { |
| 753 | + this.webViewAllowUniversalAccessFromFileURLs = webViewAllowUniversalAccessFromFileURLs; |
| 754 | + return this; |
| 755 | + } |
| 756 | + |
| 757 | + public Builder webViewAllowFileAccessFromFileURLs (boolean webViewAllowFileAccessFromFileURLs) { |
| 758 | + this.webViewAllowFileAccessFromFileURLs = webViewAllowFileAccessFromFileURLs; |
| 759 | + return this; |
| 760 | + } |
| 761 | + |
| 762 | + public Builder webViewGeolocationDatabasePath (String webViewGeolocationDatabasePath) { |
| 763 | + this.webViewGeolocationDatabasePath = webViewGeolocationDatabasePath; |
| 764 | + return this; |
| 765 | + } |
| 766 | + |
| 767 | + public Builder webViewAppCacheEnabled (boolean webViewAppCacheEnabled) { |
| 768 | + this.webViewAppCacheEnabled = webViewAppCacheEnabled; |
| 769 | + return this; |
| 770 | + } |
| 771 | + |
| 772 | + public Builder webViewAppCachePath (String webViewAppCachePath) { |
| 773 | + this.webViewAppCachePath = webViewAppCachePath; |
| 774 | + return this; |
| 775 | + } |
| 776 | + |
| 777 | + public Builder webViewDatabaseEnabled (boolean webViewDatabaseEnabled) { |
| 778 | + this.webViewDatabaseEnabled = webViewDatabaseEnabled; |
| 779 | + return this; |
| 780 | + } |
| 781 | + |
| 782 | + public Builder webViewDomStorageEnabled (boolean webViewDomStorageEnabled) { |
615 | 783 | this.webViewDomStorageEnabled = webViewDomStorageEnabled; |
616 | 784 | return this; |
617 | 785 | } |
618 | 786 |
|
619 | | - public Builder webViewBuiltInZoomControls(boolean webViewBuiltInZoomControls) { |
620 | | - this.webViewBuiltInZoomControls = webViewBuiltInZoomControls; |
| 787 | + public Builder webViewGeolocationEnabled (boolean webViewGeolocationEnabled) { |
| 788 | + this.webViewGeolocationEnabled = webViewGeolocationEnabled; |
621 | 789 | return this; |
622 | 790 | } |
623 | 791 |
|
624 | | - public Builder webViewDisplayZoomControls(boolean webViewDisplayZoomControls) { |
625 | | - this.webViewDisplayZoomControls = webViewDisplayZoomControls; |
| 792 | + public Builder webViewJavaScriptCanOpenWindowsAutomatically (boolean webViewJavaScriptCanOpenWindowsAutomatically) { |
| 793 | + this.webViewJavaScriptCanOpenWindowsAutomatically = webViewJavaScriptCanOpenWindowsAutomatically; |
626 | 794 | return this; |
627 | 795 | } |
628 | 796 |
|
629 | | - public Builder webViewDesktopMode(boolean webViewDesktopMode) { |
630 | | - this.webViewDesktopMode = webViewDesktopMode; |
| 797 | + public Builder webViewDefaultTextEncodingName (String webViewDefaultTextEncodingName) { |
| 798 | + this.webViewDefaultTextEncodingName = webViewDefaultTextEncodingName; |
| 799 | + return this; |
| 800 | + } |
| 801 | + |
| 802 | + public Builder webViewUserAgentString (String webViewUserAgentString) { |
| 803 | + this.webViewUserAgentString = webViewUserAgentString; |
| 804 | + return this; |
| 805 | + } |
| 806 | + |
| 807 | + public Builder webViewNeedInitialFocus (boolean webViewNeedInitialFocus) { |
| 808 | + this.webViewNeedInitialFocus = webViewNeedInitialFocus; |
| 809 | + return this; |
| 810 | + } |
| 811 | + |
| 812 | + public Builder webViewCacheMode (int webViewCacheMode) { |
| 813 | + this.webViewCacheMode = webViewCacheMode; |
631 | 814 | return this; |
632 | 815 | } |
633 | 816 |
|
| 817 | + public Builder webViewMixedContentMode (int webViewMixedContentMode) { |
| 818 | + this.webViewMixedContentMode = webViewMixedContentMode; |
| 819 | + return this; |
| 820 | + } |
| 821 | + |
| 822 | + public Builder webViewOffscreenPreRaster (boolean webViewOffscreenPreRaster) { |
| 823 | + this.webViewOffscreenPreRaster = webViewOffscreenPreRaster; |
| 824 | + return this; |
| 825 | + } |
| 826 | + |
| 827 | + /** |
| 828 | + * @deprecated As of release 1.1.1, replaced by {@link #webViewUserAgentString(String)} |
| 829 | + * Use setUserAgentString("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0") instead |
| 830 | + */ |
| 831 | + public Builder webViewDesktopMode(boolean webViewDesktopMode) { |
| 832 | + return webViewUserAgentString("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0"); |
| 833 | + } |
| 834 | + |
634 | 835 | public Builder injectJavaScript(String injectJavaScript) { |
635 | 836 | this.injectJavaScript = injectJavaScript; |
636 | 837 | return this; |
|
0 commit comments