Search in sources :

Example 1 with SelectImageMapWidget

use of org.odk.collect.android.widgets.items.SelectImageMapWidget in project collect by opendatakit.

the class QuestionWidget method setupQuestionLabel.

private void setupQuestionLabel() {
    audioVideoImageTextLabel.setTag(getClipID(formEntryPrompt));
    audioVideoImageTextLabel.setText(formEntryPrompt.getLongText(), formEntryPrompt.isRequired(), questionTextSizeHelper.getHeadline6());
    audioVideoImageTextLabel.setMediaUtils(mediaUtils);
    String imageURI = this instanceof SelectImageMapWidget ? null : formEntryPrompt.getImageText();
    String videoURI = formEntryPrompt.getSpecialFormQuestionText("video");
    String bigImageURI = formEntryPrompt.getSpecialFormQuestionText("big-image");
    String playableAudioURI = getPlayableAudioURI(formEntryPrompt, referenceManager);
    try {
        if (imageURI != null) {
            audioVideoImageTextLabel.setImage(new File(referenceManager.deriveReference(imageURI).getLocalURI()), imageLoader);
        }
        if (bigImageURI != null) {
            audioVideoImageTextLabel.setBigImage(new File(referenceManager.deriveReference(bigImageURI).getLocalURI()));
        }
        if (videoURI != null) {
            audioVideoImageTextLabel.setVideo(new File(referenceManager.deriveReference(videoURI).getLocalURI()));
        }
        if (playableAudioURI != null) {
            audioVideoImageTextLabel.setAudio(playableAudioURI, audioHelper);
        }
    } catch (InvalidReferenceException e) {
        Timber.d(e, "Invalid media reference due to %s ", e.getMessage());
    }
    audioVideoImageTextLabel.setPlayTextColor(getPlayColor(formEntryPrompt, themeUtils));
}
Also used : SelectImageMapWidget(org.odk.collect.android.widgets.items.SelectImageMapWidget) File(java.io.File) InvalidReferenceException(org.javarosa.core.reference.InvalidReferenceException)

Aggregations

File (java.io.File)1 InvalidReferenceException (org.javarosa.core.reference.InvalidReferenceException)1 SelectImageMapWidget (org.odk.collect.android.widgets.items.SelectImageMapWidget)1