Migrate to non-transitive R class

This commit is contained in:
Naveen 2023-09-04 15:43:10 +05:30
parent a408323236
commit e2ae8afe10
No known key found for this signature in database
GPG key ID: 0E155DAD31671DA3
51 changed files with 271 additions and 217 deletions

View file

@ -129,7 +129,13 @@ class EventActivity : SimpleActivity() {
override fun onBackPressed() {
if (System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isEventChanged()) {
mLastSavePromptTS = System.currentTimeMillis()
ConfirmationAdvancedDialog(this, "", R.string.save_before_closing, R.string.save, R.string.discard) {
ConfirmationAdvancedDialog(
activity = this,
message = "",
messageId = com.simplemobiletools.commons.R.string.save_before_closing,
positive = com.simplemobiletools.commons.R.string.save,
negative = com.simplemobiletools.commons.R.string.discard
) {
if (it) {
saveCurrentEvent()
} else {
@ -779,7 +785,7 @@ class EventActivity : SimpleActivity() {
private fun getRepeatXthDayInMonthString(includeBase: Boolean, repeatRule: Int): String {
val weekDayString = getRepeatXthDayString(includeBase, repeatRule)
val monthString = resources.getStringArray(R.array.in_months)[mEventStartDateTime.monthOfYear - 1]
val monthString = resources.getStringArray(com.simplemobiletools.commons.R.array.in_months)[mEventStartDateTime.monthOfYear - 1]
return "$weekDayString $monthString"
}
@ -794,7 +800,11 @@ class EventActivity : SimpleActivity() {
private fun checkRepetitionRuleText() {
when {
mRepeatInterval.isXWeeklyRepetition() -> {
binding.eventRepetitionRule.text = if (mRepeatRule == EVERY_DAY_BIT) getString(R.string.every_day) else getShortDaysFromBitmask(mRepeatRule)
binding.eventRepetitionRule.text = if (mRepeatRule == EVERY_DAY_BIT) {
getString(com.simplemobiletools.commons.R.string.every_day)
} else {
getShortDaysFromBitmask(mRepeatRule)
}
}
mRepeatInterval.isXMonthlyRepetition() -> {
@ -934,8 +944,8 @@ class EventActivity : SimpleActivity() {
private fun showReminderTypePicker(currentValue: Int, callback: (Int) -> Unit) {
val items = arrayListOf(
RadioItem(REMINDER_NOTIFICATION, getString(R.string.notification)),
RadioItem(REMINDER_EMAIL, getString(R.string.email))
RadioItem(REMINDER_NOTIFICATION, getString(com.simplemobiletools.commons.R.string.notification)),
RadioItem(REMINDER_EMAIL, getString(com.simplemobiletools.commons.R.string.email))
)
RadioGroupDialog(this, items, currentValue) {
callback(it as Int)
@ -970,7 +980,12 @@ class EventActivity : SimpleActivity() {
private fun updateReminderTypeImage(view: ImageView, reminder: Reminder) {
view.beVisibleIf(reminder.minutes != REMINDER_OFF && mEventCalendarId != STORED_LOCALLY_ONLY)
val drawable = if (reminder.type == REMINDER_NOTIFICATION) R.drawable.ic_bell_vector else R.drawable.ic_mail_vector
val drawable = if (reminder.type == REMINDER_NOTIFICATION) {
com.simplemobiletools.commons.R.drawable.ic_bell_vector
} else {
com.simplemobiletools.commons.R.drawable.ic_mail_vector
}
val icon = resources.getColoredDrawableWithColor(drawable, getProperTextColor())
view.setImageDrawable(icon)
}
@ -1046,7 +1061,7 @@ class EventActivity : SimpleActivity() {
if (currentCalendar == null) {
mEventCalendarId = STORED_LOCALLY_ONLY
val mediumMargin = resources.getDimension(R.dimen.medium_margin).toInt()
val mediumMargin = resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt()
eventCaldavCalendarName.apply {
text = getString(R.string.store_locally_only)
setPadding(paddingLeft, paddingTop, paddingRight, mediumMargin)
@ -1082,7 +1097,7 @@ class EventActivity : SimpleActivity() {
runOnUiThread {
eventCaldavCalendarName.apply {
text = currentCalendar.displayName
setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.tiny_margin).toInt())
setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(com.simplemobiletools.commons.R.dimen.tiny_margin).toInt())
}
eventCaldavCalendarHolder.apply {
@ -1320,7 +1335,7 @@ class EventActivity : SimpleActivity() {
storeEvent(wasRepeatable)
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
} else {

View file

@ -159,7 +159,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
addBirthdaysAnniversariesAtStart()
if (isPackageInstalled("com.simplemobiletools.calendar")) {
ConfirmationDialog(this, "", R.string.upgraded_from_free_calendar, R.string.ok, 0, false) {}
ConfirmationDialog(
activity = this,
message = "",
messageId = com.simplemobiletools.commons.R.string.upgraded_from_free_calendar,
positive = com.simplemobiletools.commons.R.string.ok,
negative = 0,
cancelOnTouchOutside = false
) {}
}
addImportIdsToTasks {
@ -247,7 +254,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
findItem(R.id.go_to_today).isVisible = shouldGoToTodayBeVisible && !binding.mainMenu.isSearchOpen
findItem(R.id.go_to_date).isVisible = config.storedView != EVENTS_LIST_VIEW
findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations)
}
}
@ -527,7 +534,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
private fun resetActionBarTitle() {
binding.mainMenu.updateHintText(getString(R.string.search))
binding.mainMenu.updateHintText(getString(com.simplemobiletools.commons.R.string.search))
}
private fun showFilterDialog() {
@ -585,7 +592,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
RadioGroupDialog(this, items) { selectedHoliday ->
SetRemindersDialog(this, OTHER_EVENT) {
val reminders = it
toast(R.string.importing)
toast(com.simplemobiletools.commons.R.string.importing)
ensureBackgroundThread {
val holidays = getString(R.string.holidays)
var eventTypeId = eventsHelper.getEventTypeIdWithClass(HOLIDAY_EVENT)
@ -631,7 +638,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
} else {
toast(R.string.no_contacts_permission)
toast(com.simplemobiletools.commons.R.string.no_contacts_permission)
}
}
}
@ -662,7 +669,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
} else {
toast(R.string.no_contacts_permission)
toast(com.simplemobiletools.commons.R.string.no_contacts_permission)
}
}
}
@ -705,7 +712,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun handleParseResult(result: ImportResult) {
toast(
when (result) {
ImportResult.IMPORT_NOTHING_NEW -> R.string.no_new_items
ImportResult.IMPORT_NOTHING_NEW -> com.simplemobiletools.commons.R.string.no_new_items
ImportResult.IMPORT_OK -> R.string.holidays_imported_successfully
ImportResult.IMPORT_PARTIAL -> R.string.importing_some_holidays_failed
else -> R.string.importing_holidays_failed
@ -964,7 +971,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun animateFabIcon(showPlus: Boolean) {
val newDrawableId = if (showPlus) {
R.drawable.ic_plus_vector
com.simplemobiletools.commons.R.drawable.ic_plus_vector
} else {
R.drawable.ic_today_vector
}
@ -1071,13 +1078,13 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
try {
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
} catch (e: ActivityNotFoundException) {
toast(R.string.system_service_disabled, Toast.LENGTH_LONG)
toast(com.simplemobiletools.commons.R.string.system_service_disabled, Toast.LENGTH_LONG)
} catch (e: Exception) {
showErrorToast(e)
}
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
} else {
@ -1101,7 +1108,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
"content" -> {
val tempFile = getTempFile()
if (tempFile == null) {
toast(R.string.unknown_error_occurred)
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
return
}
@ -1115,7 +1122,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
else -> toast(R.string.invalid_file_format)
else -> toast(com.simplemobiletools.commons.R.string.invalid_file_format)
}
}
@ -1144,7 +1151,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
try {
startActivityForResult(this, PICK_EXPORT_FILE_INTENT)
} catch (e: ActivityNotFoundException) {
toast(R.string.system_service_disabled, Toast.LENGTH_LONG)
toast(com.simplemobiletools.commons.R.string.system_service_disabled, Toast.LENGTH_LONG)
} catch (e: Exception) {
showErrorToast(e)
}
@ -1167,14 +1174,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
ensureBackgroundThread {
val events = eventsHelper.getEventsToExport(eventTypes, config.exportEvents, config.exportTasks, config.exportPastEntries)
if (events.isEmpty()) {
toast(R.string.no_entries_for_exporting)
toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
} else {
IcsExporter(this).exportEvents(outputStream, events, true) { result ->
toast(
when (result) {
ExportResult.EXPORT_OK -> R.string.exporting_successful
ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed
else -> R.string.exporting_failed
ExportResult.EXPORT_OK -> com.simplemobiletools.commons.R.string.exporting_successful
ExportResult.EXPORT_PARTIAL -> com.simplemobiletools.commons.R.string.exporting_some_entries_failed
else -> com.simplemobiletools.commons.R.string.exporting_failed
}
)
}
@ -1196,16 +1203,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
FAQItem(R.string.faq_3_title, R.string.faq_3_text),
FAQItem(R.string.faq_6_title, R.string.faq_6_text),
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons),
FAQItem(com.simplemobiletools.commons.R.string.faq_1_title_commons, com.simplemobiletools.commons.R.string.faq_1_text_commons),
FAQItem(com.simplemobiletools.commons.R.string.faq_4_title_commons, com.simplemobiletools.commons.R.string.faq_4_text_commons),
FAQItem(R.string.faq_4_title, R.string.faq_4_text)
)
if (!resources.getBoolean(R.bool.hide_google_relations)) {
faqItems.add(FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons))
faqItems.add(FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons))
faqItems.add(FAQItem(R.string.faq_7_title_commons, R.string.faq_7_text_commons))
if (!resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations)) {
faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_2_title_commons, com.simplemobiletools.commons.R.string.faq_2_text_commons))
faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_6_title_commons, com.simplemobiletools.commons.R.string.faq_6_text_commons))
faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_7_title_commons, com.simplemobiletools.commons.R.string.faq_7_text_commons))
}
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
@ -1224,7 +1230,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
val placeholderTextId = if (config.displayEventTypes.isEmpty()) {
R.string.everything_filtered_out
} else {
R.string.no_items_found
com.simplemobiletools.commons.R.string.no_items_found
}
binding.searchPlaceholder.setText(placeholderTextId)

View file

@ -348,13 +348,13 @@ class SettingsActivity : SimpleActivity() {
private fun setupStartWeekOn() = binding.apply {
val items = arrayListOf(
RadioItem(DateTimeConstants.SUNDAY, getString(R.string.sunday)),
RadioItem(DateTimeConstants.MONDAY, getString(R.string.monday)),
RadioItem(DateTimeConstants.TUESDAY, getString(R.string.tuesday)),
RadioItem(DateTimeConstants.WEDNESDAY, getString(R.string.wednesday)),
RadioItem(DateTimeConstants.THURSDAY, getString(R.string.thursday)),
RadioItem(DateTimeConstants.FRIDAY, getString(R.string.friday)),
RadioItem(DateTimeConstants.SATURDAY, getString(R.string.saturday)),
RadioItem(DateTimeConstants.SUNDAY, getString(com.simplemobiletools.commons.R.string.sunday)),
RadioItem(DateTimeConstants.MONDAY, getString(com.simplemobiletools.commons.R.string.monday)),
RadioItem(DateTimeConstants.TUESDAY, getString(com.simplemobiletools.commons.R.string.tuesday)),
RadioItem(DateTimeConstants.WEDNESDAY, getString(com.simplemobiletools.commons.R.string.wednesday)),
RadioItem(DateTimeConstants.THURSDAY, getString(com.simplemobiletools.commons.R.string.thursday)),
RadioItem(DateTimeConstants.FRIDAY, getString(com.simplemobiletools.commons.R.string.friday)),
RadioItem(DateTimeConstants.SATURDAY, getString(com.simplemobiletools.commons.R.string.saturday)),
)
settingsStartWeekOn.text = getDayOfWeekString(config.firstDayOfWeek)
@ -642,7 +642,7 @@ class SettingsActivity : SimpleActivity() {
private fun getDisplayPastEventsText(displayPastEvents: Int): String {
return if (displayPastEvents == 0) {
getString(R.string.never)
getString(com.simplemobiletools.commons.R.string.never)
} else {
getFormattedMinutes(displayPastEvents, false)
}
@ -652,10 +652,10 @@ class SettingsActivity : SimpleActivity() {
settingsFontSize.text = getFontSizeText()
settingsFontSizeHolder.setOnClickListener {
val items = arrayListOf(
RadioItem(FONT_SIZE_SMALL, getString(R.string.small)),
RadioItem(FONT_SIZE_MEDIUM, getString(R.string.medium)),
RadioItem(FONT_SIZE_LARGE, getString(R.string.large)),
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large))
RadioItem(FONT_SIZE_SMALL, getString(com.simplemobiletools.commons.R.string.small)),
RadioItem(FONT_SIZE_MEDIUM, getString(com.simplemobiletools.commons.R.string.medium)),
RadioItem(FONT_SIZE_LARGE, getString(com.simplemobiletools.commons.R.string.large)),
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(com.simplemobiletools.commons.R.string.extra_large))
)
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
@ -820,7 +820,7 @@ class SettingsActivity : SimpleActivity() {
private fun updateDefaultDurationText() {
val duration = config.defaultDuration
binding.settingsDefaultDuration.text = if (duration == 0) {
"0 ${getString(R.string.minutes_raw)}"
"0 ${getString(com.simplemobiletools.commons.R.string.minutes_raw)}"
} else {
getFormattedMinutes(duration, false)
}
@ -961,7 +961,7 @@ class SettingsActivity : SimpleActivity() {
try {
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
} catch (e: ActivityNotFoundException) {
toast(R.string.system_service_disabled, Toast.LENGTH_LONG)
toast(com.simplemobiletools.commons.R.string.system_service_disabled, Toast.LENGTH_LONG)
} catch (e: Exception) {
showErrorToast(e)
}
@ -982,7 +982,7 @@ class SettingsActivity : SimpleActivity() {
private fun parseFile(inputStream: InputStream?) {
if (inputStream == null) {
toast(R.string.unknown_error_occurred)
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
return
}
@ -1060,7 +1060,12 @@ class SettingsActivity : SimpleActivity() {
}
runOnUiThread {
val msg = if (configValues.size > 0) R.string.settings_imported_successfully else R.string.no_entries_for_importing
val msg = if (configValues.size > 0) {
com.simplemobiletools.commons.R.string.settings_imported_successfully
} else {
com.simplemobiletools.commons.R.string.no_entries_for_importing
}
toast(msg)
setupSettingItems()

View file

@ -80,12 +80,17 @@ open class SimpleActivity : BaseSimpleActivity() {
if (NotificationManagerCompat.from(this).areNotificationsEnabled()) {
callback()
} else {
ConfirmationDialog(this, messageId = R.string.notifications_disabled, positive = R.string.ok, negative = 0) {
ConfirmationDialog(
activity = this,
messageId = com.simplemobiletools.commons.R.string.notifications_disabled,
positive = com.simplemobiletools.commons.R.string.ok,
negative = 0
) {
callback()
}
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
}

View file

@ -145,7 +145,13 @@ class TaskActivity : SimpleActivity() {
override fun onBackPressed() {
if (System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isTaskChanged()) {
mLastSavePromptTS = System.currentTimeMillis()
ConfirmationAdvancedDialog(this, "", R.string.save_before_closing, R.string.save, R.string.discard) {
ConfirmationAdvancedDialog(
activity = this,
message = "",
messageId = com.simplemobiletools.commons.R.string.save_before_closing,
positive = com.simplemobiletools.commons.R.string.save,
negative = com.simplemobiletools.commons.R.string.discard
) {
if (it) {
saveCurrentTask()
} else {
@ -437,7 +443,7 @@ class TaskActivity : SimpleActivity() {
storeTask(wasRepeatable)
}
} else {
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
} else {
@ -647,7 +653,7 @@ class TaskActivity : SimpleActivity() {
private fun updateTaskCompletedButton() {
if (mTaskCompleted) {
binding.toggleMarkComplete.background = ContextCompat.getDrawable(this, R.drawable.button_background_stroke)
binding.toggleMarkComplete.background = ContextCompat.getDrawable(this, com.simplemobiletools.commons.R.drawable.button_background_stroke)
binding.toggleMarkComplete.setText(R.string.mark_incomplete)
binding.toggleMarkComplete.setTextColor(getProperTextColor())
} else {
@ -983,7 +989,7 @@ class TaskActivity : SimpleActivity() {
private fun getRepeatXthDayInMonthString(includeBase: Boolean, repeatRule: Int): String {
val weekDayString = getRepeatXthDayString(includeBase, repeatRule)
val monthString = resources.getStringArray(R.array.in_months)[mTaskDateTime.monthOfYear - 1]
val monthString = resources.getStringArray(com.simplemobiletools.commons.R.array.in_months)[mTaskDateTime.monthOfYear - 1]
return "$weekDayString $monthString"
}
@ -998,7 +1004,11 @@ class TaskActivity : SimpleActivity() {
private fun checkRepetitionRuleText() {
when {
mRepeatInterval.isXWeeklyRepetition() -> {
binding.taskRepetitionRule.text = if (mRepeatRule == EVERY_DAY_BIT) getString(R.string.every_day) else getShortDaysFromBitmask(mRepeatRule)
binding.taskRepetitionRule.text = if (mRepeatRule == EVERY_DAY_BIT) {
getString(com.simplemobiletools.commons.R.string.every_day)
} else {
getShortDaysFromBitmask(mRepeatRule)
}
}
mRepeatInterval.isXMonthlyRepetition() -> {

View file

@ -6,7 +6,6 @@ import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.databinding.WidgetConfigDateBinding
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.helpers.Formatter
@ -65,8 +64,8 @@ class WidgetDateConfigureActivity : SimpleActivity() {
updateBackgroundColor()
mTextColor = config.widgetTextColor
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
mTextColor = resources.getColor(R.color.you_primary_color, theme)
if (mTextColor == resources.getColor(com.simplemobiletools.commons.R.color.default_widget_text_color) && config.isUsingSystemTheme) {
mTextColor = resources.getColor(com.simplemobiletools.commons.R.color.you_primary_color, theme)
}
updateTextColor()

View file

@ -92,8 +92,8 @@ class WidgetListConfigureActivity : SimpleActivity() {
updateBackgroundColor()
mTextColor = config.widgetTextColor
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
mTextColor = resources.getColor(R.color.you_primary_color, theme)
if (mTextColor == resources.getColor(com.simplemobiletools.commons.R.color.default_widget_text_color) && config.isUsingSystemTheme) {
mTextColor = resources.getColor(com.simplemobiletools.commons.R.color.you_primary_color, theme)
}
updateTextColor()

View file

@ -11,7 +11,6 @@ import android.os.Bundle
import android.view.Gravity
import android.view.ViewGroup
import android.widget.LinearLayout
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.databinding.DayMonthlyNumberViewBinding
import com.simplemobiletools.calendar.pro.databinding.TopNavigationBinding
import com.simplemobiletools.calendar.pro.databinding.WidgetConfigMonthlyBinding
@ -79,8 +78,8 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
updateBackgroundColor()
mTextColor = config.widgetTextColor
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
mTextColor = resources.getColor(R.color.you_primary_color, theme)
if (mTextColor == resources.getColor(com.simplemobiletools.commons.R.color.default_widget_text_color) && config.isUsingSystemTheme) {
mTextColor = resources.getColor(com.simplemobiletools.commons.R.color.you_primary_color, theme)
}
updateTextColor()

View file

@ -5,7 +5,6 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.databinding.CheckableColorButtonBinding
import com.simplemobiletools.commons.extensions.applyColorFilter
@ -40,7 +39,7 @@ class CheckableColorAdapter(private val activity: Activity, private val colors:
}
if (checked) {
setImageResource(R.drawable.ic_check_vector)
setImageResource(com.simplemobiletools.commons.R.drawable.ic_check_vector)
applyColorFilter(Color.WHITE)
} else {
setImageDrawable(null)

View file

@ -29,7 +29,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
private val dimPastEvents = activity.config.dimPastEvents
private val dimCompletedTasks = activity.config.dimCompletedTasks
private var isPrintVersion = false
private val mediumMargin = activity.resources.getDimension(R.dimen.medium_margin).toInt()
private val mediumMargin = activity.resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt()
init {
setupDragListener(true)
@ -77,7 +77,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
fun togglePrintMode() {
isPrintVersion = !isPrintVersion
textColor = if (isPrintVersion) {
resources.getColor(R.color.theme_light_text_color)
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
} else {
activity.getProperTextColor()
}

View file

@ -40,7 +40,7 @@ class EventListAdapter(
private var use24HourFormat = activity.config.use24HourFormat
private var currentItemsHash = listItems.hashCode()
private var isPrintVersion = false
private val mediumMargin = activity.resources.getDimension(R.dimen.medium_margin).toInt()
private val mediumMargin = activity.resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt()
init {
setupDragListener(true)
@ -124,7 +124,7 @@ class EventListAdapter(
fun togglePrintMode() {
isPrintVersion = !isPrintVersion
textColor = if (isPrintVersion) {
resources.getColor(R.color.theme_light_text_color)
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
} else {
activity.getProperTextColor()
}

View file

@ -30,8 +30,8 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
private var dimPastEvents = context.config.dimPastEvents
private var dimCompletedTasks = context.config.dimCompletedTasks
private var mediumFontSize = context.getWidgetFontSize()
private var smallMargin = context.resources.getDimension(R.dimen.small_margin).toInt()
private var normalMargin = context.resources.getDimension(R.dimen.normal_margin).toInt()
private var smallMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.small_margin).toInt()
private var normalMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.normal_margin).toInt()
init {
initConfigValues()

View file

@ -18,8 +18,8 @@ class CustomEventRepeatIntervalDialog(val activity: Activity, val callback: (sec
binding.dialogRadioView.check(R.id.dialog_radio_days)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> confirmRepeatInterval() }
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmRepeatInterval() }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this) { alertDialog ->
dialog = alertDialog

View file

@ -17,8 +17,8 @@ class CustomPeriodPickerDialog(val activity: Activity, val callback: (value: Int
binding.dialogCustomPeriodValue.setText("")
binding.dialogRadioView.check(R.id.dialog_radio_days)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> confirmReminder() }
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmReminder() }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this) { alertDialog ->
dialog = alertDialog

View file

@ -1,6 +1,5 @@
package com.simplemobiletools.calendar.pro.dialogs
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.databinding.DatetimePatternInfoLayoutBinding
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
@ -12,7 +11,7 @@ class DateTimePatternInfoDialog(activity: BaseSimpleActivity) {
init {
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> { } }
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> { } }
.apply {
activity.setupDialogStuff(binding.root, this)
}

View file

@ -42,8 +42,8 @@ class DeleteEventDialog(
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.yes) { _, _ -> dialogConfirmed(binding) }
.setNegativeButton(R.string.no, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.yes) { _, _ -> dialogConfirmed(binding) }
.setNegativeButton(com.simplemobiletools.commons.R.string.no, null)
.apply {
activity.setupDialogStuff(binding.root, this) { alertDialog ->
dialog = alertDialog

View file

@ -45,8 +45,8 @@ class EditEventTypeDialog(val activity: Activity, var eventType: EventType? = nu
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this, if (isNewEvent) R.string.add_new_type else R.string.edit_type) { alertDialog ->
alertDialog.showKeyboard(binding.typeTitle)

View file

@ -63,25 +63,25 @@ class ExportEventsDialog(
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this, R.string.export_events) { alertDialog ->
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = binding.exportEventsFilename.value
when {
filename.isEmpty() -> activity.toast(R.string.empty_name)
filename.isEmpty() -> activity.toast(com.simplemobiletools.commons.R.string.empty_name)
filename.isAValidFilename() -> {
val file = File(realPath, "$filename.ics")
if (!hidePath && file.exists()) {
activity.toast(R.string.name_taken)
activity.toast(com.simplemobiletools.commons.R.string.name_taken)
return@setOnClickListener
}
val exportEventsChecked = binding.exportEventsCheckbox.isChecked
val exportTasksChecked = binding.exportTasksCheckbox.isChecked
if (!exportEventsChecked && !exportTasksChecked) {
activity.toast(R.string.no_entries_for_exporting)
activity.toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
return@setOnClickListener
}
@ -99,7 +99,7 @@ class ExportEventsDialog(
}
}
else -> activity.toast(R.string.invalid_name)
else -> activity.toast(com.simplemobiletools.commons.R.string.invalid_name)
}
}
}

View file

@ -76,13 +76,13 @@ class ImportEventsDialog(val activity: SimpleActivity, val path: String, val cal
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this, R.string.import_events) { alertDialog ->
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(null)
activity.toast(R.string.importing)
activity.toast(com.simplemobiletools.commons.R.string.importing)
ensureBackgroundThread {
val overrideFileEventTypes = binding.importEventsCheckbox.isChecked
val result = IcsImporter(activity).importEvents(path, currEventTypeId, currEventTypeCalDAVCalendarId, overrideFileEventTypes)
@ -107,10 +107,10 @@ class ImportEventsDialog(val activity: SimpleActivity, val path: String, val cal
private fun handleParseResult(result: IcsImporter.ImportResult) {
activity.toast(
when (result) {
IMPORT_NOTHING_NEW -> R.string.no_new_items
IMPORT_OK -> R.string.importing_successful
IMPORT_PARTIAL -> R.string.importing_some_entries_failed
else -> R.string.no_items_found
IMPORT_NOTHING_NEW -> com.simplemobiletools.commons.R.string.no_new_items
IMPORT_OK -> com.simplemobiletools.commons.R.string.importing_successful
IMPORT_PARTIAL -> com.simplemobiletools.commons.R.string.importing_some_entries_failed
else -> com.simplemobiletools.commons.R.string.no_items_found
}
)
callback(result != IMPORT_FAIL)

View file

@ -59,25 +59,25 @@ class ManageAutomaticBackupsDialog(private val activity: SimpleActivity, onSucce
}
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this, R.string.manage_automatic_backups) { dialog ->
activity.setupDialogStuff(binding.root, this, com.simplemobiletools.commons.R.string.manage_automatic_backups) { dialog ->
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = binding.backupEventsFilename.value
when {
filename.isEmpty() -> activity.toast(R.string.empty_name)
filename.isEmpty() -> activity.toast(com.simplemobiletools.commons.R.string.empty_name)
filename.isAValidFilename() -> {
val file = File(backupFolder, "$filename.ics")
if (file.exists() && !file.canWrite()) {
activity.toast(R.string.name_taken)
activity.toast(com.simplemobiletools.commons.R.string.name_taken)
return@setOnClickListener
}
val backupEventsChecked = binding.backupEventsCheckbox.isChecked
val backupTasksChecked = binding.backupTasksCheckbox.isChecked
if (!backupEventsChecked && !backupTasksChecked || selectedEventTypes.isEmpty()) {
activity.toast(R.string.no_entries_for_exporting)
activity.toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
return@setOnClickListener
}
@ -101,7 +101,7 @@ class ManageAutomaticBackupsDialog(private val activity: SimpleActivity, onSucce
}
}
else -> activity.toast(R.string.invalid_name)
else -> activity.toast(com.simplemobiletools.commons.R.string.invalid_name)
}
}
}

View file

@ -5,7 +5,6 @@ import android.content.Intent
import android.net.Uri
import android.provider.Settings
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.databinding.DialogReminderWarningBinding
import com.simplemobiletools.commons.extensions.*
@ -15,10 +14,10 @@ class ReminderWarningDialog(val activity: Activity, val callback: () -> Unit) {
init {
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() }
.setNeutralButton(R.string.settings, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dialogConfirmed() }
.setNeutralButton(com.simplemobiletools.commons.R.string.settings, null)
.apply {
activity.setupDialogStuff(binding.root, this, R.string.disclaimer, cancelOnTouchOutside = false) { alertDialog ->
activity.setupDialogStuff(binding.root, this, com.simplemobiletools.commons.R.string.disclaimer, cancelOnTouchOutside = false) { alertDialog ->
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener {
redirectToSettings()
}

View file

@ -36,8 +36,8 @@ class RepeatLimitTypePickerDialog(val activity: Activity, var repeatLimit: Long,
updateRepeatLimitText()
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> confirmRepetition() }
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmRepetition() }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this) { alertDialog ->
dialog = alertDialog

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.calendar.pro.dialogs
import android.app.Activity
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.databinding.DialogVerticalLinearLayoutBinding
import com.simplemobiletools.calendar.pro.databinding.MyCheckboxBinding
import com.simplemobiletools.calendar.pro.extensions.withFirstDayOfWeekToFront
@ -14,7 +13,7 @@ class RepeatRuleWeeklyDialog(val activity: Activity, val curRepeatRule: Int, val
private val binding by activity.viewBinding(DialogVerticalLinearLayoutBinding::inflate)
init {
val days = activity.resources.getStringArray(R.array.week_days)
val days = activity.resources.getStringArray(com.simplemobiletools.commons.R.array.week_days)
var checkboxes = ArrayList<MyAppCompatCheckbox>(7)
for (i in 0..6) {
val pow = Math.pow(2.0, i.toDouble()).toInt()
@ -32,8 +31,8 @@ class RepeatRuleWeeklyDialog(val activity: Activity, val curRepeatRule: Int, val
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> callback(getRepeatRuleSum()) }
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> callback(getRepeatRuleSum()) }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this)
}

View file

@ -38,8 +38,8 @@ class SelectCalendarsDialog(val activity: SimpleActivity, val callback: () -> Un
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> confirmSelection() }
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmSelection() }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this, R.string.select_caldav_calendars)
}

View file

@ -22,7 +22,7 @@ class SelectEventColorDialog(val activity: Activity, val colors: IntArray, var c
binding.colorGrid.apply {
val width = activity.resources.getDimensionPixelSize(R.dimen.smaller_icon_size)
val spacing = activity.resources.getDimensionPixelSize(R.dimen.small_margin) * 2
val spacing = activity.resources.getDimensionPixelSize(com.simplemobiletools.commons.R.dimen.small_margin) * 2
layoutManager = AutoGridLayoutManager(context = activity, itemWidth = width + spacing)
adapter = colorAdapter
}

View file

@ -23,13 +23,13 @@ class SelectEventTypeColorDialog(val activity: Activity, val colors: IntArray, v
binding.colorGrid.apply {
val width = activity.resources.getDimensionPixelSize(R.dimen.smaller_icon_size)
val spacing = activity.resources.getDimensionPixelSize(R.dimen.small_margin) * 2
val spacing = activity.resources.getDimensionPixelSize(com.simplemobiletools.commons.R.dimen.small_margin) * 2
layoutManager = AutoGridLayoutManager(context = activity, itemWidth = width + spacing)
adapter = colorAdapter
}
activity.getAlertDialogBuilder()
.setNegativeButton(R.string.cancel, null)
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this, R.string.color) {
dialog = it

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.calendar.pro.dialogs
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.adapters.FilterEventTypeAdapter
import com.simplemobiletools.calendar.pro.databinding.DialogFilterEventTypesBinding
@ -19,8 +18,8 @@ class SelectEventTypesDialog(val activity: SimpleActivity, selectedEventTypes: S
binding.filterEventTypesList.adapter = FilterEventTypeAdapter(activity, it, selectedEventTypes)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> confirmEventTypes() }
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmEventTypes() }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this) { alertDialog ->
dialog = alertDialog

View file

@ -38,7 +38,11 @@ class SetRemindersDialog(val activity: SimpleActivity, val eventType: Int, val c
}
}
} else {
PermissionRequiredDialog(activity, R.string.allow_notifications_reminders, { activity.openNotificationSettings() })
PermissionRequiredDialog(
activity = activity,
textId = com.simplemobiletools.commons.R.string.allow_notifications_reminders,
positiveActionCallback = { activity.openNotificationSettings() }
)
}
}
}
@ -78,8 +82,8 @@ class SetRemindersDialog(val activity: SimpleActivity, val eventType: Int, val c
}
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() }
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dialogConfirmed() }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(binding.root, this, R.string.event_reminders)
}

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.pro.extensions
import android.app.Activity
import com.simplemobiletools.calendar.pro.BuildConfig
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.dialogs.CustomEventRepeatIntervalDialog
import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.models.Event
@ -12,19 +11,19 @@ import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.RadioItem
import java.io.File
import java.util.*
import java.util.TreeSet
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
ensureBackgroundThread {
val file = getTempFile()
if (file == null) {
toast(R.string.unknown_error_occurred)
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
return@ensureBackgroundThread
}
val events = eventsDB.getEventsOrTasksWithIds(ids) as ArrayList<Event>
if (events.isEmpty()) {
toast(R.string.no_items_found)
toast(com.simplemobiletools.commons.R.string.no_items_found)
}
getFileOutputStream(file.toFileDirItem(this), true) {
@ -41,7 +40,7 @@ fun BaseSimpleActivity.getTempFile(): File? {
val folder = File(cacheDir, "events")
if (!folder.exists()) {
if (!folder.mkdir()) {
toast(R.string.unknown_error_occurred)
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
return null
}
}
@ -72,7 +71,7 @@ fun Activity.showEventRepeatIntervalDialog(curSeconds: Int, callback: (minutes:
selectedIndex = index
}
items.add(RadioItem(-1, getString(R.string.custom)))
items.add(RadioItem(-1, getString(com.simplemobiletools.commons.R.string.custom)))
RadioGroupDialog(this, items, selectedIndex) {
if (it == -1) {

View file

@ -111,7 +111,7 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) {
val validReminders = event.getReminders().filter { it.type == REMINDER_NOTIFICATION }
if (validReminders.isEmpty()) {
if (showToasts) {
toast(R.string.saving)
toast(com.simplemobiletools.commons.R.string.saving)
}
return
}
@ -131,7 +131,7 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) {
}
if (showToasts) {
toast(R.string.saving)
toast(com.simplemobiletools.commons.R.string.saving)
}
}
}
@ -139,7 +139,7 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) {
fun Context.scheduleEventIn(notifTS: Long, event: Event, showToasts: Boolean) {
if (notifTS < System.currentTimeMillis()) {
if (showToasts) {
toast(R.string.saving)
toast(com.simplemobiletools.commons.R.string.saving)
}
return
}
@ -147,7 +147,7 @@ fun Context.scheduleEventIn(notifTS: Long, event: Event, showToasts: Boolean) {
val newNotifTS = notifTS + 1000
if (showToasts) {
val secondsTillNotification = (newNotifTS - System.currentTimeMillis()) / 1000
val msg = String.format(getString(R.string.time_remaining), formatSecondsToTimeString(secondsTillNotification.toInt()))
val msg = String.format(getString(com.simplemobiletools.commons.R.string.time_remaining), formatSecondsToTimeString(secondsTillNotification.toInt()))
toast(msg)
}
@ -223,7 +223,7 @@ fun Context.backupEventsAndTasks() {
exportPastEntries = config.autoBackupPastEntries
)
if (events.isEmpty()) {
toast(R.string.no_entries_for_exporting)
toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
config.lastAutoBackupTime = getNowSeconds()
scheduleNextAutomaticBackup()
return@ensureBackgroundThread
@ -274,8 +274,8 @@ fun Context.backupEventsAndTasks() {
IcsExporter(this).exportEvents(outputStream, events, showExportingToast = false) { result ->
when (result) {
IcsExporter.ExportResult.EXPORT_PARTIAL -> toast(R.string.exporting_some_entries_failed)
IcsExporter.ExportResult.EXPORT_FAIL -> toast(R.string.exporting_failed)
IcsExporter.ExportResult.EXPORT_PARTIAL -> toast(com.simplemobiletools.commons.R.string.exporting_some_entries_failed)
IcsExporter.ExportResult.EXPORT_FAIL -> toast(com.simplemobiletools.commons.R.string.exporting_failed)
else -> {}
}
MediaScannerConnection.scanFile(
@ -298,10 +298,10 @@ fun Context.getRepetitionText(seconds: Int) = when (seconds) {
YEAR -> getString(R.string.yearly)
else -> {
when {
seconds % YEAR == 0 -> resources.getQuantityString(R.plurals.years, seconds / YEAR, seconds / YEAR)
seconds % MONTH == 0 -> resources.getQuantityString(R.plurals.months, seconds / MONTH, seconds / MONTH)
seconds % WEEK == 0 -> resources.getQuantityString(R.plurals.weeks, seconds / WEEK, seconds / WEEK)
else -> resources.getQuantityString(R.plurals.days, seconds / DAY, seconds / DAY)
seconds % YEAR == 0 -> resources.getQuantityString(com.simplemobiletools.commons.R.plurals.years, seconds / YEAR, seconds / YEAR)
seconds % MONTH == 0 -> resources.getQuantityString(com.simplemobiletools.commons.R.plurals.months, seconds / MONTH, seconds / MONTH)
seconds % WEEK == 0 -> resources.getQuantityString(com.simplemobiletools.commons.R.plurals.weeks, seconds / WEEK, seconds / WEEK)
else -> resources.getQuantityString(com.simplemobiletools.commons.R.plurals.days, seconds / DAY, seconds / DAY)
}
}
}
@ -341,7 +341,7 @@ fun Context.notifyEvent(originalEvent: Event) {
val displayedStartDate = when (startDate) {
LocalDate.now() -> ""
LocalDate.now().plusDays(1) -> getString(R.string.tomorrow)
LocalDate.now().plusDays(1) -> getString(com.simplemobiletools.commons.R.string.tomorrow)
else -> "${Formatter.getDateFromCode(this, Formatter.getDayCodeFromTS(event.startTS))},"
}
@ -430,7 +430,11 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
if (event.isTask() && !event.isTaskCompleted()) {
addAction(R.drawable.ic_task_vector, getString(R.string.mark_completed), getMarkCompletedPendingIntent(this@getNotification, event))
}
addAction(R.drawable.ic_snooze_vector, getString(R.string.snooze), getSnoozePendingIntent(this@getNotification, event))
addAction(
com.simplemobiletools.commons.R.drawable.ic_snooze_vector,
getString(com.simplemobiletools.commons.R.string.snooze),
getSnoozePendingIntent(this@getNotification, event)
)
}
if (config.vibrateOnReminder) {
@ -785,13 +789,13 @@ fun Context.getFirstDayOfWeekDt(date: DateTime): DateTime {
fun Context.getDayOfWeekString(dayOfWeek: Int): String {
val dayOfWeekResId = when (dayOfWeek) {
DateTimeConstants.MONDAY -> R.string.monday
DateTimeConstants.TUESDAY -> R.string.tuesday
DateTimeConstants.WEDNESDAY -> R.string.wednesday
DateTimeConstants.THURSDAY -> R.string.thursday
DateTimeConstants.FRIDAY -> R.string.friday
DateTimeConstants.SATURDAY -> R.string.saturday
DateTimeConstants.SUNDAY -> R.string.sunday
DateTimeConstants.MONDAY -> com.simplemobiletools.commons.R.string.monday
DateTimeConstants.TUESDAY -> com.simplemobiletools.commons.R.string.tuesday
DateTimeConstants.WEDNESDAY -> com.simplemobiletools.commons.R.string.wednesday
DateTimeConstants.THURSDAY -> com.simplemobiletools.commons.R.string.thursday
DateTimeConstants.FRIDAY -> com.simplemobiletools.commons.R.string.friday
DateTimeConstants.SATURDAY -> com.simplemobiletools.commons.R.string.saturday
DateTimeConstants.SUNDAY -> com.simplemobiletools.commons.R.string.sunday
else -> throw IllegalArgumentException("Invalid day: $dayOfWeek")
}
@ -801,7 +805,7 @@ fun Context.getDayOfWeekString(dayOfWeek: Int): String {
// format day bits to strings like "Mon, Tue, Wed"
fun Context.getShortDaysFromBitmask(bitMask: Int): String {
val dayBits = withFirstDayOfWeekToFront(listOf(MONDAY_BIT, TUESDAY_BIT, WEDNESDAY_BIT, THURSDAY_BIT, FRIDAY_BIT, SATURDAY_BIT, SUNDAY_BIT))
val weekDays = withFirstDayOfWeekToFront(resources.getStringArray(R.array.week_days_short).toList())
val weekDays = withFirstDayOfWeekToFront(resources.getStringArray(com.simplemobiletools.commons.R.array.week_days_short).toList())
var days = ""
dayBits.forEachIndexed { index, bit ->

View file

@ -7,7 +7,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.adapters.DayEventsAdapter
@ -54,7 +53,7 @@ class DayFragment : Fragment() {
mListener?.goLeft()
}
val pointerLeft = requireContext().getDrawable(R.drawable.ic_chevron_left_vector)
val pointerLeft = requireContext().getDrawable(com.simplemobiletools.commons.R.drawable.ic_chevron_left_vector)
pointerLeft?.isAutoMirrored = true
setImageDrawable(pointerLeft)
}
@ -66,7 +65,7 @@ class DayFragment : Fragment() {
mListener?.goRight()
}
val pointerRight = requireContext().getDrawable(R.drawable.ic_chevron_right_vector)
val pointerRight = requireContext().getDrawable(com.simplemobiletools.commons.R.drawable.ic_chevron_right_vector)
pointerRight?.isAutoMirrored = true
setImageDrawable(pointerRight)
}
@ -135,7 +134,7 @@ class DayFragment : Fragment() {
topNavigationBinding.apply {
topLeftArrow.beGone()
topRightArrow.beGone()
topValue.setTextColor(resources.getColor(R.color.theme_light_text_color))
topValue.setTextColor(resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color))
(binding.dayEvents.adapter as? DayEventsAdapter)?.togglePrintMode()
Handler().postDelayed({

View file

@ -7,7 +7,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.DatePicker
import androidx.viewpager.widget.ViewPager
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.adapters.MyDayPagerAdapter
import com.simplemobiletools.calendar.pro.databinding.FragmentDaysHolderBinding
@ -111,8 +110,8 @@ class DayFragmentsHolder : MyFragmentHolder(), NavigationListener {
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, dateTime.dayOfMonth, null)
activity?.getAlertDialogBuilder()!!
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
.apply {
activity?.setupDialogStuff(datePicker, this)
}

View file

@ -235,7 +235,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
override fun printView() {
binding.apply {
if (calendarEventsList.isGone()) {
context?.toast(R.string.no_items_found)
context?.toast(com.simplemobiletools.commons.R.string.no_items_found)
return@apply
}

View file

@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.DatePicker
import androidx.viewpager.widget.ViewPager
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.adapters.MyMonthDayPagerAdapter
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthsDaysHolderBinding
@ -115,8 +114,8 @@ class MonthDayFragmentsHolder : MyFragmentHolder(), NavigationListener {
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
activity?.getAlertDialogBuilder()!!
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
.apply {
activity?.setupDialogStuff(datePicker, this)
}

View file

@ -7,7 +7,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthBinding
import com.simplemobiletools.calendar.pro.databinding.TopNavigationBinding
@ -118,7 +117,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
listener?.goLeft()
}
val pointerLeft = requireContext().getDrawable(R.drawable.ic_chevron_left_vector)
val pointerLeft = requireContext().getDrawable(com.simplemobiletools.commons.R.drawable.ic_chevron_left_vector)
pointerLeft?.isAutoMirrored = true
setImageDrawable(pointerLeft)
}
@ -130,7 +129,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
listener?.goRight()
}
val pointerRight = requireContext().getDrawable(R.drawable.ic_chevron_right_vector)
val pointerRight = requireContext().getDrawable(com.simplemobiletools.commons.R.drawable.ic_chevron_right_vector)
pointerRight?.isAutoMirrored = true
setImageDrawable(pointerRight)
}
@ -153,7 +152,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
topNavigationBinding.apply {
topLeftArrow.beGone()
topRightArrow.beGone()
topValue.setTextColor(resources.getColor(R.color.theme_light_text_color))
topValue.setTextColor(resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color))
binding.monthViewWrapper.togglePrintMode()
requireContext().printBitmap(binding.monthCalendarHolder.getViewBitmap())

View file

@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.DatePicker
import androidx.viewpager.widget.ViewPager
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.adapters.MyMonthPagerAdapter
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthsHolderBinding
@ -117,8 +116,8 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
activity?.getAlertDialogBuilder()!!
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
.apply {
activity?.setupDialogStuff(datePicker, this)
}

View file

@ -128,7 +128,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
scrollView.onGlobalLayout {
if (fullHeight < scrollView.height) {
scrollView.layoutParams.height = fullHeight - res.getDimension(R.dimen.one_dp).toInt()
scrollView.layoutParams.height = fullHeight - res.getDimension(com.simplemobiletools.commons.R.dimen.one_dp).toInt()
}
val initialScrollY = (rowHeight * config.startWeeklyAt).toInt()
@ -210,16 +210,16 @@ class WeekFragment : Fragment(), WeeklyCalendar {
for (i in 0 until config.weeklyViewDays) {
val dayCode = Formatter.getDayCodeFromDateTime(curDay)
val labelIDs = if (useLongerDayLabels) {
R.array.week_days_short
com.simplemobiletools.commons.R.array.week_days_short
} else {
R.array.week_day_letters
com.simplemobiletools.commons.R.array.week_day_letters
}
val dayLetters = res.getStringArray(labelIDs).toMutableList() as ArrayList<String>
val dayLetter = dayLetters[curDay.dayOfWeek - 1]
val textColor = if (isPrintVersion) {
resources.getColor(R.color.theme_light_text_color)
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
} else if (todayCode == dayCode) {
primaryColor
} else if (highlightWeekends && isWeekend(curDay.dayOfWeek)) {
@ -467,7 +467,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private fun updateViewScale() {
rowHeight = context?.getWeeklyViewItemHeight() ?: return
val oneDp = res.getDimension(R.dimen.one_dp).toInt()
val oneDp = res.getDimension(com.simplemobiletools.commons.R.dimen.one_dp).toInt()
val fullHeight = max(rowHeight.toInt() * 24, scrollView.height + oneDp)
scrollView.layoutParams.height = fullHeight - oneDp
binding.weekHorizontalGridHolder.layoutParams.height = fullHeight
@ -725,7 +725,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
currentTimeView = WeekNowMarkerBinding.inflate(layoutInflater).root.apply {
applyColorFilter(primaryColor)
binding.weekEventsHolder.addView(this, 0)
val extraWidth = res.getDimension(R.dimen.activity_margin).toInt()
val extraWidth = res.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin).toInt()
val markerHeight = res.getDimension(R.dimen.weekly_view_now_height).toInt()
val minuteHeight = rowHeight / 60
(layoutParams as RelativeLayout.LayoutParams).apply {

View file

@ -11,7 +11,6 @@ import android.widget.DatePicker
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.viewpager.widget.ViewPager
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.databinding.FragmentWeekHolderBinding
@ -162,7 +161,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
val month = Formatter.getShortMonthName(requireContext(), startDateTime.monthOfYear)
binding.weekViewMonthLabel.text = month
val weekNumber = startDateTime.plusDays(3).weekOfWeekyear
binding.weekViewWeekNumber.text = "${getString(R.string.week_number_short)} $weekNumber"
binding.weekViewWeekNumber.text = "${getString(com.simplemobiletools.commons.R.string.week_number_short)} $weekNumber"
}
override fun goToToday() {
@ -180,8 +179,8 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, dateTime.dayOfMonth, null)
activity?.getAlertDialogBuilder()!!
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
.apply {
activity?.setupDialogStuff(datePicker, this)
}
@ -219,7 +218,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
}
private fun updateDaysCount(cnt: Int) {
binding.weekViewDaysCount.text = requireContext().resources.getQuantityString(R.plurals.days, cnt, cnt)
binding.weekViewDaysCount.text = requireContext().resources.getQuantityString(com.simplemobiletools.commons.R.plurals.days, cnt, cnt)
}
override fun refreshEvents() {
@ -269,7 +268,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
binding.weekViewHolder.height - binding.weekViewSeekbar.height - binding.weekViewDaysCountDivider.height
override fun printView() {
val lightTextColor = resources.getColor(R.color.theme_light_text_color)
val lightTextColor = resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
binding.apply {
weekViewDaysCountDivider.beGone()
weekViewSeekbar.beGone()

View file

@ -6,7 +6,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.databinding.FragmentYearBinding
import com.simplemobiletools.calendar.pro.databinding.SmallMonthViewHolderBinding
@ -39,9 +38,19 @@ class YearFragment : Fragment(), YearlyCalendar {
private lateinit var topNavigationBinding: TopNavigationBinding
private lateinit var monthHolders: List<SmallMonthViewHolderBinding>
private val monthIds = arrayOf(
R.string.january, R.string.february, R.string.march, R.string.april, R.string.may, R.string.june,
R.string.july, R.string.august, R.string.september, R.string.october, R.string.november, R.string.december
private val monthResIds = arrayOf(
com.simplemobiletools.commons.R.string.january,
com.simplemobiletools.commons.R.string.february,
com.simplemobiletools.commons.R.string.march,
com.simplemobiletools.commons.R.string.april,
com.simplemobiletools.commons.R.string.may,
com.simplemobiletools.commons.R.string.june,
com.simplemobiletools.commons.R.string.july,
com.simplemobiletools.commons.R.string.august,
com.simplemobiletools.commons.R.string.september,
com.simplemobiletools.commons.R.string.october,
com.simplemobiletools.commons.R.string.november,
com.simplemobiletools.commons.R.string.december
)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
@ -52,7 +61,7 @@ class YearFragment : Fragment(), YearlyCalendar {
binding.month7Holder, binding.month8Holder, binding.month9Holder, binding.month10Holder, binding.month11Holder, binding.month12Holder
).apply {
forEachIndexed { index, it ->
it.monthLabel.text = getString(monthIds[index])
it.monthLabel.text = getString(monthResIds[index])
}
}
@ -90,7 +99,7 @@ class YearFragment : Fragment(), YearlyCalendar {
val monthOfYear = index + 1
val monthView = monthHolder.smallMonthView
val curTextColor = when {
isPrintVersion -> resources.getColor(R.color.theme_light_text_color)
isPrintVersion -> resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
else -> requireContext().getProperTextColor()
}
@ -118,7 +127,7 @@ class YearFragment : Fragment(), YearlyCalendar {
listener?.goLeft()
}
val pointerLeft = requireContext().getDrawable(R.drawable.ic_chevron_left_vector)
val pointerLeft = requireContext().getDrawable(com.simplemobiletools.commons.R.drawable.ic_chevron_left_vector)
pointerLeft?.isAutoMirrored = true
setImageDrawable(pointerLeft)
}
@ -130,7 +139,7 @@ class YearFragment : Fragment(), YearlyCalendar {
listener?.goRight()
}
val pointerRight = requireContext().getDrawable(R.drawable.ic_chevron_right_vector)
val pointerRight = requireContext().getDrawable(com.simplemobiletools.commons.R.drawable.ic_chevron_right_vector)
pointerRight?.isAutoMirrored = true
setImageDrawable(pointerRight)
}

View file

@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.DatePicker
import androidx.viewpager.widget.ViewPager
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.adapters.MyYearPagerAdapter
import com.simplemobiletools.calendar.pro.databinding.FragmentYearsHolderBinding
@ -109,8 +108,8 @@ class YearFragmentsHolder : MyFragmentHolder(), NavigationListener {
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
activity?.getAlertDialogBuilder()!!
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok) { _, _ -> datePicked(datePicker) }
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> datePicked(datePicker) }
.apply {
activity?.setupDialogStuff(datePicker, this)
}

View file

@ -387,7 +387,7 @@ class CalDAVHelper(val context: Context) {
try {
context.contentResolver.insert(Reminders.CONTENT_URI, contentValues)
} catch (e: Exception) {
context.toast(R.string.unknown_error_occurred)
context.toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
}
}
}
@ -407,7 +407,7 @@ class CalDAVHelper(val context: Context) {
try {
context.contentResolver.insert(Attendees.CONTENT_URI, contentValues)
} catch (e: Exception) {
context.toast(R.string.unknown_error_occurred)
context.toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
}
}
}

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.calendar.pro.helpers
import android.content.Context
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.seconds
import org.joda.time.DateTime
@ -108,9 +107,9 @@ object Formatter {
fun getUTCDateTimeFromTS(ts: Long) = DateTime(ts * 1000L, DateTimeZone.UTC)
// use manually translated month names, as DateFormat and Joda have issues with a lot of languages
fun getMonthName(context: Context, id: Int) = context.resources.getStringArray(R.array.months)[id - 1]
fun getMonthName(context: Context, id: Int) = context.resources.getStringArray(com.simplemobiletools.commons.R.array.months)[id - 1]
fun getShortMonthName(context: Context, id: Int) = context.resources.getStringArray(R.array.months_short)[id - 1]
fun getShortMonthName(context: Context, id: Int) = context.resources.getStringArray(com.simplemobiletools.commons.R.array.months_short)[id - 1]
fun getHourPattern(context: Context) = if (context.config.use24HourFormat) PATTERN_HOURS_24 else PATTERN_HOURS_12

View file

@ -43,7 +43,7 @@ class IcsExporter(private val context: Context) {
ensureBackgroundThread {
calendars = context.calDAVHelper.getCalDAVCalendars("", false)
if (showExportingToast) {
context.toast(R.string.exporting)
context.toast(com.simplemobiletools.commons.R.string.exporting)
}
object : BufferedWriter(OutputStreamWriter(outputStream, Charsets.UTF_8)) {

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.calendar.pro.helpers
import android.provider.CalendarContract.Events
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.extensions.eventsDB
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
@ -117,7 +116,7 @@ class IcsImporter(val activity: SimpleActivity) {
} else if (line.startsWith(DESCRIPTION) && !isNotificationDescription) {
val match = DESCRIPTION_REGEX.matchEntire(line)
if (match != null) {
curDescription = match.groups[1]!!.value.replace("\\n", "\n").replace("\\,", ",") ?: ""
curDescription = match.groups[1]!!.value.replace("\\n", "\n").replace("\\,", ",")
}
if (curDescription.trim().isEmpty()) {
curDescription = ""
@ -330,6 +329,7 @@ class IcsImporter(val activity: SimpleActivity) {
IMPORT_FAIL
}
}
eventsFailed > 0 -> IMPORT_PARTIAL
else -> IMPORT_OK
}
@ -348,6 +348,7 @@ class IcsImporter(val activity: SimpleActivity) {
Parser().parseDateTimeValue(value)
}
fullString.startsWith(":") -> Parser().parseDateTimeValue(fullString.substring(1).trim())
else -> Parser().parseDateTimeValue(fullString)
}
@ -375,7 +376,12 @@ class IcsImporter(val activity: SimpleActivity) {
val eventId = eventsHelper.getEventTypeIdWithTitle(eventTypeTitle)
curEventTypeId = if (eventId == -1L) {
val newTypeColor = if (curCategoryColor == -2) activity.resources.getColor(R.color.color_primary) else curCategoryColor
val newTypeColor = if (curCategoryColor == -2) {
activity.resources.getColor(com.simplemobiletools.commons.R.color.color_primary)
} else {
curCategoryColor
}
val eventType = EventType(null, eventTypeTitle, newTypeColor)
eventsHelper.insertOrUpdateEventTypeSync(eventType)
} else {

View file

@ -49,7 +49,12 @@ class MyWidgetListProvider : AppWidgetProvider() {
setTextSize(R.id.widget_event_list_today, fontSize)
}
views.setImageViewBitmap(R.id.widget_event_new_event, context.resources.getColoredBitmap(R.drawable.ic_plus_vector, textColor))
views.setImageViewBitmap(
R.id.widget_event_new_event, context.resources.getColoredBitmap(
resourceId = com.simplemobiletools.commons.R.drawable.ic_plus_vector,
newColor = textColor
)
)
setupIntent(context, views, NEW_EVENT, R.id.widget_event_new_event)
setupIntent(context, views, LAUNCH_CAL, R.id.widget_event_list_today)

View file

@ -199,16 +199,16 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
views.setTextColor(R.id.top_value, textColor)
views.setTextSize(R.id.top_value, largerFontSize)
var bmp = resources.getColoredBitmap(R.drawable.ic_chevron_left_vector, textColor)
var bmp = resources.getColoredBitmap(com.simplemobiletools.commons.R.drawable.ic_chevron_left_vector, textColor)
views.setImageViewBitmap(R.id.top_left_arrow, bmp)
bmp = resources.getColoredBitmap(R.drawable.ic_chevron_right_vector, textColor)
bmp = resources.getColoredBitmap(com.simplemobiletools.commons.R.drawable.ic_chevron_right_vector, textColor)
views.setImageViewBitmap(R.id.top_right_arrow, bmp)
bmp = resources.getColoredBitmap(R.drawable.ic_today_vector, textColor)
views.setImageViewBitmap(R.id.top_go_to_today, bmp)
bmp = resources.getColoredBitmap(R.drawable.ic_plus_vector, textColor)
bmp = resources.getColoredBitmap(com.simplemobiletools.commons.R.drawable.ic_plus_vector, textColor)
views.setImageViewBitmap(R.id.top_new_event, bmp)
val shouldGoToTodayBeVisible = currTargetDate.withTime(0, 0, 0, 0) != DateTime.now().withDayOfMonth(1).withTime(0, 0, 0, 0)
@ -238,7 +238,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
val firstDayOfWeek = config.firstDayOfWeek
val smallerFontSize = context.getWidgetFontSize()
val packageName = context.packageName
val letters = context.resources.getStringArray(R.array.week_day_letters)
val letters = context.resources.getStringArray(com.simplemobiletools.commons.R.array.week_day_letters)
for (i in 0..6) {
val id = resources.getIdentifier("label_$i", "id", packageName)

View file

@ -70,7 +70,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
highlightWeekends = config.highlightWeekends
smallPadding = resources.displayMetrics.density.toInt()
val normalTextSize = resources.getDimensionPixelSize(R.dimen.normal_text_size)
val normalTextSize = resources.getDimensionPixelSize(com.simplemobiletools.commons.R.dimen.normal_text_size)
weekDaysLetterHeight = normalTextSize * 2
textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
@ -89,7 +89,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
color = primaryColor
}
val smallerTextSize = resources.getDimensionPixelSize(R.dimen.smaller_text_size)
val smallerTextSize = resources.getDimensionPixelSize(com.simplemobiletools.commons.R.dimen.smaller_text_size)
eventTitleHeight = smallerTextSize
eventTitlePaint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply {
color = textColor
@ -391,7 +391,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
}
private fun initWeekDayLetters() {
dayLetters = context.withFirstDayOfWeekToFront(context.resources.getStringArray(R.array.week_day_letters).toList())
dayLetters = context.withFirstDayOfWeekToFront(context.resources.getStringArray(com.simplemobiletools.commons.R.array.week_day_letters).toList())
}
private fun setupCurrentDayOfWeekIndex() {
@ -430,7 +430,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
fun togglePrintMode() {
isPrintVersion = !isPrintVersion
textColor = if (isPrintVersion) {
resources.getColor(R.color.theme_light_text_color)
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
} else {
context.getProperTextColor()
}

View file

@ -4,7 +4,6 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.databinding.MonthViewBackgroundBinding
import com.simplemobiletools.calendar.pro.databinding.MonthViewBinding
import com.simplemobiletools.calendar.pro.extensions.config
@ -29,7 +28,7 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0)
init {
val normalTextSize = resources.getDimensionPixelSize(R.dimen.normal_text_size).toFloat()
val normalTextSize = resources.getDimensionPixelSize(com.simplemobiletools.commons.R.dimen.normal_text_size).toFloat()
weekDaysLetterHeight = 2 * normalTextSize.toInt()
inflater = LayoutInflater.from(context)
@ -99,7 +98,11 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F
}
private fun setupHorizontalOffset() {
horizontalOffset = if (context.config.showWeekNumbers) resources.getDimensionPixelSize(R.dimen.smaller_text_size) * 2 else 0
horizontalOffset = if (context.config.showWeekNumbers) {
resources.getDimensionPixelSize(com.simplemobiletools.commons.R.dimen.smaller_text_size) * 2
} else {
0
}
}
private fun measureSizes() {

View file

@ -117,7 +117,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
fun togglePrintMode() {
isPrintVersion = !isPrintVersion
textColor = if (isPrintVersion) {
resources.getColor(R.color.theme_light_text_color)
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
} else {
context.getProperTextColor().adjustAlpha(MEDIUM_ALPHA)
}

View file

@ -5,7 +5,6 @@ import android.graphics.Canvas
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.getWeeklyViewItemHeight
@ -17,7 +16,7 @@ class WeeklyViewGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0)
init {
paint.color = context.resources.getColor(R.color.divider_grey)
paint.color = context.resources.getColor(com.simplemobiletools.commons.R.color.divider_grey)
}
override fun onDraw(canvas: Canvas) {

View file

@ -1,4 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
android.nonTransitiveRClass=false
org.gradle.jvmargs=-Xmx8192m