Skip to content

sudoxE7/MLBBDialog

Repository files navigation

MLBBDialog

MLBB Dialog Library for Android

Screenshots

Including in your project

Gradle

Add below codes to your root build.gradle file (not your module build.gradle file).

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

And add a dependency code to your module's build.gradle file.

dependencies {
        implementation 'com.github.sudoxE7:MLBBDialog:1.0.0'
}

Default Usage

Add in your Activity file.

new MLBBDialogBuilder(MainActivity.this, Style.NEW)
        .setTitle(getString(R.string.title))
        .setSubtitle(getString(R.string.subtitle))
        .setCancelable(true)
        .setPositiveListener(getString(R.string.positive), new MLBBDialogClickListener() {
            @Override
            public void onClick(MLBBDialog mLBBDialog) {
                finishAffinity();
                mLBBDialog.dismiss();
            }
        })
        .setNegativeListener(getString(R.string.negative), new MLBBDialogClickListener() {
            @Override
            public void onClick(MLBBDialog mLBBDialog) {
                mLBBDialog.dismiss();
            }
        })
        .build().show();

How to hide Negative Button

Just remove in build:

.setNegativeListener(getString(R.string.negative), new MLBBDialogClickListener() {
    @Override
    public void onClick(MLBBDialog mLBBDialog) {
        mLBBDialog.dismiss();
    }
})

How to add Custom Font

Just add in build:

.setFont(Typeface.createFromAsset(getAssets(),"fonts/anastasia.ttf"))

Style

To change the style of MLBB Dialog

Style.OLD
Style.NEW

// Credit to Exodus