| Name | Message | Date |
|---|---|---|
| 📄 FolderPickerActivity.cs | 4 days ago | |
| 📄 NoteListActivity.cs | 4 days ago | |
| 📄 NoteViewActivity.cs | 4 days ago | |
| 📄 SettingsActivity.cs | 4 days ago |
📄
src/Activities/NoteViewActivity.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Android.Views; using AndroidX.AppCompat.App; using Google.Android.Material.ProgressIndicator; using NotesApp.Graph; using NotesApp.Views; using Toolbar = AndroidX.AppCompat.Widget.Toolbar; namespace NotesApp.Activities; [Activity(Label = "@string/app_name", Exported = false)] public class NoteViewActivity : AppCompatActivity { public const string ExtraNoteId = "note_id"; public const string ExtraNoteName = "note_name"; public const string ExtraNotePreview = "note_preview"; private TextView _contentView = null!; private LinearProgressIndicator _progressBar = null!; private GraphService _graphService = null!; protected override void OnCreate(Bundle? savedInstanceState) { AndroidX.Activity.EdgeToEdge.Enable(this); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_note_view); EdgeToEdgeHelper.Apply(FindViewById(Resource.Id.note_view_root)!); var toolbar = FindViewById<Toolbar>(Resource.Id.note_view_toolbar)!; SetSupportActionBar(toolbar); SupportActionBar?.SetDisplayHomeAsUpEnabled(true); var noteId = Intent?.GetStringExtra(ExtraNoteId); toolbar.Title = Intent?.GetStringExtra(ExtraNoteName) ?? GetString(Resource.String.app_name); _contentView = FindViewById<TextView>(Resource.Id.note_view_content)!; _progressBar = FindViewById<LinearProgressIndicator>(Resource.Id.note_view_progress)!; _contentView.Text = Intent?.GetStringExtra(ExtraNotePreview) ?? ""; _graphService = new GraphService(this); if (noteId != null) _ = LoadContentAsync(noteId); } public override bool OnSupportNavigateUp() { Finish(); return true; } private async Task LoadContentAsync(string noteId) { _progressBar.Visibility = ViewStates.Visible; try { _contentView.Text = await _graphService.GetContentAsync(noteId); } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long)?.Show(); // Leave the preview text in place as a partial fallback rather than blanking it. } finally { _progressBar.Visibility = ViewStates.Gone; } } }