diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt
index 6b86c0d1b..b8d6c78e9 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt
@@ -268,7 +268,7 @@ fun Context.addDayNumber(rawTextColor: Int, day: DayMonthly, linearLayout: Linea
if (!day.isThisMonth)
textColor = textColor.adjustAlpha(LOW_ALPHA)
- (View.inflate(this, R.layout.day_monthly_item_view, null) as TextView).apply {
+ (View.inflate(this, R.layout.day_monthly_number_view, null) as TextView).apply {
setTextColor(textColor)
text = day.value.toString()
gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL
@@ -310,7 +310,7 @@ fun Context.addDayEvents(day: DayMonthly, linearLayout: LinearLayout, res: Resou
textColor = textColor.adjustAlpha(0.25f)
}
- (View.inflate(this, R.layout.day_monthly_item_view, null) as TextView).apply {
+ (View.inflate(this, R.layout.day_monthly_event_view, null) as TextView).apply {
setTextColor(textColor)
text = it.title.replace(" ", "\u00A0") // allow word break by char
background = backgroundDrawable
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt
index 460150e75..d8c29d83b 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt
@@ -29,7 +29,6 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
private var mTextColor = 0
private var mCalendar: MonthlyCalendarImpl? = null
- private var mRemoteViews: RemoteViews? = null
private var mSmallerFontSize = 0f
private var mMediumFontSize = 0f
@@ -42,6 +41,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
companion object {
private var mTargetDate = DateTime()
+ private var mRemoteViews: RemoteViews? = null
}
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
@@ -112,7 +112,6 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
override fun onReceive(context: Context, intent: Intent) {
if (mCalendar == null || mRemoteViews == null) {
initVariables(context)
- return
}
val action = intent.action
@@ -178,10 +177,10 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
backgroundColor = backgroundColor.adjustAlpha(0.25f)
}
- val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_item_view).apply {
- setTextViewText(R.id.day_monthly_id, it.title.replace(" ", "\u00A0"))
- setTextColor(R.id.day_monthly_id, eventTextColor)
- setBackgroundColor(R.id.day_monthly_id, backgroundColor)
+ val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_event_view).apply {
+ setTextViewText(R.id.day_monthly_event_id, it.title.replace(" ", "\u00A0"))
+ setTextColor(R.id.day_monthly_event_id, eventTextColor)
+ setBackgroundColor(R.id.day_monthly_event_id, backgroundColor)
}
mRemoteViews!!.addView(id, newRemoteView)
}
@@ -189,13 +188,13 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
}
private fun addDayNumber(day: DayMonthly, packageName: String, textColor: Int, id: Int, primaryColor: Int) {
- val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_item_view).apply {
- setTextViewText(R.id.day_monthly_id, day.value.toString())
- setTextColor(R.id.day_monthly_id, textColor)
+ val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_number_view).apply {
+ setTextViewText(R.id.day_monthly_number_id, day.value.toString())
+ setTextColor(R.id.day_monthly_number_id, textColor)
if (day.isToday) {
- setViewPadding(R.id.day_monthly_id, 10, 0, 10, 0)
- setBackgroundColor(R.id.day_monthly_id, primaryColor)
+ setViewPadding(R.id.day_monthly_number_id, 10, 0, 10, 0)
+ setBackgroundColor(R.id.day_monthly_number_id, primaryColor)
}
}
mRemoteViews!!.addView(id, newRemoteView)
diff --git a/app/src/main/res/layout/day_monthly_event_view.xml b/app/src/main/res/layout/day_monthly_event_view.xml
new file mode 100644
index 000000000..9a85d597e
--- /dev/null
+++ b/app/src/main/res/layout/day_monthly_event_view.xml
@@ -0,0 +1,16 @@
+
+
diff --git a/app/src/main/res/layout/day_monthly_item_view.xml b/app/src/main/res/layout/day_monthly_number_view.xml
similarity index 86%
rename from app/src/main/res/layout/day_monthly_item_view.xml
rename to app/src/main/res/layout/day_monthly_number_view.xml
index d27046520..baffa6f6f 100644
--- a/app/src/main/res/layout/day_monthly_item_view.xml
+++ b/app/src/main/res/layout/day_monthly_number_view.xml
@@ -2,13 +2,13 @@