updating commons and target SDK to 31

This commit is contained in:
tibbi
2022-04-06 23:21:11 +02:00
parent a87d271f5d
commit 267a469bc3
15 changed files with 43 additions and 44 deletions

View File

@@ -11,12 +11,12 @@ if (keystorePropertiesFile.exists()) {
} }
android { android {
compileSdkVersion 30 compileSdkVersion 31
defaultConfig { defaultConfig {
applicationId "com.simplemobiletools.calendar.pro" applicationId "com.simplemobiletools.calendar.pro"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 31
versionCode 216 versionCode 216
versionName "6.17.4" versionName "6.17.4"
multiDexEnabled true multiDexEnabled true
@@ -70,7 +70,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:99ed70cdbf' implementation 'com.github.SimpleMobileTools:Simple-Commons:4db798d92d'
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@@ -1488,10 +1488,10 @@ class EventActivity : SimpleActivity() {
event_attendees_holder.addView(attendeeHolder) event_attendees_holder.addView(attendeeHolder)
val textColor = config.textColor val textColor = getProperTextColor()
autoCompleteView.setColors(textColor, getAdjustedPrimaryColor(), config.backgroundColor) autoCompleteView.setColors(textColor, getProperPrimaryColor(), getProperBackgroundColor())
selectedAttendeeHolder.event_contact_name.setColors(textColor, getAdjustedPrimaryColor(), config.backgroundColor) selectedAttendeeHolder.event_contact_name.setColors(textColor, getProperPrimaryColor(), getProperBackgroundColor())
selectedAttendeeHolder.event_contact_me_status.setColors(textColor, getAdjustedPrimaryColor(), config.backgroundColor) selectedAttendeeHolder.event_contact_me_status.setColors(textColor, getProperPrimaryColor(), getProperBackgroundColor())
selectedAttendeeDismiss.applyColorFilter(textColor) selectedAttendeeDismiss.applyColorFilter(textColor)
selectedAttendeeDismiss.setOnClickListener { selectedAttendeeDismiss.setOnClickListener {
@@ -1686,7 +1686,7 @@ class EventActivity : SimpleActivity() {
} }
private fun updateIconColors() { private fun updateIconColors() {
event_show_on_map.applyColorFilter(getAdjustedPrimaryColor()) event_show_on_map.applyColorFilter(getProperPrimaryColor())
val textColor = config.textColor val textColor = config.textColor
arrayOf( arrayOf(
event_time_image, event_time_zone_image, event_repetition_image, event_reminder_image, event_type_image, event_caldav_calendar_image, event_time_image, event_time_zone_image, event_repetition_image, event_reminder_image, event_type_image, event_caldav_calendar_image,

View File

@@ -73,7 +73,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private var mStoredTextColor = 0 private var mStoredTextColor = 0
private var mStoredBackgroundColor = 0 private var mStoredBackgroundColor = 0
private var mStoredAdjustedPrimaryColor = 0 private var mStoredPrimaryColor = 0
private var mStoredDayCode = "" private var mStoredDayCode = ""
private var mStoredIsSundayFirst = false private var mStoredIsSundayFirst = false
private var mStoredMidnightSpan = true private var mStoredMidnightSpan = true
@@ -154,7 +154,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredAdjustedPrimaryColor != getAdjustedPrimaryColor() if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != getProperPrimaryColor()
|| mStoredDayCode != Formatter.getTodayCode() || mStoredDimPastEvents != config.dimPastEvents || mStoredHighlightWeekends != config.highlightWeekends || mStoredDayCode != Formatter.getTodayCode() || mStoredDimPastEvents != config.dimPastEvents || mStoredHighlightWeekends != config.highlightWeekends
|| mStoredHighlightWeekendsColor != config.highlightWeekendsColor || mStoredHighlightWeekendsColor != config.highlightWeekendsColor
) { ) {
@@ -183,8 +183,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
fab_event_label.setTextColor(config.textColor) fab_event_label.setTextColor(config.textColor)
fab_task_label.setTextColor(config.textColor) fab_task_label.setTextColor(config.textColor)
fab_task_icon.drawable.applyColorFilter(mStoredAdjustedPrimaryColor.getContrastColor()) fab_task_icon.drawable.applyColorFilter(mStoredPrimaryColor.getContrastColor())
fab_task_icon.background.applyColorFilter(mStoredAdjustedPrimaryColor) fab_task_icon.background.applyColorFilter(mStoredPrimaryColor)
search_holder.background = ColorDrawable(config.backgroundColor) search_holder.background = ColorDrawable(config.backgroundColor)
checkSwipeRefreshAvailability() checkSwipeRefreshAvailability()
@@ -303,7 +303,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
mStoredMidnightSpan = showMidnightSpanningEventsAtTop mStoredMidnightSpan = showMidnightSpanningEventsAtTop
mStoredStartWeekWithCurrentDay = startWeekWithCurrentDay mStoredStartWeekWithCurrentDay = startWeekWithCurrentDay
} }
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor() mStoredPrimaryColor = getProperPrimaryColor()
mStoredDayCode = Formatter.getTodayCode() mStoredDayCode = Formatter.getTodayCode()
} }
@@ -951,7 +951,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} else { } else {
R.drawable.ic_today_vector R.drawable.ic_today_vector
} }
val newDrawable = resources.getColoredDrawableWithColor(newDrawableId, getAdjustedPrimaryColor()) val newDrawable = resources.getColoredDrawableWithColor(newDrawableId, getProperPrimaryColor())
val duration = 75L val duration = 75L
var rotation = 90f var rotation = 90f

View File

@@ -20,7 +20,6 @@ import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.AlarmSound import com.simplemobiletools.commons.models.AlarmSound
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
import kotlinx.android.synthetic.main.dialog_event_type.view.*
import org.joda.time.DateTime import org.joda.time.DateTime
import java.io.File import java.io.File
import java.io.InputStream import java.io.InputStream
@@ -30,12 +29,12 @@ class SettingsActivity : SimpleActivity() {
private val GET_RINGTONE_URI = 1 private val GET_RINGTONE_URI = 1
private val PICK_IMPORT_SOURCE_INTENT = 2 private val PICK_IMPORT_SOURCE_INTENT = 2
private var mStoredAdjustedPrimaryColor = 0 private var mStoredPrimaryColor = 0
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor() mStoredPrimaryColor = getProperPrimaryColor()
} }
override fun onResume() { override fun onResume() {
@@ -104,7 +103,7 @@ class SettingsActivity : SimpleActivity() {
settings_events_label, settings_events_label,
settings_migrating_label settings_migrating_label
).forEach { ).forEach {
it.setTextColor(getAdjustedPrimaryColor()) it.setTextColor(getProperPrimaryColor())
} }
arrayOf( arrayOf(
@@ -126,7 +125,7 @@ class SettingsActivity : SimpleActivity() {
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor() mStoredPrimaryColor = getProperPrimaryColor()
} }
override fun onStop() { override fun onStop() {
@@ -154,12 +153,12 @@ class SettingsActivity : SimpleActivity() {
} }
private fun checkPrimaryColor() { private fun checkPrimaryColor() {
if (getAdjustedPrimaryColor() != mStoredAdjustedPrimaryColor) { if (getProperPrimaryColor() != mStoredPrimaryColor) {
ensureBackgroundThread { ensureBackgroundThread {
val eventTypes = eventsHelper.getEventTypesSync() val eventTypes = eventsHelper.getEventTypesSync()
if (eventTypes.filter { it.caldavCalendarId == 0 }.size == 1) { if (eventTypes.filter { it.caldavCalendarId == 0 }.size == 1) {
val eventType = eventTypes.first { it.caldavCalendarId == 0 } val eventType = eventTypes.first { it.caldavCalendarId == 0 }
eventType.color = getAdjustedPrimaryColor() eventType.color = getProperPrimaryColor()
eventsHelper.insertOrUpdateEventTypeSync(eventType) eventsHelper.insertOrUpdateEventTypeSync(eventType)
} }
} }

View File

@@ -287,7 +287,7 @@ class TaskActivity : SimpleActivity() {
val markCompleteBgColor = if (isWhiteTheme()) { val markCompleteBgColor = if (isWhiteTheme()) {
Color.WHITE Color.WHITE
} else { } else {
getAdjustedPrimaryColor() getProperPrimaryColor()
} }
toggle_mark_complete.setTextColor(markCompleteBgColor.getContrastColor()) toggle_mark_complete.setTextColor(markCompleteBgColor.getContrastColor())
} }

View File

@@ -154,14 +154,14 @@ class EventListAdapter(
var newTextColor = textColor var newTextColor = textColor
if (listEvent.isAllDay || listEvent.startTS <= now && listEvent.endTS <= now) { if (listEvent.isAllDay || listEvent.startTS <= now && listEvent.endTS <= now) {
if (listEvent.isAllDay && Formatter.getDayCodeFromTS(listEvent.startTS) == Formatter.getDayCodeFromTS(now) && !isPrintVersion) { if (listEvent.isAllDay && Formatter.getDayCodeFromTS(listEvent.startTS) == Formatter.getDayCodeFromTS(now) && !isPrintVersion) {
newTextColor = adjustedPrimaryColor newTextColor = properPrimaryColor
} }
if (dimPastEvents && listEvent.isPastEvent && !isPrintVersion) { if (dimPastEvents && listEvent.isPastEvent && !isPrintVersion) {
newTextColor = newTextColor.adjustAlpha(MEDIUM_ALPHA) newTextColor = newTextColor.adjustAlpha(MEDIUM_ALPHA)
} }
} else if (listEvent.startTS <= now && listEvent.endTS >= now && !isPrintVersion) { } else if (listEvent.startTS <= now && listEvent.endTS >= now && !isPrintVersion) {
newTextColor = adjustedPrimaryColor newTextColor = properPrimaryColor
} }
event_item_time.setTextColor(newTextColor) event_item_time.setTextColor(newTextColor)
@@ -182,7 +182,7 @@ class EventListAdapter(
private fun setupListSectionDay(view: View, listSectionDay: ListSectionDay) { private fun setupListSectionDay(view: View, listSectionDay: ListSectionDay) {
view.event_section_title.apply { view.event_section_title.apply {
text = listSectionDay.title text = listSectionDay.title
val dayColor = if (listSectionDay.isToday) adjustedPrimaryColor else textColor val dayColor = if (listSectionDay.isToday) properPrimaryColor else textColor
setTextColor(dayColor) setTextColor(dayColor)
} }
} }
@@ -190,7 +190,7 @@ class EventListAdapter(
private fun setupListSectionMonth(view: View, listSectionMonth: ListSectionMonth) { private fun setupListSectionMonth(view: View, listSectionMonth: ListSectionMonth) {
view.event_section_title.apply { view.event_section_title.apply {
text = listSectionMonth.title text = listSectionMonth.title
setTextColor(adjustedPrimaryColor) setTextColor(properPrimaryColor)
} }
} }

View File

@@ -5,12 +5,12 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.models.EventType import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.getProperBackgroundColor
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setFillWithStroke
import kotlinx.android.synthetic.main.filter_event_type_view.view.* import kotlinx.android.synthetic.main.filter_event_type_view.view.*
import java.util.*
class FilterEventTypeAdapter(val activity: SimpleActivity, val eventTypes: List<EventType>, val displayEventTypes: Set<String>) : class FilterEventTypeAdapter(val activity: SimpleActivity, val eventTypes: List<EventType>, val displayEventTypes: Set<String>) :
RecyclerView.Adapter<FilterEventTypeAdapter.ViewHolder>() { RecyclerView.Adapter<FilterEventTypeAdapter.ViewHolder>() {
@@ -53,9 +53,9 @@ class FilterEventTypeAdapter(val activity: SimpleActivity, val eventTypes: List<
val isSelected = selectedKeys.contains(eventType.id) val isSelected = selectedKeys.contains(eventType.id)
itemView.apply { itemView.apply {
filter_event_type_checkbox.isChecked = isSelected filter_event_type_checkbox.isChecked = isSelected
filter_event_type_checkbox.setColors(activity.config.textColor, activity.getAdjustedPrimaryColor(), activity.config.backgroundColor) filter_event_type_checkbox.setColors(activity.getProperTextColor(), activity.getProperPrimaryColor(), activity.getProperBackgroundColor())
filter_event_type_checkbox.text = eventType.getDisplayTitle() filter_event_type_checkbox.text = eventType.getDisplayTitle()
filter_event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor) filter_event_type_color.setFillWithStroke(eventType.color, activity.getProperBackgroundColor())
filter_event_type_holder.setOnClickListener { viewClicked(!isSelected, eventType) } filter_event_type_holder.setOnClickListener { viewClicked(!isSelected, eventType) }
} }

View File

@@ -454,7 +454,7 @@ fun Context.addDayNumber(rawTextColor: Int, day: DayMonthly, linearLayout: Linea
gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL
if (day.isToday) { if (day.isToday) {
val primaryColor = getAdjustedPrimaryColor() val primaryColor = getProperPrimaryColor()
setTextColor(primaryColor.getContrastColor()) setTextColor(primaryColor.getContrastColor())
if (dayLabelHeight == 0) { if (dayLabelHeight == 0) {
onGlobalLayout { onGlobalLayout {

View File

@@ -54,7 +54,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
mView.background = ColorDrawable(requireContext().config.backgroundColor) mView.background = ColorDrawable(requireContext().config.backgroundColor)
mView.calendar_events_list_holder?.id = (System.currentTimeMillis() % 100000).toInt() mView.calendar_events_list_holder?.id = (System.currentTimeMillis() % 100000).toInt()
mView.calendar_empty_list_placeholder_2.apply { mView.calendar_empty_list_placeholder_2.apply {
setTextColor(context.getAdjustedPrimaryColor()) setTextColor(context.getProperPrimaryColor())
underlineText() underlineText()
setOnClickListener { setOnClickListener {
activity?.hideKeyboard() activity?.hideKeyboard()

View File

@@ -92,7 +92,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
weekTimestamp = requireArguments().getLong(WEEK_START_TIMESTAMP) weekTimestamp = requireArguments().getLong(WEEK_START_TIMESTAMP)
dimPastEvents = config.dimPastEvents dimPastEvents = config.dimPastEvents
highlightWeekends = config.highlightWeekends highlightWeekends = config.highlightWeekends
primaryColor = requireContext().getAdjustedPrimaryColor() primaryColor = requireContext().getProperPrimaryColor()
allDayRows.add(HashSet()) allDayRows.add(HashSet())
} }

View File

@@ -17,11 +17,10 @@ import com.simplemobiletools.calendar.pro.helpers.YearlyCalendarImpl
import com.simplemobiletools.calendar.pro.interfaces.YearlyCalendar import com.simplemobiletools.calendar.pro.interfaces.YearlyCalendar
import com.simplemobiletools.calendar.pro.models.DayYearly import com.simplemobiletools.calendar.pro.models.DayYearly
import com.simplemobiletools.calendar.pro.views.SmallMonthView import com.simplemobiletools.calendar.pro.views.SmallMonthView
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
import kotlinx.android.synthetic.main.fragment_year.view.* import kotlinx.android.synthetic.main.fragment_year.view.*
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.*
class YearFragment : Fragment(), YearlyCalendar { class YearFragment : Fragment(), YearlyCalendar {
private var mYear = 0 private var mYear = 0
@@ -97,7 +96,7 @@ class YearFragment : Fragment(), YearlyCalendar {
private fun markCurrentMonth(now: DateTime) { private fun markCurrentMonth(now: DateTime) {
if (now.year == mYear) { if (now.year == mYear) {
val monthLabel = mView.findViewById<TextView>(resources.getIdentifier("month_${now.monthOfYear}_label", "id", requireContext().packageName)) val monthLabel = mView.findViewById<TextView>(resources.getIdentifier("month_${now.monthOfYear}_label", "id", requireContext().packageName))
monthLabel.setTextColor(requireContext().getAdjustedPrimaryColor()) monthLabel.setTextColor(requireContext().getProperPrimaryColor())
val monthView = mView.findViewById<SmallMonthView>(resources.getIdentifier("month_${now.monthOfYear}", "id", requireContext().packageName)) val monthView = mView.findViewById<SmallMonthView>(resources.getIdentifier("month_${now.monthOfYear}", "id", requireContext().packageName))
monthView.todaysId = now.dayOfMonth monthView.todaysId = now.dayOfMonth

View File

@@ -60,8 +60,8 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0)
init { init {
primaryColor = context.getAdjustedPrimaryColor() primaryColor = context.getProperPrimaryColor()
textColor = config.textColor textColor = context.getProperTextColor()
weekendsTextColor = config.highlightWeekendsColor weekendsTextColor = config.highlightWeekendsColor
showWeekNumbers = config.showWeekNumbers showWeekNumbers = config.showWeekNumbers
dimPastEvents = config.dimPastEvents dimPastEvents = config.dimPastEvents

View File

@@ -11,7 +11,7 @@ import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.helpers.isWeekend import com.simplemobiletools.calendar.pro.helpers.isWeekend
import com.simplemobiletools.calendar.pro.models.DayYearly import com.simplemobiletools.calendar.pro.models.DayYearly
import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA
import java.util.* import java.util.*
@@ -48,7 +48,8 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
val attributes = context.theme.obtainStyledAttributes( val attributes = context.theme.obtainStyledAttributes(
attrs, attrs,
R.styleable.SmallMonthView, R.styleable.SmallMonthView,
0, 0) 0, 0
)
try { try {
days = attributes.getInt(R.styleable.SmallMonthView_days, 31) days = attributes.getInt(R.styleable.SmallMonthView_days, 31)
@@ -69,7 +70,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
} }
todayCirclePaint = Paint(paint) todayCirclePaint = Paint(paint)
todayCirclePaint.color = context.getAdjustedPrimaryColor().adjustAlpha(MEDIUM_ALPHA) todayCirclePaint.color = context.getProperPrimaryColor().adjustAlpha(MEDIUM_ALPHA)
isLandscape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE isLandscape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
} }

View File

@@ -10,7 +10,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.0.4' classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "de.timfreiheit.resourceplaceholders:placeholders:0.4" classpath "de.timfreiheit.resourceplaceholders:placeholders:0.4"

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip