From 85165249ec9a02d652ac34f8fca79738c293140c Mon Sep 17 00:00:00 2001 From: Patrick MacDowell Date: Fri, 29 Jul 2016 08:49:12 -0700 Subject: [PATCH 1/5] 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){} + } } From fcf54bee3e379c6645d59422f168caa1ee3a4101 Mon Sep 17 00:00:00 2001 From: Patrick MacDowell Date: Mon, 1 Aug 2016 08:02:27 -0700 Subject: [PATCH 2/5] Fixed some grammatical errors Adjusted text and changed catch argument. Omitted an e.printStackTrace() as I was unsure if it was desired. Let me know if you want it implemented. --- .../java/is/arontibo/library/ElasticDownloadView.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java index 86d7c2d..bb815b9 100644 --- a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java +++ b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java @@ -108,15 +108,12 @@ 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){ + public void setBackgroundColor(int passedColor) { this.mBackgroundColor = passedColor; this.mProgressDownloadView.setBackgroundColor(mBackgroundColor); } @@ -126,14 +123,14 @@ public void setBackgroundColor(int passedColor){ * @param passedColor String of a color hex color (IE: #fd5c79) that can be parsed by * Color.parseColor(string) */ - public void setBackgroundColor(String passedColor){ + public void setBackgroundColor(String passedColor) { if(passedColor == null){ return; } try { int color = Color.parseColor(passedColor); this.setBackgroundColor(color); - } catch (Exception e){} + } catch (IllegalArgumentException e) {} } } From cbd20328f31256d194746f6a497ca3c4531b0510 Mon Sep 17 00:00:00 2001 From: Patrick MacDowell Date: Mon, 1 Aug 2016 14:23:58 -0700 Subject: [PATCH 3/5] Adding in printStackTrace e.printStackTrace(); under catch for null Strings or bad color parsing strings sent --- .../main/java/is/arontibo/library/ElasticDownloadView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java index bb815b9..6490ae0 100644 --- a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java +++ b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java @@ -130,7 +130,9 @@ public void setBackgroundColor(String passedColor) { try { int color = Color.parseColor(passedColor); this.setBackgroundColor(color); - } catch (IllegalArgumentException e) {} + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } } } From c5d5beeae90018c27a2fe5c36167a520a25fb109 Mon Sep 17 00:00:00 2001 From: Patrick MacDowell Date: Tue, 2 Aug 2016 07:56:13 -0700 Subject: [PATCH 4/5] Adding a space for formatting --- .../src/main/java/is/arontibo/library/ElasticDownloadView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java index 6490ae0..bf280bb 100644 --- a/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java +++ b/elasticdownload/src/main/java/is/arontibo/library/ElasticDownloadView.java @@ -124,7 +124,7 @@ public void setBackgroundColor(int passedColor) { * Color.parseColor(string) */ public void setBackgroundColor(String passedColor) { - if(passedColor == null){ + if (passedColor == null){ return; } try { From d4442328592058d4cdafb945c4f2903fb49def8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arda=20=C3=87ebi?= Date: Sun, 6 May 2018 01:16:09 +0300 Subject: [PATCH 5/5] Replacement of "compile" with "implementation" As "compile" is going to be deprecated end-2018, this PR replaces with "implementation" that is the new usage. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb3d79e..aba6388 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Usage Grab it from maven: ```groovy - compile 'com.github.tibolte:elasticdownload:1.0.+' + implementation 'com.github.tibolte:elasticdownload:1.0.+' ````