From ba688cb868d85caaeffe7f01cdf02248b18eb0dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Glavatkii=20Fran=C3=A7ois?=
<108989231+ProgRaizell@users.noreply.github.com>
Date: Thu, 9 Nov 2023 15:21:01 +0100
Subject: [PATCH 1/7] Update strings.xml
---
app/src/main/res/values-fr/strings.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index a1a4287d5..c9fd107e4 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -159,7 +159,7 @@
Ajouter des jours fériés
Jours fériés nationaux
Jours fériés religieux
- Les jours fériés ont été correctement importés dans le type d'évènement \'Jours fériés\'
+ Les jours fériés ont été correctement importés dans le type d\'évènement \'Jours fériés\'
L\'importation de certains évènements a échoué
L\'importation des jours fériés a échoué
From aebe52bf8027907bd3b966a5d90d32db4e4ca5a9 Mon Sep 17 00:00:00 2001
From: ProgRaizell
Date: Thu, 9 Nov 2023 17:19:56 +0100
Subject: [PATCH 2/7] Solution pour l issue #2258
---
.../calendar/pro/views/SmallMonthView.kt | 21 +++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt
index c6ed6dc0d..50dfaef2d 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt
@@ -90,8 +90,25 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
canvas.drawText(curId.toString(), x * dayWidth - (dayWidth / 4), y * dayWidth, paint)
if (curId == todaysId && !isPrintVersion) {
- val dividerConstant = if (isLandscape) 6 else 4
- canvas.drawCircle(x * dayWidth - dayWidth / 2, y * dayWidth - dayWidth / dividerConstant, dayWidth * 0.41f, todayCirclePaint)
+ val array_1_to_9= listOf(1, 2, 3, 4, 5,6,7,8,9)
+ val array_10_to_19= listOf(10, 11, 12, 13, 14,15,16,17,18,19)
+
+ if(todaysId in array_1_to_9){
+ val dividerConstantX = if (isLandscape) 2.6f else 2.8f
+ val dividerConstantY = if (isLandscape) 6.0f else 5.1f
+ canvas.drawCircle(x * dayWidth - dayWidth / dividerConstantX, y * dayWidth - dayWidth / dividerConstantY, dayWidth * 0.41f, todayCirclePaint)
+ }else if (todaysId in array_10_to_19){
+ val dividerConstantX = if (isLandscape) 2.0f else 2.1f
+ val dividerConstantY = if (isLandscape) 6.0f else 5.2f
+ canvas.drawCircle(x * dayWidth - dayWidth / dividerConstantX, y * dayWidth - dayWidth / dividerConstantY, dayWidth * 0.41f, todayCirclePaint)
+
+ }else {
+ val dividerConstantX = if (isLandscape) 2.0f else 2.0f
+ val dividerConstantY = if (isLandscape) 6.0f else 5.4f
+ canvas.drawCircle(x * dayWidth - dayWidth / dividerConstantX, y * dayWidth - dayWidth / dividerConstantY, dayWidth * 0.41f, todayCirclePaint)
+ }
+
+
}
}
curId++
From cf884d8cf3d31685f8b045308d5eb12439d2c7d3 Mon Sep 17 00:00:00 2001
From: MariemMARZOUGUI <127297843+MariemMARZOUGUI@users.noreply.github.com>
Date: Tue, 28 Nov 2023 22:37:42 +0100
Subject: [PATCH 3/7] tentative de delete events
---
.../pro/activities/SettingsActivity.kt | 65 ++++++++++++++++++-
.../calendar/pro/helpers/EventsHelper.kt | 8 +++
.../calendar/pro/interfaces/EventsDao.kt | 3 +
app/src/main/res/layout/activity_settings.xml | 29 +++++++++
4 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
index 2b956c784..b41e09696 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
@@ -1,13 +1,20 @@
package com.simplemobiletools.calendar.pro.activities
import android.app.Activity
+import android.app.DatePickerDialog
import android.app.TimePickerDialog
import android.content.ActivityNotFoundException
import android.content.Intent
+import android.icu.util.Calendar
import android.media.AudioManager
import android.media.RingtoneManager
+import android.os.Build
import android.os.Bundle
+import android.util.Log
+import android.widget.Button
+import android.widget.DatePicker
import android.widget.Toast
+import androidx.annotation.RequiresApi
import com.google.android.material.timepicker.MaterialTimePicker
import com.google.android.material.timepicker.TimeFormat
import com.simplemobiletools.calendar.pro.R
@@ -27,7 +34,6 @@ import java.io.File
import java.io.InputStream
import java.io.OutputStream
import java.text.SimpleDateFormat
-import java.util.Calendar
import java.util.Locale
import kotlin.system.exitProcess
@@ -43,6 +49,9 @@ class SettingsActivity : SimpleActivity() {
private val binding by viewBinding(ActivitySettingsBinding::inflate)
+ public var chosenDateTimestamp = 0L
+
+ @RequiresApi(Build.VERSION_CODES.N)
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
super.onCreate(savedInstanceState)
@@ -51,14 +60,56 @@ class SettingsActivity : SimpleActivity() {
updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
setupMaterialScrollListener(binding.settingsNestedScrollview, binding.settingsToolbar)
+ val selectDateButton: Button = findViewById(R.id.selectDateButton)
+
+ selectDateButton.setOnClickListener {
+ showDatePickerDialog()
+
+
+ }
+
+
}
+ @RequiresApi(Build.VERSION_CODES.N)
+ private fun showDatePickerDialog() {
+ val currentDate = Calendar.getInstance()
+ val year = currentDate.get(Calendar.YEAR)
+ val month = currentDate.get(Calendar.MONTH)
+ val day = currentDate.get(Calendar.DAY_OF_MONTH)
+
+ val datePickerDialog = DatePickerDialog(
+ this,
+ { _, year, month, day ->
+ val selectedDate = Calendar.getInstance()
+ selectedDate.set(year, month, day)
+ chosenDateTimestamp = selectedDate.timeInMillis
+
+ // You can display the selected date if needed
+ Toast.makeText(this, selectedDate.toString(), Toast.LENGTH_SHORT).show()
+ Log.d("MyApp", "Toast displayed: ${selectedDate.toString()}")
+ },
+ year,
+ month,
+ day
+ )
+
+ datePickerDialog.show()
+
+ // Now, you can use chosenDateTimestamp in other parts of your code if needed.
+ setupDeleteEventsFromDate(chosenDateTimestamp)
+
+ }
+
+
+ @RequiresApi(Build.VERSION_CODES.N)
override fun onResume() {
super.onResume()
setupToolbar(binding.settingsToolbar, NavigationIcon.Arrow)
setupSettingItems()
}
+ @RequiresApi(Build.VERSION_CODES.N)
private fun setupSettingItems() {
setupCustomizeColors()
setupCustomizeNotifications()
@@ -72,6 +123,7 @@ class SettingsActivity : SimpleActivity() {
setupHighlightWeekends()
setupHighlightWeekendsColor()
setupDeleteAllEvents()
+ setupDeleteEventsFromDate(chosenDateTimestamp)
setupDisplayDescription()
setupReplaceDescription()
setupWeekNumbers()
@@ -144,6 +196,7 @@ class SettingsActivity : SimpleActivity() {
config.defaultReminder3 = reminders.getOrElse(2) { REMINDER_OFF }
}
+ @RequiresApi(Build.VERSION_CODES.N)
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == GET_RINGTONE_URI && resultCode == RESULT_OK && resultData != null) {
@@ -402,10 +455,16 @@ class SettingsActivity : SimpleActivity() {
settingsDeleteAllEventsHolder.setOnClickListener {
ConfirmationDialog(this@SettingsActivity, messageId = R.string.delete_all_events_confirmation) {
eventsHelper.deleteAllEvents()
+
}
}
}
+ @RequiresApi(Build.VERSION_CODES.N)
+ private fun setupDeleteEventsFromDate(choosendateTimestamp: Long) = binding.apply {
+ eventsHelper.deleteEventsFromDate(choosendateTimestamp)
+ }
+
private fun setupDisplayDescription() = binding.apply {
settingsDisplayDescription.isChecked = config.displayDescription
settingsReplaceDescriptionHolder.beVisibleIf(config.displayDescription)
@@ -424,6 +483,7 @@ class SettingsActivity : SimpleActivity() {
}
}
+ @RequiresApi(Build.VERSION_CODES.N)
private fun setupWeeklyStart() = binding.apply {
settingsStartWeeklyAt.text = getHoursString(config.startWeeklyAt)
settingsStartWeeklyAtHolder.setOnClickListener {
@@ -620,6 +680,7 @@ class SettingsActivity : SimpleActivity() {
}
}
+ @RequiresApi(Build.VERSION_CODES.N)
private fun getHoursString(hours: Int): String {
return if (config.use24HourFormat) {
String.format("%02d:00", hours)
@@ -972,6 +1033,7 @@ class SettingsActivity : SimpleActivity() {
}
}
+ @RequiresApi(Build.VERSION_CODES.N)
private fun setupImportSettings() {
binding.settingsImportHolder.setOnClickListener {
if (isQPlus()) {
@@ -1001,6 +1063,7 @@ class SettingsActivity : SimpleActivity() {
}
}
+ @RequiresApi(Build.VERSION_CODES.N)
private fun parseFile(inputStream: InputStream?) {
if (inputStream == null) {
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
index 1abff94d4..2443ad7c1 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
@@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.pro.helpers
import android.app.Activity
import android.content.Context
+import android.util.Log
import android.widget.Toast
import androidx.annotation.ColorRes
import androidx.collection.LongSparseArray
@@ -13,6 +14,7 @@ import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.CHOPPED_LIST_DEFAULT_SIZE
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
+import java.util.Calendar
class EventsHelper(val context: Context) {
private val config = context.config
@@ -257,6 +259,12 @@ class EventsHelper(val context: Context) {
}
}
+ fun deleteEventsFromDate(choosendateTimestamp: Long) {
+ ensureBackgroundThread {
+ val eventIds = eventsDB.getEventIdsWhereDate(choosendateTimestamp).toMutableList()
+ deleteEvents(eventIds, true)
+ }
+ }
fun deleteEvent(id: Long, deleteFromCalDAV: Boolean) = deleteEvents(arrayListOf(id), deleteFromCalDAV)
fun deleteEvents(ids: MutableList, deleteFromCalDAV: Boolean) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
index 956e4257e..cd43aebc1 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
@@ -136,4 +136,7 @@ interface EventsDao {
@Query("DELETE FROM events WHERE source = :source AND import_id = :importId")
fun deleteBirthdayAnniversary(source: String, importId: String): Int
+
+ @Query("SELECT id FROM events WHERE start_ts > :chosenDateTimestamp")
+ fun getEventIdsWhereDate( chosenDateTimestamp : Long) :List
}
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 5a351c751..17d8de75e 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -884,6 +884,35 @@
+
+
+
+
+
+
+
+
+
+
From 75ab6fac7e2bd47eb39e60ff142ca3f1659e5867 Mon Sep 17 00:00:00 2001
From: MariemMARZOUGUI <127297843+MariemMARZOUGUI@users.noreply.github.com>
Date: Sat, 2 Dec 2023 16:39:01 +0100
Subject: [PATCH 4/7] delete events from date resolved
---
.../pro/activities/SettingsActivity.kt | 34 +++++++------------
.../calendar/pro/helpers/EventsHelper.kt | 4 +--
.../calendar/pro/interfaces/EventsDao.kt | 4 +--
app/src/main/res/layout/activity_settings.xml | 20 +++--------
4 files changed, 20 insertions(+), 42 deletions(-)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
index b41e09696..31539b584 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
@@ -1,5 +1,6 @@
package com.simplemobiletools.calendar.pro.activities
+import android.annotation.SuppressLint
import android.app.Activity
import android.app.DatePickerDialog
import android.app.TimePickerDialog
@@ -11,8 +12,10 @@ import android.media.RingtoneManager
import android.os.Build
import android.os.Bundle
import android.util.Log
+import android.widget.RelativeLayout
import android.widget.Button
import android.widget.DatePicker
+import android.widget.ImageButton
import android.widget.Toast
import androidx.annotation.RequiresApi
import com.google.android.material.timepicker.MaterialTimePicker
@@ -42,15 +45,11 @@ class SettingsActivity : SimpleActivity() {
private val PICK_SETTINGS_IMPORT_SOURCE_INTENT = 2
private val PICK_EVENTS_IMPORT_SOURCE_INTENT = 3
private val PICK_EVENTS_EXPORT_FILE_INTENT = 4
-
private var mStoredPrimaryColor = 0
-
private var eventTypesToExport = listOf()
-
private val binding by viewBinding(ActivitySettingsBinding::inflate)
- public var chosenDateTimestamp = 0L
-
+ @SuppressLint("WrongViewCast")
@RequiresApi(Build.VERSION_CODES.N)
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
@@ -60,12 +59,10 @@ class SettingsActivity : SimpleActivity() {
updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
setupMaterialScrollListener(binding.settingsNestedScrollview, binding.settingsToolbar)
- val selectDateButton: Button = findViewById(R.id.selectDateButton)
+ val settingsDeleteEventsFromDateHolder: RelativeLayout = findViewById(R.id.settings_delete_events_from_date_holder)
- selectDateButton.setOnClickListener {
+ settingsDeleteEventsFromDateHolder.setOnClickListener {
showDatePickerDialog()
-
-
}
@@ -77,28 +74,20 @@ class SettingsActivity : SimpleActivity() {
val year = currentDate.get(Calendar.YEAR)
val month = currentDate.get(Calendar.MONTH)
val day = currentDate.get(Calendar.DAY_OF_MONTH)
-
val datePickerDialog = DatePickerDialog(
this,
{ _, year, month, day ->
val selectedDate = Calendar.getInstance()
selectedDate.set(year, month, day)
- chosenDateTimestamp = selectedDate.timeInMillis
+ val chosenDateTimestamp = selectedDate.timeInMillis
+ setupDeleteEventsFromDate(chosenDateTimestamp)
- // You can display the selected date if needed
- Toast.makeText(this, selectedDate.toString(), Toast.LENGTH_SHORT).show()
- Log.d("MyApp", "Toast displayed: ${selectedDate.toString()}")
},
year,
month,
day
)
-
datePickerDialog.show()
-
- // Now, you can use chosenDateTimestamp in other parts of your code if needed.
- setupDeleteEventsFromDate(chosenDateTimestamp)
-
}
@@ -123,7 +112,6 @@ class SettingsActivity : SimpleActivity() {
setupHighlightWeekends()
setupHighlightWeekendsColor()
setupDeleteAllEvents()
- setupDeleteEventsFromDate(chosenDateTimestamp)
setupDisplayDescription()
setupReplaceDescription()
setupWeekNumbers()
@@ -164,6 +152,7 @@ class SettingsActivity : SimpleActivity() {
setupExportSettings()
setupImportSettings()
+
arrayOf(
binding.settingsColorCustomizationSectionLabel,
binding.settingsGeneralSettingsLabel,
@@ -461,8 +450,9 @@ class SettingsActivity : SimpleActivity() {
}
@RequiresApi(Build.VERSION_CODES.N)
- private fun setupDeleteEventsFromDate(choosendateTimestamp: Long) = binding.apply {
- eventsHelper.deleteEventsFromDate(choosendateTimestamp)
+ private fun setupDeleteEventsFromDate(chosenDateTimestamp: Long) = binding.apply {
+ Log.d("MyApp", "Deleting events after timestamp: $chosenDateTimestamp")
+ eventsHelper.deleteEventsFromDate(chosenDateTimestamp)
}
private fun setupDisplayDescription() = binding.apply {
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
index 2443ad7c1..a3f29cee2 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
@@ -259,9 +259,9 @@ class EventsHelper(val context: Context) {
}
}
- fun deleteEventsFromDate(choosendateTimestamp: Long) {
+ fun deleteEventsFromDate(chosenDateTimestamp: Long) {
ensureBackgroundThread {
- val eventIds = eventsDB.getEventIdsWhereDate(choosendateTimestamp).toMutableList()
+ val eventIds = eventsDB.getEventIdsWhereDate(chosenDateTimestamp).toMutableList()
deleteEvents(eventIds, true)
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
index cd43aebc1..81ab126b7 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
@@ -137,6 +137,6 @@ interface EventsDao {
@Query("DELETE FROM events WHERE source = :source AND import_id = :importId")
fun deleteBirthdayAnniversary(source: String, importId: String): Int
- @Query("SELECT id FROM events WHERE start_ts > :chosenDateTimestamp")
- fun getEventIdsWhereDate( chosenDateTimestamp : Long) :List
+ @Query("SELECT id FROM events WHERE start_ts*1000 > :chosenDateTimestamp")
+ fun getEventIdsWhereDate(chosenDateTimestamp: Long): List
}
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 17d8de75e..75bf1dab2 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -884,35 +884,23 @@
+
+ android:layout_height="wrap_content"
+ android:clickable="true">
-
-
+ android:text="Delete events and tasks after a specific date" />
-
-
From 28bbb1d10cfc24b0288fda7de212801e8f3b0669 Mon Sep 17 00:00:00 2001
From: MariemMARZOUGUI <127297843+MariemMARZOUGUI@users.noreply.github.com>
Date: Sat, 2 Dec 2023 17:39:39 +0100
Subject: [PATCH 5/7] removed settings feature back to the second commit -
circle issue resolved
---
.../pro/activities/SettingsActivity.kt | 32 -------------------
.../calendar/pro/helpers/EventsHelper.kt | 6 ----
.../calendar/pro/interfaces/EventsDao.kt | 2 --
app/src/main/res/layout/activity_settings.xml | 16 ----------
4 files changed, 56 deletions(-)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
index 31539b584..cd26166d3 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
@@ -59,36 +59,9 @@ class SettingsActivity : SimpleActivity() {
updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
setupMaterialScrollListener(binding.settingsNestedScrollview, binding.settingsToolbar)
- val settingsDeleteEventsFromDateHolder: RelativeLayout = findViewById(R.id.settings_delete_events_from_date_holder)
-
- settingsDeleteEventsFromDateHolder.setOnClickListener {
- showDatePickerDialog()
- }
-
}
- @RequiresApi(Build.VERSION_CODES.N)
- private fun showDatePickerDialog() {
- val currentDate = Calendar.getInstance()
- val year = currentDate.get(Calendar.YEAR)
- val month = currentDate.get(Calendar.MONTH)
- val day = currentDate.get(Calendar.DAY_OF_MONTH)
- val datePickerDialog = DatePickerDialog(
- this,
- { _, year, month, day ->
- val selectedDate = Calendar.getInstance()
- selectedDate.set(year, month, day)
- val chosenDateTimestamp = selectedDate.timeInMillis
- setupDeleteEventsFromDate(chosenDateTimestamp)
-
- },
- year,
- month,
- day
- )
- datePickerDialog.show()
- }
@RequiresApi(Build.VERSION_CODES.N)
@@ -449,11 +422,6 @@ class SettingsActivity : SimpleActivity() {
}
}
- @RequiresApi(Build.VERSION_CODES.N)
- private fun setupDeleteEventsFromDate(chosenDateTimestamp: Long) = binding.apply {
- Log.d("MyApp", "Deleting events after timestamp: $chosenDateTimestamp")
- eventsHelper.deleteEventsFromDate(chosenDateTimestamp)
- }
private fun setupDisplayDescription() = binding.apply {
settingsDisplayDescription.isChecked = config.displayDescription
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
index a3f29cee2..c43b70cb9 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
@@ -259,12 +259,6 @@ class EventsHelper(val context: Context) {
}
}
- fun deleteEventsFromDate(chosenDateTimestamp: Long) {
- ensureBackgroundThread {
- val eventIds = eventsDB.getEventIdsWhereDate(chosenDateTimestamp).toMutableList()
- deleteEvents(eventIds, true)
- }
- }
fun deleteEvent(id: Long, deleteFromCalDAV: Boolean) = deleteEvents(arrayListOf(id), deleteFromCalDAV)
fun deleteEvents(ids: MutableList, deleteFromCalDAV: Boolean) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
index 81ab126b7..6d9059441 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
@@ -137,6 +137,4 @@ interface EventsDao {
@Query("DELETE FROM events WHERE source = :source AND import_id = :importId")
fun deleteBirthdayAnniversary(source: String, importId: String): Int
- @Query("SELECT id FROM events WHERE start_ts*1000 > :chosenDateTimestamp")
- fun getEventIdsWhereDate(chosenDateTimestamp: Long): List
}
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 75bf1dab2..324dc6cc9 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -885,22 +885,6 @@
-
-
-
-
-
-
From 20614dc9738edc284949c09b3c072ec9abac214a Mon Sep 17 00:00:00 2001
From: MariemMARZOUGUI <127297843+MariemMARZOUGUI@users.noreply.github.com>
Date: Sat, 2 Dec 2023 18:10:59 +0100
Subject: [PATCH 6/7] removed the unnecessary edits in the files
---
.../pro/activities/SettingsActivity.kt | 28 +++----------------
.../calendar/pro/helpers/EventsHelper.kt | 2 --
.../calendar/pro/interfaces/EventsDao.kt | 1 -
3 files changed, 4 insertions(+), 27 deletions(-)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
index cd26166d3..7debdaa10 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
@@ -2,22 +2,13 @@ package com.simplemobiletools.calendar.pro.activities
import android.annotation.SuppressLint
import android.app.Activity
-import android.app.DatePickerDialog
import android.app.TimePickerDialog
import android.content.ActivityNotFoundException
import android.content.Intent
-import android.icu.util.Calendar
import android.media.AudioManager
import android.media.RingtoneManager
-import android.os.Build
import android.os.Bundle
-import android.util.Log
-import android.widget.RelativeLayout
-import android.widget.Button
-import android.widget.DatePicker
-import android.widget.ImageButton
import android.widget.Toast
-import androidx.annotation.RequiresApi
import com.google.android.material.timepicker.MaterialTimePicker
import com.google.android.material.timepicker.TimeFormat
import com.simplemobiletools.calendar.pro.R
@@ -37,6 +28,7 @@ import java.io.File
import java.io.InputStream
import java.io.OutputStream
import java.text.SimpleDateFormat
+import java.util.Calendar
import java.util.Locale
import kotlin.system.exitProcess
@@ -49,8 +41,7 @@ class SettingsActivity : SimpleActivity() {
private var eventTypesToExport = listOf()
private val binding by viewBinding(ActivitySettingsBinding::inflate)
- @SuppressLint("WrongViewCast")
- @RequiresApi(Build.VERSION_CODES.N)
+
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
super.onCreate(savedInstanceState)
@@ -59,19 +50,14 @@ class SettingsActivity : SimpleActivity() {
updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
setupMaterialScrollListener(binding.settingsNestedScrollview, binding.settingsToolbar)
-
}
-
-
- @RequiresApi(Build.VERSION_CODES.N)
override fun onResume() {
super.onResume()
setupToolbar(binding.settingsToolbar, NavigationIcon.Arrow)
setupSettingItems()
}
- @RequiresApi(Build.VERSION_CODES.N)
private fun setupSettingItems() {
setupCustomizeColors()
setupCustomizeNotifications()
@@ -125,7 +111,6 @@ class SettingsActivity : SimpleActivity() {
setupExportSettings()
setupImportSettings()
-
arrayOf(
binding.settingsColorCustomizationSectionLabel,
binding.settingsGeneralSettingsLabel,
@@ -158,7 +143,6 @@ class SettingsActivity : SimpleActivity() {
config.defaultReminder3 = reminders.getOrElse(2) { REMINDER_OFF }
}
- @RequiresApi(Build.VERSION_CODES.N)
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == GET_RINGTONE_URI && resultCode == RESULT_OK && resultData != null) {
@@ -417,12 +401,10 @@ class SettingsActivity : SimpleActivity() {
settingsDeleteAllEventsHolder.setOnClickListener {
ConfirmationDialog(this@SettingsActivity, messageId = R.string.delete_all_events_confirmation) {
eventsHelper.deleteAllEvents()
-
}
}
}
-
private fun setupDisplayDescription() = binding.apply {
settingsDisplayDescription.isChecked = config.displayDescription
settingsReplaceDescriptionHolder.beVisibleIf(config.displayDescription)
@@ -441,7 +423,6 @@ class SettingsActivity : SimpleActivity() {
}
}
- @RequiresApi(Build.VERSION_CODES.N)
private fun setupWeeklyStart() = binding.apply {
settingsStartWeeklyAt.text = getHoursString(config.startWeeklyAt)
settingsStartWeeklyAtHolder.setOnClickListener {
@@ -638,7 +619,7 @@ class SettingsActivity : SimpleActivity() {
}
}
- @RequiresApi(Build.VERSION_CODES.N)
+
private fun getHoursString(hours: Int): String {
return if (config.use24HourFormat) {
String.format("%02d:00", hours)
@@ -991,7 +972,6 @@ class SettingsActivity : SimpleActivity() {
}
}
- @RequiresApi(Build.VERSION_CODES.N)
private fun setupImportSettings() {
binding.settingsImportHolder.setOnClickListener {
if (isQPlus()) {
@@ -1021,7 +1001,7 @@ class SettingsActivity : SimpleActivity() {
}
}
- @RequiresApi(Build.VERSION_CODES.N)
+
private fun parseFile(inputStream: InputStream?) {
if (inputStream == null) {
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
index c43b70cb9..1abff94d4 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
@@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.pro.helpers
import android.app.Activity
import android.content.Context
-import android.util.Log
import android.widget.Toast
import androidx.annotation.ColorRes
import androidx.collection.LongSparseArray
@@ -14,7 +13,6 @@ import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.CHOPPED_LIST_DEFAULT_SIZE
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
-import java.util.Calendar
class EventsHelper(val context: Context) {
private val config = context.config
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
index 6d9059441..956e4257e 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt
@@ -136,5 +136,4 @@ interface EventsDao {
@Query("DELETE FROM events WHERE source = :source AND import_id = :importId")
fun deleteBirthdayAnniversary(source: String, importId: String): Int
-
}
From 019aa16b59fba1c21cbd6f134585e63af755ede9 Mon Sep 17 00:00:00 2001
From: MariemMARZOUGUI <127297843+MariemMARZOUGUI@users.noreply.github.com>
Date: Sat, 2 Dec 2023 18:15:23 +0100
Subject: [PATCH 7/7] removed the unnecessary edits in the files
---
.../calendar/pro/activities/SettingsActivity.kt | 7 +++----
app/src/main/res/layout/activity_settings.xml | 1 -
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
index 7debdaa10..2b956c784 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt
@@ -1,6 +1,5 @@
package com.simplemobiletools.calendar.pro.activities
-import android.annotation.SuppressLint
import android.app.Activity
import android.app.TimePickerDialog
import android.content.ActivityNotFoundException
@@ -37,10 +36,12 @@ class SettingsActivity : SimpleActivity() {
private val PICK_SETTINGS_IMPORT_SOURCE_INTENT = 2
private val PICK_EVENTS_IMPORT_SOURCE_INTENT = 3
private val PICK_EVENTS_EXPORT_FILE_INTENT = 4
+
private var mStoredPrimaryColor = 0
+
private var eventTypesToExport = listOf()
- private val binding by viewBinding(ActivitySettingsBinding::inflate)
+ private val binding by viewBinding(ActivitySettingsBinding::inflate)
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
@@ -619,7 +620,6 @@ class SettingsActivity : SimpleActivity() {
}
}
-
private fun getHoursString(hours: Int): String {
return if (config.use24HourFormat) {
String.format("%02d:00", hours)
@@ -1001,7 +1001,6 @@ class SettingsActivity : SimpleActivity() {
}
}
-
private fun parseFile(inputStream: InputStream?) {
if (inputStream == null) {
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 324dc6cc9..5a351c751 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -884,7 +884,6 @@
-