Commit d542b9ff authored by rahadi's avatar rahadi

Added real time validation mechanism

parent 255714c9
...@@ -4,24 +4,36 @@ import android.view.View; ...@@ -4,24 +4,36 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import org.javarosa.core.model.FormIndex;
import java.io.InvalidObjectException;
import java.util.ArrayList; import java.util.ArrayList;
import id.ac.stis.capi.lessthink.listeners.OnChangeListener;
import id.ac.stis.capi.lessthink.models.BaseHierarchy; import id.ac.stis.capi.lessthink.models.BaseHierarchy;
import id.ac.stis.capi.lessthink.models.PromptHierarchy;
import id.ac.stis.capi.lessthink.utils.ViewUtils;
import id.ac.stis.capi.odk.widgets.QuestionWidget; import id.ac.stis.capi.odk.widgets.QuestionWidget;
import timber.log.Timber;
/** /**
* Author : Rahadi Jalu * Author : Rahadi Jalu
* Email : 14.8325@stis.ac.id * Email : 14.8325@stis.ac.id
* Company: Politeknik Statistika STIS * Company: Politeknik Statistika STIS
*/ */
public class HierarchyAdapter extends BaseAdapter { public class HierarchyAdapter extends BaseAdapter implements OnChangeListener {
private ArrayList<BaseHierarchy> hierarchies; private ArrayList<BaseHierarchy> hierarchies;
private OnChangeListener onChangeListener;
public HierarchyAdapter(ArrayList<BaseHierarchy> hierarchies) { public HierarchyAdapter(ArrayList<BaseHierarchy> hierarchies) {
this.hierarchies = hierarchies; this.hierarchies = hierarchies;
} }
public void setOnChangeListener(OnChangeListener onChangeListener) {
this.onChangeListener = onChangeListener;
}
@Override @Override
public int getCount() { public int getCount() {
return hierarchies.size(); return hierarchies.size();
...@@ -45,19 +57,36 @@ public class HierarchyAdapter extends BaseAdapter { ...@@ -45,19 +57,36 @@ public class HierarchyAdapter extends BaseAdapter {
@Override @Override
public View getView(final int position, View view, final ViewGroup parent) { public View getView(final int position, View view, final ViewGroup parent) {
View v = hierarchies.get(position).getView(); BaseHierarchy hierarchy = hierarchies.get(position);
View v = hierarchy.getView();
if (v instanceof QuestionWidget) {
v.setOnFocusChangeListener(new View.OnFocusChangeListener() { if (hierarchy instanceof PromptHierarchy) {
@Override final QuestionWidget widget = ((PromptHierarchy) hierarchy).getWidget();
public void onFocusChange(View v, boolean hasFocus) { // widget.setOnFocusChangeListener(new View.OnFocusChangeListener() {
if (hasFocus) { // @Override
((QuestionWidget) v).setFocus(parent.getContext()); // public void onFocusChange(View v, boolean hasFocus) {
} // if (hasFocus) {
} // widget.setFocus(parent.getContext());
}); // }
// }
// });
try {
ViewUtils.setChangeListener(widget, ((PromptHierarchy) hierarchy).getPrompt().getIndex(),
this);
} catch (InvalidObjectException e) {
Timber.e(e);
}
} }
return v; return v;
} }
@Override
public void onChange(QuestionWidget questionWidget, FormIndex formIndex) {
if (onChangeListener != null) {
onChangeListener.onChange(questionWidget, formIndex);
}
}
} }
\ No newline at end of file
...@@ -15,6 +15,7 @@ import android.view.LayoutInflater; ...@@ -15,6 +15,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AbsListView;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
...@@ -24,7 +25,6 @@ import org.javarosa.core.model.data.IAnswerData; ...@@ -24,7 +25,6 @@ import org.javarosa.core.model.data.IAnswerData;
import org.javarosa.form.api.FormEntryController; import org.javarosa.form.api.FormEntryController;
import java.io.File; import java.io.File;
import java.io.InvalidObjectException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
...@@ -38,7 +38,6 @@ import id.ac.stis.capi.lessthink.listeners.OnChangeListener; ...@@ -38,7 +38,6 @@ import id.ac.stis.capi.lessthink.listeners.OnChangeListener;
import id.ac.stis.capi.lessthink.listeners.OnEditRutaSavedListener; import id.ac.stis.capi.lessthink.listeners.OnEditRutaSavedListener;
import id.ac.stis.capi.lessthink.models.BaseHierarchy; import id.ac.stis.capi.lessthink.models.BaseHierarchy;
import id.ac.stis.capi.lessthink.models.PromptHierarchy; import id.ac.stis.capi.lessthink.models.PromptHierarchy;
import id.ac.stis.capi.lessthink.utils.ViewUtils;
import id.ac.stis.capi.odk.application.Collect; import id.ac.stis.capi.odk.application.Collect;
import id.ac.stis.capi.odk.dao.FormsDao; import id.ac.stis.capi.odk.dao.FormsDao;
import id.ac.stis.capi.odk.dao.InstancesDao; import id.ac.stis.capi.odk.dao.InstancesDao;
...@@ -190,26 +189,40 @@ public class FormEntryDialogFragment extends DialogFragment implements FormLoade ...@@ -190,26 +189,40 @@ public class FormEntryDialogFragment extends DialogFragment implements FormLoade
FormController controller = Collect.getInstance().getFormController(); FormController controller = Collect.getInstance().getFormController();
hierarchies = controller.getAllQuestions(getContext()); hierarchies = controller.getAllQuestions(getContext());
setupChangeListener();
adapter = new HierarchyAdapter(hierarchies); adapter = new HierarchyAdapter(hierarchies);
mainContent.setAdapter(adapter); mainContent.setAdapter(adapter);
mainContent.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (scrollState == SCROLL_STATE_IDLE) {
view.setFocusable(true);
} else {
view.setFocusable(false);
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
adapter.setOnChangeListener(this);
setPositiveButtonState(saveAnswers(false));
// adapter.notifyDataSetChanged(); // adapter.notifyDataSetChanged();
// populateQuestionWidgets(hierarchies, questionContainer); // populateQuestionWidgets(hierarchies, questionContainer);
} }
private void setupChangeListener() { private void refreshView() {
for (BaseHierarchy hierarchy : hierarchies) { FormController controller = Collect.getInstance().getFormController();
if (hierarchy instanceof PromptHierarchy) { newHierarchies = controller.getAllQuestions(getContext());
QuestionWidget widget = ((PromptHierarchy) hierarchy).getWidget();
try { hierarchies.clear();
ViewUtils.setChangeListener(widget, ((PromptHierarchy) hierarchy).getPrompt().getIndex(), this); hierarchies.addAll(newHierarchies);
} catch (InvalidObjectException e) { adapter.notifyDataSetChanged();
e.printStackTrace();
}
}
}
} }
// private void refreshView(FormIndex index) { // private void refreshView(FormIndex index) {
...@@ -485,71 +498,120 @@ public class FormEntryDialogFragment extends DialogFragment implements FormLoade ...@@ -485,71 +498,120 @@ public class FormEntryDialogFragment extends DialogFragment implements FormLoade
* @return false if any error occurs while saving (constraint violated, * @return false if any error occurs while saving (constraint violated,
* etc...), true otherwise. * etc...), true otherwise.
*/ */
// private boolean saveAnswers() { private boolean saveAnswers(boolean refreshView) {
// FormController formController = Collect.getInstance() AlertDialog dialog = (AlertDialog) getDialog();
// .getFormController(); Window window = dialog.getWindow();
// if (window != null) {
// if (formController.currentPromptIsQuestion()) { window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
// LinkedHashMap<FormIndex, IAnswerData> answers = new LinkedHashMap<>(); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
// }
// Set<String> references = questionWidgets.keySet();
// for (String reference : references) { boolean isClean = true;
// Timber.d("Put Reference : %s", reference);
// answers.put(questionWidgets.get(reference).getPrompt().getIndex(), FormController formController = Collect.getInstance()
// questionWidgets.get(reference).getAnswer()); .getFormController();
// }
// if (formController.currentPromptIsQuestion()) {
// try { LinkedHashMap<FormIndex, IAnswerData> answers = new LinkedHashMap<>();
// ArrayList<FailedConstraint> constraints = formController.saveAllScreenAnswers(answers,
// true); for (int i = 0; i < adapter.getCount(); i++) {
// if (constraints != null) { if (adapter.getItem(i) instanceof PromptHierarchy) {
// for (FailedConstraint constraint : constraints) { PromptHierarchy hierarchy = (PromptHierarchy) adapter.getItem(i);
// String message = null; answers.put(hierarchy.getPrompt().getIndex(),
// switch (constraint.status) { hierarchy.getWidget().getAnswer());
// case FormEntryController.ANSWER_REQUIRED_BUT_EMPTY: }
// message = formController.getQuestionPromptRequiredText(constraint.index); }
// if (message == null || message.trim().length() == 0) {
// message = formController.getQuestionPrompt(constraint.index) try {
// .getSpecialFormQuestionText("requiredMsg"); ArrayList<FailedConstraint> constraints = formController.saveAllScreenAnswers(answers,
// true);
// if (message == null || message.trim().length() == 0) {
// message = "Answer is Required"; if (refreshView) {
// } refreshView();
// } }
// break;
// case FormEntryController.ANSWER_CONSTRAINT_VIOLATED: if (constraints != null) {
// message = formController.getQuestionPromptConstraintText(constraint.index); for (FailedConstraint constraint : constraints) {
// if (message == null || message.trim().length() == 0) { String message = null;
// message = formController.getQuestionPrompt(constraint.index) switch (constraint.status) {
// .getSpecialFormQuestionText("constraintMsg"); case FormEntryController.ANSWER_REQUIRED_BUT_EMPTY:
// message = formController.getQuestionPromptRequiredText(constraint.index);
// if (message == null || message.trim().length() == 0) { if (message == null || message.trim().length() == 0) {
// message = "Answer violates Constraint"; message = formController.getQuestionPrompt(constraint.index)
// } .getSpecialFormQuestionText("requiredMsg");
// }
// break; if (message == null || message.trim().length() == 0) {
// } message = "Answer is Required";
// }
// QuestionWidget questionWidget = questionWidgets.get(constraint.index.getReference().toString()); }
// answers.remove(questionWidget.getPrompt().getIndex()); break;
// ViewUtils.setError(questionWidget, message); case FormEntryController.ANSWER_CONSTRAINT_VIOLATED:
// } message = formController.getQuestionPromptConstraintText(constraint.index);
// if (message == null || message.trim().length() == 0) {
// Set<FormIndex> formIndices = answers.keySet(); message = formController.getQuestionPrompt(constraint.index)
// for (FormIndex formIndex : formIndices) { .getSpecialFormQuestionText("constraintMsg");
// ViewUtils.clearError(questionWidgets.get(formIndex.getReference().toString()));
// } if (message == null || message.trim().length() == 0) {
// message = "Answer violates Constraint";
// return false; }
// } }
// } catch (JavaRosaException e) { break;
// Timber.e(e); }
//// createErrorDialog(e.getCause().getMessage(), DO_NOT_EXIT);
// return false; Timber.d("Current Index: %s %s", constraint.index,
// } constraint.index.getReference());
// }
// return true; for (int i = 0; i < adapter.getCount(); i++) {
// } if (adapter.getItem(i) instanceof PromptHierarchy) {
PromptHierarchy h = (PromptHierarchy) adapter.getItem(i);
if (h.getPrompt().getIndex().getReference().toString()
.equals(constraint.index.getReference().toString())) {
Timber.d("Error caught! (%s) Index: %s %s", message,
constraint.index, constraint.index.getReference());
answers.remove(constraint.index);
h.setError(message);
break;
}
}
}
}
isClean = false;
}
Set<FormIndex> formIndices = answers.keySet();
for (FormIndex formIndex : formIndices) {
for (int i = 0; i < adapter.getCount(); i++) {
if (adapter.getItem(i) instanceof PromptHierarchy) {
PromptHierarchy h = (PromptHierarchy) adapter.getItem(i);
if (h.getPrompt().getIndex().getReference().toString()
.equals(formIndex.getReference().toString())) {
Timber.d("Clean! Index: %s %s", formIndex,
formIndex.getReference());
h.setError(null);
break;
}
}
}
}
} catch (JavaRosaException e) {
Timber.e(e);
// createErrorDialog(e.getCause().getMessage(), DO_NOT_EXIT);
isClean = false;
}
}
if (window != null) {
window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
/*| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL*/
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
}
return isClean;
}
@Override @Override
public void loadingError(String errorMsg) { public void loadingError(String errorMsg) {
...@@ -568,8 +630,7 @@ public class FormEntryDialogFragment extends DialogFragment implements FormLoade ...@@ -568,8 +630,7 @@ public class FormEntryDialogFragment extends DialogFragment implements FormLoade
.getFormController(); .getFormController();
formController.jumpToIndex(index); formController.jumpToIndex(index);
// saveAnswers(); setPositiveButtonState(saveAnswers(true));
// refreshView(index);
} }
} }
...@@ -20,4 +20,4 @@ public interface UpdatingErrorInterface { ...@@ -20,4 +20,4 @@ public interface UpdatingErrorInterface {
* Specifically made for updating mode. * Specifically made for updating mode.
* */ * */
void clearError(); void clearError();
} }
\ No newline at end of file
...@@ -54,7 +54,7 @@ public class CaptionHierarchy extends BaseHierarchy { ...@@ -54,7 +54,7 @@ public class CaptionHierarchy extends BaseHierarchy {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
75, 75); 75, 75);
params.topMargin = 15; params.topMargin = 26;
params.bottomMargin = 15; params.bottomMargin = 15;
textView.setLayoutParams(params); textView.setLayoutParams(params);
} else if (getType() == TYPE_NEW_REPEAT) { } else if (getType() == TYPE_NEW_REPEAT) {
...@@ -67,7 +67,7 @@ public class CaptionHierarchy extends BaseHierarchy { ...@@ -67,7 +67,7 @@ public class CaptionHierarchy extends BaseHierarchy {
ta.recycle(); ta.recycle();
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 1); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 1);
textView.setPadding(25, 45, 25, 45); textView.setPadding(15, 45, 15, 45);
textView.setTextColor(ContextCompat.getColor(context, R.color.white)); textView.setTextColor(ContextCompat.getColor(context, R.color.white));
textView.setBackground(drawable); textView.setBackground(drawable);
...@@ -165,6 +165,20 @@ public class CaptionHierarchy extends BaseHierarchy { ...@@ -165,6 +165,20 @@ public class CaptionHierarchy extends BaseHierarchy {
this.captionView = container; this.captionView = container;
// View v = LayoutInflater.from(context).inflate(R.layout.item_updating_hierarchy, null);
// View mainContent = v.findViewById(R.id.main_content);
//
// ViewGroup parent = (ViewGroup) mainContent.getParent();
// int index = parent.indexOfChild(mainContent);
//
// parent.removeView(mainContent);
// parent.addView(textView, index);
//
// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) parent.getLayoutParams();
// params.setMargins(6 * getLevel(), 0, 6 * getLevel(), 0);
// parent.setLayoutParams(params);
//
// this.captionView = v;
} }
public View getText() { public View getText() {
......
...@@ -8,12 +8,18 @@ import android.view.ViewGroup; ...@@ -8,12 +8,18 @@ import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import org.javarosa.core.model.FormIndex;
import org.javarosa.form.api.FormEntryPrompt; import org.javarosa.form.api.FormEntryPrompt;
import java.io.InvalidObjectException;
import id.ac.stis.capi.R; import id.ac.stis.capi.R;
import id.ac.stis.capi.lessthink.listeners.OnChangeListener;
import id.ac.stis.capi.lessthink.utils.ViewUtils;
import id.ac.stis.capi.lessthink.views.HierarchyErrorView; import id.ac.stis.capi.lessthink.views.HierarchyErrorView;
import id.ac.stis.capi.odk.widgets.QuestionWidget; import id.ac.stis.capi.odk.widgets.QuestionWidget;
import id.ac.stis.capi.odk.widgets.WidgetFactory; import id.ac.stis.capi.odk.widgets.WidgetFactory;
import timber.log.Timber;
/** /**
* Author : Rahadi Jalu * Author : Rahadi Jalu
...@@ -70,10 +76,10 @@ public class PromptHierarchy extends BaseHierarchy { ...@@ -70,10 +76,10 @@ public class PromptHierarchy extends BaseHierarchy {
LinearLayout.LayoutParams errorParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams errorParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
errorParams.leftMargin = 15; // errorParams.leftMargin = 20;
errorParams.bottomMargin = 15; // errorParams.bottomMargin = 14;
errorParams.rightMargin = 15; // errorParams.rightMargin = 20;
errorParams.topMargin = 15; // errorParams.topMargin = 14;
errorView.setLayoutParams(errorParams); errorView.setLayoutParams(errorParams);
widgetContainer.addView(errorView); widgetContainer.addView(errorView);
...@@ -138,6 +144,7 @@ public class PromptHierarchy extends BaseHierarchy { ...@@ -138,6 +144,7 @@ public class PromptHierarchy extends BaseHierarchy {
} }
public void setError(String message) { public void setError(String message) {
Timber.d("Set Error: %s %s", message, prompt.getIndex().getReference().toString());
if (message == null) { if (message == null) {
widgetContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.white)); widgetContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.white));
errorView.setVisibility(View.GONE); errorView.setVisibility(View.GONE);
......
...@@ -2,6 +2,7 @@ package id.ac.stis.capi.lessthink.utils; ...@@ -2,6 +2,7 @@ package id.ac.stis.capi.lessthink.utils;
import android.support.v7.widget.AppCompatButton; import android.support.v7.widget.AppCompatButton;
import android.text.Editable; import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
...@@ -17,6 +18,8 @@ import org.javarosa.core.model.FormIndex; ...@@ -17,6 +18,8 @@ import org.javarosa.core.model.FormIndex;
import java.io.InvalidObjectException; import java.io.InvalidObjectException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
import id.ac.stis.capi.lessthink.interfaces.UpdatingErrorInterface; import id.ac.stis.capi.lessthink.interfaces.UpdatingErrorInterface;
import id.ac.stis.capi.lessthink.listeners.OnChangeListener; import id.ac.stis.capi.lessthink.listeners.OnChangeListener;
...@@ -33,7 +36,6 @@ import id.ac.stis.capi.odk.widgets.SelectOneWidget; ...@@ -33,7 +36,6 @@ import id.ac.stis.capi.odk.widgets.SelectOneWidget;
import id.ac.stis.capi.odk.widgets.SpinnerWidget; import id.ac.stis.capi.odk.widgets.SpinnerWidget;
import id.ac.stis.capi.odk.widgets.StringWidget; import id.ac.stis.capi.odk.widgets.StringWidget;
import id.ac.stis.capi.odk.widgets.TriggerWidget; import id.ac.stis.capi.odk.widgets.TriggerWidget;
import timber.log.Timber;
/** /**
* Author : Rahadi Jalu * Author : Rahadi Jalu
...@@ -178,6 +180,10 @@ public class ViewUtils { ...@@ -178,6 +180,10 @@ public class ViewUtils {
if (ed != null) { if (ed != null) {
ed.addTextChangedListener(new TextWatcher() { ed.addTextChangedListener(new TextWatcher() {
private final long DELAY = 500;
private Timer timer = new Timer();
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
...@@ -190,14 +196,21 @@ public class ViewUtils { ...@@ -190,14 +196,21 @@ public class ViewUtils {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (onChangeListener != null) { timer.cancel();
onChangeListener.onChange(qw, index); timer = new Timer();
} timer.schedule(new TimerTask() {
@Override
public void run() {
if (onChangeListener != null) {
onChangeListener.onChange(qw, index);
}
if (qw instanceof StringWidget) if (qw instanceof StringWidget)
((StringWidget) qw).getEditText().requestFocus(); ((StringWidget) qw).getEditText().requestFocus();
else if (qw instanceof ExStringWidget) else if (qw instanceof ExStringWidget)
((ExStringWidget) qw).getEditText().requestFocus(); ((ExStringWidget) qw).getEditText().requestFocus();
}
}, DELAY);
} }
}); });
return; return;
......
package id.ac.stis.capi.lessthink.views; package id.ac.stis.capi.lessthink.views;
import android.content.Context; import android.content.Context;
import android.graphics.Paint;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
...@@ -30,7 +28,8 @@ public class HierarchyErrorView extends LinearLayout { ...@@ -30,7 +28,8 @@ public class HierarchyErrorView extends LinearLayout {
setGravity(Gravity.CENTER_VERTICAL); setGravity(Gravity.CENTER_VERTICAL);
setPadding(25, 25, 25, 25); setPadding(25, 25, 25, 25);
setBackground(ContextCompat.getDrawable(context, R.drawable.bg_border_tb)); // setBackground(ContextCompat.getDrawable(context, R.drawable.bg_border_t));
setBackgroundColor(ContextCompat.getColor(context, R.color.smooth_red));
this.messageView = new TextView(context); this.messageView = new TextView(context);
messageView.setGravity(Gravity.CENTER_VERTICAL); messageView.setGravity(Gravity.CENTER_VERTICAL);
......
...@@ -1032,7 +1032,7 @@ public class FormController { ...@@ -1032,7 +1032,7 @@ public class FormController {
prompts.add(new CaptionHierarchy(context, fcRep, CaptionHierarchy.TYPE_NEW_REPEAT, prompts.add(new CaptionHierarchy(context, fcRep, CaptionHierarchy.TYPE_NEW_REPEAT,
prevType, currLevel, prevLevel)); prevType, currLevel, prevLevel));
prevLevel = CaptionHierarchy.TYPE_NEW_REPEAT; prevType = CaptionHierarchy.TYPE_NEW_REPEAT;
prevLevel = currLevel; prevLevel = currLevel;
break; break;
case FormEntryController.EVENT_REPEAT: case FormEntryController.EVENT_REPEAT:
...@@ -1052,14 +1052,13 @@ public class FormController { ...@@ -1052,14 +1052,13 @@ public class FormController {
// Display the repeat header for the group. // Display the repeat header for the group.
prompts.add(new CaptionHierarchy(context, fc, CaptionHierarchy.TYPE_REPEAT, prompts.add(new CaptionHierarchy(context, fc, CaptionHierarchy.TYPE_REPEAT,
prevType, currLevel, prevLevel)); prevType, currLevel, prevLevel));
prevType = CaptionHierarchy.TYPE_REPEAT;
prevLevel = currLevel;
} }
prompts.add(new CaptionHierarchy(context, fc, CaptionHierarchy.TYPE_MULTIPLICITY, prompts.add(new CaptionHierarchy(context, fc, CaptionHierarchy.TYPE_MULTIPLICITY,
prevType, currLevel, prevLevel)); prevType, currLevel, prevLevel));
prevType = CaptionHierarchy.TYPE_REPEAT;
prevLevel = currLevel;
// prevLevel = currLevel; // prevLevel = currLevel;
// currLevel++; // currLevel++;