From 85165249ec9a02d652ac34f8fca79738c293140c Mon Sep 17 00:00:00 2001 From: Patrick MacDowell Date: Fri, 29 Jul 2016 08:49:12 -0700 Subject: [PATCH] Added the ability to set the background color Added 2 methods for setting the background color of the Elastic view. It should take in either an int color or a String and parse the color. If the string is null or the parsing fails, nothing will be set and it will retain the original color --- .../arontibo/library/ElasticDownloadView.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java index 17f2b6d..86d7c2d 100644 --- a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java +++ b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java @@ -107,5 +107,33 @@ public void onEnterAnimationFinished() { // Do further actions if necessary } + + + ///////////////////////////////////////////////////////////////////////////// + ///Added on 2016-07-29 by PGMacDesign as per Issue #27 in Github///////////// + ///////////////////////////////////////////////////////////////////////////// + /** + * 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){ + return; + } + try { + int color = Color.parseColor(passedColor); + this.setBackgroundColor(color); + } catch (Exception e){} + } }