Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Implementation Examples #46

Open
m-anshuman2166 opened this issue Nov 15, 2021 · 2 comments
Open

Java Implementation Examples #46

m-anshuman2166 opened this issue Nov 15, 2021 · 2 comments

Comments

@m-anshuman2166
Copy link

Java Implementation Examples are needed.......... Many devs prefer Java

@prasmaran
Copy link

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 :)

@prasmaran
Copy link

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants