From a71175d96b0bbd2ba02fbf5157882eb19cf6abbb Mon Sep 17 00:00:00 2001 From: carlosmuvi Date: Fri, 23 Jun 2017 15:36:59 -0700 Subject: [PATCH] Added reset feature. --- .../main/java/com/carlosmuvi/sample/MainActivity.java | 8 ++++++++ app/src/main/res/layout/activity_main.xml | 10 ++++++++++ gradle.properties | 4 ++-- library/build.gradle | 4 ++-- .../segmentedprogressbar/SegmentedProgressBar.kt | 6 ++++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/carlosmuvi/sample/MainActivity.java b/app/src/main/java/com/carlosmuvi/sample/MainActivity.java index b225bab..86432c4 100644 --- a/app/src/main/java/com/carlosmuvi/sample/MainActivity.java +++ b/app/src/main/java/com/carlosmuvi/sample/MainActivity.java @@ -11,6 +11,7 @@ public class MainActivity extends AppCompatActivity { SegmentedProgressBar segmentedProgressBar; Button startButton; Button pauseButton; + Button resetButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -20,6 +21,7 @@ public class MainActivity extends AppCompatActivity { startButton = (Button) findViewById(R.id.button); pauseButton = (Button) findViewById(R.id.button3); + resetButton = (Button) findViewById(R.id.button2); startButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -32,6 +34,12 @@ public class MainActivity extends AppCompatActivity { segmentedProgressBar.pause(); } }); + + resetButton.setOnClickListener(new View.OnClickListener() { + @Override public void onClick(View view) { + segmentedProgressBar.reset(); + } + }); } private void initSegmentedProgressBar() { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 12173ba..cb51bbc 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -44,4 +44,14 @@ android:text="Start next segment" /> +