MotionToast
MotionToast copied to clipboard
Java Implementation Examples
Java Implementation Examples are needed.......... Many devs prefer Java
I hope this example will help you guys. Let's assume you want to see the toast upon clicking a button, the code will be:
startBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MotionToast.Companion.createColorToast(
MainActivity.this,
"Welcome",
"Enjoy the application",
MotionToastStyle.INFO,
MotionToast.GRAVITY_BOTTOM,
MotionToast.LONG_DURATION,
ResourcesCompat.getFont(MainActivity.this, R.font.helvetica_regular)
);
}
});
You may change the motion toast style to your preferences :)
And don't forget to include the maven { url "https://jitpack.io" } like below in the settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
**maven { url "https://jitpack.io" }**
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "your_app_name"
include ':app'