A Custom Material Design Dialog Library for Android
Purpose
CuteDialog is a Highly Customizable Material Design Android Library. CuteDialog allows developer to create beautiful dialogs with material design. It is highly customizable and can be used for lots of different purposes.
Features
Screenshot
Icon | Image | Animation |
---|---|---|
Demo
Download and Give it a try.
Prerequisites
Gradle
Old
If you’re using old gradle versions then follow this.
Add this in your root build.gradle
:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
New
If you’re using new gradle versions then follow this.
Add this in your settings.gradle
file:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Theme
For using CuteDialog in your project, you must use Material Theme in your project. You can use CuteDialog in both Material Light and Dark theme.
For example:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
Or
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
</style>
Dependencies
Add this to your app level build.gradle
:
(Always use the latest version. Current Latest version is )
dependencies {
...
implementation 'com.github.CuteLibs:CuteDialog:2.1'
}
Usage ( Wiki ) ( Old Usage )
Basic
new CuteDialog.withIcon(this)
.setIcon(R.mipmap.ic_launcher)
.setTitle("Simple Dialog")
.setDescription("This is a simple Dialog")
.setPositiveButtonText("Okay", v2 -> {
})
.setNegativeButtonText("Cancel", v2 -> {
})
.show();
Advanced
new CuteDialog.withIcon(this)
.setIcon(R.mipmap.ic_launcher)
.setTitle("Simple Dialog")
.setTitleTextSize(20)
.setTitleTextColor(Color.parseColor("#FF4081"))
.setTitleTextStyle(CuteDialog.STYLE_BOLD)
.setDescription("This is a simple Dialog")
.setDescriptionTextColor(Color.parseColor("#FF4081"))
.setDescriptionTextSize(16)
.setDescriptionTextStyle(CuteDialog.STYLE_NORMAL)
.setPositiveButtonText("Okay", v2 -> {
})
.setNegativeButtonText("Cancel", v2 -> {
})
.setCloseIconListener(v2 -> {
})
.setCloseIcon(R.drawable.icon_1)
.setCloseIconColor(Color.parseColor("#FF4081"))
.setCloseIconSize(20)
.setPositiveButtonColor(Color.parseColor("#FF4081"))
.setPositiveButtonRadius(10)
.setPositiveButtonBorderColor(Color.parseColor("#FF4081"))
.setPositiveButtonBorderWidth(2)
.setPositiveButtonTextColor(Color.parseColor("#FFFFFF"))
.setPositiveButtonTextSize(16)
.setPositiveButtonTextStyle(CuteDialog.STYLE_NORMAL)
.setNegativeButtonColor(Color.parseColor("#FFFFFF"))
.setNegativeButtonRadius(10)
.setNegativeButtonBorderColor(Color.parseColor("#FF4081"))
.setNegativeButtonBorderWidth(2)
.setNegativeButtonTextColor(Color.parseColor("#FF4081"))
.setNegativeButtonTextSize(16)
.setNegativeButtonTextStyle(CuteDialog.STYLE_NORMAL)
.setDialogBackgroundColor(Color.parseColor("#FFFFFF"))
.setDialogRadius(10)
.setDialogPosition(CuteDialog.POSITION_CENTER)
.setPadding(20)
.setPrimaryColor(Color.parseColor("#FF4081"))
.isCancelable(true)
.hideNegativeButton(false)
.hidePositiveButton(false)
.hideDescription(false)
.hideTitle(false)
.hideCloseIcon(false)
.show();
Theme ( Wiki )
with Icon
Call new CuteDialog.withIcon(this)
for using a Icon as header and use .setIcon
to set the resource.
Example:
new CuteDialog.withIcon(this)
.setIcon(R.mipmap.ic_launcher)
.setTitle("Simple Dialog")
.setDescription("This is a simple Dialog")
.show();
with Image
Call new CuteDialog.withImage(this)
for using a Image as header and use .setImage
to set the resource.
Example:
new CuteDialog.withImage(this)
.setImage(R.drawable.image_1)
.setTitle("Take a break")
.setDescription("Isn't it a great time to go for a walk?")
.show();
with Animation
Call new CuteDialog.withAnim(this)
for using a Image as header and use .setAnimation
to set the resource. Put the Animation in res/raw
folder
Example:
new CuteDialog.withAnimation(this)
.setAnimation(R.raw.anim1)
.setTitle("Set Reminder")
.setDescription("Do you want me to remind you? ")
.show();
Customizations ( Wiki )
Notes
new CuteDialog.withIcon(this)
- use an icon as header, basically drawable/mipmap. Example,R.drawable.icon
/R.mipmap.ic_launcher
new CuteDialog.withImage(this)
- use an image as header, basically drawable. Example,R.drawable.image
new CuteDialog.withAnimation(this)
- use an animation as header, from ‘res/raw’ folder. Example,R.raw.anim
. Animtaion is shown using Lottie for Android library.
More Demo
Contribute
Please fork this repository and contribute back using pull requests.
Any contributions, large or small, major features, bug fixes, are welcomed and appreciated.
Let me know which features you want in the future in Request Feature
tab.
If this project helps you a little bit, then give a to Star ⭐ the Repo.
Credits
Created with ❤️ by CuteLibs & K M Rejowan Ahmmed
- Animation - Lottie for Android library
License
Copyright 2022 CuteLibs
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.