HeaderDialog


Source link: https://github.com/marcoscgdev/HeaderDialog

HeaderDialog  

An android library to display a material-designed dialog with header.


Releases:

Current release: 1.0.5.

You can see all the library releases here.


Screenshots


Features

  • Roboto font
  • LinkMovementMethod support
  • Justify text option
  • Icon, text and both as header
  • Custom header background color
  • Custom header text color
  • Custom header icon color
  • Custom header text gravity
  • Custom message text gravity
  • Show or hide header shadow
  • Multiline header title text option
  • Arabic text support
  • Custom view support (NEW)

Usage:

Adding the depencency

Add this to your root build.gradle file:

allprojects {

  repositories {

...

maven {
 url 'https://jitpack.io' 
}

  
}
 
}
 

Now add the dependency to your app build.gradle file:

compile 'com.github.marcoscgdev:HeaderDialog:1.0.5' 

Creating the dialog

Here is a complete snippet of it usage:

new HeaderDialog(this)
  .setColor(getResources().getColor(R.color.colorAccent)) // Sets the header background color
  .setElevation(false) // Sets the header elevation, true by default
  .setIcon(getResources().getDrawable(R.drawable.ic_info_outline_black_48dp)) // Sets the dialog icon image
  .setTitle(R.string.library_name) // Sets the dialog title
  .setMessage("Lorem ipsum dolor sit amet...") // Sets the dialog message
  .justifyContent(true) // Justifies the message text, false by default
  .setTitleColor(Color.parseColor("#212121")) // Sets the header title text color
  .setIconColor(Color.parseColor("#212121")) // Sets the header icon color
  .setTitleGravity(Gravity.CENTER_HORIZONTAL) // Sets the header title text gravity
  .setMessageGravity(Gravity.CENTER_HORIZONTAL) // Sets the message text gravity
  .setTitleMultiline(false) // Multiline header title text option, true by default
  .setView(R.layout.custom);
 // Set custom view to the dialog (only possible via layout resource)
  .setPositiveButton("Ok", new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int which) {

// Your action

}

  
}
)
  .setNegativeButton("Close", null)
  .show();

Important note: Do not enable the justified text if you are using html content!

Accessing inflated custom view

HeaderDialog headerDialog = new HeaderDialog(this);
 ... headerDialog.setView(R.layout.custom);
 ... headerDialog.show();
 headerDialog.getInflatedView().findViewById(R.id.checkbox).setOnClickListener(new View.OnClickListener() {

  @Override
  public void onClick(View v) {

Toast.makeText(MainActivity.this, "Checkbox clicked!", Toast.LENGTH_SHORT).show();

  
}
 
}
);

See the sample project to clarify any queries you may have.


License

The MIT License (MIT)  Copyright (c) 2017 Marcos Calvo GarcĂ­a  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. 

Resources

The Firebase Android JobDispatcher is a library that provides a high-level wrapper around job scheduling engines on Android, starting with the GCM Network Manager.

Sticky observable nested ScrollView for Android.

Lib that imports all the vector drawables from materialdesignicons.com into your R.drawable/.

A simple plain pie chart widget fully customizable.

Library for toolbar animation.

A simple ViewPager indicator implementation compatible with the Android Support Library. It can use arrows on the left and on right and it can display a pageIndicator.

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