From 12566293debd1c632987fff5d874ea21f652db34 Mon Sep 17 00:00:00 2001 From: Anna Eglite <35799489+thetrueeagle@users.noreply.github.com> Date: Fri, 2 Feb 2018 15:42:13 +0000 Subject: [PATCH] Add decrementProgress method --- .../daimajia/numberprogressbar/NumberProgressBar.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library/src/main/java/com/daimajia/numberprogressbar/NumberProgressBar.java b/library/src/main/java/com/daimajia/numberprogressbar/NumberProgressBar.java index a48b425..ae96705 100644 --- a/library/src/main/java/com/daimajia/numberprogressbar/NumberProgressBar.java +++ b/library/src/main/java/com/daimajia/numberprogressbar/NumberProgressBar.java @@ -432,6 +432,17 @@ public void incrementProgressBy(int by) { mListener.onProgressChange(getProgress(), getMax()); } } + + + public void decrementProgressBy(int by) { + if (by < 0) { + setProgress(getProgress() - by); + } + + if(mListener != null){ + mListener.onProgressChange(getProgress(), getMax()); + } + } public void setProgress(int progress) { if (progress <= getMax() && progress >= 0) {