Material Dialog Fragments


Source link: https://github.com/MFlisar/MaterialDialogFragments

How to create material dialog Fragment?

MaterialDialogFragments Release

Common dialog fragments based on https://github.com/afollestad/material-dialogs

Features

  • handles fragments save/restore states for you automatically
  • includes mechanism to handle dialog events (even after screen restoration) inside activity and/or fragments
  • includes some special dialogs (extracted in own modules) like e.g. a custom color dialog, text and number dialogs, multi text and number dialogs, a fast adapter recycler view dialog, an ads dialog - maybe even more to come
  • also supports to show dialogs as dialog or bottom sheet
  • easily extendable - create you own dialogs, simply check out the extension modules

Screenshots

Dialog Simple info dialog Dialog Info dialog with Timeout + Warning Dialog Info dialog with HTML content
Dialog Simple list dialog Dialog Multi select list dialog with images Dialog Multi select list dialog with custom check marks
Dialog Multi click list dialog Dialog Custom parcelable data list dialog Dialog Color picker dialog
Dialog Datetime dialog Dialog EditText dialog Dialog Multi EditText dialog
Dialog Number dialog Dialog Custom number dialog Dialog Multi number dialog
Dialog Progress dialog Dialog Frequency dialog Dialog Debug settings dialog

Gradle (via JitPack.io)

  1. add jitpack to your project s build.gradle:
repositories {

  maven {
 url "https://jitpack.io" 
}
 
}
  1. add the implementation statement(s) to your module s build.gradle:
dependencies {
  	// -------- 	// core - DialogInfo, DialogList, DialogProgress 	// -------- 	 	implementation "com.github.MFlisar.MaterialDialogFragments:dialogs:<LATEST-VERSION>" 	 	// -------- 	// optional 	// -------- 	 	// input - DialogInput, DialogNumber, DialogNumberPicker 	implementation "com.github.MFlisar.MaterialDialogFragments:dialogs-input:<LATEST-VERSION>" 	 	// specials	 	implementation "com.github.MFlisar.MaterialDialogFragments:dialogs-datetime:<LATEST-VERSION>" 	implementation "com.github.MFlisar.MaterialDialogFragments:dialogs-fastadapter:<LATEST-VERSION>"	 	implementation "com.github.MFlisar.MaterialDialogFragments:dialogs-color:<LATEST-VERSION>" 	implementation "com.github.MFlisar.MaterialDialogFragments:dialogs-frequency:<LATEST-VERSION>" 	implementation "com.github.MFlisar.MaterialDialogFragments:dialogs-ads:<LATEST-VERSION>"  	// -------- 	// alternatively, to include ALL modules at once 	// -------- 	 	// implementation  com.github.MFlisar:MaterialDialogFragments:<LATEST-VERSION>  
}

Usage

Usage is very simply, you only need to do following:

  • Activities or Fragments using the dialog fragments must implement the simple DialogFragmentCallback interface:

      interface DialogFragmentCallback {
    
    	fun onDialogResultAvailable(event: BaseDialogEvent): Boolean
    
    }
     
  • you create a dialog with the corresponding setup class like e.g.:

      DialogInfo(
    	1, // ID - this allows you to identify dialog events in the callback
    	"Info Title".asText(),
    	"Some info label".asText()
    )
    		.create()
    		.show(this) 
  • in the DialogFragmentCallback you can handle the result now like following:

      override fun onDialogResultAvailable(event: BaseDialogEvent): Boolean {
    
     return when (event) {
    
    		is DialogInfoEvent -> {
    
    			Toast.makeText(this, "Info dialog closed - ID = ${
    event.id
    }
    ", Toast.LENGTH_SHORT).show()
    			true
    		
    }
     else false
    	
    }
    
    }
     

That s all. Optionally you can set up some global settings like following, preferably in your application class once only:

DialogSetup.SEND_CANCEL_EVENT_BY_DEFAULT = true 

The DialogSetup offers some other settings as well.

Check the demo app for more informations.

Resources

Tools for working with a house of (credit) cards.

Lynx is an Android library created to show a custom view with all the information logcat is printing, different traces of different levels will be rendered to show from log messages to your application exceptions. You can filter this traces, share your logcat to other apps, configure the max number of traces to show or the sampling rate used by the library. The min Api Level supported is 8.

Wrap your app screenshots in real device artwork.

JUniversal makes Java truly cross platform

Writing the same code from scratch for every platform is a pain & inefficient. There must be a better way. JUniversal lets you write code in Java (like you probably already do if you develop for Android) and take that code to places you never thought it could go. It’s primarily targeted to sharing code across mobile apps, but the technology can extend to non-mobile scenarios as well.

View for locking and unlocking.

This library provide syncing of SharedPreferences between handheld and wearable.

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