GithubHelp home page GithubHelp logo

awesomedialog's Introduction

Awesome Dialog - A Beautiful Dialogs Library for Android Kotlin ๐Ÿคฉ๐Ÿ”ฅ

platform API Android Arsenal GitHub license GitHub stars GitHub forks Repo size GitHub follow

A Beautiful Multipurpose Awesome Dialogs Library in Android using Kotlin ๐Ÿ˜


Showcase

Showcase

About

A Beautiful Multipurpose Awesome Dialogs Library in Android using Kotlin.

Dependency Project Level

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

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

Dependency App Level

Add dependency in your app module

	dependencies {
	        implementation 'com.github.chnouman:AwesomeDialog:1.0.4'
	}

Simple Dialog ๐Ÿ–๐Ÿผ

AwesomeDialog.build(this)
                .title("Congratulations")
                .body("Your New Account has been created")
                .onPositive("Go To My Account") {
                    Log.d("TAG", "positive ")
                } 

Dialog With Icon โŒ›๏ธ

AwesomeDialog.build(this)
		.title("Congratulations")
                .body("Your New Account has been created")
		.icon(R.drawable.ic_congrts)
                .onPositive("Go To My Account") {
                    Log.d("TAG", "positive ")
                }       

Usage

Sample Code for ๐ŸŒŸ

Icon+Title+Body

AwesomeDialog.build(this)
                .title(title)
                .body(body)
                .icon(R.drawable.ic_congrts)                

Output

Icon+Title+Body+ (+ Button)

   AwesomeDialog.build(this)
                .title(title)
                .body(body)
                .icon(R.drawable.ic_congrts)
                .onPositive(goToMyAccount) {
                    Log.d("TAG", "positive ")
                }

Output

Icon+Title+Body+ (+/- Button)

AwesomeDialog.build(this)
                .title(title)
                .body(body)
                .icon(R.drawable.ic_congrts)
                .onPositive(goToMyAccount) {
                    Log.d("TAG", "positive ")
                }
                .onNegative(cancel) {
                    Log.d("TAG", "negative ")
                }
        

Output

Title+Body+ (- Button)

AwesomeDialog.build(this)
                .title(title)
                .body(body)
                .onPositive(goToMyAccount) {
                    Log.d("TAG", "positive ")
                }

Output

Title+Body+ (+/- Button)

       AwesomeDialog.build(this)
                .title(title)
                .body(body)
                .onPositive(goToMyAccount) {
                    Log.d("TAG", "positive ")
                }
                .onNegative(cancel) {
                    Log.d("TAG", "negative ")
                }  

Output

Title+Body+ (+/- Button) With Backgroud ๐ŸŒˆ

  AwesomeDialog.build(this)
                .title(
                    title,
                    titleColor = ContextCompat.getColor(this, android.R.color.white)
                )
                .body(
                    body,
                    color = ContextCompat.getColor(this, android.R.color.white)
                )
                .background(R.drawable.layout_rounded_dark_black)
                .onPositive(goToMyAccount) {
                    Log.d("TAG", "positive ")
                }
                .onNegative(cancel) {
                    Log.d("TAG", "negative ")
                }
                

Output

Custom Coloring ๐ŸŒˆ

  AwesomeDialog.build(this)
                .title(
                    title,
                    titleColor = ContextCompat.getColor(this, android.R.color.white)
                )
                .body(
                    body,
                    color = ContextCompat.getColor(this, android.R.color.white)
                )
                .icon(R.drawable.ic_congrts)
                .background(R.drawable.layout_rounded_green)
                .onPositive(
                    goToMyAccount,
                    buttonBackgroundColor = R.drawable.layout_rounded_dark_white,
                    textColor = ContextCompat.getColor(this, android.R.color.black)
                ) {
                    Log.d("TAG", "positive ")
                }                

Output

Positioning

We can customize the Position of Dialog.

POSITIONS.CENTER
POSITIONS.BOTTOM

By Default Position is Bottom.

CENTER BOTTOM

Awesome Attributes Properties

title()

Parameter Type Default Value
title String Empty String
fontStyle TypeFace Android Default
titleColor Int Android Default Color

body()

Parameter Type Default Value.
body String Empty String.
fontStyle Typeface Android Default.
color Int Android Default Text Color.

icon()

Parameter Type Default Value
icon Int Not Null
animateIcon Boolean false

position()

Parameter Type Default Value
position POSITIONS POSITIONS.BOTTOM

background()

Parameter Type Default Value
dialogBackgroundColor INT DEFAULT

onPositive()

Parameter Type Default Value
text String Empty String
buttonBackgroundColor Int Default Color
action () -> Unit Empty

onNegative()

Parameter Type Default Value
text String Empty String
buttonBackgroundColor Int Default Color
action () -> Unit Empty

License



    Copyright 2020 Muhammad Nouman

    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.

awesomedialog's People

Contributors

chnouman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.