/M2Dia

🦄 This is a Material Design 2 pop-up component developed in Java, combined with Lottie to achieve perfect pop-up functionality. It provides rich interface design and animation effects.

Primary LanguageJava

❤️M2Dia Android Dialog Tool

  • 🕊️ This is a Material Design 2 pop-up component developed in Java, combined with Lottie to achieve perfect pop-up functionality. It provides rich interface design and animation effects.
  • 🐬这是一个使用Java开发的Material Design 2弹出式组件,结合Lottie,可以实现完美的弹出功能。它提供了丰富的界面设计和动画效果。

🤡Configuration

Context, title, and type must be assigned, and other parameters can be customized and implemented. Place this anywhere in your app:

m2Dia = M2Dia.createSuccess(MainActivity.this, getString(R.string.success_title), M2Dia.M2ButTpe.HAVE_ALL_BUT)
             .setContent(getString(R.string.context)) // set the context , default null
             .setConfirmClick(con) // confirm button click , default dismiss
             .setCloseClick(clo) // close button click , default dismiss
             .setConfirmButText("confirm T") // confirm button text , default "confirm"
             .setCloseButText("close T") // close button text , default "close"
             .setLottieJson(M2Dia.M2Type.SUCCESS, "success.json") // custom lottie , default success.json
             .setRepeatCount(5) // lottie count ,if 0 then only play 1 , default 0
             .setCancelables(false) // Allow closing by clicking the return button , default true
             .setCanceledOnTouchOutsides(false) // Allow closing by clicking on the screen , default true
             .showM2(); // show the dialog

When you want to close it, you can define an M2Dia class variable and implement the following methods:

private M2Dia m2Dia; //import
...
m2Dia = M2Dia.createError(MainActivity.this, getString(R.string.error_title), M2Dia.M2ButTpe.NO_CLOSE_BUT)
             .showM2(); //create
...
m2Dia.dismiss(); //dismiss

🐳Usage

Each method always returns a Toast object, so you can customize the Toast much more. DON'T FORGET THE show() METHOD! Have confirm and close button:

M2Dia.createWarning(MainActivity.this, getString(R.string.warning_title), M2Dia.M2ButTpe.HAVE_ALL_BUT)
     .showM2();

Have confirm button ,no have close button:

M2Dia.createError(MainActivity.this, getString(R.string.error_title), M2Dia.M2ButTpe.NO_CLOSE_BUT)
     .showM2();

🤢Email

Hi there 👋,I'm Evan.

  • 🔭 I’m currently working on something cool.
  • 🌱 I’m currently learning Everything I like.
  • 💬 Ask me about anything related to Java/Python.
  • 📫 How to reach me: uyevan@163.com
  • 😄 Read more about my Blog: GoTo

🏁Screenshots

gif

c5b96a847e28db5356a4296bf54ca8ec

img