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 {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "com.simplemobiletools.calendar.pro"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 216
versionName "6.17.4"
multiDexEnabled true
@ -70,7 +70,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:99ed70cdbf'
implementation 'com.github.SimpleMobileTools:Simple-Commons:4db798d92d'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@ -1488,10 +1488,10 @@ class EventActivity : SimpleActivity() {
event_attendees_holder.addView(attendeeHolder)
val textColor = config.textColor
autoCompleteView.setColors(textColor, getAdjustedPrimaryColor(), config.backgroundColor)
selectedAttendeeHolder.event_contact_name.setColors(textColor, getAdjustedPrimaryColor(), config.backgroundColor)
selectedAttendeeHolder.event_contact_me_status.setColors(textColor, getAdjustedPrimaryColor(), config.backgroundColor)
val textColor = getProperTextColor()
autoCompleteView.setColors(textColor, getProperPrimaryColor(), getProperBackgroundColor())
selectedAttendeeHolder.event_contact_name.setColors(textColor, getProperPrimaryColor(), getProperBackgroundColor())
selectedAttendeeHolder.event_contact_me_status.setColors(textColor, getProperPrimaryColor(), getProperBackgroundColor())
selectedAttendeeDismiss.applyColorFilter(textColor)
selectedAttendeeDismiss.setOnClickListener {
@ -1686,7 +1686,7 @@ class EventActivity : SimpleActivity() {
}
private fun updateIconColors() {
event_show_on_map.applyColorFilter(getAdjustedPrimaryColor())
event_show_on_map.applyColorFilter(getProperPrimaryColor())
val textColor = config.textColor
arrayOf(
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 mStoredBackgroundColor = 0
private var mStoredAdjustedPrimaryColor = 0
private var mStoredPrimaryColor = 0
private var mStoredDayCode = ""
private var mStoredIsSundayFirst = false
private var mStoredMidnightSpan = true
@ -154,7 +154,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
override fun 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
|| mStoredHighlightWeekendsColor != config.highlightWeekendsColor
) {
@ -183,8 +183,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
fab_event_label.setTextColor(config.textColor)
fab_task_label.setTextColor(config.textColor)
fab_task_icon.drawable.applyColorFilter(mStoredAdjustedPrimaryColor.getContrastColor())
fab_task_icon.background.applyColorFilter(mStoredAdjustedPrimaryColor)
fab_task_icon.drawable.applyColorFilter(mStoredPrimaryColor.getContrastColor())
fab_task_icon.background.applyColorFilter(mStoredPrimaryColor)
search_holder.background = ColorDrawable(config.backgroundColor)
checkSwipeRefreshAvailability()
@ -303,7 +303,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
mStoredMidnightSpan = showMidnightSpanningEventsAtTop
mStoredStartWeekWithCurrentDay = startWeekWithCurrentDay
}
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor()
mStoredPrimaryColor = getProperPrimaryColor()
mStoredDayCode = Formatter.getTodayCode()
}
@ -951,7 +951,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} else {
R.drawable.ic_today_vector
}
val newDrawable = resources.getColoredDrawableWithColor(newDrawableId, getAdjustedPrimaryColor())
val newDrawable = resources.getColoredDrawableWithColor(newDrawableId, getProperPrimaryColor())
val duration = 75L
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.RadioItem
import kotlinx.android.synthetic.main.activity_settings.*
import kotlinx.android.synthetic.main.dialog_event_type.view.*
import org.joda.time.DateTime
import java.io.File
import java.io.InputStream
@ -30,12 +29,12 @@ class SettingsActivity : SimpleActivity() {
private val GET_RINGTONE_URI = 1
private val PICK_IMPORT_SOURCE_INTENT = 2
private var mStoredAdjustedPrimaryColor = 0
private var mStoredPrimaryColor = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor()
mStoredPrimaryColor = getProperPrimaryColor()
}
override fun onResume() {
@ -104,7 +103,7 @@ class SettingsActivity : SimpleActivity() {
settings_events_label,
settings_migrating_label
).forEach {
it.setTextColor(getAdjustedPrimaryColor())
it.setTextColor(getProperPrimaryColor())
}
arrayOf(
@ -126,7 +125,7 @@ class SettingsActivity : SimpleActivity() {
override fun onPause() {
super.onPause()
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor()
mStoredPrimaryColor = getProperPrimaryColor()
}
override fun onStop() {
@ -154,12 +153,12 @@ class SettingsActivity : SimpleActivity() {
}
private fun checkPrimaryColor() {
if (getAdjustedPrimaryColor() != mStoredAdjustedPrimaryColor) {
if (getProperPrimaryColor() != mStoredPrimaryColor) {
ensureBackgroundThread {
val eventTypes = eventsHelper.getEventTypesSync()
if (eventTypes.filter { it.caldavCalendarId == 0 }.size == 1) {
val eventType = eventTypes.first { it.caldavCalendarId == 0 }
eventType.color = getAdjustedPrimaryColor()
eventType.color = getProperPrimaryColor()
eventsHelper.insertOrUpdateEventTypeSync(eventType)
}
}

View File

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

View File

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

View File

@ -5,12 +5,12 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.extensions.config
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 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>) :
RecyclerView.Adapter<FilterEventTypeAdapter.ViewHolder>() {
@ -53,9 +53,9 @@ class FilterEventTypeAdapter(val activity: SimpleActivity, val eventTypes: List<
val isSelected = selectedKeys.contains(eventType.id)
itemView.apply {
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_color.setFillWithStroke(eventType.color, activity.config.backgroundColor)
filter_event_type_color.setFillWithStroke(eventType.color, activity.getProperBackgroundColor())
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
if (day.isToday) {
val primaryColor = getAdjustedPrimaryColor()
val primaryColor = getProperPrimaryColor()
setTextColor(primaryColor.getContrastColor())
if (dayLabelHeight == 0) {
onGlobalLayout {

View File

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

View File

@ -92,7 +92,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
weekTimestamp = requireArguments().getLong(WEEK_START_TIMESTAMP)
dimPastEvents = config.dimPastEvents
highlightWeekends = config.highlightWeekends
primaryColor = requireContext().getAdjustedPrimaryColor()
primaryColor = requireContext().getProperPrimaryColor()
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.models.DayYearly
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 kotlinx.android.synthetic.main.fragment_year.view.*
import org.joda.time.DateTime
import java.util.*
class YearFragment : Fragment(), YearlyCalendar {
private var mYear = 0
@ -97,7 +96,7 @@ class YearFragment : Fragment(), YearlyCalendar {
private fun markCurrentMonth(now: DateTime) {
if (now.year == mYear) {
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))
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)
init {
primaryColor = context.getAdjustedPrimaryColor()
textColor = config.textColor
primaryColor = context.getProperPrimaryColor()
textColor = context.getProperTextColor()
weekendsTextColor = config.highlightWeekendsColor
showWeekNumbers = config.showWeekNumbers
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.models.DayYearly
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 java.util.*
@ -48,7 +48,8 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
val attributes = context.theme.obtainStyledAttributes(
attrs,
R.styleable.SmallMonthView,
0, 0)
0, 0
)
try {
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.color = context.getAdjustedPrimaryColor().adjustAlpha(MEDIUM_ALPHA)
todayCirclePaint.color = context.getProperPrimaryColor().adjustAlpha(MEDIUM_ALPHA)
isLandscape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
}

View File

@ -10,7 +10,7 @@ buildscript {
}
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 "de.timfreiheit.resourceplaceholders:placeholders:0.4"

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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