Skip to content

Commit

Permalink
Fixed bug with media files and autocomplete appearance - wrong media …
Browse files Browse the repository at this point in the history
…files were used
  • Loading branch information
grzesiek2010 committed May 17, 2019
1 parent e8165f0 commit cc8864f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ View setUpNoButtonsView(int index) {
View view = new View(context);
int itemPadding = context.getResources().getDimensionPixelSize(R.dimen.select_item_border);

SelectChoice selectChoice = items.get(index);
SelectChoice selectChoice = filteredItems.get(index);

String imageURI = selectChoice instanceof ExternalSelectChoice
? ((ExternalSelectChoice) selectChoice).getImage()
Expand Down Expand Up @@ -213,7 +213,7 @@ void bind(final int index) {
view.removeAllViews();
view.addView(setUpNoButtonsView(index));
} else {
widget.addMediaFromChoice(mediaLayout, index, setUpButton(index));
widget.addMediaFromChoice(mediaLayout, index, setUpButton(index), filteredItems);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import org.javarosa.core.model.SelectChoice;
import org.javarosa.form.api.FormEntryCaption;
import org.javarosa.form.api.FormEntryPrompt;
import org.odk.collect.android.R;
Expand All @@ -37,6 +38,7 @@
import org.odk.collect.android.views.MediaLayout;

import java.util.ArrayList;
import java.util.List;

public abstract class SelectWidget extends ItemsWidget {

Expand Down Expand Up @@ -125,7 +127,7 @@ public void initMediaLayoutSetUp(MediaLayout mediaLayout) {
/**
* Pull media from the current item and add it to the media layout.
*/
public void addMediaFromChoice(MediaLayout mediaLayout, int index, TextView textView) {
public void addMediaFromChoice(MediaLayout mediaLayout, int index, TextView textView, List<SelectChoice> items) {
String audioURI = getFormEntryPrompt().getSpecialFormSelectChoiceText(items.get(index), FormEntryCaption.TEXT_FORM_AUDIO);

String imageURI;
Expand Down

0 comments on commit cc8864f

Please sign in to comment.