Display answers by group

This commit is contained in:
M66B
2022-01-22 11:30:19 +01:00
parent c7ad6e057a
commit c8e292f2bf
7 changed files with 92 additions and 20 deletions

View File

@@ -73,7 +73,6 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
private View view;
private View vwColor;
private TextView tvName;
private TextView tvGroup;
private ImageView ivExternal;
private ImageView ivStandard;
private ImageView ivFavorite;
@@ -89,7 +88,6 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
view = itemView.findViewById(R.id.clItem);
vwColor = itemView.findViewById(R.id.vwColor);
tvName = itemView.findViewById(R.id.tvName);
tvGroup = itemView.findViewById(R.id.tvGroup);
ivExternal = itemView.findViewById(R.id.ivExternal);
ivStandard = itemView.findViewById(R.id.ivStandard);
ivFavorite = itemView.findViewById(R.id.ivFavorite);
@@ -112,8 +110,6 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
view.setAlpha(answer.hide ? Helper.LOW_LIGHT : 1.0f);
vwColor.setBackgroundColor(answer.color == null ? Color.TRANSPARENT : answer.color);
tvName.setText(answer.name);
tvGroup.setText(answer.group);
tvGroup.setVisibility(TextUtils.isEmpty(answer.group) ? View.GONE : View.VISIBLE);
ivExternal.setVisibility(answer.external ? View.VISIBLE : View.GONE);
ivStandard.setVisibility(answer.standard ? View.VISIBLE : View.GONE);
ivFavorite.setVisibility(answer.favorite ? View.VISIBLE : View.GONE);
@@ -406,6 +402,13 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
return selected.get(position).id;
}
public EntityAnswer getItemAtPosition(int pos) {
if (pos >= 0 && pos < selected.size())
return selected.get(pos);
else
return null;
}
@Override
public int getItemCount() {
return selected.size();