Skip to content

Commit

Permalink
Auto advance doesn't work when user clicks on already selected answer (
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 authored and lognaturel committed Feb 2, 2017
1 parent c8d7163 commit 5734426
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.database.Cursor;
import android.graphics.BitmapFactory;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.CompoundButton;
import android.widget.ImageView;
Expand Down Expand Up @@ -52,7 +53,7 @@
* @author Yaw Anokwa ([email protected])
*/
public class ItemsetWidget extends QuestionWidget implements
android.widget.CompoundButton.OnCheckedChangeListener {
CompoundButton.OnCheckedChangeListener, View.OnClickListener {

private static String tag = "ItemsetWidget";

Expand Down Expand Up @@ -248,6 +249,7 @@ protected ItemsetWidget(Context context, FormEntryPrompt prompt, boolean readOnl
RadioButton rb = new RadioButton(context);

rb.setOnCheckedChangeListener(this);
rb.setOnClickListener(this);
rb.setTextSize(mAnswerFontsize);
rb.setText(label);
rb.setTag(index);
Expand Down Expand Up @@ -381,10 +383,13 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mAnswer = mAnswers.get(buttonView.getText().toString());
}
}
if (mAutoAdvanceToNext) {
mAutoAdvanceToNextListener.advance();
}
}
}

@Override
public void onClick(View v) {
if (mAutoAdvanceToNext) {
mAutoAdvanceToNextListener.advance();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.graphics.BitmapFactory;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
Expand Down Expand Up @@ -51,7 +52,7 @@
*
* @author Jeff Beorse ([email protected])
*/
public class SelectOneAutoAdvanceWidget extends QuestionWidget implements OnCheckedChangeListener {
public class SelectOneAutoAdvanceWidget extends QuestionWidget implements OnCheckedChangeListener, View.OnClickListener {
List<SelectChoice> mItems; // may take a while to compute
ArrayList<RadioButton> buttons;
AdvanceToNextListener listener;
Expand Down Expand Up @@ -111,6 +112,7 @@ public SelectOneAutoAdvanceWidget(Context context, FormEntryPrompt prompt) {
}

r.setOnCheckedChangeListener(this);
r.setOnClickListener(this);

String audioURI = null;
audioURI =
Expand Down Expand Up @@ -209,8 +211,6 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
Collect.getInstance().getActivityLogger().logInstanceAction(this, "onCheckedChanged",
mItems.get((Integer) buttonView.getTag()).getValue(), mPrompt.getIndex());

listener.advance();
}


Expand All @@ -230,4 +230,8 @@ public void cancelLongPress() {
}
}

@Override
public void onClick(View v) {
listener.advance();
}
}

0 comments on commit 5734426

Please sign in to comment.