Skip to content

Commit

Permalink
Clear text formatting when alarm days are deselected
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaholst committed Aug 26, 2024
1 parent 33bc9cf commit a4418f3
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class AlarmView extends ItemViewHolder<Alarm> {
private final AppCompatCheckedTextView repeat;
private final TextView playlist;
private final TextView[] dowTexts = new TextView[DAY_TEXT_IDS.length];
private final CharSequence[] dayTexts = new String[DAY_TEXT_IDS.length];

public AlarmView(@NonNull AlarmsActivity activity, @NonNull View view) {
super(activity, view);
Expand Down Expand Up @@ -94,6 +95,7 @@ public AlarmView(@NonNull AlarmsActivity activity, @NonNull View view) {

for (int day = 0; day < DAY_TEXT_IDS.length; day++) {
dowTexts[day] = view.findViewById(DAY_TEXT_IDS[day]);
dayTexts[day] = dowTexts[day].getText();
final int finalDay = day;
dowTexts[day].setOnClickListener(v -> {
if (getActivity().getService() != null) {
Expand Down Expand Up @@ -154,7 +156,7 @@ public void bindView(Alarm item) {


private void setDowText(int day) {
SpannableString text = new SpannableString(dowTexts[day].getText());
SpannableString text = new SpannableString(dayTexts[day]);
if (item.isDayActive(day)) {
text.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), 0);
text.setSpan(new ForegroundColorSpan(mColorSelected), 0, text.length(), 0);
Expand Down

0 comments on commit a4418f3

Please sign in to comment.