项目作者: mejdi14

项目描述 :
📱Android Library to implement beautiful dialogs in android apps easily
高级语言: Java
项目地址: git://github.com/mejdi14/Flat-Dialog-Android.git
创建时间: 2019-10-13T10:52:45Z
项目社区:https://github.com/mejdi14/Flat-Dialog-Android

开源协议:

下载


Flat-Dialog

platform
License


gitmoji-changelog



Installation

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

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url "https://jitpack.io" }
  5. }
  6. }

Dependency

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

  1. dependencies {
  2. ...
  3. implementation 'com.github.mejdi14:Flat-Dialog-Android:1.0.5'
  4. }

Screenshots


How to use with java

  1. final FlatDialog flatDialog = new FlatDialog(ExempleActivity.this);
  2. flatDialog.setTitle("Login")
  3. .setSubtitle("write your profile info here")
  4. .setFirstTextFieldHint("email")
  5. .setSecondTextFieldHint("password")
  6. .setFirstButtonText("CONNECT")
  7. .setSecondButtonText("CANCEL")
  8. .withFirstButtonListner(new View.OnClickListener() {
  9. @Override
  10. public void onClick(View view) {
  11. Toast.makeText(ExempleActivity.this, flatDialog.getFirstTextField(), Toast.LENGTH_SHORT).show();
  12. }
  13. })
  14. .withSecondButtonListner(new View.OnClickListener() {
  15. @Override
  16. public void onClick(View view) {
  17. flatDialog.dismiss();
  18. }
  19. })
  20. .show();

How to use with kotlin

  1. val flatDialog = FlatDialog(this@MainActivity)
  2. flatDialog.setTitle("Login")
  3. .setSubtitle("write your profile info here")
  4. .setFirstTextFieldHint("email")
  5. .setSecondTextFieldHint("password")
  6. .setFirstButtonText("CONNECT")
  7. .setSecondButtonText("CANCEL")
  8. .withFirstButtonListner {
  9. // do something ...
  10. }
  11. .withSecondButtonListner {
  12. flatDialog.dismiss()
  13. }
  14. .show()

More useful methods






































Method Description
isCancelable(boolean) Define if you want to close dialog when you click outside
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