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

Added the ability to set the background color #35

Merged
merged 4 commits into from Aug 2, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -107,5 +107,30 @@ public void onEnterAnimationFinished() {

// Do further actions if necessary
}


/**
* Set the background color of the Elastic Download View
* @param passedColor int Color Color to set the background
*/
public void setBackgroundColor(int passedColor) {
this.mBackgroundColor = passedColor;
this.mProgressDownloadView.setBackgroundColor(mBackgroundColor);
}

/**
* Overloaded method, takes in a String color to parse
* @param passedColor String of a color hex color (IE: #fd5c79) that can be parsed by
* Color.parseColor(string)
*/
public void setBackgroundColor(String passedColor) {
if(passedColor == null){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if needs a space between itself and the parenthesis (like the rest of the code).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just missing if (passedColor == null) (adding a white space) and it's good to go.

return;
}
try {
int color = Color.parseColor(passedColor);
this.setBackgroundColor(color);
} catch (IllegalArgumentException e) {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better! What we usually do in the case is use e.printstacktrace(); to notify in logcat that something when wrong, or you can use a log message with Log.e. Either way we should do something here, so developers can get notified when a wrong color has been passed to this function.

}

}