diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index 11a668d6..1fee9e01 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -205,23 +205,17 @@ class TopicAdapter extends RecyclerView.Adapter { if (poll.getAvailableVoteCount() > 1) { for (Poll.Entry entry : entries) { - LinearLayout container = new LinearLayout(context); - container.setOrientation(LinearLayout.HORIZONTAL); CheckBox checkBox = new CheckBox(context); - TextView label = new TextView(context); - label.setTextColor(primaryTextColor); - label.setMovementMethod(LinkMovementMethod.getInstance()); + checkBox.setTextColor(primaryTextColor); + checkBox.setMovementMethod(LinkMovementMethod.getInstance()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - label.setText(Html.fromHtml(entry.getEntryName(), Html.FROM_HTML_MODE_LEGACY)); + checkBox.setText(Html.fromHtml(entry.getEntryName(), Html.FROM_HTML_MODE_LEGACY)); } else { //noinspection deprecation - label.setText(Html.fromHtml(entry.getEntryName())); + checkBox.setText(Html.fromHtml(entry.getEntryName())); } - label.setText(ThmmyParser.html2span(context, entry.getEntryName())); checkBox.setTextColor(primaryTextColor); - container.addView(checkBox); - container.addView(label); - holder.optionsLayout.addView(container); + holder.optionsLayout.addView(checkBox); } holder.voteChart.setVisibility(View.GONE); holder.optionsLayout.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/gr/thmmy/mthmmy/viewmodel/TopicViewModel.java b/app/src/main/java/gr/thmmy/mthmmy/viewmodel/TopicViewModel.java index eebd1ad6..a9e255f6 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/viewmodel/TopicViewModel.java +++ b/app/src/main/java/gr/thmmy/mthmmy/viewmodel/TopicViewModel.java @@ -144,10 +144,10 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa if (optionsLayout.getChildAt(0) instanceof RadioGroup) { RadioGroup optionsRadioGroup = (RadioGroup) optionsLayout.getChildAt(0); votes.add(optionsRadioGroup.getCheckedRadioButtonId()); - } else if (optionsLayout.getChildAt(0) instanceof LinearLayout) { + } else if (optionsLayout.getChildAt(0) instanceof CheckBox) { for (int i = 0; i < optionsLayout.getChildCount(); i++) { - LinearLayout container = (LinearLayout) optionsLayout.getChildAt(i); - if (((CheckBox) container.getChildAt(0)).isChecked()) + CheckBox checkBox = (CheckBox) optionsLayout.getChildAt(i); + if (checkBox.isChecked()) votes.add(i); } }