diff --git a/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/helper/AnnotationHelper.java b/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/helper/AnnotationHelper.java index 3c7fda50f4..ff4b5f1e9d 100644 --- a/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/helper/AnnotationHelper.java +++ b/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/helper/AnnotationHelper.java @@ -42,6 +42,7 @@ import org.androidannotations.annotations.OnActivityResult; import org.androidannotations.annotations.OptionsItem; import org.androidannotations.annotations.ResId; +import org.androidannotations.annotations.SeekBarTouchStop; import org.androidannotations.logger.Level; import org.androidannotations.logger.Logger; import org.androidannotations.logger.LoggerFactory; @@ -366,6 +367,9 @@ public String actionName(String annotationName) { if (OnActivityResult.class.getName().equals(annotationName)) { return "Result"; } + if (SeekBarTouchStop.class.getName().equals(annotationName)) { + return "SeekBarTouchStopped"; + } String annotationSimpleName = annotationName.substring(annotationName.lastIndexOf('.') + 1); if (annotationSimpleName.endsWith("e")) { return annotationSimpleName + "d"; diff --git a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/SeekBarChangeListenedActivity.java b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/SeekBarChangeListenedActivity.java index 723aa4771e..33fd91ce17 100644 --- a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/SeekBarChangeListenedActivity.java +++ b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/SeekBarChangeListenedActivity.java @@ -77,6 +77,11 @@ void m9(SeekBar seekBar) { void m10() { } + @SeekBarTouchStop + void seekBar1SeekBarTouchStopped() { + handled = true; + } + @SeekBarTouchStart(R.id.seekBar1) void m11(SeekBar seekBar) { } diff --git a/AndroidAnnotations/functional-test-1-5/src/test/java/org/androidannotations/test15/SeekBarChangeListenedActivityTest.java b/AndroidAnnotations/functional-test-1-5/src/test/java/org/androidannotations/test15/SeekBarChangeListenedActivityTest.java index 8d40d49b58..42f0bacd35 100644 --- a/AndroidAnnotations/functional-test-1-5/src/test/java/org/androidannotations/test15/SeekBarChangeListenedActivityTest.java +++ b/AndroidAnnotations/functional-test-1-5/src/test/java/org/androidannotations/test15/SeekBarChangeListenedActivityTest.java @@ -31,19 +31,20 @@ public class SeekBarChangeListenedActivityTest { private SeekBarChangeListenedActivity_ activity; + private SeekBar seekBar; + private ShadowSeekBar shadowSeekBar; @Before public void setUp() { activity = setupActivity(SeekBarChangeListenedActivity_.class); + seekBar = (SeekBar) activity.findViewById(R.id.seekBar1); + shadowSeekBar = shadowOf_(seekBar); } @Test public void testActionHandled() { assertThat(activity.handled).isFalse(); - SeekBar seekBar = (SeekBar) activity.findViewById(R.id.seekBar1); - ShadowSeekBar shadowSeekBar = shadowOf_(seekBar); - shadowSeekBar.getOnSeekBarChangeListener().onProgressChanged(seekBar, 0, false); assertThat(activity.handled).isTrue(); @@ -53,9 +54,6 @@ public void testActionHandled() { public void testSeekBarPassed() { assertThat(activity.seekBar).isNull(); - SeekBar seekBar = (SeekBar) activity.findViewById(R.id.seekBar1); - ShadowSeekBar shadowSeekBar = shadowOf_(seekBar); - shadowSeekBar.getOnSeekBarChangeListener().onProgressChanged(seekBar, 0, false); assertThat(activity.seekBar).isEqualTo(seekBar); @@ -65,8 +63,6 @@ public void testSeekBarPassed() { public void testProgressPassed() { assertThat(activity.progress).isZero(); - SeekBar seekBar = (SeekBar) activity.findViewById(R.id.seekBar1); - ShadowSeekBar shadowSeekBar = shadowOf_(seekBar); int progress = 45; shadowSeekBar.getOnSeekBarChangeListener().onProgressChanged(seekBar, progress, false); @@ -78,12 +74,18 @@ public void testProgressPassed() { public void testFromUserPassed() { assertThat(activity.fromUser).isFalse(); - SeekBar seekBar = (SeekBar) activity.findViewById(R.id.seekBar1); - ShadowSeekBar shadowSeekBar = shadowOf_(seekBar); - shadowSeekBar.getOnSeekBarChangeListener().onProgressChanged(seekBar, 0, true); assertThat(activity.fromUser).isTrue(); } + @Test + public void testSeekBarTouchStopNamingConvention() { + assertThat(activity.handled).isFalse(); + + shadowSeekBar.getOnSeekBarChangeListener().onStopTrackingTouch(seekBar); + + assertThat(activity.handled).isTrue(); + } + }