-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Create new methods, which allow devs to customize MotionToast even further #15
Create new methods, which allow devs to customize MotionToast even further #15
Conversation
Hey, @hpratsch Can you add the screenshots here? |
Hi @Spikeysanju , I've added 2 screenshots of toasts with custom colors to the PR. I hope, that's what you meant. |
Reviewing Your PR, So far it's LGTM, Will let you know when it's done 👍 |
@hpratsch PR Merged, Thanks a ton. Have a great day! |
@Spikeysanju you're welcome. Thanks for merging. In the future, I can add more customizable options (e.g. customized title text), but right now, allowing the dev to change colors was more important. |
Description:
This PR adds several new methods to the library, that lets us customize the colors used in the toast messages on the request of our ux/ui designers. These changes will allow us to use this library in our applications.
This PR also remove unnecessary empty lines and extends the sample app to showcase the new features.
Customizability:
The following colors can now be customized:
Usage:
To change the color of the success toast, you need to call the following method:
MotionToast.setSuccessColor(R.color.custom_success_color)
MotionToast.setSuccessBackgroundColor(R.color.success_bg_color)`If you want to reset all custom toast colors and use the default colors, call:
MotionToast.resetToastColors()
Conclusion
There should not be any compatibility issues with these changes.
I'm open for feedback, if you want we can discuss my changes. Also feel free to adjust the naming of the methods to your liking.
At first, I planned to create just one config() methods, that changes all the colors at once, but in the end I decided to create for every color adjustment one separate methods, because this way you don't need to insert 10+ colors into one method and you it's cleaner.
Another idea for the future, would be to allow customizing the title of the toast message. This would come in handy, if you are supporting multiple languages and dont wan't to display the title "DELETE" in foreign language settings. The devs also might want to customize the wording to their liking.