Migrate to non-transitive R class
This commit is contained in:
parent
a408323236
commit
e2ae8afe10
51 changed files with 271 additions and 217 deletions
|
@ -129,7 +129,13 @@ class EventActivity : SimpleActivity() {
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isEventChanged()) {
|
if (System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isEventChanged()) {
|
||||||
mLastSavePromptTS = System.currentTimeMillis()
|
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) {
|
if (it) {
|
||||||
saveCurrentEvent()
|
saveCurrentEvent()
|
||||||
} else {
|
} else {
|
||||||
|
@ -779,7 +785,7 @@ class EventActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun getRepeatXthDayInMonthString(includeBase: Boolean, repeatRule: Int): String {
|
private fun getRepeatXthDayInMonthString(includeBase: Boolean, repeatRule: Int): String {
|
||||||
val weekDayString = getRepeatXthDayString(includeBase, repeatRule)
|
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"
|
return "$weekDayString $monthString"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,7 +800,11 @@ class EventActivity : SimpleActivity() {
|
||||||
private fun checkRepetitionRuleText() {
|
private fun checkRepetitionRuleText() {
|
||||||
when {
|
when {
|
||||||
mRepeatInterval.isXWeeklyRepetition() -> {
|
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() -> {
|
mRepeatInterval.isXMonthlyRepetition() -> {
|
||||||
|
@ -934,8 +944,8 @@ class EventActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun showReminderTypePicker(currentValue: Int, callback: (Int) -> Unit) {
|
private fun showReminderTypePicker(currentValue: Int, callback: (Int) -> Unit) {
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(REMINDER_NOTIFICATION, getString(R.string.notification)),
|
RadioItem(REMINDER_NOTIFICATION, getString(com.simplemobiletools.commons.R.string.notification)),
|
||||||
RadioItem(REMINDER_EMAIL, getString(R.string.email))
|
RadioItem(REMINDER_EMAIL, getString(com.simplemobiletools.commons.R.string.email))
|
||||||
)
|
)
|
||||||
RadioGroupDialog(this, items, currentValue) {
|
RadioGroupDialog(this, items, currentValue) {
|
||||||
callback(it as Int)
|
callback(it as Int)
|
||||||
|
@ -970,7 +980,12 @@ class EventActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun updateReminderTypeImage(view: ImageView, reminder: Reminder) {
|
private fun updateReminderTypeImage(view: ImageView, reminder: Reminder) {
|
||||||
view.beVisibleIf(reminder.minutes != REMINDER_OFF && mEventCalendarId != STORED_LOCALLY_ONLY)
|
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())
|
val icon = resources.getColoredDrawableWithColor(drawable, getProperTextColor())
|
||||||
view.setImageDrawable(icon)
|
view.setImageDrawable(icon)
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1061,7 @@ class EventActivity : SimpleActivity() {
|
||||||
|
|
||||||
if (currentCalendar == null) {
|
if (currentCalendar == null) {
|
||||||
mEventCalendarId = STORED_LOCALLY_ONLY
|
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 {
|
eventCaldavCalendarName.apply {
|
||||||
text = getString(R.string.store_locally_only)
|
text = getString(R.string.store_locally_only)
|
||||||
setPadding(paddingLeft, paddingTop, paddingRight, mediumMargin)
|
setPadding(paddingLeft, paddingTop, paddingRight, mediumMargin)
|
||||||
|
@ -1082,7 +1097,7 @@ class EventActivity : SimpleActivity() {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
eventCaldavCalendarName.apply {
|
eventCaldavCalendarName.apply {
|
||||||
text = currentCalendar.displayName
|
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 {
|
eventCaldavCalendarHolder.apply {
|
||||||
|
@ -1320,7 +1335,7 @@ class EventActivity : SimpleActivity() {
|
||||||
storeEvent(wasRepeatable)
|
storeEvent(wasRepeatable)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
|
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -159,7 +159,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
addBirthdaysAnniversariesAtStart()
|
addBirthdaysAnniversariesAtStart()
|
||||||
|
|
||||||
if (isPackageInstalled("com.simplemobiletools.calendar")) {
|
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 {
|
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_today).isVisible = shouldGoToTodayBeVisible && !binding.mainMenu.isSearchOpen
|
||||||
findItem(R.id.go_to_date).isVisible = config.storedView != EVENTS_LIST_VIEW
|
findItem(R.id.go_to_date).isVisible = config.storedView != EVENTS_LIST_VIEW
|
||||||
findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync
|
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() {
|
private fun resetActionBarTitle() {
|
||||||
binding.mainMenu.updateHintText(getString(R.string.search))
|
binding.mainMenu.updateHintText(getString(com.simplemobiletools.commons.R.string.search))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showFilterDialog() {
|
private fun showFilterDialog() {
|
||||||
|
@ -585,7 +592,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
RadioGroupDialog(this, items) { selectedHoliday ->
|
RadioGroupDialog(this, items) { selectedHoliday ->
|
||||||
SetRemindersDialog(this, OTHER_EVENT) {
|
SetRemindersDialog(this, OTHER_EVENT) {
|
||||||
val reminders = it
|
val reminders = it
|
||||||
toast(R.string.importing)
|
toast(com.simplemobiletools.commons.R.string.importing)
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val holidays = getString(R.string.holidays)
|
val holidays = getString(R.string.holidays)
|
||||||
var eventTypeId = eventsHelper.getEventTypeIdWithClass(HOLIDAY_EVENT)
|
var eventTypeId = eventsHelper.getEventTypeIdWithClass(HOLIDAY_EVENT)
|
||||||
|
@ -631,7 +638,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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 {
|
} 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) {
|
private fun handleParseResult(result: ImportResult) {
|
||||||
toast(
|
toast(
|
||||||
when (result) {
|
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_OK -> R.string.holidays_imported_successfully
|
||||||
ImportResult.IMPORT_PARTIAL -> R.string.importing_some_holidays_failed
|
ImportResult.IMPORT_PARTIAL -> R.string.importing_some_holidays_failed
|
||||||
else -> R.string.importing_holidays_failed
|
else -> R.string.importing_holidays_failed
|
||||||
|
@ -964,7 +971,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
|
|
||||||
private fun animateFabIcon(showPlus: Boolean) {
|
private fun animateFabIcon(showPlus: Boolean) {
|
||||||
val newDrawableId = if (showPlus) {
|
val newDrawableId = if (showPlus) {
|
||||||
R.drawable.ic_plus_vector
|
com.simplemobiletools.commons.R.drawable.ic_plus_vector
|
||||||
} else {
|
} else {
|
||||||
R.drawable.ic_today_vector
|
R.drawable.ic_today_vector
|
||||||
}
|
}
|
||||||
|
@ -1071,13 +1078,13 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
try {
|
try {
|
||||||
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
|
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} 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) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
|
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1101,7 +1108,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
"content" -> {
|
"content" -> {
|
||||||
val tempFile = getTempFile()
|
val tempFile = getTempFile()
|
||||||
if (tempFile == null) {
|
if (tempFile == null) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
return
|
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 {
|
try {
|
||||||
startActivityForResult(this, PICK_EXPORT_FILE_INTENT)
|
startActivityForResult(this, PICK_EXPORT_FILE_INTENT)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} 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) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
|
@ -1167,14 +1174,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val events = eventsHelper.getEventsToExport(eventTypes, config.exportEvents, config.exportTasks, config.exportPastEntries)
|
val events = eventsHelper.getEventsToExport(eventTypes, config.exportEvents, config.exportTasks, config.exportPastEntries)
|
||||||
if (events.isEmpty()) {
|
if (events.isEmpty()) {
|
||||||
toast(R.string.no_entries_for_exporting)
|
toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
|
||||||
} else {
|
} else {
|
||||||
IcsExporter(this).exportEvents(outputStream, events, true) { result ->
|
IcsExporter(this).exportEvents(outputStream, events, true) { result ->
|
||||||
toast(
|
toast(
|
||||||
when (result) {
|
when (result) {
|
||||||
ExportResult.EXPORT_OK -> R.string.exporting_successful
|
ExportResult.EXPORT_OK -> com.simplemobiletools.commons.R.string.exporting_successful
|
||||||
ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed
|
ExportResult.EXPORT_PARTIAL -> com.simplemobiletools.commons.R.string.exporting_some_entries_failed
|
||||||
else -> R.string.exporting_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_3_title, R.string.faq_3_text),
|
||||||
FAQItem(R.string.faq_6_title, R.string.faq_6_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, R.string.faq_1_text),
|
||||||
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
|
FAQItem(com.simplemobiletools.commons.R.string.faq_1_title_commons, com.simplemobiletools.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_4_title_commons, com.simplemobiletools.commons.R.string.faq_4_text_commons),
|
||||||
FAQItem(R.string.faq_4_title, R.string.faq_4_text)
|
FAQItem(R.string.faq_4_title, R.string.faq_4_text)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!resources.getBoolean(R.bool.hide_google_relations)) {
|
if (!resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations)) {
|
||||||
faqItems.add(FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons))
|
faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_2_title_commons, com.simplemobiletools.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(com.simplemobiletools.commons.R.string.faq_6_title_commons, com.simplemobiletools.commons.R.string.faq_6_text_commons))
|
||||||
faqItems.add(FAQItem(R.string.faq_7_title_commons, R.string.faq_7_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)
|
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()) {
|
val placeholderTextId = if (config.displayEventTypes.isEmpty()) {
|
||||||
R.string.everything_filtered_out
|
R.string.everything_filtered_out
|
||||||
} else {
|
} else {
|
||||||
R.string.no_items_found
|
com.simplemobiletools.commons.R.string.no_items_found
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.searchPlaceholder.setText(placeholderTextId)
|
binding.searchPlaceholder.setText(placeholderTextId)
|
||||||
|
|
|
@ -348,13 +348,13 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupStartWeekOn() = binding.apply {
|
private fun setupStartWeekOn() = binding.apply {
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(DateTimeConstants.SUNDAY, getString(R.string.sunday)),
|
RadioItem(DateTimeConstants.SUNDAY, getString(com.simplemobiletools.commons.R.string.sunday)),
|
||||||
RadioItem(DateTimeConstants.MONDAY, getString(R.string.monday)),
|
RadioItem(DateTimeConstants.MONDAY, getString(com.simplemobiletools.commons.R.string.monday)),
|
||||||
RadioItem(DateTimeConstants.TUESDAY, getString(R.string.tuesday)),
|
RadioItem(DateTimeConstants.TUESDAY, getString(com.simplemobiletools.commons.R.string.tuesday)),
|
||||||
RadioItem(DateTimeConstants.WEDNESDAY, getString(R.string.wednesday)),
|
RadioItem(DateTimeConstants.WEDNESDAY, getString(com.simplemobiletools.commons.R.string.wednesday)),
|
||||||
RadioItem(DateTimeConstants.THURSDAY, getString(R.string.thursday)),
|
RadioItem(DateTimeConstants.THURSDAY, getString(com.simplemobiletools.commons.R.string.thursday)),
|
||||||
RadioItem(DateTimeConstants.FRIDAY, getString(R.string.friday)),
|
RadioItem(DateTimeConstants.FRIDAY, getString(com.simplemobiletools.commons.R.string.friday)),
|
||||||
RadioItem(DateTimeConstants.SATURDAY, getString(R.string.saturday)),
|
RadioItem(DateTimeConstants.SATURDAY, getString(com.simplemobiletools.commons.R.string.saturday)),
|
||||||
)
|
)
|
||||||
|
|
||||||
settingsStartWeekOn.text = getDayOfWeekString(config.firstDayOfWeek)
|
settingsStartWeekOn.text = getDayOfWeekString(config.firstDayOfWeek)
|
||||||
|
@ -642,7 +642,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun getDisplayPastEventsText(displayPastEvents: Int): String {
|
private fun getDisplayPastEventsText(displayPastEvents: Int): String {
|
||||||
return if (displayPastEvents == 0) {
|
return if (displayPastEvents == 0) {
|
||||||
getString(R.string.never)
|
getString(com.simplemobiletools.commons.R.string.never)
|
||||||
} else {
|
} else {
|
||||||
getFormattedMinutes(displayPastEvents, false)
|
getFormattedMinutes(displayPastEvents, false)
|
||||||
}
|
}
|
||||||
|
@ -652,10 +652,10 @@ class SettingsActivity : SimpleActivity() {
|
||||||
settingsFontSize.text = getFontSizeText()
|
settingsFontSize.text = getFontSizeText()
|
||||||
settingsFontSizeHolder.setOnClickListener {
|
settingsFontSizeHolder.setOnClickListener {
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(FONT_SIZE_SMALL, getString(R.string.small)),
|
RadioItem(FONT_SIZE_SMALL, getString(com.simplemobiletools.commons.R.string.small)),
|
||||||
RadioItem(FONT_SIZE_MEDIUM, getString(R.string.medium)),
|
RadioItem(FONT_SIZE_MEDIUM, getString(com.simplemobiletools.commons.R.string.medium)),
|
||||||
RadioItem(FONT_SIZE_LARGE, getString(R.string.large)),
|
RadioItem(FONT_SIZE_LARGE, getString(com.simplemobiletools.commons.R.string.large)),
|
||||||
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large))
|
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(com.simplemobiletools.commons.R.string.extra_large))
|
||||||
)
|
)
|
||||||
|
|
||||||
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
|
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
|
||||||
|
@ -820,7 +820,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
private fun updateDefaultDurationText() {
|
private fun updateDefaultDurationText() {
|
||||||
val duration = config.defaultDuration
|
val duration = config.defaultDuration
|
||||||
binding.settingsDefaultDuration.text = if (duration == 0) {
|
binding.settingsDefaultDuration.text = if (duration == 0) {
|
||||||
"0 ${getString(R.string.minutes_raw)}"
|
"0 ${getString(com.simplemobiletools.commons.R.string.minutes_raw)}"
|
||||||
} else {
|
} else {
|
||||||
getFormattedMinutes(duration, false)
|
getFormattedMinutes(duration, false)
|
||||||
}
|
}
|
||||||
|
@ -961,7 +961,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
try {
|
try {
|
||||||
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
|
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} 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) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun parseFile(inputStream: InputStream?) {
|
private fun parseFile(inputStream: InputStream?) {
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,7 +1060,12 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
runOnUiThread {
|
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)
|
toast(msg)
|
||||||
|
|
||||||
setupSettingItems()
|
setupSettingItems()
|
||||||
|
|
|
@ -80,12 +80,17 @@ open class SimpleActivity : BaseSimpleActivity() {
|
||||||
if (NotificationManagerCompat.from(this).areNotificationsEnabled()) {
|
if (NotificationManagerCompat.from(this).areNotificationsEnabled()) {
|
||||||
callback()
|
callback()
|
||||||
} else {
|
} 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()
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
|
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,13 @@ class TaskActivity : SimpleActivity() {
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isTaskChanged()) {
|
if (System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isTaskChanged()) {
|
||||||
mLastSavePromptTS = System.currentTimeMillis()
|
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) {
|
if (it) {
|
||||||
saveCurrentTask()
|
saveCurrentTask()
|
||||||
} else {
|
} else {
|
||||||
|
@ -437,7 +443,7 @@ class TaskActivity : SimpleActivity() {
|
||||||
storeTask(wasRepeatable)
|
storeTask(wasRepeatable)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
|
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_reminders, { openNotificationSettings() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -647,7 +653,7 @@ class TaskActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun updateTaskCompletedButton() {
|
private fun updateTaskCompletedButton() {
|
||||||
if (mTaskCompleted) {
|
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.setText(R.string.mark_incomplete)
|
||||||
binding.toggleMarkComplete.setTextColor(getProperTextColor())
|
binding.toggleMarkComplete.setTextColor(getProperTextColor())
|
||||||
} else {
|
} else {
|
||||||
|
@ -983,7 +989,7 @@ class TaskActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun getRepeatXthDayInMonthString(includeBase: Boolean, repeatRule: Int): String {
|
private fun getRepeatXthDayInMonthString(includeBase: Boolean, repeatRule: Int): String {
|
||||||
val weekDayString = getRepeatXthDayString(includeBase, repeatRule)
|
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"
|
return "$weekDayString $monthString"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -998,7 +1004,11 @@ class TaskActivity : SimpleActivity() {
|
||||||
private fun checkRepetitionRuleText() {
|
private fun checkRepetitionRuleText() {
|
||||||
when {
|
when {
|
||||||
mRepeatInterval.isXWeeklyRepetition() -> {
|
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() -> {
|
mRepeatInterval.isXMonthlyRepetition() -> {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Intent
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.databinding.WidgetConfigDateBinding
|
import com.simplemobiletools.calendar.pro.databinding.WidgetConfigDateBinding
|
||||||
import com.simplemobiletools.calendar.pro.extensions.config
|
import com.simplemobiletools.calendar.pro.extensions.config
|
||||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||||
|
@ -65,8 +64,8 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
||||||
updateBackgroundColor()
|
updateBackgroundColor()
|
||||||
|
|
||||||
mTextColor = config.widgetTextColor
|
mTextColor = config.widgetTextColor
|
||||||
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
if (mTextColor == resources.getColor(com.simplemobiletools.commons.R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
||||||
mTextColor = resources.getColor(R.color.you_primary_color, theme)
|
mTextColor = resources.getColor(com.simplemobiletools.commons.R.color.you_primary_color, theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTextColor()
|
updateTextColor()
|
||||||
|
|
|
@ -92,8 +92,8 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||||
updateBackgroundColor()
|
updateBackgroundColor()
|
||||||
|
|
||||||
mTextColor = config.widgetTextColor
|
mTextColor = config.widgetTextColor
|
||||||
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
if (mTextColor == resources.getColor(com.simplemobiletools.commons.R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
||||||
mTextColor = resources.getColor(R.color.you_primary_color, theme)
|
mTextColor = resources.getColor(com.simplemobiletools.commons.R.color.you_primary_color, theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTextColor()
|
updateTextColor()
|
||||||
|
|
|
@ -11,7 +11,6 @@ import android.os.Bundle
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.databinding.DayMonthlyNumberViewBinding
|
import com.simplemobiletools.calendar.pro.databinding.DayMonthlyNumberViewBinding
|
||||||
import com.simplemobiletools.calendar.pro.databinding.TopNavigationBinding
|
import com.simplemobiletools.calendar.pro.databinding.TopNavigationBinding
|
||||||
import com.simplemobiletools.calendar.pro.databinding.WidgetConfigMonthlyBinding
|
import com.simplemobiletools.calendar.pro.databinding.WidgetConfigMonthlyBinding
|
||||||
|
@ -79,8 +78,8 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
||||||
updateBackgroundColor()
|
updateBackgroundColor()
|
||||||
|
|
||||||
mTextColor = config.widgetTextColor
|
mTextColor = config.widgetTextColor
|
||||||
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
if (mTextColor == resources.getColor(com.simplemobiletools.commons.R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
||||||
mTextColor = resources.getColor(R.color.you_primary_color, theme)
|
mTextColor = resources.getColor(com.simplemobiletools.commons.R.color.you_primary_color, theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTextColor()
|
updateTextColor()
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.view.ViewGroup
|
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.databinding.CheckableColorButtonBinding
|
import com.simplemobiletools.calendar.pro.databinding.CheckableColorButtonBinding
|
||||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ class CheckableColorAdapter(private val activity: Activity, private val colors:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checked) {
|
if (checked) {
|
||||||
setImageResource(R.drawable.ic_check_vector)
|
setImageResource(com.simplemobiletools.commons.R.drawable.ic_check_vector)
|
||||||
applyColorFilter(Color.WHITE)
|
applyColorFilter(Color.WHITE)
|
||||||
} else {
|
} else {
|
||||||
setImageDrawable(null)
|
setImageDrawable(null)
|
||||||
|
|
|
@ -29,7 +29,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
||||||
private val dimPastEvents = activity.config.dimPastEvents
|
private val dimPastEvents = activity.config.dimPastEvents
|
||||||
private val dimCompletedTasks = activity.config.dimCompletedTasks
|
private val dimCompletedTasks = activity.config.dimCompletedTasks
|
||||||
private var isPrintVersion = false
|
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 {
|
init {
|
||||||
setupDragListener(true)
|
setupDragListener(true)
|
||||||
|
@ -77,7 +77,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
||||||
fun togglePrintMode() {
|
fun togglePrintMode() {
|
||||||
isPrintVersion = !isPrintVersion
|
isPrintVersion = !isPrintVersion
|
||||||
textColor = if (isPrintVersion) {
|
textColor = if (isPrintVersion) {
|
||||||
resources.getColor(R.color.theme_light_text_color)
|
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
|
||||||
} else {
|
} else {
|
||||||
activity.getProperTextColor()
|
activity.getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class EventListAdapter(
|
||||||
private var use24HourFormat = activity.config.use24HourFormat
|
private var use24HourFormat = activity.config.use24HourFormat
|
||||||
private var currentItemsHash = listItems.hashCode()
|
private var currentItemsHash = listItems.hashCode()
|
||||||
private var isPrintVersion = false
|
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 {
|
init {
|
||||||
setupDragListener(true)
|
setupDragListener(true)
|
||||||
|
@ -124,7 +124,7 @@ class EventListAdapter(
|
||||||
fun togglePrintMode() {
|
fun togglePrintMode() {
|
||||||
isPrintVersion = !isPrintVersion
|
isPrintVersion = !isPrintVersion
|
||||||
textColor = if (isPrintVersion) {
|
textColor = if (isPrintVersion) {
|
||||||
resources.getColor(R.color.theme_light_text_color)
|
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
|
||||||
} else {
|
} else {
|
||||||
activity.getProperTextColor()
|
activity.getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
|
||||||
private var dimPastEvents = context.config.dimPastEvents
|
private var dimPastEvents = context.config.dimPastEvents
|
||||||
private var dimCompletedTasks = context.config.dimCompletedTasks
|
private var dimCompletedTasks = context.config.dimCompletedTasks
|
||||||
private var mediumFontSize = context.getWidgetFontSize()
|
private var mediumFontSize = context.getWidgetFontSize()
|
||||||
private var smallMargin = context.resources.getDimension(R.dimen.small_margin).toInt()
|
private var smallMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.small_margin).toInt()
|
||||||
private var normalMargin = context.resources.getDimension(R.dimen.normal_margin).toInt()
|
private var normalMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.normal_margin).toInt()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initConfigValues()
|
initConfigValues()
|
||||||
|
|
|
@ -18,8 +18,8 @@ class CustomEventRepeatIntervalDialog(val activity: Activity, val callback: (sec
|
||||||
binding.dialogRadioView.check(R.id.dialog_radio_days)
|
binding.dialogRadioView.check(R.id.dialog_radio_days)
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> confirmRepeatInterval() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmRepeatInterval() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
||||||
dialog = alertDialog
|
dialog = alertDialog
|
||||||
|
|
|
@ -17,8 +17,8 @@ class CustomPeriodPickerDialog(val activity: Activity, val callback: (value: Int
|
||||||
binding.dialogCustomPeriodValue.setText("")
|
binding.dialogCustomPeriodValue.setText("")
|
||||||
binding.dialogRadioView.check(R.id.dialog_radio_days)
|
binding.dialogRadioView.check(R.id.dialog_radio_days)
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> confirmReminder() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmReminder() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
||||||
dialog = alertDialog
|
dialog = alertDialog
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.simplemobiletools.calendar.pro.dialogs
|
package com.simplemobiletools.calendar.pro.dialogs
|
||||||
|
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.databinding.DatetimePatternInfoLayoutBinding
|
import com.simplemobiletools.calendar.pro.databinding.DatetimePatternInfoLayoutBinding
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||||
|
@ -12,7 +11,7 @@ class DateTimePatternInfoDialog(activity: BaseSimpleActivity) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> { } }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> { } }
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this)
|
activity.setupDialogStuff(binding.root, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ class DeleteEventDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.yes) { _, _ -> dialogConfirmed(binding) }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.yes) { _, _ -> dialogConfirmed(binding) }
|
||||||
.setNegativeButton(R.string.no, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.no, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
||||||
dialog = alertDialog
|
dialog = alertDialog
|
||||||
|
|
|
@ -45,8 +45,8 @@ class EditEventTypeDialog(val activity: Activity, var eventType: EventType? = nu
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, if (isNewEvent) R.string.add_new_type else R.string.edit_type) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this, if (isNewEvent) R.string.add_new_type else R.string.edit_type) { alertDialog ->
|
||||||
alertDialog.showKeyboard(binding.typeTitle)
|
alertDialog.showKeyboard(binding.typeTitle)
|
||||||
|
|
|
@ -63,25 +63,25 @@ class ExportEventsDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.export_events) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this, R.string.export_events) { alertDialog ->
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||||
val filename = binding.exportEventsFilename.value
|
val filename = binding.exportEventsFilename.value
|
||||||
when {
|
when {
|
||||||
filename.isEmpty() -> activity.toast(R.string.empty_name)
|
filename.isEmpty() -> activity.toast(com.simplemobiletools.commons.R.string.empty_name)
|
||||||
filename.isAValidFilename() -> {
|
filename.isAValidFilename() -> {
|
||||||
val file = File(realPath, "$filename.ics")
|
val file = File(realPath, "$filename.ics")
|
||||||
if (!hidePath && file.exists()) {
|
if (!hidePath && file.exists()) {
|
||||||
activity.toast(R.string.name_taken)
|
activity.toast(com.simplemobiletools.commons.R.string.name_taken)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
val exportEventsChecked = binding.exportEventsCheckbox.isChecked
|
val exportEventsChecked = binding.exportEventsCheckbox.isChecked
|
||||||
val exportTasksChecked = binding.exportTasksCheckbox.isChecked
|
val exportTasksChecked = binding.exportTasksCheckbox.isChecked
|
||||||
if (!exportEventsChecked && !exportTasksChecked) {
|
if (!exportEventsChecked && !exportTasksChecked) {
|
||||||
activity.toast(R.string.no_entries_for_exporting)
|
activity.toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
|
||||||
return@setOnClickListener
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,13 +76,13 @@ class ImportEventsDialog(val activity: SimpleActivity, val path: String, val cal
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.import_events) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this, R.string.import_events) { alertDialog ->
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(null)
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(null)
|
||||||
activity.toast(R.string.importing)
|
activity.toast(com.simplemobiletools.commons.R.string.importing)
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val overrideFileEventTypes = binding.importEventsCheckbox.isChecked
|
val overrideFileEventTypes = binding.importEventsCheckbox.isChecked
|
||||||
val result = IcsImporter(activity).importEvents(path, currEventTypeId, currEventTypeCalDAVCalendarId, overrideFileEventTypes)
|
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) {
|
private fun handleParseResult(result: IcsImporter.ImportResult) {
|
||||||
activity.toast(
|
activity.toast(
|
||||||
when (result) {
|
when (result) {
|
||||||
IMPORT_NOTHING_NEW -> R.string.no_new_items
|
IMPORT_NOTHING_NEW -> com.simplemobiletools.commons.R.string.no_new_items
|
||||||
IMPORT_OK -> R.string.importing_successful
|
IMPORT_OK -> com.simplemobiletools.commons.R.string.importing_successful
|
||||||
IMPORT_PARTIAL -> R.string.importing_some_entries_failed
|
IMPORT_PARTIAL -> com.simplemobiletools.commons.R.string.importing_some_entries_failed
|
||||||
else -> R.string.no_items_found
|
else -> com.simplemobiletools.commons.R.string.no_items_found
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
callback(result != IMPORT_FAIL)
|
callback(result != IMPORT_FAIL)
|
||||||
|
|
|
@ -59,25 +59,25 @@ class ManageAutomaticBackupsDialog(private val activity: SimpleActivity, onSucce
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.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 {
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||||
val filename = binding.backupEventsFilename.value
|
val filename = binding.backupEventsFilename.value
|
||||||
when {
|
when {
|
||||||
filename.isEmpty() -> activity.toast(R.string.empty_name)
|
filename.isEmpty() -> activity.toast(com.simplemobiletools.commons.R.string.empty_name)
|
||||||
filename.isAValidFilename() -> {
|
filename.isAValidFilename() -> {
|
||||||
val file = File(backupFolder, "$filename.ics")
|
val file = File(backupFolder, "$filename.ics")
|
||||||
if (file.exists() && !file.canWrite()) {
|
if (file.exists() && !file.canWrite()) {
|
||||||
activity.toast(R.string.name_taken)
|
activity.toast(com.simplemobiletools.commons.R.string.name_taken)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
val backupEventsChecked = binding.backupEventsCheckbox.isChecked
|
val backupEventsChecked = binding.backupEventsCheckbox.isChecked
|
||||||
val backupTasksChecked = binding.backupTasksCheckbox.isChecked
|
val backupTasksChecked = binding.backupTasksCheckbox.isChecked
|
||||||
if (!backupEventsChecked && !backupTasksChecked || selectedEventTypes.isEmpty()) {
|
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
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.databinding.DialogReminderWarningBinding
|
import com.simplemobiletools.calendar.pro.databinding.DialogReminderWarningBinding
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
|
|
||||||
|
@ -15,10 +14,10 @@ class ReminderWarningDialog(val activity: Activity, val callback: () -> Unit) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dialogConfirmed() }
|
||||||
.setNeutralButton(R.string.settings, null)
|
.setNeutralButton(com.simplemobiletools.commons.R.string.settings, null)
|
||||||
.apply {
|
.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 {
|
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener {
|
||||||
redirectToSettings()
|
redirectToSettings()
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ class RepeatLimitTypePickerDialog(val activity: Activity, var repeatLimit: Long,
|
||||||
updateRepeatLimitText()
|
updateRepeatLimitText()
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> confirmRepetition() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmRepetition() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
||||||
dialog = alertDialog
|
dialog = alertDialog
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simplemobiletools.calendar.pro.dialogs
|
package com.simplemobiletools.calendar.pro.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.databinding.DialogVerticalLinearLayoutBinding
|
import com.simplemobiletools.calendar.pro.databinding.DialogVerticalLinearLayoutBinding
|
||||||
import com.simplemobiletools.calendar.pro.databinding.MyCheckboxBinding
|
import com.simplemobiletools.calendar.pro.databinding.MyCheckboxBinding
|
||||||
import com.simplemobiletools.calendar.pro.extensions.withFirstDayOfWeekToFront
|
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)
|
private val binding by activity.viewBinding(DialogVerticalLinearLayoutBinding::inflate)
|
||||||
|
|
||||||
init {
|
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)
|
var checkboxes = ArrayList<MyAppCompatCheckbox>(7)
|
||||||
for (i in 0..6) {
|
for (i in 0..6) {
|
||||||
val pow = Math.pow(2.0, i.toDouble()).toInt()
|
val pow = Math.pow(2.0, i.toDouble()).toInt()
|
||||||
|
@ -32,8 +31,8 @@ class RepeatRuleWeeklyDialog(val activity: Activity, val curRepeatRule: Int, val
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> callback(getRepeatRuleSum()) }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> callback(getRepeatRuleSum()) }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this)
|
activity.setupDialogStuff(binding.root, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ class SelectCalendarsDialog(val activity: SimpleActivity, val callback: () -> Un
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> confirmSelection() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmSelection() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.select_caldav_calendars)
|
activity.setupDialogStuff(binding.root, this, R.string.select_caldav_calendars)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class SelectEventColorDialog(val activity: Activity, val colors: IntArray, var c
|
||||||
|
|
||||||
binding.colorGrid.apply {
|
binding.colorGrid.apply {
|
||||||
val width = activity.resources.getDimensionPixelSize(R.dimen.smaller_icon_size)
|
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)
|
layoutManager = AutoGridLayoutManager(context = activity, itemWidth = width + spacing)
|
||||||
adapter = colorAdapter
|
adapter = colorAdapter
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,13 @@ class SelectEventTypeColorDialog(val activity: Activity, val colors: IntArray, v
|
||||||
|
|
||||||
binding.colorGrid.apply {
|
binding.colorGrid.apply {
|
||||||
val width = activity.resources.getDimensionPixelSize(R.dimen.smaller_icon_size)
|
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)
|
layoutManager = AutoGridLayoutManager(context = activity, itemWidth = width + spacing)
|
||||||
adapter = colorAdapter
|
adapter = colorAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.color) {
|
activity.setupDialogStuff(binding.root, this, R.string.color) {
|
||||||
dialog = it
|
dialog = it
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simplemobiletools.calendar.pro.dialogs
|
package com.simplemobiletools.calendar.pro.dialogs
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
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.adapters.FilterEventTypeAdapter
|
import com.simplemobiletools.calendar.pro.adapters.FilterEventTypeAdapter
|
||||||
import com.simplemobiletools.calendar.pro.databinding.DialogFilterEventTypesBinding
|
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)
|
binding.filterEventTypesList.adapter = FilterEventTypeAdapter(activity, it, selectedEventTypes)
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> confirmEventTypes() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> confirmEventTypes() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
||||||
dialog = alertDialog
|
dialog = alertDialog
|
||||||
|
|
|
@ -38,7 +38,11 @@ class SetRemindersDialog(val activity: SimpleActivity, val eventType: Int, val c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dialogConfirmed() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.event_reminders)
|
activity.setupDialogStuff(binding.root, this, R.string.event_reminders)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.pro.extensions
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import com.simplemobiletools.calendar.pro.BuildConfig
|
import com.simplemobiletools.calendar.pro.BuildConfig
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.dialogs.CustomEventRepeatIntervalDialog
|
import com.simplemobiletools.calendar.pro.dialogs.CustomEventRepeatIntervalDialog
|
||||||
import com.simplemobiletools.calendar.pro.helpers.*
|
import com.simplemobiletools.calendar.pro.helpers.*
|
||||||
import com.simplemobiletools.calendar.pro.models.Event
|
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.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.TreeSet
|
||||||
|
|
||||||
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val file = getTempFile()
|
val file = getTempFile()
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
return@ensureBackgroundThread
|
return@ensureBackgroundThread
|
||||||
}
|
}
|
||||||
|
|
||||||
val events = eventsDB.getEventsOrTasksWithIds(ids) as ArrayList<Event>
|
val events = eventsDB.getEventsOrTasksWithIds(ids) as ArrayList<Event>
|
||||||
if (events.isEmpty()) {
|
if (events.isEmpty()) {
|
||||||
toast(R.string.no_items_found)
|
toast(com.simplemobiletools.commons.R.string.no_items_found)
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileOutputStream(file.toFileDirItem(this), true) {
|
getFileOutputStream(file.toFileDirItem(this), true) {
|
||||||
|
@ -41,7 +40,7 @@ fun BaseSimpleActivity.getTempFile(): File? {
|
||||||
val folder = File(cacheDir, "events")
|
val folder = File(cacheDir, "events")
|
||||||
if (!folder.exists()) {
|
if (!folder.exists()) {
|
||||||
if (!folder.mkdir()) {
|
if (!folder.mkdir()) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +71,7 @@ fun Activity.showEventRepeatIntervalDialog(curSeconds: Int, callback: (minutes:
|
||||||
selectedIndex = index
|
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) {
|
RadioGroupDialog(this, items, selectedIndex) {
|
||||||
if (it == -1) {
|
if (it == -1) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) {
|
||||||
val validReminders = event.getReminders().filter { it.type == REMINDER_NOTIFICATION }
|
val validReminders = event.getReminders().filter { it.type == REMINDER_NOTIFICATION }
|
||||||
if (validReminders.isEmpty()) {
|
if (validReminders.isEmpty()) {
|
||||||
if (showToasts) {
|
if (showToasts) {
|
||||||
toast(R.string.saving)
|
toast(com.simplemobiletools.commons.R.string.saving)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showToasts) {
|
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) {
|
fun Context.scheduleEventIn(notifTS: Long, event: Event, showToasts: Boolean) {
|
||||||
if (notifTS < System.currentTimeMillis()) {
|
if (notifTS < System.currentTimeMillis()) {
|
||||||
if (showToasts) {
|
if (showToasts) {
|
||||||
toast(R.string.saving)
|
toast(com.simplemobiletools.commons.R.string.saving)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ fun Context.scheduleEventIn(notifTS: Long, event: Event, showToasts: Boolean) {
|
||||||
val newNotifTS = notifTS + 1000
|
val newNotifTS = notifTS + 1000
|
||||||
if (showToasts) {
|
if (showToasts) {
|
||||||
val secondsTillNotification = (newNotifTS - System.currentTimeMillis()) / 1000
|
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)
|
toast(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ fun Context.backupEventsAndTasks() {
|
||||||
exportPastEntries = config.autoBackupPastEntries
|
exportPastEntries = config.autoBackupPastEntries
|
||||||
)
|
)
|
||||||
if (events.isEmpty()) {
|
if (events.isEmpty()) {
|
||||||
toast(R.string.no_entries_for_exporting)
|
toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
|
||||||
config.lastAutoBackupTime = getNowSeconds()
|
config.lastAutoBackupTime = getNowSeconds()
|
||||||
scheduleNextAutomaticBackup()
|
scheduleNextAutomaticBackup()
|
||||||
return@ensureBackgroundThread
|
return@ensureBackgroundThread
|
||||||
|
@ -274,8 +274,8 @@ fun Context.backupEventsAndTasks() {
|
||||||
|
|
||||||
IcsExporter(this).exportEvents(outputStream, events, showExportingToast = false) { result ->
|
IcsExporter(this).exportEvents(outputStream, events, showExportingToast = false) { result ->
|
||||||
when (result) {
|
when (result) {
|
||||||
IcsExporter.ExportResult.EXPORT_PARTIAL -> toast(R.string.exporting_some_entries_failed)
|
IcsExporter.ExportResult.EXPORT_PARTIAL -> toast(com.simplemobiletools.commons.R.string.exporting_some_entries_failed)
|
||||||
IcsExporter.ExportResult.EXPORT_FAIL -> toast(R.string.exporting_failed)
|
IcsExporter.ExportResult.EXPORT_FAIL -> toast(com.simplemobiletools.commons.R.string.exporting_failed)
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
MediaScannerConnection.scanFile(
|
MediaScannerConnection.scanFile(
|
||||||
|
@ -298,10 +298,10 @@ fun Context.getRepetitionText(seconds: Int) = when (seconds) {
|
||||||
YEAR -> getString(R.string.yearly)
|
YEAR -> getString(R.string.yearly)
|
||||||
else -> {
|
else -> {
|
||||||
when {
|
when {
|
||||||
seconds % YEAR == 0 -> resources.getQuantityString(R.plurals.years, seconds / YEAR, seconds / YEAR)
|
seconds % YEAR == 0 -> resources.getQuantityString(com.simplemobiletools.commons.R.plurals.years, seconds / YEAR, seconds / YEAR)
|
||||||
seconds % MONTH == 0 -> resources.getQuantityString(R.plurals.months, seconds / MONTH, seconds / MONTH)
|
seconds % MONTH == 0 -> resources.getQuantityString(com.simplemobiletools.commons.R.plurals.months, seconds / MONTH, seconds / MONTH)
|
||||||
seconds % WEEK == 0 -> resources.getQuantityString(R.plurals.weeks, seconds / WEEK, seconds / WEEK)
|
seconds % WEEK == 0 -> resources.getQuantityString(com.simplemobiletools.commons.R.plurals.weeks, seconds / WEEK, seconds / WEEK)
|
||||||
else -> resources.getQuantityString(R.plurals.days, seconds / DAY, seconds / DAY)
|
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) {
|
val displayedStartDate = when (startDate) {
|
||||||
LocalDate.now() -> ""
|
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))},"
|
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()) {
|
if (event.isTask() && !event.isTaskCompleted()) {
|
||||||
addAction(R.drawable.ic_task_vector, getString(R.string.mark_completed), getMarkCompletedPendingIntent(this@getNotification, event))
|
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) {
|
if (config.vibrateOnReminder) {
|
||||||
|
@ -785,13 +789,13 @@ fun Context.getFirstDayOfWeekDt(date: DateTime): DateTime {
|
||||||
|
|
||||||
fun Context.getDayOfWeekString(dayOfWeek: Int): String {
|
fun Context.getDayOfWeekString(dayOfWeek: Int): String {
|
||||||
val dayOfWeekResId = when (dayOfWeek) {
|
val dayOfWeekResId = when (dayOfWeek) {
|
||||||
DateTimeConstants.MONDAY -> R.string.monday
|
DateTimeConstants.MONDAY -> com.simplemobiletools.commons.R.string.monday
|
||||||
DateTimeConstants.TUESDAY -> R.string.tuesday
|
DateTimeConstants.TUESDAY -> com.simplemobiletools.commons.R.string.tuesday
|
||||||
DateTimeConstants.WEDNESDAY -> R.string.wednesday
|
DateTimeConstants.WEDNESDAY -> com.simplemobiletools.commons.R.string.wednesday
|
||||||
DateTimeConstants.THURSDAY -> R.string.thursday
|
DateTimeConstants.THURSDAY -> com.simplemobiletools.commons.R.string.thursday
|
||||||
DateTimeConstants.FRIDAY -> R.string.friday
|
DateTimeConstants.FRIDAY -> com.simplemobiletools.commons.R.string.friday
|
||||||
DateTimeConstants.SATURDAY -> R.string.saturday
|
DateTimeConstants.SATURDAY -> com.simplemobiletools.commons.R.string.saturday
|
||||||
DateTimeConstants.SUNDAY -> R.string.sunday
|
DateTimeConstants.SUNDAY -> com.simplemobiletools.commons.R.string.sunday
|
||||||
else -> throw IllegalArgumentException("Invalid day: $dayOfWeek")
|
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"
|
// format day bits to strings like "Mon, Tue, Wed"
|
||||||
fun Context.getShortDaysFromBitmask(bitMask: Int): String {
|
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 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 = ""
|
var days = ""
|
||||||
dayBits.forEachIndexed { index, bit ->
|
dayBits.forEachIndexed { index, bit ->
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
||||||
import com.simplemobiletools.calendar.pro.adapters.DayEventsAdapter
|
import com.simplemobiletools.calendar.pro.adapters.DayEventsAdapter
|
||||||
|
@ -54,7 +53,7 @@ class DayFragment : Fragment() {
|
||||||
mListener?.goLeft()
|
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
|
pointerLeft?.isAutoMirrored = true
|
||||||
setImageDrawable(pointerLeft)
|
setImageDrawable(pointerLeft)
|
||||||
}
|
}
|
||||||
|
@ -66,7 +65,7 @@ class DayFragment : Fragment() {
|
||||||
mListener?.goRight()
|
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
|
pointerRight?.isAutoMirrored = true
|
||||||
setImageDrawable(pointerRight)
|
setImageDrawable(pointerRight)
|
||||||
}
|
}
|
||||||
|
@ -135,7 +134,7 @@ class DayFragment : Fragment() {
|
||||||
topNavigationBinding.apply {
|
topNavigationBinding.apply {
|
||||||
topLeftArrow.beGone()
|
topLeftArrow.beGone()
|
||||||
topRightArrow.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()
|
(binding.dayEvents.adapter as? DayEventsAdapter)?.togglePrintMode()
|
||||||
|
|
||||||
Handler().postDelayed({
|
Handler().postDelayed({
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.DatePicker
|
import android.widget.DatePicker
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.adapters.MyDayPagerAdapter
|
import com.simplemobiletools.calendar.pro.adapters.MyDayPagerAdapter
|
||||||
import com.simplemobiletools.calendar.pro.databinding.FragmentDaysHolderBinding
|
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)
|
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, dateTime.dayOfMonth, null)
|
||||||
|
|
||||||
activity?.getAlertDialogBuilder()!!
|
activity?.getAlertDialogBuilder()!!
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
|
||||||
.apply {
|
.apply {
|
||||||
activity?.setupDialogStuff(datePicker, this)
|
activity?.setupDialogStuff(datePicker, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
|
||||||
override fun printView() {
|
override fun printView() {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
if (calendarEventsList.isGone()) {
|
if (calendarEventsList.isGone()) {
|
||||||
context?.toast(R.string.no_items_found)
|
context?.toast(com.simplemobiletools.commons.R.string.no_items_found)
|
||||||
return@apply
|
return@apply
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.DatePicker
|
import android.widget.DatePicker
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.adapters.MyMonthDayPagerAdapter
|
import com.simplemobiletools.calendar.pro.adapters.MyMonthDayPagerAdapter
|
||||||
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthsDaysHolderBinding
|
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthsDaysHolderBinding
|
||||||
|
@ -115,8 +114,8 @@ class MonthDayFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||||
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
|
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
|
||||||
|
|
||||||
activity?.getAlertDialogBuilder()!!
|
activity?.getAlertDialogBuilder()!!
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
|
||||||
.apply {
|
.apply {
|
||||||
activity?.setupDialogStuff(datePicker, this)
|
activity?.setupDialogStuff(datePicker, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthBinding
|
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthBinding
|
||||||
import com.simplemobiletools.calendar.pro.databinding.TopNavigationBinding
|
import com.simplemobiletools.calendar.pro.databinding.TopNavigationBinding
|
||||||
|
@ -118,7 +117,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
||||||
listener?.goLeft()
|
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
|
pointerLeft?.isAutoMirrored = true
|
||||||
setImageDrawable(pointerLeft)
|
setImageDrawable(pointerLeft)
|
||||||
}
|
}
|
||||||
|
@ -130,7 +129,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
||||||
listener?.goRight()
|
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
|
pointerRight?.isAutoMirrored = true
|
||||||
setImageDrawable(pointerRight)
|
setImageDrawable(pointerRight)
|
||||||
}
|
}
|
||||||
|
@ -153,7 +152,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
||||||
topNavigationBinding.apply {
|
topNavigationBinding.apply {
|
||||||
topLeftArrow.beGone()
|
topLeftArrow.beGone()
|
||||||
topRightArrow.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()
|
binding.monthViewWrapper.togglePrintMode()
|
||||||
|
|
||||||
requireContext().printBitmap(binding.monthCalendarHolder.getViewBitmap())
|
requireContext().printBitmap(binding.monthCalendarHolder.getViewBitmap())
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.DatePicker
|
import android.widget.DatePicker
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.adapters.MyMonthPagerAdapter
|
import com.simplemobiletools.calendar.pro.adapters.MyMonthPagerAdapter
|
||||||
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthsHolderBinding
|
import com.simplemobiletools.calendar.pro.databinding.FragmentMonthsHolderBinding
|
||||||
|
@ -117,8 +116,8 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||||
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
|
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
|
||||||
|
|
||||||
activity?.getAlertDialogBuilder()!!
|
activity?.getAlertDialogBuilder()!!
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> datePicked(dateTime, datePicker) }
|
||||||
.apply {
|
.apply {
|
||||||
activity?.setupDialogStuff(datePicker, this)
|
activity?.setupDialogStuff(datePicker, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
|
|
||||||
scrollView.onGlobalLayout {
|
scrollView.onGlobalLayout {
|
||||||
if (fullHeight < scrollView.height) {
|
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()
|
val initialScrollY = (rowHeight * config.startWeeklyAt).toInt()
|
||||||
|
@ -210,16 +210,16 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
for (i in 0 until config.weeklyViewDays) {
|
for (i in 0 until config.weeklyViewDays) {
|
||||||
val dayCode = Formatter.getDayCodeFromDateTime(curDay)
|
val dayCode = Formatter.getDayCodeFromDateTime(curDay)
|
||||||
val labelIDs = if (useLongerDayLabels) {
|
val labelIDs = if (useLongerDayLabels) {
|
||||||
R.array.week_days_short
|
com.simplemobiletools.commons.R.array.week_days_short
|
||||||
} else {
|
} else {
|
||||||
R.array.week_day_letters
|
com.simplemobiletools.commons.R.array.week_day_letters
|
||||||
}
|
}
|
||||||
|
|
||||||
val dayLetters = res.getStringArray(labelIDs).toMutableList() as ArrayList<String>
|
val dayLetters = res.getStringArray(labelIDs).toMutableList() as ArrayList<String>
|
||||||
val dayLetter = dayLetters[curDay.dayOfWeek - 1]
|
val dayLetter = dayLetters[curDay.dayOfWeek - 1]
|
||||||
|
|
||||||
val textColor = if (isPrintVersion) {
|
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) {
|
} else if (todayCode == dayCode) {
|
||||||
primaryColor
|
primaryColor
|
||||||
} else if (highlightWeekends && isWeekend(curDay.dayOfWeek)) {
|
} else if (highlightWeekends && isWeekend(curDay.dayOfWeek)) {
|
||||||
|
@ -467,7 +467,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
private fun updateViewScale() {
|
private fun updateViewScale() {
|
||||||
rowHeight = context?.getWeeklyViewItemHeight() ?: return
|
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)
|
val fullHeight = max(rowHeight.toInt() * 24, scrollView.height + oneDp)
|
||||||
scrollView.layoutParams.height = fullHeight - oneDp
|
scrollView.layoutParams.height = fullHeight - oneDp
|
||||||
binding.weekHorizontalGridHolder.layoutParams.height = fullHeight
|
binding.weekHorizontalGridHolder.layoutParams.height = fullHeight
|
||||||
|
@ -725,7 +725,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
currentTimeView = WeekNowMarkerBinding.inflate(layoutInflater).root.apply {
|
currentTimeView = WeekNowMarkerBinding.inflate(layoutInflater).root.apply {
|
||||||
applyColorFilter(primaryColor)
|
applyColorFilter(primaryColor)
|
||||||
binding.weekEventsHolder.addView(this, 0)
|
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 markerHeight = res.getDimension(R.dimen.weekly_view_now_height).toInt()
|
||||||
val minuteHeight = rowHeight / 60
|
val minuteHeight = rowHeight / 60
|
||||||
(layoutParams as RelativeLayout.LayoutParams).apply {
|
(layoutParams as RelativeLayout.LayoutParams).apply {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import android.widget.DatePicker
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.adapters.MyWeekPagerAdapter
|
import com.simplemobiletools.calendar.pro.adapters.MyWeekPagerAdapter
|
||||||
import com.simplemobiletools.calendar.pro.databinding.FragmentWeekHolderBinding
|
import com.simplemobiletools.calendar.pro.databinding.FragmentWeekHolderBinding
|
||||||
|
@ -162,7 +161,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
||||||
val month = Formatter.getShortMonthName(requireContext(), startDateTime.monthOfYear)
|
val month = Formatter.getShortMonthName(requireContext(), startDateTime.monthOfYear)
|
||||||
binding.weekViewMonthLabel.text = month
|
binding.weekViewMonthLabel.text = month
|
||||||
val weekNumber = startDateTime.plusDays(3).weekOfWeekyear
|
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() {
|
override fun goToToday() {
|
||||||
|
@ -180,8 +179,8 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
||||||
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, dateTime.dayOfMonth, null)
|
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, dateTime.dayOfMonth, null)
|
||||||
|
|
||||||
activity?.getAlertDialogBuilder()!!
|
activity?.getAlertDialogBuilder()!!
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> dateSelected(dateTime, datePicker) }
|
||||||
.apply {
|
.apply {
|
||||||
activity?.setupDialogStuff(datePicker, this)
|
activity?.setupDialogStuff(datePicker, this)
|
||||||
}
|
}
|
||||||
|
@ -219,7 +218,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateDaysCount(cnt: Int) {
|
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() {
|
override fun refreshEvents() {
|
||||||
|
@ -269,7 +268,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
||||||
binding.weekViewHolder.height - binding.weekViewSeekbar.height - binding.weekViewDaysCountDivider.height
|
binding.weekViewHolder.height - binding.weekViewSeekbar.height - binding.weekViewDaysCountDivider.height
|
||||||
|
|
||||||
override fun printView() {
|
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 {
|
binding.apply {
|
||||||
weekViewDaysCountDivider.beGone()
|
weekViewDaysCountDivider.beGone()
|
||||||
weekViewSeekbar.beGone()
|
weekViewSeekbar.beGone()
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.databinding.FragmentYearBinding
|
import com.simplemobiletools.calendar.pro.databinding.FragmentYearBinding
|
||||||
import com.simplemobiletools.calendar.pro.databinding.SmallMonthViewHolderBinding
|
import com.simplemobiletools.calendar.pro.databinding.SmallMonthViewHolderBinding
|
||||||
|
@ -39,9 +38,19 @@ class YearFragment : Fragment(), YearlyCalendar {
|
||||||
private lateinit var topNavigationBinding: TopNavigationBinding
|
private lateinit var topNavigationBinding: TopNavigationBinding
|
||||||
private lateinit var monthHolders: List<SmallMonthViewHolderBinding>
|
private lateinit var monthHolders: List<SmallMonthViewHolderBinding>
|
||||||
|
|
||||||
private val monthIds = arrayOf(
|
private val monthResIds = arrayOf(
|
||||||
R.string.january, R.string.february, R.string.march, R.string.april, R.string.may, R.string.june,
|
com.simplemobiletools.commons.R.string.january,
|
||||||
R.string.july, R.string.august, R.string.september, R.string.october, R.string.november, R.string.december
|
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 {
|
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
|
binding.month7Holder, binding.month8Holder, binding.month9Holder, binding.month10Holder, binding.month11Holder, binding.month12Holder
|
||||||
).apply {
|
).apply {
|
||||||
forEachIndexed { index, it ->
|
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 monthOfYear = index + 1
|
||||||
val monthView = monthHolder.smallMonthView
|
val monthView = monthHolder.smallMonthView
|
||||||
val curTextColor = when {
|
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()
|
else -> requireContext().getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +127,7 @@ class YearFragment : Fragment(), YearlyCalendar {
|
||||||
listener?.goLeft()
|
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
|
pointerLeft?.isAutoMirrored = true
|
||||||
setImageDrawable(pointerLeft)
|
setImageDrawable(pointerLeft)
|
||||||
}
|
}
|
||||||
|
@ -130,7 +139,7 @@ class YearFragment : Fragment(), YearlyCalendar {
|
||||||
listener?.goRight()
|
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
|
pointerRight?.isAutoMirrored = true
|
||||||
setImageDrawable(pointerRight)
|
setImageDrawable(pointerRight)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.DatePicker
|
import android.widget.DatePicker
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||||
import com.simplemobiletools.calendar.pro.adapters.MyYearPagerAdapter
|
import com.simplemobiletools.calendar.pro.adapters.MyYearPagerAdapter
|
||||||
import com.simplemobiletools.calendar.pro.databinding.FragmentYearsHolderBinding
|
import com.simplemobiletools.calendar.pro.databinding.FragmentYearsHolderBinding
|
||||||
|
@ -109,8 +108,8 @@ class YearFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||||
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
|
datePicker.init(dateTime.year, dateTime.monthOfYear - 1, 1, null)
|
||||||
|
|
||||||
activity?.getAlertDialogBuilder()!!
|
activity?.getAlertDialogBuilder()!!
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> datePicked(datePicker) }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> datePicked(datePicker) }
|
||||||
.apply {
|
.apply {
|
||||||
activity?.setupDialogStuff(datePicker, this)
|
activity?.setupDialogStuff(datePicker, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,7 +387,7 @@ class CalDAVHelper(val context: Context) {
|
||||||
try {
|
try {
|
||||||
context.contentResolver.insert(Reminders.CONTENT_URI, contentValues)
|
context.contentResolver.insert(Reminders.CONTENT_URI, contentValues)
|
||||||
} catch (e: Exception) {
|
} 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 {
|
try {
|
||||||
context.contentResolver.insert(Attendees.CONTENT_URI, contentValues)
|
context.contentResolver.insert(Attendees.CONTENT_URI, contentValues)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
context.toast(R.string.unknown_error_occurred)
|
context.toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simplemobiletools.calendar.pro.helpers
|
package com.simplemobiletools.calendar.pro.helpers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.extensions.config
|
import com.simplemobiletools.calendar.pro.extensions.config
|
||||||
import com.simplemobiletools.calendar.pro.extensions.seconds
|
import com.simplemobiletools.calendar.pro.extensions.seconds
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
@ -108,9 +107,9 @@ object Formatter {
|
||||||
fun getUTCDateTimeFromTS(ts: Long) = DateTime(ts * 1000L, DateTimeZone.UTC)
|
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
|
// 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
|
fun getHourPattern(context: Context) = if (context.config.use24HourFormat) PATTERN_HOURS_24 else PATTERN_HOURS_12
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class IcsExporter(private val context: Context) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
calendars = context.calDAVHelper.getCalDAVCalendars("", false)
|
calendars = context.calDAVHelper.getCalDAVCalendars("", false)
|
||||||
if (showExportingToast) {
|
if (showExportingToast) {
|
||||||
context.toast(R.string.exporting)
|
context.toast(com.simplemobiletools.commons.R.string.exporting)
|
||||||
}
|
}
|
||||||
|
|
||||||
object : BufferedWriter(OutputStreamWriter(outputStream, Charsets.UTF_8)) {
|
object : BufferedWriter(OutputStreamWriter(outputStream, Charsets.UTF_8)) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simplemobiletools.calendar.pro.helpers
|
package com.simplemobiletools.calendar.pro.helpers
|
||||||
|
|
||||||
import android.provider.CalendarContract.Events
|
import android.provider.CalendarContract.Events
|
||||||
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.eventsDB
|
import com.simplemobiletools.calendar.pro.extensions.eventsDB
|
||||||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
||||||
|
@ -117,7 +116,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
} else if (line.startsWith(DESCRIPTION) && !isNotificationDescription) {
|
} else if (line.startsWith(DESCRIPTION) && !isNotificationDescription) {
|
||||||
val match = DESCRIPTION_REGEX.matchEntire(line)
|
val match = DESCRIPTION_REGEX.matchEntire(line)
|
||||||
if (match != null) {
|
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()) {
|
if (curDescription.trim().isEmpty()) {
|
||||||
curDescription = ""
|
curDescription = ""
|
||||||
|
@ -330,6 +329,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
IMPORT_FAIL
|
IMPORT_FAIL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventsFailed > 0 -> IMPORT_PARTIAL
|
eventsFailed > 0 -> IMPORT_PARTIAL
|
||||||
else -> IMPORT_OK
|
else -> IMPORT_OK
|
||||||
}
|
}
|
||||||
|
@ -348,6 +348,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
|
|
||||||
Parser().parseDateTimeValue(value)
|
Parser().parseDateTimeValue(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fullString.startsWith(":") -> Parser().parseDateTimeValue(fullString.substring(1).trim())
|
fullString.startsWith(":") -> Parser().parseDateTimeValue(fullString.substring(1).trim())
|
||||||
else -> Parser().parseDateTimeValue(fullString)
|
else -> Parser().parseDateTimeValue(fullString)
|
||||||
}
|
}
|
||||||
|
@ -375,7 +376,12 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
|
|
||||||
val eventId = eventsHelper.getEventTypeIdWithTitle(eventTypeTitle)
|
val eventId = eventsHelper.getEventTypeIdWithTitle(eventTypeTitle)
|
||||||
curEventTypeId = if (eventId == -1L) {
|
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)
|
val eventType = EventType(null, eventTypeTitle, newTypeColor)
|
||||||
eventsHelper.insertOrUpdateEventTypeSync(eventType)
|
eventsHelper.insertOrUpdateEventTypeSync(eventType)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -49,7 +49,12 @@ class MyWidgetListProvider : AppWidgetProvider() {
|
||||||
setTextSize(R.id.widget_event_list_today, fontSize)
|
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, NEW_EVENT, R.id.widget_event_new_event)
|
||||||
setupIntent(context, views, LAUNCH_CAL, R.id.widget_event_list_today)
|
setupIntent(context, views, LAUNCH_CAL, R.id.widget_event_list_today)
|
||||||
|
|
||||||
|
|
|
@ -199,16 +199,16 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||||
views.setTextColor(R.id.top_value, textColor)
|
views.setTextColor(R.id.top_value, textColor)
|
||||||
views.setTextSize(R.id.top_value, largerFontSize)
|
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)
|
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)
|
views.setImageViewBitmap(R.id.top_right_arrow, bmp)
|
||||||
|
|
||||||
bmp = resources.getColoredBitmap(R.drawable.ic_today_vector, textColor)
|
bmp = resources.getColoredBitmap(R.drawable.ic_today_vector, textColor)
|
||||||
views.setImageViewBitmap(R.id.top_go_to_today, bmp)
|
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)
|
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)
|
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 firstDayOfWeek = config.firstDayOfWeek
|
||||||
val smallerFontSize = context.getWidgetFontSize()
|
val smallerFontSize = context.getWidgetFontSize()
|
||||||
val packageName = context.packageName
|
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) {
|
for (i in 0..6) {
|
||||||
val id = resources.getIdentifier("label_$i", "id", packageName)
|
val id = resources.getIdentifier("label_$i", "id", packageName)
|
||||||
|
|
|
@ -70,7 +70,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
||||||
highlightWeekends = config.highlightWeekends
|
highlightWeekends = config.highlightWeekends
|
||||||
|
|
||||||
smallPadding = resources.displayMetrics.density.toInt()
|
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
|
weekDaysLetterHeight = normalTextSize * 2
|
||||||
|
|
||||||
textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||||
|
@ -89,7 +89,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
||||||
color = primaryColor
|
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
|
eventTitleHeight = smallerTextSize
|
||||||
eventTitlePaint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply {
|
eventTitlePaint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||||
color = textColor
|
color = textColor
|
||||||
|
@ -391,7 +391,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initWeekDayLetters() {
|
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() {
|
private fun setupCurrentDayOfWeekIndex() {
|
||||||
|
@ -430,7 +430,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
||||||
fun togglePrintMode() {
|
fun togglePrintMode() {
|
||||||
isPrintVersion = !isPrintVersion
|
isPrintVersion = !isPrintVersion
|
||||||
textColor = if (isPrintVersion) {
|
textColor = if (isPrintVersion) {
|
||||||
resources.getColor(R.color.theme_light_text_color)
|
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
|
||||||
} else {
|
} else {
|
||||||
context.getProperTextColor()
|
context.getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.databinding.MonthViewBackgroundBinding
|
import com.simplemobiletools.calendar.pro.databinding.MonthViewBackgroundBinding
|
||||||
import com.simplemobiletools.calendar.pro.databinding.MonthViewBinding
|
import com.simplemobiletools.calendar.pro.databinding.MonthViewBinding
|
||||||
import com.simplemobiletools.calendar.pro.extensions.config
|
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)
|
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0)
|
||||||
|
|
||||||
init {
|
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()
|
weekDaysLetterHeight = 2 * normalTextSize.toInt()
|
||||||
|
|
||||||
inflater = LayoutInflater.from(context)
|
inflater = LayoutInflater.from(context)
|
||||||
|
@ -99,7 +98,11 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupHorizontalOffset() {
|
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() {
|
private fun measureSizes() {
|
||||||
|
|
|
@ -117,7 +117,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
||||||
fun togglePrintMode() {
|
fun togglePrintMode() {
|
||||||
isPrintVersion = !isPrintVersion
|
isPrintVersion = !isPrintVersion
|
||||||
textColor = if (isPrintVersion) {
|
textColor = if (isPrintVersion) {
|
||||||
resources.getColor(R.color.theme_light_text_color)
|
resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color)
|
||||||
} else {
|
} else {
|
||||||
context.getProperTextColor().adjustAlpha(MEDIUM_ALPHA)
|
context.getProperTextColor().adjustAlpha(MEDIUM_ALPHA)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.graphics.Canvas
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.simplemobiletools.calendar.pro.R
|
|
||||||
import com.simplemobiletools.calendar.pro.extensions.config
|
import com.simplemobiletools.calendar.pro.extensions.config
|
||||||
import com.simplemobiletools.calendar.pro.extensions.getWeeklyViewItemHeight
|
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)
|
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0)
|
||||||
|
|
||||||
init {
|
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) {
|
override fun onDraw(canvas: Canvas) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.nonTransitiveRClass=false
|
|
||||||
org.gradle.jvmargs=-Xmx8192m
|
org.gradle.jvmargs=-Xmx8192m
|
||||||
|
|
Loading…
Reference in a new issue