Skip to content

Commit 82ae188

Browse files
committed
Add link to settings page from the recording screen
1 parent de05508 commit 82ae188

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

src/Tracked/Screens/Record/RecordScreen.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
xmlns:controls="clr-namespace:Tracked.Controls"
66
x:Class="Tracked.Screens.Record.RecordScreen"
77
Title="{Binding Title}">
8+
<ContentPage.ToolbarItems>
9+
<ToolbarItem
10+
Text="Settings"
11+
Order="Primary"
12+
Clicked="Settings_Tapped" />
13+
</ContentPage.ToolbarItems>
814
<ContentPage.Content>
915
<Grid
1016
RowSpacing="0">

src/Tracked/Screens/Record/RecordScreen.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ protected override async void OnAppearing() {
1717
base.OnAppearing();
1818

1919
await ViewModel.StartLocationListening();
20+
21+
ViewModel.OnPropertyChanged();
2022
}
2123

2224
protected override async void OnDisappearing() {
@@ -33,5 +35,9 @@ private async void Stop_Clicked(object sender, EventArgs e) {
3335
await ViewModel.Stop();
3436
await Navigation.PopToRootAsync();
3537
}
38+
39+
private async void Settings_Tapped(object sender, EventArgs e) {
40+
await ViewModel.GoToSettings();
41+
}
3642
}
3743
}

src/Tracked/Screens/Record/RecordScreenViewModel.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@
1212
namespace Tracked.Screens.Record {
1313
public class RecordScreenViewModel : ViewModelBase {
1414
private readonly RideRecorder rideRecorder;
15-
private readonly bool shouldDetectJumps;
1615
private readonly Timer timer;
1716

1817
private RecordStatus status;
1918
private bool hasAcquiredGpsSignal;
2019

2120
public RecordScreenViewModel(MainContext context) : base(context) {
2221
rideRecorder = new RideRecorder(Context);
23-
shouldDetectJumps = context.Settings.ShouldDetectJumps;
2422
status = RecordStatus.NotStarted;
2523
timer = new Timer();
2624
timer.Elapsed += Timer_Elapsed;
@@ -70,9 +68,9 @@ public string TimerDisplay {
7068

7169
public bool ShowNotifications => Status == RecordStatus.NotStarted;
7270

73-
public string AccelerometerNotification => shouldDetectJumps ? "Detecting Jumps" : "Not Detecting Jumps";
71+
public string AccelerometerNotification => ShouldDetectJumps ? "Detecting Jumps" : "Not Detecting Jumps";
7472

75-
public bool ShouldDetectJumps => shouldDetectJumps;
73+
public bool ShouldDetectJumps => Context.Settings.ShouldDetectJumps;
7674

7775
public RecordStatus Status {
7876
get { return status; }
@@ -133,5 +131,9 @@ public async Task StopLocationListening() {
133131

134132
DependencyService.Get<INativeForegroundService>().Stop();
135133
}
134+
135+
public async Task GoToSettings() {
136+
await Context.UI.GoToSettingsScreenAsync();
137+
}
136138
}
137139
}

src/Tracked/Utilities/NotifyPropertyChangedBase.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
using System.ComponentModel;
22

3-
namespace Tracked.Utilities
4-
{
5-
public class NotifyPropertyChangedBase : INotifyPropertyChanged
6-
{
3+
namespace Tracked.Utilities {
4+
public class NotifyPropertyChangedBase : INotifyPropertyChanged {
75
public event PropertyChangedEventHandler PropertyChanged;
86

9-
protected void OnPropertyChanged()
10-
{
7+
public void OnPropertyChanged() {
118
OnPropertyChanged(null);
129
}
1310

14-
protected virtual void OnPropertyChanged(string propertyName)
15-
{
11+
protected virtual void OnPropertyChanged(string propertyName) {
1612
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
1713
}
1814
}

0 commit comments

Comments
 (0)