Spikeysanju / MotionToast

🌈 A Beautiful Motion Toast Library for Kotlin Android
1.48k stars 130 forks source link

Create new methods, which allow devs to customize MotionToast even further #15

Closed hpratsch closed 3 years ago

hpratsch commented 3 years ago

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.

gif

gif

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.

Spikeysanju commented 3 years ago

Hey, @hpratsch Can you add the screenshots here?

hpratsch commented 3 years ago

Hi @Spikeysanju , I've added 2 screenshots of toasts with custom colors to the PR. I hope, that's what you meant.

Spikeysanju commented 3 years ago

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 👍

Spikeysanju commented 3 years ago

@hpratsch PR Merged, Thanks a ton. Have a great day!

henrypra commented 3 years ago

@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.