Skip to content

Commit

Permalink
refactor spannable string variable
Browse files Browse the repository at this point in the history
Signed-off-by: Amr Hossam <[email protected]>
  • Loading branch information
amrhossamdev authored and aaronbrethorst committed Sep 27, 2024
1 parent 0feca09 commit b48c171
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,14 @@ public static SpannableString formatQuestionText(Context context, String questio
// Append asterisk with a space
questionText = questionText.trim();
questionText += " ";
SpannableString spannableString = new SpannableString(questionText + (isAnswerRequired ? "*" : ""));
SpannableString questionTitleFormatted = new SpannableString(questionText + (isAnswerRequired ? "*" : ""));
int asteriskColor = ContextCompat.getColor(context, R.color.quantum_googredA700);
if (isAnswerRequired) {
// Set the color of the asterisk
spannableString.setSpan(new ForegroundColorSpan(asteriskColor), questionText.length(), questionText.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
questionTitleFormatted.setSpan(new ForegroundColorSpan(asteriskColor), questionText.length(), questionText.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}

return spannableString;
return questionTitleFormatted;
}

}

0 comments on commit b48c171

Please sign in to comment.