From 8d014ab7e92eb1ccd0fd020c24aaefb2f29c568a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82?= Date: Thu, 7 Jun 2018 08:13:49 +0200 Subject: [PATCH] Fix displaying the replacements in widget (#134) --- .../wulkanowy/ui/widgets/TimetableWidgetFactory.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/widgets/TimetableWidgetFactory.java b/app/src/main/java/io/github/wulkanowy/ui/widgets/TimetableWidgetFactory.java index 2a858b90..395e1c07 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/widgets/TimetableWidgetFactory.java +++ b/app/src/main/java/io/github/wulkanowy/ui/widgets/TimetableWidgetFactory.java @@ -2,6 +2,7 @@ package io.github.wulkanowy.ui.widgets; import android.content.Context; import android.content.Intent; +import android.graphics.Paint; import android.view.View; import android.widget.AdapterView; import android.widget.RemoteViews; @@ -75,13 +76,21 @@ public class TimetableWidgetFactory implements RemoteViewsService.RemoteViewsFac views.setTextViewText(R.id.timetable_widget_item_room, getRoomText(position)); if (!getDescriptionText(position).isEmpty()) { + views.setViewVisibility(R.id.timetable_widget_item_description, View.VISIBLE); views.setTextViewText(R.id.timetable_widget_item_description, getDescriptionText(position)); } else { views.setViewVisibility(R.id.timetable_widget_item_description, View.GONE); } - views.setOnClickFillInIntent(R.id.timetable_widget_item_container, new Intent()); + if (lessonList.get(position).getMovedOrCanceled()) { + views.setInt(R.id.timetable_widget_item_subject, "setPaintFlags", + Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); + } else { + views.setInt(R.id.timetable_widget_item_subject, "setPaintFlags", + Paint.ANTI_ALIAS_FLAG); + } + views.setOnClickFillInIntent(R.id.timetable_widget_item_container, new Intent()); return views; }