X Tutup
Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ void m9(SeekBar seekBar) {
void m10() {
}

@SeekBarTouchStop
void seekBar1SeekBarTouchStopped() {
handled = true;
}

@SeekBarTouchStart(R.id.seekBar1)
void m11(SeekBar seekBar) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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();
}

}
X Tutup