Flat-Dialog-Android

Additional

Language
Java
Version
1.0.5 (May 3, 2020)
Created
Oct 13, 2019
Updated
May 3, 2020
Owner
mejdi hafiane (mejdi14)
Contributor
mejdi hafiane (mejdi14)
1
Activity
Badge
Generate
Download
Source code
APK file

Show card

Flat-Dialog

Installation

Add this in your root build.gradle file (not your module build.gradle file):

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

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
 ...
 implementation 'com.github.mejdi14:Flat-Dialog-Android:1.0.5'
}

Screenshots

How to use with java

 final FlatDialog flatDialog = new FlatDialog(ExempleActivity.this);
        flatDialog.setTitle("Login")
                .setSubtitle("write your profile info here")
                .setFirstTextFieldHint("email")
                .setSecondTextFieldHint("password")
                .setFirstButtonText("CONNECT")
                .setSecondButtonText("CANCEL")
                .withFirstButtonListner(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Toast.makeText(ExempleActivity.this, flatDialog.getFirstTextField(), Toast.LENGTH_SHORT).show();
                    }
                })
                .withSecondButtonListner(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        flatDialog.dismiss();
                    }
                })
                .show();

How to use with kotlin

   val flatDialog = FlatDialog(this@MainActivity)
        flatDialog.setTitle("Login")
            .setSubtitle("write your profile info here")
            .setFirstTextFieldHint("email")
            .setSecondTextFieldHint("password")
            .setFirstButtonText("CONNECT")
            .setSecondButtonText("CANCEL")
            .withFirstButtonListner {
                 // do something ...
                }
            .withSecondButtonListner {
                    flatDialog.dismiss()
            }
            .show()

More useful methods

Method Description
isCancelable(boolean)
setIcon(image) Add an image at the top of the dialog
setBackgroundColor(color) Change the dialog background color
setFirstTextFieldHint(String) Set a hint for the edittext
setFirstTextFieldTextColor(color) Set the edittext text color
setFirstTextFieldBorderColor(color) Set the border color for the edittext
setFirstTextFieldInputType(type) Set the input type for the edittext
setFirstButtonColor(color) Set the button background color

Contributing

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated