store the weekly view item height in shared confs

This commit is contained in:
tibbi 2020-03-22 17:19:30 +01:00
parent cd478ea36f
commit 401670d429
3 changed files with 8 additions and 2 deletions

View File

@ -69,7 +69,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
res = context!!.resources res = context!!.resources
config = context!!.config config = context!!.config
rowHeight = res.getDimension(R.dimen.weekly_view_row_height) rowHeight = config.weeklyViewItemHeight
weekTimestamp = arguments!!.getLong(WEEK_START_TIMESTAMP) weekTimestamp = arguments!!.getLong(WEEK_START_TIMESTAMP)
dimPastEvents = config.dimPastEvents dimPastEvents = config.dimPastEvents
primaryColor = context!!.getAdjustedPrimaryColor() primaryColor = context!!.getAdjustedPrimaryColor()
@ -228,7 +228,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
addNewLine() addNewLine()
val fullHeight = res.getDimension(R.dimen.weekly_view_events_height) val fullHeight = rowHeight * 24
val minuteHeight = fullHeight / (24 * 60) val minuteHeight = fullHeight / (24 * 60)
val minimalHeight = res.getDimension(R.dimen.weekly_view_minimal_event_height).toInt() val minimalHeight = res.getDimension(R.dimen.weekly_view_minimal_event_height).toInt()
val density = Math.round(res.displayMetrics.density) val density = Math.round(res.displayMetrics.density)

View File

@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.pro.helpers
import android.content.Context import android.content.Context
import android.media.AudioManager import android.media.AudioManager
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.scheduleCalDAVSync import com.simplemobiletools.calendar.pro.extensions.scheduleCalDAVSync
import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle
@ -178,4 +179,8 @@ class Config(context: Context) : BaseConfig(context) {
var exportPastEvents: Boolean var exportPastEvents: Boolean
get() = prefs.getBoolean(EXPORT_PAST_EVENTS, false) get() = prefs.getBoolean(EXPORT_PAST_EVENTS, false)
set(exportPastEvents) = prefs.edit().putBoolean(EXPORT_PAST_EVENTS, exportPastEvents).apply() set(exportPastEvents) = prefs.edit().putBoolean(EXPORT_PAST_EVENTS, exportPastEvents).apply()
var weeklyViewItemHeight: Float
get() = prefs.getFloat(WEEKLY_VIEW_ITEM_HEIGHT, context.resources.getDimension(R.dimen.weekly_view_row_height))
set(weeklyViewItemHeight) = prefs.edit().putFloat(WEEKLY_VIEW_ITEM_HEIGHT, weeklyViewItemHeight).apply()
} }

View File

@ -74,6 +74,7 @@ const val DEFAULT_EVENT_TYPE_ID = "default_event_type_id"
const val ALLOW_CHANGING_TIME_ZONES = "allow_changing_time_zones" const val ALLOW_CHANGING_TIME_ZONES = "allow_changing_time_zones"
const val LAST_EXPORT_PATH = "last_export_path" const val LAST_EXPORT_PATH = "last_export_path"
const val EXPORT_PAST_EVENTS = "export_past_events" const val EXPORT_PAST_EVENTS = "export_past_events"
const val WEEKLY_VIEW_ITEM_HEIGHT = "weekly_view_item_height"
// repeat_rule for monthly and yearly repetition // repeat_rule for monthly and yearly repetition
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition) const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)