xiprox / ErrorView

A custom view that displays an image, a title, and a subtitle. Use it for errors, empty states, or just messages with images!
Apache License 2.0
568 stars 93 forks source link

Added ability to change text color of title and subtitle programmatically and in xml. #1

Closed taylorsloan closed 9 years ago

xiprox commented 9 years ago

Hi, thanks for contributing! I really appreciate that you followed the general code format too.

One thing though, are you sure it works with setColor(int res) when you want to use color resources? I think it should be something like setColor(context.getResources.getColor(int res)).

We don't really need to get colors from resources in ErrorView though. We could just have setColor(int color) methods and the users would get colors from resources before passing them to ErrorView.

taylorsloan commented 9 years ago

I made some name changes and added the changes you requested.

xiprox commented 9 years ago

Oh, I think I couldn't make my point clear. I think it's a better idea to use color ints directly for setColor methods. As for the reason, not always would a user want to use colors from resources. There may be cases when colors generated at runtime may be desired to be used. The methods would look like

setColor(int color) {
    mView.setTextColor(color);
}

If anyone wants to use a resource, they'd have to do something like the following:

mErrorView.setErrorTitleColor(context.getResources(getColor(R.color.some_color)));
xiprox commented 9 years ago

Ok, seems good. Thanks again!

taylorsloan commented 9 years ago

Np, happy to help