Commit 349ed645 authored by rahadi's avatar rahadi

Added external intent handlers

parent d542b9ff
...@@ -17,7 +17,8 @@ import java.util.List; ...@@ -17,7 +17,8 @@ import java.util.List;
import id.ac.stis.capi.R; import id.ac.stis.capi.R;
import id.ac.stis.capi.collectiva.preferences.Constants; import id.ac.stis.capi.collectiva.preferences.Constants;
import id.ac.stis.capi.lessthink.fragments.FormEntryDialogFragment; import id.ac.stis.capi.lessthink.fragments.FormEntryDialogFragment;
import id.ac.stis.capi.lessthink.listeners.OnAddButtonClickListener; import id.ac.stis.capi.lessthink.fragments.FormEntryRVDialogFragment;
import id.ac.stis.capi.lessthink.listeners.OnTableAddButtonClickListener;
import id.ac.stis.capi.lessthink.models.FormLabels; import id.ac.stis.capi.lessthink.models.FormLabels;
import id.ac.stis.capi.lessthink.models.InstanceValues; import id.ac.stis.capi.lessthink.models.InstanceValues;
import id.ac.stis.capi.lessthink.utils.XmlUtils; import id.ac.stis.capi.lessthink.utils.XmlUtils;
...@@ -31,6 +32,7 @@ import id.ac.stis.capi.odk.dto.Instance; ...@@ -31,6 +32,7 @@ import id.ac.stis.capi.odk.dto.Instance;
import id.ac.stis.capi.odk.provider.FormsProviderAPI; import id.ac.stis.capi.odk.provider.FormsProviderAPI;
import id.ac.stis.capi.odk.provider.InstanceProviderAPI; import id.ac.stis.capi.odk.provider.InstanceProviderAPI;
import id.ac.stis.capi.odk.utilities.ApplicationConstants; import id.ac.stis.capi.odk.utilities.ApplicationConstants;
import timber.log.Timber;
public class ListingInstanceActivity extends AppCompatActivity { public class ListingInstanceActivity extends AppCompatActivity {
...@@ -41,7 +43,8 @@ public class ListingInstanceActivity extends AppCompatActivity { ...@@ -41,7 +43,8 @@ public class ListingInstanceActivity extends AppCompatActivity {
private TableRowView tableRowView; private TableRowView tableRowView;
private TableFooterView tableFooterView; private TableFooterView tableFooterView;
private String formId, formName; private String formId, formName;
private FormEntryDialogFragment entryDialogFragment; // private FormEntryDialogFragment entryDialogFragment;
private FormEntryRVDialogFragment entryDialogFragment;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -91,7 +94,9 @@ public class ListingInstanceActivity extends AppCompatActivity { ...@@ -91,7 +94,9 @@ public class ListingInstanceActivity extends AppCompatActivity {
// Toast.makeText(ListingInstanceActivity.this, "Click : " + view.getTag(), Toast.LENGTH_LONG).show(); // Toast.makeText(ListingInstanceActivity.this, "Click : " + view.getTag(), Toast.LENGTH_LONG).show();
String instanceUuid = view.getTag().toString(); String instanceUuid = view.getTag().toString();
entryDialogFragment = FormEntryDialogFragment.newInstance(instanceUuid, // entryDialogFragment = FormEntryDialogFragment.newInstance(instanceUuid,
// FormEntryDialogFragment.MODE_EDIT, false);
entryDialogFragment = FormEntryRVDialogFragment.newInstance(instanceUuid,
FormEntryDialogFragment.MODE_EDIT, false); FormEntryDialogFragment.MODE_EDIT, false);
entryDialogFragment.show(getSupportFragmentManager(), instanceUuid); entryDialogFragment.show(getSupportFragmentManager(), instanceUuid);
// //
...@@ -101,7 +106,7 @@ public class ListingInstanceActivity extends AppCompatActivity { ...@@ -101,7 +106,7 @@ public class ListingInstanceActivity extends AppCompatActivity {
} }
}); });
tableFooterView.setOnAddButtonClickListener(new OnAddButtonClickListener() { tableFooterView.setOnTableAddButtonClickListener(new OnTableAddButtonClickListener() {
@Override @Override
public void onAddButtonClick(View v) { public void onAddButtonClick(View v) {
fillBlankForm(); fillBlankForm();
...@@ -109,6 +114,14 @@ public class ListingInstanceActivity extends AppCompatActivity { ...@@ -109,6 +114,14 @@ public class ListingInstanceActivity extends AppCompatActivity {
}); });
} }
@Override
public void onActivityResult(int requestCode, int resultCode, final Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
Timber.d("Activity Result : %s %s", requestCode, resultCode);
entryDialogFragment.onActivityResult(requestCode, resultCode, intent);
}
//todo: update yow //todo: update yow
private void fillBlankForm() { private void fillBlankForm() {
Cursor formslist = new FormsDao().getFormsCursor(); Cursor formslist = new FormsDao().getFormsCursor();
......
package id.ac.stis.capi.lessthink.adapters;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import java.util.List;
import id.ac.stis.capi.lessthink.models.BaseHierarchy;
import timber.log.Timber;
/**
* Author : Rahadi Jalu
* Email : 14.8325@stis.ac.id
* Company: Politeknik Statistika STIS
*/
public class HierarchyRVAdapter extends RecyclerView.Adapter<HierarchyRVAdapter.ViewHolder> {
private List<BaseHierarchy> hierarchies;
public HierarchyRVAdapter(List<BaseHierarchy> hierarchies) {
this.hierarchies = hierarchies;
}
public void setHierarchies(List<BaseHierarchy> hierarchies) {
this.hierarchies = hierarchies;
}
public BaseHierarchy getItem(int position) {
return hierarchies.get(position);
}
@Override
public int getItemViewType(int position) {
return position;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
Timber.d("Creating with type %s", viewType);
// BaseHierarchy hierarchy = hierarchies.get(viewType);
// if (hierarchy instanceof PromptHierarchy) {
// ((PromptHierarchy) hierarchy).setOnChangeListener(onChangeListener);
// return new PromptViewHolder(hierarchy.getView());
// } else if (hierarchy instanceof CaptionHierarchy) {
// return new CaptionViewHolder(hierarchy.getView());
// } else {
// // Should not be happening
// return new ViewHolder(hierarchy.getView());
// }
return new ViewHolder(new LinearLayout(parent.getContext()));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
// if (holder instanceof PromptViewHolder) {
// PromptHierarchy hierarchy = (PromptHierarchy) hierarchies.get(position);
// }
holder.bind(hierarchies.get(position));
}
@Override
public int getItemCount() {
return hierarchies.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(View itemView) {
super(itemView);
}
void bind(BaseHierarchy hierarchy) {
ViewGroup parent = (ViewGroup) itemView;
if (parent != null) {
parent.removeAllViews();
parent.addView(hierarchy.getView());
}
}
}
}
package id.ac.stis.capi.lessthink.listeners;
import android.view.View;
import org.javarosa.core.model.FormIndex;
/**
* Author : Rahadi Jalu
* Email : 14.8325@stis.ac.id
* Company: Politeknik Statistika STIS
*/
public interface OnButtonHierarchyClickListener {
void onButtonClick(View v, FormIndex formIndex, int type);
}
...@@ -7,6 +7,6 @@ import android.view.View; ...@@ -7,6 +7,6 @@ import android.view.View;
* Email : 14.8325@stis.ac.id * Email : 14.8325@stis.ac.id
* Company: Politeknik Statistika STIS * Company: Politeknik Statistika STIS
*/ */
public interface OnAddButtonClickListener { public interface OnTableAddButtonClickListener {
void onAddButtonClick(View v); void onAddButtonClick(View v);
} }
package id.ac.stis.capi.lessthink.models;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.javarosa.core.model.FormIndex;
import id.ac.stis.capi.R;
import id.ac.stis.capi.lessthink.listeners.OnButtonHierarchyClickListener;
import id.ac.stis.capi.odk.application.Collect;
/**
* Author : Rahadi Jalu
* Email : 14.8325@stis.ac.id
* Company: Politeknik Statistika STIS
*/
public class ButtonHierarchy extends BaseHierarchy {
public static int TYPE_NEW_REPEAT = 31;
public static int TYPE_MULTIPLICITY = 32;
private Context context;
private View buttonView;
private TextView textView;
private int type, prevType;
private FormIndex formIndex;
private OnButtonHierarchyClickListener onButtonHierarchyClickListener;
public ButtonHierarchy(Context context, FormIndex formIndex, int type, int prevType, int level, int prevLevel) {
super(level, prevLevel);
this.type = type;
this.prevType = prevType;
this.formIndex = formIndex;
this.context = context;
this.textView = new TextView(context);
textView.setGravity(Gravity.CENTER);
if (getType() == TYPE_NEW_REPEAT) {
textView.setText(context.getResources().getString(R.string.add_another));
textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_add, 0, 0, 0);
int[] attrs = new int[]{R.attr.selectableItemBackground /* index 0 */};
TypedArray ta = context.obtainStyledAttributes(attrs);
Drawable drawable = ta.getDrawable(0 /* index */);
ta.recycle();
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 1);
textView.setPadding(15, 45, 15, 45);
textView.setTextColor(ContextCompat.getColor(context, R.color.white));
textView.setBackground(drawable);
} else if (getType() == TYPE_MULTIPLICITY) {
textView.setText(String.valueOf(formIndex.getElementMultiplicity() + 1));
textView.setTextColor(ContextCompat.getColor(context, R.color.primary_dark));
textView.setBackground(ContextCompat.getDrawable(context, R.drawable.wb_circle_btn));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 3);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
75, 75);
params.topMargin = 26;
params.bottomMargin = 15;
textView.setLayoutParams(params);
}
textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onButtonHierarchyClickListener != null) {
onButtonHierarchyClickListener.onButtonClick(v, ButtonHierarchy.this.formIndex,
getType());
}
}
});
createWidgetView();
}
public void setOnButtonHierarchyClickListener(OnButtonHierarchyClickListener onButtonHierarchyClickListener) {
this.onButtonHierarchyClickListener = onButtonHierarchyClickListener;
}
private void createWidgetView() {
RelativeLayout container = new RelativeLayout(context);
container.setBackgroundColor(ContextCompat.getColor(context, R.color.primary));
LinearLayout widgetContainer = new LinearLayout(context);
widgetContainer.setOrientation(LinearLayout.VERTICAL);
widgetContainer.setGravity(Gravity.CENTER);
widgetContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.primary_dark));
widgetContainer.addView(textView);
RelativeLayout.LayoutParams widgetContainerParams = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
widgetContainerParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
widgetContainerParams.rightMargin = 14 * getLevel();
widgetContainerParams.leftMargin = 14 * getLevel();
widgetContainer.setLayoutParams(widgetContainerParams);
container.addView(widgetContainer);
if (getLevel() != getPrevLevel()) {
View shadowView;
View protector;
RelativeLayout.LayoutParams protectorParams;
View shadow;
RelativeLayout.LayoutParams shadowParams;
if (getLevel() > getPrevLevel()) {
shadowView = LayoutInflater.from(context).inflate(R.layout.view_shadow_protector, null);
shadow = shadowView.findViewById(R.id.shadow);
shadowParams = (RelativeLayout.LayoutParams) shadow.getLayoutParams();
shadowParams.rightMargin = 14 * getPrevLevel();
shadowParams.leftMargin = 14 * getPrevLevel();
protector = shadowView.findViewById(R.id.protector);
protectorParams = (RelativeLayout.LayoutParams) protector.getLayoutParams();
protectorParams.rightMargin = 14 * getLevel();
protectorParams.leftMargin = 14 * getLevel();
} else {
shadowView = LayoutInflater.from(context).inflate(R.layout.view_shadow_inverted_protector, null);
shadow = shadowView.findViewById(R.id.shadow);
shadowParams = (RelativeLayout.LayoutParams) shadow.getLayoutParams();
shadowParams.rightMargin = 14 * getLevel();
shadowParams.leftMargin = 14 * getLevel();
protector = shadowView.findViewById(R.id.protector);
protectorParams = (RelativeLayout.LayoutParams) protector.getLayoutParams();
protectorParams.rightMargin = 14 * getPrevLevel();
protectorParams.leftMargin = 14 * getPrevLevel();
}
shadowView.setBackgroundColor(ContextCompat.getColor(context, R.color.primary));
protector.setLayoutParams(protectorParams);
shadow.setLayoutParams(shadowParams);
container.addView(shadowView);
}
this.buttonView = container;
}
public View getText() {
return textView;
}
@Override
public View getView() {
return buttonView;
}
@Override
public int getType() {
return type;
}
@Override
public int getPrevType() {
return prevType;
}
}
package id.ac.stis.capi.lessthink.models; package id.ac.stis.capi.lessthink.models;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray;
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;
...@@ -28,8 +26,6 @@ public class CaptionHierarchy extends BaseHierarchy { ...@@ -28,8 +26,6 @@ public class CaptionHierarchy extends BaseHierarchy {
public static int TYPE_GROUP = 10; public static int TYPE_GROUP = 10;
public static int TYPE_REPEAT = 11; public static int TYPE_REPEAT = 11;
public static int TYPE_MULTIPLICITY = 12;
public static int TYPE_NEW_REPEAT = 13;
private Context context; private Context context;
private View captionView; private View captionView;
...@@ -46,43 +42,10 @@ public class CaptionHierarchy extends BaseHierarchy { ...@@ -46,43 +42,10 @@ public class CaptionHierarchy extends BaseHierarchy {
this.textView = new TextView(context); this.textView = new TextView(context);
textView.setGravity(Gravity.CENTER); textView.setGravity(Gravity.CENTER);
if (getType() == TYPE_MULTIPLICITY) { textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 1);
textView.setText(String.valueOf(caption.getMultiplicity() + 1)); textView.setText(caption.getLongText());
textView.setTextColor(ContextCompat.getColor(context, R.color.primary_dark)); textView.setTextColor(ContextCompat.getColor(context, R.color.white));
textView.setBackground(ContextCompat.getDrawable(context, R.drawable.wb_circle_btn)); textView.setPadding(15, 20, 15, 20);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 3);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
75, 75);
params.topMargin = 26;
params.bottomMargin = 15;
textView.setLayoutParams(params);
} else if (getType() == TYPE_NEW_REPEAT) {
textView.setText(context.getResources().getString(R.string.add_another));
textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_add, 0, 0, 0);
int[] attrs = new int[]{R.attr.selectableItemBackground /* index 0 */};
TypedArray ta = context.obtainStyledAttributes(attrs);
Drawable drawable = ta.getDrawable(0 /* index */);
ta.recycle();
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 1);
textView.setPadding(15, 45, 15, 45);
textView.setTextColor(ContextCompat.getColor(context, R.color.white));
textView.setBackground(drawable);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
} else {
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Collect.getQuestionFontsize() - 1);
textView.setText(caption.getLongText());
textView.setTextColor(ContextCompat.getColor(context, R.color.white));
textView.setPadding(15, 20, 15, 20);
}
textView.setTypeface(textView.getTypeface(), Typeface.BOLD); textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
createWidgetView(); createWidgetView();
......
...@@ -8,13 +8,12 @@ import android.view.ViewGroup; ...@@ -8,13 +8,12 @@ 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.core.model.data.IAnswerData;
import org.javarosa.form.api.FormEntryPrompt; import org.javarosa.form.api.FormEntryPrompt;
import java.io.InvalidObjectException; 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.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;
...@@ -161,6 +160,10 @@ public class PromptHierarchy extends BaseHierarchy { ...@@ -161,6 +160,10 @@ public class PromptHierarchy extends BaseHierarchy {
return widgetView; return widgetView;
} }
public IAnswerData getAnswer() {
return widget.getAnswer();
}
@Override @Override
public int getType() { public int getType() {
return type; return type;
......
...@@ -20,6 +20,7 @@ import java.io.InvalidObjectException; ...@@ -20,6 +20,7 @@ import java.io.InvalidObjectException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.logging.Handler;
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;
...@@ -205,10 +206,10 @@ public class ViewUtils { ...@@ -205,10 +206,10 @@ public class ViewUtils {
onChangeListener.onChange(qw, index); 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); }, DELAY);
} }
...@@ -217,7 +218,7 @@ public class ViewUtils { ...@@ -217,7 +218,7 @@ public class ViewUtils {
} }
throw new InvalidObjectException("Nothing available to handle instance of " + qw.getClass().getSimpleName()); throw new InvalidObjectException("Nothing available to handle instance of " + qw.getClass().getSimpleName());
} }
/** /**
* A wrapper for UpdatingErrorInterface.setError(message). * A wrapper for UpdatingErrorInterface.setError(message).
......
...@@ -15,7 +15,7 @@ import android.widget.TextView; ...@@ -15,7 +15,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import id.ac.stis.capi.R; import id.ac.stis.capi.R;
import id.ac.stis.capi.lessthink.listeners.OnAddButtonClickListener; import id.ac.stis.capi.lessthink.listeners.OnTableAddButtonClickListener;
import id.ac.stis.capi.lessthink.listeners.OnFooterNavigationListener; import id.ac.stis.capi.lessthink.listeners.OnFooterNavigationListener;
/** /**
...@@ -30,7 +30,7 @@ public class TableFooterView extends RelativeLayout implements View.OnClickListe ...@@ -30,7 +30,7 @@ public class TableFooterView extends RelativeLayout implements View.OnClickListe
private LinearLayout pageIndicator, navigationWrapper; private LinearLayout pageIndicator, navigationWrapper;
private int textSize, componentColor, footerColor, currentPage, pageCount; private int textSize, componentColor, footerColor, currentPage, pageCount;
private OnFooterNavigationListener onFooterNavigationListener; private OnFooterNavigationListener onFooterNavigationListener;
private OnAddButtonClickListener onAddButtonClickListener; private OnTableAddButtonClickListener onTableAddButtonClickListener;
public TableFooterView(Context context, AttributeSet attrs) { public TableFooterView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
...@@ -176,8 +176,8 @@ public class TableFooterView extends RelativeLayout implements View.OnClickListe ...@@ -176,8 +176,8 @@ public class TableFooterView extends RelativeLayout implements View.OnClickListe
this.onFooterNavigationListener = onFooterNavigationListener; this.onFooterNavigationListener = onFooterNavigationListener;
} }
public void setOnAddButtonClickListener(OnAddButtonClickListener onAddButtonClickListener) { public void setOnTableAddButtonClickListener(OnTableAddButtonClickListener onTableAddButtonClickListener) {
this.onAddButtonClickListener = onAddButtonClickListener; this.onTableAddButtonClickListener = onTableAddButtonClickListener;
} }
public int getTextSize() { public int getTextSize() {
...@@ -214,8 +214,8 @@ public class TableFooterView extends RelativeLayout implements View.OnClickListe ...@@ -214,8 +214,8 @@ public class TableFooterView extends RelativeLayout implements View.OnClickListe
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.footer_view_add_button: case R.id.footer_view_add_button:
if (onAddButtonClickListener != null) { if (onTableAddButtonClickListener != null) {
onAddButtonClickListener.onAddButtonClick(view); onTableAddButtonClickListener.onAddButtonClick(view);
} else { } else {
Toast.makeText(getContext(), "Add Button is Not Implemented Yet", Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), "Add Button is Not Implemented Yet", Toast.LENGTH_LONG).show();
} }
......
...@@ -61,6 +61,7 @@ import id.ac.stis.capi.R; ...@@ -61,6 +61,7 @@ import id.ac.stis.capi.R;
import id.ac.stis.capi.collectiva.loader.ErrorHierarchy; import id.ac.stis.capi.collectiva.loader.ErrorHierarchy;
import id.ac.stis.capi.collectiva.preferences.CapiInstancePreferences; import id.ac.stis.capi.collectiva.preferences.CapiInstancePreferences;
import id.ac.stis.capi.lessthink.models.BaseHierarchy; import id.ac.stis.capi.lessthink.models.BaseHierarchy;
import id.ac.stis.capi.lessthink.models.ButtonHierarchy;
import id.ac.stis.capi.lessthink.models.CaptionHierarchy; import id.ac.stis.capi.lessthink.models.CaptionHierarchy;
import id.ac.stis.capi.lessthink.models.PromptHierarchy; import id.ac.stis.capi.lessthink.models.PromptHierarchy;
import id.ac.stis.capi.odk.application.Collect; import id.ac.stis.capi.odk.application.Collect;
...@@ -1028,11 +1029,10 @@ public class FormController { ...@@ -1028,11 +1029,10 @@ public class FormController {
case FormEntryController.EVENT_PROMPT_NEW_REPEAT: case FormEntryController.EVENT_PROMPT_NEW_REPEAT:
// this would display the 'add new repeat' dialog // this would display the 'add new repeat' dialog
// ignore it. // ignore it.
FormEntryCaption fcRep = getCaptionPrompt(); prompts.add(new ButtonHierarchy(context, getFormIndex(), ButtonHierarchy.TYPE_NEW_REPEAT,
prompts.add(new CaptionHierarchy(context, fcRep, CaptionHierarchy.TYPE_NEW_REPEAT,
prevType, currLevel, prevLevel)); prevType, currLevel, prevLevel));
prevType = CaptionHierarchy.TYPE_NEW_REPEAT; prevType = ButtonHierarchy.TYPE_NEW_REPEAT;
prevLevel = currLevel; prevLevel = currLevel;
break; break;
case FormEntryController.EVENT_REPEAT: case FormEntryController.EVENT_REPEAT:
...@@ -1054,7 +1054,7 @@ public class FormController { ...@@ -1054,7 +1054,7 @@ public class FormController {
prevType, currLevel, prevLevel)); prevType, currLevel, prevLevel));
} }
prompts.add(new CaptionHierarchy(context, fc, CaptionHierarchy.TYPE_MULTIPLICITY, prompts.add(new ButtonHierarchy(context, getFormIndex(), ButtonHierarchy.TYPE_MULTIPLICITY,
prevType, currLevel, prevLevel)); prevType, currLevel, prevLevel));
prevType = CaptionHierarchy.TYPE_REPEAT; prevType = CaptionHierarchy.TYPE_REPEAT;
...@@ -1518,7 +1518,7 @@ public class FormController { ...@@ -1518,7 +1518,7 @@ public class FormController {
public ArrayList<FailedConstraint> saveAllScreenAnswers(LinkedHashMap<FormIndex, IAnswerData> answers, public ArrayList<FailedConstraint> saveAllScreenAnswers(LinkedHashMap<FormIndex, IAnswerData> answers,
boolean evaluateConstraints) throws JavaRosaException { boolean evaluateConstraints) throws JavaRosaException {
ArrayList<FailedConstraint> failedConstraints = new ArrayList<>(); ArrayList<FailedConstraint> failedConstraints = new ArrayList<>();
if (currentPromptIsQuestion()) { // if (currentPromptIsQuestion()) {
Iterator<FormIndex> it = answers.keySet().iterator(); Iterator<FormIndex> it = answers.keySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
FormIndex index = it.next(); FormIndex index = it.next();
...@@ -1547,8 +1547,8 @@ public class FormController { ...@@ -1547,8 +1547,8 @@ public class FormController {
if (failedConstraints.size() > 0) { if (failedConstraints.size() > 0) {
return failedCon