HtmlDialog


Source link: https://github.com/jjobes/HtmlDialog

HtmlDialog

HtmlDialog is an Android library that simplifies the display of HTML in a DialogFragment. It is useful for displaying Open Source Licenses, EULAs, Terms of Service pages, etc. Tested on Android 4.0+.

Setup

To add this library to your project, add the following to your builde.gradle:

dependencies {

 compile project(':htmlDialog') 
}

How to Use

(See SampleActivity for a more complete example)

new HtmlDialog.Builder(getFragmentManager())
  .setHtmlResId(R.raw.licenses)
  .build()
  .show();

To set the resource Id of your HTML file:

.setHtmlResId(int)

This is required. Pass in the resource Id of an HTML file that resides /res/raw/ in your main project. In the above example, R.raw.licenses refers to /res/raw/licenses.html in the main project.

To set the title of the dialog:

.setTitle(String)

By default, the dialog will have no title.

To show a negative button at the bottom of the dialog:

.setShowNegativeButton(true)

By default, no negative button is shown.

To specify the negative button text:

.setNegativeButtonText(String)

Make sure to call this if you are showing the negative button.

To show a positive button at the bottom of the dialog:

.setShowPositiveButton(true)

By default, no positive button is shown.

To specify the positive button text:

.setPositiveButtonText(String)

Make sure to call this if you are showing the positive button.

To force the user to click a button:

.setCancelable(false)

This is useful if you are displaying a license agreement.

To specify a listener:

.setListener(new HtmlDialogListener() {

@Override
  public void onNegativeButtonPressed()
  {

  
}

@Override
  public void onPositiveButtonPressed()
  {

  
}

@Override
  public void onDialogCancel()
  {

// This override is optional.

// Called when the user presses the Back button

// or touches outside the dialog.
  
}
 
}
)

Contributing

Contributions are welcome. Please open up an issue in GitHub or submit a PR.

Changelog

v1.1.2

  • Update build.gradle

v1.1.1

  • Changed to Android Studio / Gradle project

v1.1.0

  • removed setShowCloseButton() and setCloseButtonText()
  • added setShowNegativeButton(), setNegativeButtonText()
  • added setShowPositiveButton(), setPositiveButtonText()
  • added setCancelable()
  • added setListener()
  • updated SampleActivity

v1.0.0

  • First release

License

Licensed under the Apache License, Version 2.0

Acknowledgements

This project is based off of Adam Speakman's AndroidLicensesPage.

Resources

The goal of this library is to allow your app to support Facebooks Rebound effect on all views, with circular reveal effect and also provides bottom bar with circular reveal effect. ram size depending animation play support.

Makes it easy to create a beautiful about screen for your app.

Micro-Transitions for Smooth Android To-Do List Animations.

A set of EditTexts with built-in support for Date and TimePicker's using fragments.

Mobile Test Automation Tool

  • Run the same test on different mobile devices and operating systems with a mobile test automation tool that allows tests portability
  • Perform mobile test automation using real devices and emulators
  • Create a test on one device and run it on any other device model or operating system
  • Increase coverage with full peripheral testing capabilities
  • Start your mobile test automation quickly with a simple plug, record and play tool
  • Enhance your mobile test automation by Integrating into all your major ALM environments
  • Integrate with any continuous integration environment
  • Recorder for quick test creation

This example is basically used for simple using of data binding for Views and RecyclerView using model.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes