mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2024-12-24 15:31:05 +01:00
updating commons to 5.22.5
This commit is contained in:
parent
6030857fea
commit
53c88f1ab2
@ -64,7 +64,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.21.9'
|
||||
implementation 'com.simplemobiletools:commons:5.22.5'
|
||||
implementation 'joda-time:joda-time:2.10.1'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
|
||||
|
@ -515,12 +515,6 @@ class SettingsActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getFontSizeText() = getString(when (config.fontSize) {
|
||||
FONT_SIZE_SMALL -> R.string.small
|
||||
FONT_SIZE_MEDIUM -> R.string.medium
|
||||
else -> R.string.large
|
||||
})
|
||||
|
||||
private fun setupCustomizeWidgetColors() {
|
||||
settings_customize_widget_colors_holder.setOnClickListener {
|
||||
Intent(this, WidgetListConfigureActivity::class.java).apply {
|
||||
|
@ -10,6 +10,7 @@ import com.simplemobiletools.calendar.pro.R.id.event_item_holder
|
||||
import com.simplemobiletools.calendar.pro.R.id.event_section_title
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
||||
import com.simplemobiletools.calendar.pro.extensions.getWidgetFontSize
|
||||
import com.simplemobiletools.calendar.pro.extensions.seconds
|
||||
import com.simplemobiletools.calendar.pro.helpers.*
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
@ -34,7 +35,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
|
||||
private var weakTextColor = textColor.adjustAlpha(LOW_ALPHA)
|
||||
private val replaceDescription = context.config.replaceDescription
|
||||
private val dimPastEvents = context.config.dimPastEvents
|
||||
private var mediumFontSize = context.config.getFontSize()
|
||||
private var mediumFontSize = context.getWidgetFontSize()
|
||||
|
||||
override fun getViewAt(position: Int): RemoteViews? {
|
||||
val type = getItemViewType(position)
|
||||
@ -154,7 +155,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
|
||||
override fun onDataSetChanged() {
|
||||
textColor = context.config.widgetTextColor
|
||||
weakTextColor = textColor.adjustAlpha(LOW_ALPHA)
|
||||
mediumFontSize = context.config.getFontSize()
|
||||
mediumFontSize = context.getWidgetFontSize()
|
||||
val fromTS = DateTime().seconds() - context.config.displayPastEvents * 60
|
||||
val toTS = DateTime().plusYears(1).seconds()
|
||||
context.eventsHelper.getEventsSync(fromTS, toTS, applyTypeFilter = true) {
|
||||
|
@ -512,3 +512,14 @@ fun Context.refreshCalDAVCalendars(ids: String, showToasts: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Context.getWidgetFontSize() = when (config.fontSize) {
|
||||
FONT_SIZE_SMALL -> getWidgetSmallFontSize()
|
||||
FONT_SIZE_MEDIUM -> getWidgetMediumFontSize()
|
||||
else -> getWidgetLargeFontSize()
|
||||
}
|
||||
|
||||
fun Context.getWidgetSmallFontSize() = getWidgetMediumFontSize() - 3f
|
||||
fun Context.getWidgetMediumFontSize() = resources.getDimension(R.dimen.day_text_size) / resources.displayMetrics.density
|
||||
fun Context.getWidgetLargeFontSize() = getWidgetMediumFontSize() + 3f
|
||||
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.pro.helpers
|
||||
|
||||
import android.content.Context
|
||||
import android.media.AudioManager
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.scheduleCalDAVSync
|
||||
import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle
|
||||
@ -73,10 +72,6 @@ class Config(context: Context) : BaseConfig(context) {
|
||||
get() = prefs.getStringSet(DISPLAY_EVENT_TYPES, HashSet<String>())
|
||||
set(displayEventTypes) = prefs.edit().remove(DISPLAY_EVENT_TYPES).putStringSet(DISPLAY_EVENT_TYPES, displayEventTypes).apply()
|
||||
|
||||
var fontSize: Int
|
||||
get() = prefs.getInt(FONT_SIZE, FONT_SIZE_MEDIUM)
|
||||
set(size) = prefs.edit().putInt(FONT_SIZE, size).apply()
|
||||
|
||||
var listWidgetViewToOpen: Int
|
||||
get() = prefs.getInt(LIST_WIDGET_VIEW_TO_OPEN, DAILY_VIEW)
|
||||
set(viewToOpenFromListWidget) = prefs.edit().putInt(LIST_WIDGET_VIEW_TO_OPEN, viewToOpenFromListWidget).apply()
|
||||
@ -140,16 +135,6 @@ class Config(context: Context) : BaseConfig(context) {
|
||||
displayEventTypes = currDisplayEventTypes
|
||||
}
|
||||
|
||||
fun getFontSize() = when (fontSize) {
|
||||
FONT_SIZE_SMALL -> getSmallFontSize()
|
||||
FONT_SIZE_MEDIUM -> getMediumFontSize()
|
||||
else -> getLargeFontSize()
|
||||
}
|
||||
|
||||
private fun getSmallFontSize() = getMediumFontSize() - 3f
|
||||
private fun getMediumFontSize() = context.resources.getDimension(R.dimen.day_text_size) / context.resources.displayMetrics.density
|
||||
private fun getLargeFontSize() = getMediumFontSize() + 3f
|
||||
|
||||
var usePreviousEventReminders: Boolean
|
||||
get() = prefs.getBoolean(USE_PREVIOUS_EVENT_REMINDERS, true)
|
||||
set(usePreviousEventReminders) = prefs.edit().putBoolean(USE_PREVIOUS_EVENT_REMINDERS, usePreviousEventReminders).apply()
|
||||
|
@ -50,7 +50,6 @@ const val LAST_EVENT_REMINDER_MINUTES = "reminder_minutes"
|
||||
const val LAST_EVENT_REMINDER_MINUTES_2 = "reminder_minutes_2"
|
||||
const val LAST_EVENT_REMINDER_MINUTES_3 = "reminder_minutes_3"
|
||||
const val DISPLAY_EVENT_TYPES = "display_event_types"
|
||||
const val FONT_SIZE = "font_size"
|
||||
const val LIST_WIDGET_VIEW_TO_OPEN = "list_widget_view_to_open"
|
||||
const val CALDAV_SYNC = "caldav_sync"
|
||||
const val CALDAV_SYNCED_CALENDAR_IDS = "caldav_synced_calendar_ids"
|
||||
@ -142,11 +141,6 @@ const val FR = "FR"
|
||||
const val SA = "SA"
|
||||
const val SU = "SU"
|
||||
|
||||
// font sizes
|
||||
const val FONT_SIZE_SMALL = 0
|
||||
const val FONT_SIZE_MEDIUM = 1
|
||||
const val FONT_SIZE_LARGE = 2
|
||||
|
||||
const val SOURCE_SIMPLE_CALENDAR = "simple-calendar"
|
||||
const val SOURCE_IMPORTED_ICS = "imported-ics"
|
||||
const val SOURCE_CONTACT_BIRTHDAY = "contact-birthday"
|
||||
|
@ -11,6 +11,7 @@ import android.widget.RemoteViews
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.SplashActivity
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.getWidgetFontSize
|
||||
import com.simplemobiletools.calendar.pro.extensions.launchNewEventIntent
|
||||
import com.simplemobiletools.calendar.pro.services.WidgetService
|
||||
import com.simplemobiletools.calendar.pro.services.WidgetServiceEmpty
|
||||
@ -27,7 +28,7 @@ class MyWidgetListProvider : AppWidgetProvider() {
|
||||
}
|
||||
|
||||
private fun performUpdate(context: Context) {
|
||||
val fontSize = context.config.getFontSize()
|
||||
val fontSize = context.getWidgetFontSize()
|
||||
val textColor = context.config.widgetTextColor
|
||||
|
||||
val appWidgetManager = AppWidgetManager.getInstance(context)
|
||||
|
@ -12,6 +12,7 @@ import android.widget.RemoteViews
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.SplashActivity
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.getWidgetFontSize
|
||||
import com.simplemobiletools.calendar.pro.extensions.launchNewEventIntent
|
||||
import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar
|
||||
import com.simplemobiletools.calendar.pro.models.DayMonthly
|
||||
@ -93,7 +94,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
val displayWeekNumbers = context.config.showWeekNumbers
|
||||
val textColor = context.config.widgetTextColor
|
||||
val dimPastEvents = context.config.dimPastEvents
|
||||
val smallerFontSize = context.config.getFontSize() - 3f
|
||||
val smallerFontSize = context.getWidgetFontSize() - 3f
|
||||
val res = context.resources
|
||||
val len = days.size
|
||||
val packageName = context.packageName
|
||||
@ -148,7 +149,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
private fun addDayNumber(context: Context, views: RemoteViews, day: DayMonthly, textColor: Int, id: Int) {
|
||||
val newRemoteView = RemoteViews(context.packageName, R.layout.day_monthly_number_view).apply {
|
||||
setText(R.id.day_monthly_number_id, day.value.toString())
|
||||
setTextSize(R.id.day_monthly_number_id, context.config.getFontSize() - 3f)
|
||||
setTextSize(R.id.day_monthly_number_id, context.getWidgetFontSize() - 3f)
|
||||
|
||||
if (day.isToday) {
|
||||
setBackgroundColor(R.id.day_monthly_number_id, textColor)
|
||||
@ -162,7 +163,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
|
||||
private val monthlyCalendar = object : MonthlyCalendar {
|
||||
override fun updateMonthlyCalendar(context: Context, month: String, days: ArrayList<DayMonthly>, checkedEvents: Boolean, currTargetDate: DateTime) {
|
||||
val largerFontSize = context.config.getFontSize() + 3f
|
||||
val largerFontSize = context.getWidgetFontSize() + 3f
|
||||
val textColor = context.config.widgetTextColor
|
||||
val resources = context.resources
|
||||
|
||||
@ -212,7 +213,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
|
||||
private fun updateDayLabels(context: Context, views: RemoteViews, resources: Resources, textColor: Int) {
|
||||
val sundayFirst = context.config.isSundayFirst
|
||||
val smallerFontSize = context.config.getFontSize()
|
||||
val smallerFontSize = context.getWidgetFontSize()
|
||||
val packageName = context.packageName
|
||||
val letters = context.resources.getStringArray(R.array.week_day_letters)
|
||||
for (i in 0..6) {
|
||||
|
Loading…
Reference in New Issue
Block a user