Search in sources :

Example 6 with CustomTextView

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);
}
Also used : AKeyboardQuestionView(org.eyeseetea.malariacare.views.question.AKeyboardQuestionView) IMultiQuestionView(org.eyeseetea.malariacare.views.question.IMultiQuestionView) ImageView(android.widget.ImageView) CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) AOptionQuestionView(org.eyeseetea.malariacare.views.question.AOptionQuestionView) View(android.view.View) IImageQuestionView(org.eyeseetea.malariacare.views.question.IImageQuestionView) IQuestionView(org.eyeseetea.malariacare.views.question.IQuestionView)

Example 7 with CustomTextView

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);
}
Also used : CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView)

Example 8 with CustomTextView

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;
}
Also used : CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) Treatment(org.eyeseetea.malariacare.domain.entity.Treatment) Typeface(android.graphics.Typeface) ArrayList(java.util.ArrayList) Question(org.eyeseetea.malariacare.data.database.model.Question) ImageView(android.widget.ImageView) AKeyboardQuestionView(org.eyeseetea.malariacare.views.question.AKeyboardQuestionView) ImageView(android.widget.ImageView) AOptionQuestionView(org.eyeseetea.malariacare.views.question.AOptionQuestionView) View(android.view.View) INavigationQuestionView(org.eyeseetea.malariacare.views.question.INavigationQuestionView) IQuestionView(org.eyeseetea.malariacare.views.question.IQuestionView) ImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.ImageRadioButtonSingleQuestionView) CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) ListView(android.widget.ListView) IMultiQuestionView(org.eyeseetea.malariacare.views.question.IMultiQuestionView) DynamicStockImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.DynamicStockImageRadioButtonSingleQuestionView) IImageQuestionView(org.eyeseetea.malariacare.views.question.IImageQuestionView) NumberRadioButtonMultiquestionView(org.eyeseetea.malariacare.views.question.multiquestion.NumberRadioButtonMultiquestionView) ScrollView(android.widget.ScrollView)

Example 9 with CustomTextView

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());
    }
}
Also used : CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) Option(org.eyeseetea.malariacare.data.database.model.Option) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) View(android.view.View)

Example 10 with CustomTextView

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;
}
Also used : CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) Question(org.eyeseetea.malariacare.data.database.model.Question) CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) View(android.view.View)

Aggregations

CustomTextView (org.eyeseetea.sdk.presentation.views.CustomTextView)13 View (android.view.View)6 ImageView (android.widget.ImageView)5 Option (org.eyeseetea.malariacare.data.database.model.Option)3 AOptionQuestionView (org.eyeseetea.malariacare.views.question.AOptionQuestionView)3 IImageQuestionView (org.eyeseetea.malariacare.views.question.IImageQuestionView)3 IMultiQuestionView (org.eyeseetea.malariacare.views.question.IMultiQuestionView)3 IQuestionView (org.eyeseetea.malariacare.views.question.IQuestionView)3 Typeface (android.graphics.Typeface)2 TextView (android.widget.TextView)2 Question (org.eyeseetea.malariacare.data.database.model.Question)2 AKeyboardQuestionView (org.eyeseetea.malariacare.views.question.AKeyboardQuestionView)2 INavigationQuestionView (org.eyeseetea.malariacare.views.question.INavigationQuestionView)2 ImageButton (android.widget.ImageButton)1 LinearLayout (android.widget.LinearLayout)1 ListView (android.widget.ListView)1 ScrollView (android.widget.ScrollView)1 DateFormat (java.text.DateFormat)1 ArrayList (java.util.ArrayList)1 Treatment (org.eyeseetea.malariacare.domain.entity.Treatment)1