use of org.eyeseetea.sdk.presentation.views.CustomTextView in project pictureapp by EyeSeeTea.
the class NumberRadioButtonMultiquestionView method init.
private void init(final Context context) {
View view = inflate(context, R.layout.multi_question_radio_button_row, this);
header = (CustomTextView) view.findViewById(R.id.row_header_text);
image = (ImageView) view.findViewById(R.id.question_image_row);
radioGroup = (RadioGroup) view.findViewById(R.id.answer);
radioGroup.setOrientation(HORIZONTAL);
}
use of org.eyeseetea.sdk.presentation.views.CustomTextView in project pictureapp by EyeSeeTea.
the class AssessmentAdapter method showRDT.
public void showRDT(View rowView, int viewId, String RDTValue) {
CustomTextView rdt = (CustomTextView) rowView.findViewById(viewId);
rdt.setText(RDTValue);
}
use of org.eyeseetea.sdk.presentation.views.CustomTextView in project pictureapp by EyeSeeTea.
the class DynamicTabAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
mMultiQuestionViews.clear();
Validation.init();
//init validation control(used only in multiquestions tabs)
failedValidations = 0;
//Inflate the layout
View rowView = lInflater.inflate(R.layout.dynamic_tab_grid_question, parent, false);
rowView.getLayoutParams().height = parent.getHeight();
rowView.requestLayout();
Question questionItem = (Question) this.getItem(position);
// We get values from DB and put them in Session
if (getMalariaSurvey() != null) {
if (Session.getStockSurvey() != null) {
Session.getStockSurvey().getValuesFromDB();
}
getMalariaSurvey().getValuesFromDB();
} else {
// getView is called.
return convertView;
}
//Question
CustomTextView headerView = (CustomTextView) rowView.findViewById(question);
//Load a font which support Khmer character
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/" + context.getString(R.string.specific_language_font));
headerView.setTypeface(tf);
int tabType = questionItem.getHeader().getTab().getType();
if (Tab.isMultiQuestionTab(tabType)) {
headerView.setText(questionItem.getHeader().getTab().getInternationalizedName());
} else if (Tab.isDynamicTreatmentTab(tabType)) {
headerView.setText(questionItem.getHeader().getTab().getInternationalizedName());
} else {
headerView.setText(questionItem.getInternationalizedForm_name());
}
//question image
if (questionItem.getPath() != null && !questionItem.getPath().equals("") && mDynamicTabAdapterStrategy.HasQuestionImageVisibleInHeader(questionItem.getOutput())) {
ImageView imageView = (ImageView) rowView.findViewById(R.id.questionImage);
BaseLayoutUtils.putImageInImageView(questionItem.getInternationalizedPath(), imageView);
imageView.setVisibility(View.VISIBLE);
}
//Progress
ProgressUtils.updateProgressBarStatus(rowView, navigationController.getCurrentPage(), navigationController.getCurrentTotalPages());
List<Question> screenQuestions = new ArrayList<>();
if (isTabScrollable(questionItem, tabType)) {
tableLayout = (TableLayout) rowView.findViewById(R.id.multi_question_options_table);
(rowView.findViewById(R.id.scrolled_table)).setVisibility(View.VISIBLE);
(rowView.findViewById(R.id.no_scrolled_table)).setVisibility(View.GONE);
if (tabType == Constants.TAB_DYNAMIC_TREATMENT) {
Treatment treatment = new Treatment(Session.getMalariaSurvey(), Session.getStockSurvey());
if (treatment.hasTreatment()) {
screenQuestions = treatment.getQuestions();
doseByQuestion = treatment.getDoseByQuestion();
} else {
screenQuestions = treatment.getNoTreatmentQuestions();
}
} else if (Tab.isMultiQuestionTab(tabType)) {
screenQuestions = questionItem.getQuestionsByTab(questionItem.getHeader().getTab());
} else {
screenQuestions.add(questionItem);
}
swipeTouchListener.addScrollView((ScrollView) (rowView.findViewById(R.id.scrolled_table)).findViewById(R.id.table_scroll));
} else {
tableLayout = (TableLayout) rowView.findViewById(R.id.dynamic_tab_options_table);
(rowView.findViewById(R.id.no_scrolled_table)).setVisibility(View.VISIBLE);
(rowView.findViewById(R.id.scrolled_table)).setVisibility(View.GONE);
screenQuestions.add(questionItem);
}
navigationButtonHolder = rowView.findViewById(R.id.snackbar);
if (GradleVariantConfig.isButtonNavigationActive()) {
initializeNavigationButtons(navigationButtonHolder);
isClicked = false;
}
Log.d(TAG, "Questions in actual tab: " + screenQuestions.size());
swipeTouchListener.clearClickableViews();
for (Question screenQuestion : screenQuestions) {
renderQuestion(rowView, tabType, screenQuestion);
}
rowView.requestLayout();
reloadingQuestionFromInvalidOption = false;
//FIXME: 09/03/2017 Refactor: This is used to prevent multiple open and close surveys crash
Session.setIsLoadingSurvey(false);
if (Session.shouldPressBackOnLoadSurvey()) {
DashboardActivity.dashboardActivity.runOnUiThread(new Runnable() {
public void run() {
DashboardActivity.dashboardActivity.onBackPressed();
}
});
}
return rowView;
}
use of org.eyeseetea.sdk.presentation.views.CustomTextView in project pictureapp by EyeSeeTea.
the class ConfirmCounterCommonStrategy method showStandardConfirmCounter.
public void showStandardConfirmCounter(final View view, final Option selectedOption, final Question question, Question questionCounter) {
//Change question x confirm message
View rootView = view.getRootView();
final CustomTextView questionView = (CustomTextView) rootView.findViewById(R.id.question);
questionView.setText(questionCounter.getInternationalizedForm_name());
ProgressUtils.setProgressBarText(rootView, "");
//cancel
ImageView noView = (ImageView) rootView.findViewById(R.id.confirm_no);
noView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Leave current question as it was
removeConfirmCounter(v);
mDynamicTabAdapter.notifyDataSetChanged();
isClicked = false;
}
});
//confirm
ImageView yesView = (ImageView) rootView.findViewById(R.id.confirm_yes);
yesView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDynamicTabAdapter.navigationController.increaseCounterRepetitions(selectedOption);
removeConfirmCounter(v);
mDynamicTabAdapter.saveOptionValue(view, selectedOption, question, true);
}
});
//Show confirm on full screen
rootView.findViewById(R.id.no_scrolled_table).setVisibility(View.GONE);
rootView.findViewById(R.id.scrolled_table).setVisibility(View.GONE);
rootView.findViewById(R.id.confirm_table).setVisibility(View.VISIBLE);
//Show question image in counter alert
if (questionCounter.getPath() != null && !questionCounter.getPath().equals("")) {
ImageView imageView = (ImageView) rootView.findViewById(R.id.questionImageRow);
BaseLayoutUtils.putImageInImageView(questionCounter.getInternationalizedPath(), imageView);
imageView.setVisibility(View.VISIBLE);
}
//Question "header" is in the first option in Options.csv
List<Option> questionOptions = questionCounter.getAnswer().getOptions();
if (questionOptions.get(0) != null) {
CustomTextView textCard = (CustomTextView) rootView.findViewById(R.id.questionTextRow);
textCard.setText(questionOptions.get(0).getInternationalizedCode());
textCard.setTextSize(questionOptions.get(0).getOptionAttribute().getText_size());
}
//Question "confirm button" is in the second option in Options.csv
if (questionOptions.get(1) != null) {
CustomTextView confirmTextCard = (CustomTextView) rootView.findViewById(R.id.textcard_confirm_yes);
confirmTextCard.setText(questionOptions.get(1).getInternationalizedCode());
confirmTextCard.setTextSize(questionOptions.get(1).getOptionAttribute().getText_size());
}
//Question "no confirm button" is in the third option in Options.csv
if (questionOptions.get(2) != null) {
CustomTextView noConfirmTextCard = (CustomTextView) rootView.findViewById(R.id.textcard_confirm_no);
noConfirmTextCard.setText(questionOptions.get(2).getInternationalizedCode());
noConfirmTextCard.setTextSize(questionOptions.get(2).getOptionAttribute().getText_size());
}
}
use of org.eyeseetea.sdk.presentation.views.CustomTextView in project pictureapp by EyeSeeTea.
the class ReviewFragmentStrategy method createViewRow.
public TableRow createViewRow(TableRow rowView, Value value) {
rowView.setTag(getCorrectQuestion(value.getQuestion()));
//Sets the value text in the row and add the question as tag.
CustomTextView questionTextView = (CustomTextView) rowView.findViewById(R.id.review_title_text);
if ((value.getQuestion() != null)) {
questionTextView.setText(value.getQuestion().getInternationalizedCodeDe_Name() + TITLE_SEPARATOR);
//Adds click listener to hide the fragment and go to the clicked question.
rowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Question question = (Question) v.getTag();
DashboardActivity.dashboardActivity.hideReview(question);
}
});
questionTextView.setText(questionTextView.getText().toString() + ((value.getOption() != null) ? value.getOption().getInternationalizedCode() : value.getValue()));
if (value.getOption() != null && value.getOption().getBackground_colour() != null) {
rowView.setBackgroundColor(Color.parseColor("#" + value.getOption().getBackground_colour()));
}
}
return rowView;
}
Aggregations