2121
2222** KAlertDialog** is a beautiful, modern, customizable Material-style AlertDialog library for Android.
2323
24- It helps Android developers create professional dialogs such as success dialogs, error dialogs, warning dialogs, progress dialogs, input dialogs, custom image dialogs, URL image dialogs, and custom view dialogs with simple Java code.
24+ It helps Android developers create professional dialogs such as success dialogs, error dialogs, warning dialogs, progress dialogs, input dialogs, custom image dialogs, URL image dialogs, custom view dialogs, and WebView dialogs with simple Java code.
2525
2626![ Maven Central] ( https://img.shields.io/maven-central/v/io.github.tutorialsandroid/kalertdialog )
2727![ API] ( https://img.shields.io/badge/API-23%2B-brightgreen.svg?style=flat )
@@ -32,38 +32,21 @@ It helps Android developers create professional dialogs such as success dialogs,
3232
3333## Latest Release
3434
35- ### Version ` 21.0 .0 `
35+ ### Version ` 21.1 .0 `
3636
37- Released on ** 21 -05-2026**
37+ Released on ** 28 -05-2026**
3838
3939### Changelog
4040
41- - Added option to set font weight for title and content.
42- - Added modern style presets.
43- - Added dialog corner radius customization.
44- - Added dialog elevation customization.
45- - Added dialog dim amount customization.
46- - Added input validation support.
47- - Added input max length support.
48- - Added input type support.
49- - Added custom view dialog support.
50- - Added button text size customization.
51- - Added button font weight customization.
52- - Added button all-caps control.
53- - Added button icon support.
54- - Added URL image placeholder support.
55- - Added URL image error drawable support.
56- - Added progress shortcut methods.
57- - Added show and dismiss callback APIs.
58- - Added support for custom button drawables.
59- - Updated ProgressX library to latest version.
60- - Updated compileSdk and targetSdk to 37 across the project.
61- - Increased minSdkVersion to 23.
62- - Updated dependencies including Glide 5.0.7, Material 1.14.0, and AppCompat 1.7.1.
63- - Upgraded Gradle Wrapper to 9.4.1 and Android Gradle Plugin to 9.2.1.
64- - Refactored publishing configuration using modern ` maven-publish ` .
65- - Configured Java toolchain to version 17.
66- - Cleaned up Gradle properties and ` .gitignore ` .
41+ - Added WebView dialog support using ` WEB_VIEW_TYPE ` .
42+ - Added ` setWebViewUrl() ` for loading hosted web pages inside a dialog.
43+ - Added ` setWebViewHeight() ` for controlling WebView dialog height.
44+ - Added horizontal WebView loading progress support.
45+ - Added center loading spinner for WebView dialogs.
46+ - Added WebView page lifecycle listener using ` setWebViewPageListener() ` .
47+ - Added WebView JavaScript, DOM storage, zoom, viewport, overview mode, and mixed content configuration APIs.
48+ - Added helper methods ` getDialogWebView() ` , ` canWebViewGoBack() ` , and ` goBackWebView() ` .
49+ - Added support for Terms, Privacy Policy, Refund Policy, Help, FAQ, and hosted web content dialogs.
6750
6851---
6952
@@ -125,6 +108,13 @@ Thanks to all contributors who helped improve this library.
125108- Custom image dialog.
126109- URL image dialog.
127110- Custom view dialog.
111+ - WebView dialog.
112+ - Terms and Privacy Policy dialog support.
113+ - Hosted web page dialog support.
114+ - WebView loading progress support.
115+ - WebView center loading spinner support.
116+ - WebView page lifecycle listener support.
117+ - WebView JavaScript, DOM storage, zoom, viewport and mixed content configuration.
128118- Modern style presets.
129119- Custom dialog corner radius.
130120- Custom dialog elevation.
@@ -239,6 +229,12 @@ Below are some examples of dialogs created using **KAlertDialog**.
239229 <img src="art/new/callbacks_dialog.png" width="110%" alt="KAlert Dialog Show and Dismiss Callbacks"/>
240230 </td>
241231 </tr>
232+ <tr>
233+ <td align="center">
234+ <b>WebView Terms and Privacy Dialog</b><br><br>
235+ <img src="art/new/webview_dialog.png" width="110%" alt="KAlert Dialog WebView Terms and Privacy Dialog"/>
236+ </td>
237+ </tr>
242238 </table >
243239</p >
244240
@@ -336,7 +332,7 @@ In your app-level `build.gradle`, add:
336332
337333``` gradle
338334dependencies {
339- implementation 'io.github.tutorialsandroid:kalertdialog:21.0 .0'
335+ implementation 'io.github.tutorialsandroid:kalertdialog:21.1 .0'
340336 implementation 'io.github.tutorialsandroid:progressx:7.0.5'
341337}
342338```
@@ -345,7 +341,7 @@ For Kotlin DSL:
345341
346342``` kotlin
347343dependencies {
348- implementation(" io.github.tutorialsandroid:kalertdialog:21.0 .0" )
344+ implementation(" io.github.tutorialsandroid:kalertdialog:21.1 .0" )
349345 implementation(" io.github.tutorialsandroid:progressx:7.0.5" )
350346}
351347```
@@ -359,7 +355,7 @@ Starting from the latest versions of **KAlertDialog** and **ProgressX**, this li
359355If you are using:
360356
361357``` gradle
362- implementation 'io.github.tutorialsandroid:kalertdialog:21.0 .0'
358+ implementation 'io.github.tutorialsandroid:kalertdialog:21.1 .0'
363359implementation 'io.github.tutorialsandroid:progressx:7.0.5'
364360```
365361
@@ -501,6 +497,9 @@ KAlertDialog.URL_IMAGE_TYPE
501497KAlertDialog . PROGRESS_TYPE
502498KAlertDialog . INPUT_TYPE
503499KAlertDialog . CUSTOM_VIEW_TYPE
500+ KAlertDialog . INFO_TYPE
501+ KAlertDialog . QUESTION_TYPE
502+ KAlertDialog . WEB_VIEW_TYPE
504503```
505504
506505---
@@ -810,6 +809,144 @@ Available custom view methods:
810809
811810---
812811
812+ ## WebView Dialog
813+
814+ KAlertDialog supports WebView dialogs for showing web pages directly inside a dialog.
815+
816+ This is useful for:
817+
818+ - Terms and Conditions
819+ - Privacy Policy
820+ - Refund Policy
821+ - Help pages
822+ - FAQ pages
823+ - Documentation pages
824+ - Hosted HTML content
825+ - Any web page that should be opened without leaving the app
826+
827+ > Important: Your app must have Internet permission if you are loading online URLs.
828+
829+ ``` xml
830+ <uses-permission android : name =" android.permission.INTERNET" />
831+ ```
832+
833+ ---
834+
835+ ### Terms and Privacy Policy WebView Dialog
836+
837+ ``` java
838+ new KAlertDialog (this , KAlertDialog . WEB_VIEW_TYPE , true )
839+ .setTitleText(" Terms & Privacy Policy" )
840+ .setContentText(" Please read our terms and privacy policy before continuing." )
841+ .applyStyle(KAlertDialog . STYLE_MODERN )
842+ .setWebViewUrl(" https://policies.google.com/privacy" )
843+ .setWebViewHeight(420 )
844+ .setWebViewJavaScriptEnabled(true )
845+ .setWebViewDomStorageEnabled(true )
846+ .setWebViewZoomEnabled(false )
847+ .setWebViewWideViewPortEnabled(true )
848+ .setWebViewLoadWithOverviewMode(true )
849+ .setWebViewAllowMixedContent(false )
850+ .showWebViewHorizontalProgress(true )
851+ .showWebViewCenterLoader(true )
852+ .showCancelButton(true )
853+ .setCancelClickListener(" Cancel" , dialog - > dialog. dismissWithAnimation())
854+ .setConfirmButtonAllCaps(false )
855+ .setCancelButtonAllCaps(false )
856+ .setConfirmClickListener(" I Agree" , dialog - > {
857+ dialog. dismissWithAnimation();
858+ Toast . makeText(this , " Accepted" , Toast . LENGTH_SHORT ). show();
859+ })
860+ .show();
861+ ```
862+
863+ ---
864+
865+ ### WebView Dialog with Page Listener
866+
867+ ``` java
868+ new KAlertDialog (this , KAlertDialog . WEB_VIEW_TYPE , true )
869+ .setTitleText(" Terms of Use" )
870+ .setContentText(" Please read the terms before continuing." )
871+ .applyStyle(KAlertDialog . STYLE_MODERN )
872+ .setWebViewUrl(" https://example.com/terms" )
873+ .setWebViewHeight(420 )
874+ .setWebViewPageListener(new KAlertDialog .WebViewPageListener () {
875+ @Override
876+ public void onPageStarted (KAlertDialog dialog , String url ) {
877+ // Page started loading
878+ }
879+
880+ @Override
881+ public void onPageFinished (KAlertDialog dialog , String url ) {
882+ // Page finished loading
883+ }
884+
885+ @Override
886+ public void onPageError (KAlertDialog dialog , String url , String error ) {
887+ Toast . makeText(MainActivity . this , " Unable to load page" , Toast . LENGTH_SHORT ). show();
888+ }
889+ })
890+ .showCancelButton(true )
891+ .setCancelClickListener(" Cancel" , dialog - > dialog. dismissWithAnimation())
892+ .setConfirmClickListener(" Close" , dialog - > dialog. dismissWithAnimation())
893+ .show();
894+ ```
895+
896+ ---
897+
898+ ### WebView Dialog Methods
899+
900+ ``` java
901+ .setWebViewUrl(" https://example.com/privacy-policy" )
902+ .setWebViewHeight(420 )
903+ .setWebViewJavaScriptEnabled(true )
904+ .setWebViewDomStorageEnabled(true )
905+ .setWebViewZoomEnabled(false )
906+ .setWebViewWideViewPortEnabled(true )
907+ .setWebViewLoadWithOverviewMode(true )
908+ .setWebViewAllowMixedContent(false )
909+ .showWebViewHorizontalProgress(true )
910+ .showWebViewCenterLoader(true )
911+ .setWebViewPageListener(listener)
912+ .getDialogWebView()
913+ .canWebViewGoBack()
914+ .goBackWebView()
915+ ```
916+
917+ ---
918+
919+ ### WebView Listener
920+
921+ ``` java
922+ .setWebViewPageListener(new KAlertDialog .WebViewPageListener () {
923+ @Override
924+ public void onPageStarted (KAlertDialog dialog , String url ) {
925+ // Page started loading
926+ }
927+
928+ @Override
929+ public void onPageFinished (KAlertDialog dialog , String url ) {
930+ // Page finished loading
931+ }
932+
933+ @Override
934+ public void onPageError (KAlertDialog dialog , String url , String error ) {
935+ // Page failed to load
936+ }
937+ })
938+ ```
939+
940+ ---
941+
942+ ### Important WebView Error Note
943+
944+ Some websites may fail to load small internal resources such as favicon, analytics scripts, CSS, images, or iframe content. KAlertDialog only reports the error callback for the main page load, so your app does not show false error messages when the main WebView page loads successfully.
945+
946+ ---
947+
948+
949+
813950## Custom Image Dialog
814951
815952``` java
@@ -1283,6 +1420,7 @@ The sample app demonstrates:
12831420- Warning confirm/cancel flow.
12841421- Input validation.
12851422- Custom view.
1423+ - WebView Terms and Privacy dialog.
12861424- Custom icon.
12871425- URL circle image.
12881426- URL big image.
@@ -1362,6 +1500,48 @@ new KAlertDialog(this, KAlertDialog.INPUT_TYPE, true)
13621500
13631501---
13641502
1503+ ### WebView page is not loading
1504+
1505+ If your WebView dialog does not load an online URL, make sure your app has Internet permission:
1506+
1507+ ``` xml
1508+ <uses-permission android : name =" android.permission.INTERNET" />
1509+ ```
1510+
1511+ Also make sure the URL starts with ` https:// ` :
1512+
1513+ ``` java
1514+ .setWebViewUrl(" https://example.com/privacy-policy" )
1515+ ```
1516+
1517+ ---
1518+
1519+ ### WebView shows error even when page loads
1520+
1521+ Some websites may fail to load small sub-resources such as favicon, analytics scripts, images, CSS files, or iframe content. These are not always main page errors.
1522+
1523+ KAlertDialog handles this by reporting WebView errors only when the main page fails to load.
1524+
1525+ If you use ` setWebViewPageListener() ` , show user-facing errors only inside ` onPageError() ` .
1526+
1527+ ---
1528+
1529+ ### WebView content is too small on tablets
1530+
1531+ For tablets, use a larger WebView height:
1532+
1533+ ``` java
1534+ .setWebViewHeight(460 )
1535+ ```
1536+
1537+ If you are using a ` layout-sw600dp ` dialog layout, make sure the dialog width is larger, for example:
1538+
1539+ ``` xml
1540+ android:layout_width="560dp"
1541+ ```
1542+
1543+ ---
1544+
13651545## API Summary
13661546
13671547### Constructors
@@ -1480,6 +1660,27 @@ KAlertDialog.IMAGE_CIRCLE
14801660
14811661---
14821662
1663+ ### WebView methods
1664+
1665+ ``` java
1666+ .setWebViewUrl(" https://example.com/privacy-policy" )
1667+ .setWebViewHeight(420 )
1668+ .setWebViewJavaScriptEnabled(true )
1669+ .setWebViewDomStorageEnabled(true )
1670+ .setWebViewZoomEnabled(false )
1671+ .setWebViewWideViewPortEnabled(true )
1672+ .setWebViewLoadWithOverviewMode(true )
1673+ .setWebViewAllowMixedContent(false )
1674+ .showWebViewHorizontalProgress(true )
1675+ .showWebViewCenterLoader(true )
1676+ .setWebViewPageListener(listener)
1677+ .getDialogWebView()
1678+ .canWebViewGoBack()
1679+ .goBackWebView()
1680+ ```
1681+
1682+ ---
1683+
14831684### URL image methods
14841685
14851686``` java
0 commit comments