Fixed span error in AttributeListAdapter

This commit is contained in:
Akash Yadav
2021-12-23 16:41:20 +05:30
parent 04a0f241f2
commit f179afaee1
@@ -51,6 +51,9 @@ public class AttributeListAdapter extends RecyclerView.Adapter <AttributeListAda
return new VH (LayoutAttrEditorSheetItemBinding.inflate (LayoutInflater.from (parent.getContext ()), parent, false));
}
// hello th
//
@Override
public void onBindViewHolder (@NonNull VH holder, int position) {
final var binding = holder.binding;
@@ -62,8 +65,10 @@ public class AttributeListAdapter extends RecyclerView.Adapter <AttributeListAda
sb.append (attr.getValue (), new StyleSpan (Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
final var length = attr.getValue ().length ();
sb.setSpan (new ForegroundColorSpan (ContextCompat.getColor (binding.text.getContext (), R.color.primaryTextColor),
));
sb.setSpan (new ForegroundColorSpan (ContextCompat.getColor (binding.text.getContext (), R.color.primaryTextColor)),
sb.length () - length,
sb.length () - 1,
SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
}
binding.text.setText (sb);