Skip to content

kishannareshpal/SuperDialog

Repository files navigation

SuperDialog

A very cool looking android dialog library.

API 14Download

Setup

To begin using SuperDialog in your projects just add the dependecy via Gradle or Maven.

a) Gradle
  1. Add the library to the dependencies { ... } section of your app level build.gradle file:
dependencies {
    // ...
    implementation 'com.kishannareshpal:superdialog:<version>'
    // ...
}
b) Maven
  1. Add the library as a dependency to your app level build.gradle file:

    <dependency>
      <groupId>com.kishannareshpal</groupId>
      <artifactId>superdialog</artifactId>
      <version>1.4</version>
      <type>pom</type>
    </dependency>

Getting Started

// To show the dialog later via .show(FragmentManager);
FragmentManager fm = getSupportFragmentManager()

// With title only
new SuperDialog().title("Hello World!").show(fm);

// With message only
new SuperDialog().message("What you see, is what you get").show(fm);

// With title and message
new SuperDialog().title("Sweet!")
    .message("What you see, is what you get").show(fm);

// With custom icon drawable
new SuperDialog().iconMode(IconMode.CUSTOM_IMAGE)
    .customImageRes(R.drawable.yelloFace)
    .show(fm);

// and so much more...

All of the properties

new SuperDialog()
    .iconMode(IconMode mode) // NORMAL, SUCCESS, ERROR, WARNING, PROGRESS, CUSTOM_IMAGE
    .customIconRes(@DrawableRes drawableRes) // When iconMode is CUSTOM_IMAGE, you can select that icon image using this.
    
    .title(String title)
	.message(String body)
	
	.cancelable(boolean isCancelable) // If false, disallows dismiss when touched outside of the dialog.
	
	.positiveText(String positiveButtonText)
	.positiveColorRes(@ColorRes positiveButtonBackgroundColor)
	.positiveTextColorRes(@ColorRes positiveButtonTextColor)
	
	.negativeText(String negativeButtonText)
	.negativeColorRes(@ColorRes negativeButtonBackgroundColor)
	.negativeTextColorRes(@ColorRes negativeButtonTextColor)
	
	.cancelText(String cancelButtonText)
	.cancelColorRes(@ColorRes cancelButtonBackgroundColor)
	.cancelTextColorRes(@ColorRes cancelButtonTextColor)
	
	.onPositive(OnButtonClickListener onPositiveButtonClick)
	.onNegative(OnButtonClickListener onNegativeButtonClick)
	.onCancel(OnButtonClickListener onCancelButtonClick)
	
	.show(FragmentManager fm) // to show the dialog.
You may change any of the dialog properties anytime, by simply calling it's methods on the dialog. Example:
SuperDialog sd = new SuperDialog()
    	.iconMode(IconMode.INDEFINITE_PROGRESS)
    	.title("Loading...");
	sd.show();
	
// ... later on:
sd.iconMode(IconMode.SUCCESS)
    .title("Yay!! You rock!")
    .message("Some text body just for you to read.")
    .show(fm);

Licence

Copyright 2018 Kishan Nareshpal Jadav

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

A beautifully crafted Android dialog library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages