store just a multiplier related to the weekly view height
This commit is contained in:
parent
78be6801d5
commit
541c147b6e
|
@ -525,3 +525,9 @@ fun Context.getWidgetSmallFontSize() = getWidgetMediumFontSize() - 3f
|
|||
fun Context.getWidgetMediumFontSize() = resources.getDimension(R.dimen.day_text_size) / resources.displayMetrics.density
|
||||
fun Context.getWidgetLargeFontSize() = getWidgetMediumFontSize() + 3f
|
||||
fun Context.getWidgetExtraLargeFontSize() = getWidgetMediumFontSize() + 6f
|
||||
|
||||
fun Context.getWeeklyViewItemHeight(): Float {
|
||||
val defaultHeight = resources.getDimension(R.dimen.weekly_view_row_height)
|
||||
val multiplier = config.weeklyViewItemHeightMultiplier
|
||||
return defaultHeight * multiplier
|
||||
}
|
||||
|
|
|
@ -13,10 +13,7 @@ import androidx.collection.LongSparseArray
|
|||
import androidx.fragment.app.Fragment
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.EventActivity
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
||||
import com.simplemobiletools.calendar.pro.extensions.seconds
|
||||
import com.simplemobiletools.calendar.pro.extensions.touch
|
||||
import com.simplemobiletools.calendar.pro.extensions.*
|
||||
import com.simplemobiletools.calendar.pro.helpers.*
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.interfaces.WeekFragmentListener
|
||||
|
@ -64,7 +61,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
super.onCreate(savedInstanceState)
|
||||
res = context!!.resources
|
||||
config = context!!.config
|
||||
rowHeight = config.weeklyViewItemHeight
|
||||
rowHeight = context!!.getWeeklyViewItemHeight()
|
||||
weekTimestamp = arguments!!.getLong(WEEK_START_TIMESTAMP)
|
||||
dimPastEvents = config.dimPastEvents
|
||||
primaryColor = context!!.getAdjustedPrimaryColor()
|
||||
|
@ -75,7 +72,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
this.inflater = inflater
|
||||
|
||||
mView = inflater.inflate(R.layout.fragment_week, container, false).apply {
|
||||
val fullHeight = context.config.weeklyViewItemHeight.toInt() * 24
|
||||
val fullHeight = context.getWeeklyViewItemHeight().toInt() * 24
|
||||
week_horizontal_grid_holder.layoutParams.height = fullHeight
|
||||
week_events_columns_holder.layoutParams.height = fullHeight
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.simplemobiletools.calendar.pro.R
|
|||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||
import com.simplemobiletools.calendar.pro.adapters.MyWeekPagerAdapter
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.getWeeklyViewItemHeight
|
||||
import com.simplemobiletools.calendar.pro.extensions.seconds
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.WEEK_START_DATE_TIME
|
||||
|
@ -50,7 +51,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
weekHolder = inflater.inflate(R.layout.fragment_week_holder, container, false) as ViewGroup
|
||||
weekHolder!!.background = ColorDrawable(context!!.config.backgroundColor)
|
||||
|
||||
val itemHeight = context!!.config.weeklyViewItemHeight.toInt()
|
||||
val itemHeight = context!!.getWeeklyViewItemHeight().toInt()
|
||||
weekHolder!!.week_view_hours_holder.setPadding(0, 0, 0, itemHeight)
|
||||
|
||||
viewPager = weekHolder!!.week_view_view_pager
|
||||
|
@ -62,7 +63,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
private fun setupFragment() {
|
||||
val weekTSs = getWeekTimestamps(currentWeekTS)
|
||||
val weeklyAdapter = MyWeekPagerAdapter(activity!!.supportFragmentManager, weekTSs, this)
|
||||
val itemHeight = context!!.config.weeklyViewItemHeight.toInt()
|
||||
val itemHeight = context!!.getWeeklyViewItemHeight().toInt()
|
||||
|
||||
val textColor = context!!.config.textColor
|
||||
weekHolder!!.week_view_hours_holder.removeAllViews()
|
||||
|
@ -111,7 +112,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
|
||||
private fun updateRowHeight() {
|
||||
val childCnt = weekHolder!!.week_view_hours_holder.childCount
|
||||
val itemHeight = context!!.config.weeklyViewItemHeight.toInt()
|
||||
val itemHeight = context!!.getWeeklyViewItemHeight().toInt()
|
||||
for (i in 0..childCnt) {
|
||||
val textView = weekHolder!!.week_view_hours_holder.getChildAt(i) as? TextView ?: continue
|
||||
textView.layoutParams.height = itemHeight
|
||||
|
|
|
@ -180,7 +180,7 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getBoolean(EXPORT_PAST_EVENTS, false)
|
||||
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()
|
||||
var weeklyViewItemHeightMultiplier: Float
|
||||
get() = prefs.getFloat(WEEKLY_VIEW_ITEM_HEIGHT_MULTIPLIER, 1f)
|
||||
set(weeklyViewItemHeightMultiplier) = prefs.edit().putFloat(WEEKLY_VIEW_ITEM_HEIGHT_MULTIPLIER, weeklyViewItemHeightMultiplier).apply()
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ const val DEFAULT_EVENT_TYPE_ID = "default_event_type_id"
|
|||
const val ALLOW_CHANGING_TIME_ZONES = "allow_changing_time_zones"
|
||||
const val LAST_EXPORT_PATH = "last_export_path"
|
||||
const val EXPORT_PAST_EVENTS = "export_past_events"
|
||||
const val WEEKLY_VIEW_ITEM_HEIGHT = "weekly_view_item_height"
|
||||
const val WEEKLY_VIEW_ITEM_HEIGHT_MULTIPLIER = "weekly_view_item_height_multiplier"
|
||||
|
||||
// repeat_rule for monthly and yearly repetition
|
||||
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)
|
||||
|
|
Loading…
Reference in New Issue