File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
app/src/main/kotlin/com/simplemobiletools/notes/pro/helpers Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com.simplemobiletools.notes.pro.helpers
2
2
3
3
import android.graphics.Color
4
+ import org.joda.time.DateTime
4
5
5
6
const val NOTE_ID = " note_id"
6
7
const val OPEN_NOTE_ID = " open_note_id"
@@ -39,6 +40,26 @@ const val FONT_SIZE_PERCENTAGE = "font_size_percentage"
39
40
const val EXPORT_MIME_TYPE = " text/plain"
40
41
const val ADD_NEW_CHECKLIST_ITEMS_TOP = " add_new_checklist_items_top"
41
42
43
+ // auto backups
44
+ const val AUTOMATIC_BACKUP_REQUEST_CODE = 10001
45
+ const val AUTO_BACKUP_INTERVAL_IN_DAYS = 1
46
+
47
+ // 6 am is the hardcoded automatic backup time, intervals shorter than 1 day are not yet supported.
48
+ fun getNextAutoBackupTime (): DateTime {
49
+ val now = DateTime .now()
50
+ val sixHour = now.withHourOfDay(6 )
51
+ return if (now.millis < sixHour.millis) {
52
+ sixHour
53
+ } else {
54
+ sixHour.plusDays(AUTO_BACKUP_INTERVAL_IN_DAYS )
55
+ }
56
+ }
57
+
58
+ fun getPreviousAutoBackupTime (): DateTime {
59
+ val nextBackupTime = getNextAutoBackupTime()
60
+ return nextBackupTime.minusDays(AUTO_BACKUP_INTERVAL_IN_DAYS )
61
+ }
62
+
42
63
// gravity
43
64
const val GRAVITY_START = 0
44
65
const val GRAVITY_CENTER = 1
You can’t perform that action at this time.
0 commit comments