properly update the even list widget font size too

This commit is contained in:
tibbi 2017-07-06 21:10:06 +02:00
parent f88b9425bd
commit 35fdbed726
2 changed files with 13 additions and 2 deletions

View File

@ -23,8 +23,9 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
val ITEM_EVENT = 0
val ITEM_HEADER = 1
var events: List<ListItem> = ArrayList()
val textColor: Int = context.config.widgetTextColor
var events = ArrayList<ListItem>()
val textColor = context.config.widgetTextColor
var mediumFontSize = context.config.getFontSize()
var todayDate = ""
val allDayString = context.resources.getString(R.string.all_day)
@ -64,6 +65,11 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
setInt(R.id.event_item_start, "setTextColor", textColor)
setInt(R.id.event_item_end, "setTextColor", textColor)
setFloat(R.id.event_item_title, "setTextSize", mediumFontSize)
setFloat(R.id.event_item_description, "setTextSize", mediumFontSize)
setFloat(R.id.event_item_start, "setTextSize", mediumFontSize)
setFloat(R.id.event_item_end, "setTextSize", mediumFontSize)
Intent().apply {
putExtra(EVENT_ID, item.id)
putExtra(EVENT_OCCURRENCE_TS, item.startTS)
@ -74,6 +80,7 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
val item = events[position] as ListSection
remoteView = RemoteViews(context.packageName, R.layout.event_list_section_widget).apply {
setInt(R.id.event_item_title, "setTextColor", textColor)
setFloat(R.id.event_item_title, "setTextSize", mediumFontSize)
setTextViewText(R.id.event_item_title, item.title)
}
}
@ -96,6 +103,7 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
override fun getItemId(position: Int) = position.toLong()
override fun onDataSetChanged() {
mediumFontSize = context.config.getFontSize()
val fromTS = DateTime().seconds()
val toTS = DateTime().plusYears(1).seconds()
context.dbHelper.getEventsInBackground(fromTS, toTS) {

View File

@ -48,7 +48,10 @@ class MyWidgetListProvider : AppWidgetProvider() {
mRemoteViews.setInt(R.id.widget_event_list_holder, "setBackgroundColor", context.config.widgetBgColor)
mRemoteViews.setInt(R.id.widget_event_list_empty, "setTextColor", mTextColor)
mRemoteViews.setFloat(R.id.widget_event_list_empty, "setTextSize", context.config.getFontSize())
mRemoteViews.setInt(R.id.widget_event_list_today, "setTextColor", mTextColor)
mRemoteViews.setFloat(R.id.widget_event_list_today, "setTextSize", context.config.getFontSize() + 3)
val now = (System.currentTimeMillis() / 1000).toInt()
val todayCode = Formatter.getDayCodeFromTS(now)