forked from getodk/collect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto advance doesn't work when user clicks on already selected answer (…
- Loading branch information
1 parent
c8d7163
commit 5734426
Showing
2 changed files
with
16 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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"; | ||
|
||
|
@@ -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); | ||
|
@@ -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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -111,6 +112,7 @@ public SelectOneAutoAdvanceWidget(Context context, FormEntryPrompt prompt) { | |
} | ||
|
||
r.setOnCheckedChangeListener(this); | ||
r.setOnClickListener(this); | ||
|
||
String audioURI = null; | ||
audioURI = | ||
|
@@ -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(); | ||
} | ||
|
||
|
||
|
@@ -230,4 +230,8 @@ public void cancelLongPress() { | |
} | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
listener.advance(); | ||
} | ||
} |