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

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

Merged
merged 14 commits into from
Sep 25, 2020

Conversation

hpratsch
Copy link
Contributor

@hpratsch hpratsch commented Sep 24, 2020

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:

  • successColor
  • errorColor
  • warningColor
  • infoColor
  • deleteColor

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 Spikeysanju self-assigned this Sep 25, 2020
@Spikeysanju Spikeysanju added the enhancement New feature or request label Sep 25, 2020
@Spikeysanju
Copy link
Owner

Hey, @hpratsch Can you add the screenshots here?

@hpratsch
Copy link
Contributor Author

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

@Spikeysanju
Copy link
Owner

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 Spikeysanju linked an issue Sep 25, 2020 that may be closed by this pull request
@Spikeysanju Spikeysanju merged commit 8c850fd into Spikeysanju:master Sep 25, 2020
@Spikeysanju
Copy link
Owner

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

@henrypra
Copy link

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

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

Successfully merging this pull request may close these issues.

Cannot customize colors?
3 participants