/** * Add a Views containing the question text, audio (if applicable), and image (if applicable). To * satisfy the RelativeLayout constraints, we add the audio first if it exists, then the TextView * to fit the rest of the space, then the image if applicable. */ protected void addQuestionText(FormEntryPrompt p) { String imageURI = p.getImageText(); String audioURI = p.getAudioText(); String videoURI = p.getSpecialFormQuestionText("video"); // shown when image is clicked String bigImageURI = p.getSpecialFormQuestionText("big-image"); String promptText = p.getLongText(); // Add the text view. Textview always exists, regardless of whether there's text. mQuestionText = new TextView(getContext()); mQuestionText.setText(promptText == null ? "" : promptText); mQuestionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize); mQuestionText.setTypeface(null, Typeface.BOLD); mQuestionText.setPadding(0, 0, 0, 7); mQuestionText.setId(QuestionWidget.newUniqueId()); // assign random id // Wrap to the size of the parent view mQuestionText.setHorizontallyScrolling(false); if (promptText == null || promptText.length() == 0) { mQuestionText.setVisibility(GONE); } // Create the layout for audio, image, text mediaLayout = new MediaLayout(getContext()); mediaLayout.setAVT(p.getIndex(), "", mQuestionText, audioURI, imageURI, videoURI, bigImageURI); addView(mediaLayout, mLayout); }
/** * Add a Views containing the question text, audio (if applicable), and image (if applicable). To * satisfy the RelativeLayout constraints, we add the audio first if it exists, then the TextView * to fit the rest of the space, then the image if applicable. */ protected void addQuestionText(final FormEntryPrompt p) { String imageURI = p.getImageText(); String audioURI = p.getAudioText(); String videoURI = p.getSpecialFormQuestionText("video"); String qrCodeContent = p.getSpecialFormQuestionText("qrcode"); // shown when image is clicked String bigImageURI = p.getSpecialFormQuestionText("big-image"); // Add the text view. Textview always exists, regardless of whether there's text. mQuestionText = new TextView(getContext()); mQuestionText.setText(p.getLongText()); mQuestionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize); mQuestionText.setTypeface(null, Typeface.BOLD); mQuestionText.setPadding(0, 0, 0, 7); mQuestionText.setId(38475483); // assign random id if (p.getLongText() != null) { if (p.getLongText().contains("\u260E")) { if (Linkify.addLinks(mQuestionText, Linkify.PHONE_NUMBERS)) { stripUnderlines(mQuestionText); } else { System.out.println("this should be an error I'm thinking?"); } } } // Wrap to the size of the parent view mQuestionText.setHorizontallyScrolling(false); if (p.getLongText() == null) { mQuestionText.setVisibility(GONE); } // Create the layout for audio, image, text MediaLayout mediaLayout = new MediaLayout(getContext()); mediaLayout.setAVT(mQuestionText, audioURI, imageURI, videoURI, bigImageURI, qrCodeContent); addView(mediaLayout, mLayout); }