From 00f1f80d1a90a6eb56cdab6c3e036ca1775d0085 Mon Sep 17 00:00:00 2001 From: DjBushido Date: Mon, 24 Mar 2014 10:07:09 -0400 Subject: [PATCH] Add methods to be used by both button presses and gesture detection --- HW4/src/com/example/hw4/ImageViewerActivity.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/HW4/src/com/example/hw4/ImageViewerActivity.java b/HW4/src/com/example/hw4/ImageViewerActivity.java index 7131563..aa8cf78 100644 --- a/HW4/src/com/example/hw4/ImageViewerActivity.java +++ b/HW4/src/com/example/hw4/ImageViewerActivity.java @@ -32,17 +32,27 @@ public class ImageViewerActivity extends Activity { } public void onClickPrev(View v) { - + displayPrev(); } public void onClickNext(View v) { - + displayNext(); } public void onClickBack(View v) { finish(); } + private void displayPrev() { + currentIndex -= 1; + displayImage(currentIndex); + } + + private void displayNext() { + currentIndex += 1; + displayImage(currentIndex); + } + public void displayImage(int indexToDisplay) {