| Name | Message | Date |
|---|---|---|
| 📄 FolderPickerActivity.cs | 4 days ago | |
| 📄 NoteListActivity.cs | 3 days ago | |
| 📄 NoteResultIntent.cs | 4 days ago | |
| 📄 NoteViewActivity.cs | 3 days ago | |
| 📄 SettingsActivity.cs | 4 days ago |
📄
src/Activities/NoteResultIntent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Globalization; using Android.Content; using NotesApp.Models; namespace NotesApp.Activities; // The extras contract shared by NoteListActivity <-> NoteViewActivity: launching an existing // note passes its current cached fields in, and closing (whether or not anything was edited) // passes the freshest known fields back out, so the list can patch its cache without a // network round trip either way. internal static class NoteResultIntent { public static void Put(Intent intent, NoteCacheEntry entry) { intent.PutExtra(NoteViewActivity.ExtraNoteId, entry.Id); intent.PutExtra(NoteViewActivity.ExtraNoteName, entry.Name); intent.PutExtra(NoteViewActivity.ExtraNotePreview, entry.Preview); intent.PutExtra(NoteViewActivity.ExtraNoteETag, entry.ETag); intent.PutExtra( NoteViewActivity.ExtraNoteLastModifiedUtc, entry.LastModifiedUtc?.ToString("O") ?? "" ); intent.PutExtra(NoteViewActivity.ExtraNoteSize, entry.Size ?? -1L); } public static NoteCacheEntry? TryGet(Intent? intent) { var id = intent?.GetStringExtra(NoteViewActivity.ExtraNoteId); var name = intent?.GetStringExtra(NoteViewActivity.ExtraNoteName); if (id is null || name is null) return null; var preview = intent?.GetStringExtra(NoteViewActivity.ExtraNotePreview) ?? ""; var eTag = intent?.GetStringExtra(NoteViewActivity.ExtraNoteETag) ?? ""; var lastModifiedRaw = intent?.GetStringExtra(NoteViewActivity.ExtraNoteLastModifiedUtc); var lastModified = string.IsNullOrEmpty(lastModifiedRaw) ? (DateTimeOffset?)null : DateTimeOffset.Parse(lastModifiedRaw, null, DateTimeStyles.RoundtripKind); var sizeRaw = intent?.GetLongExtra(NoteViewActivity.ExtraNoteSize, -1) ?? -1; var size = sizeRaw < 0 ? (long?)null : sizeRaw; return new NoteCacheEntry(id, name, eTag, lastModified, preview, size); } }