Layout and Push Fix
This commit is contained in:
@@ -4,4 +4,5 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
|
using Android.Provider;
|
||||||
using AndroidX.Core.App;
|
using AndroidX.Core.App;
|
||||||
using cfs_tracker.Data;
|
using cfs_tracker.Data;
|
||||||
using cfs_tracker.Helpers;
|
using cfs_tracker.Helpers;
|
||||||
@@ -54,12 +55,29 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
|
|
||||||
public async Task<bool> EnsurePermissionAsync()
|
public async Task<bool> EnsurePermissionAsync()
|
||||||
{
|
{
|
||||||
var status = await Permissions.CheckStatusAsync<NotificationPermission>();
|
var notificationStatus = await Permissions.CheckStatusAsync<NotificationPermission>();
|
||||||
if (status == PermissionStatus.Granted)
|
if (notificationStatus != PermissionStatus.Granted)
|
||||||
|
{
|
||||||
|
notificationStatus = await Permissions.RequestAsync<NotificationPermission>();
|
||||||
|
if (notificationStatus != PermissionStatus.Granted)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OperatingSystem.IsAndroidVersionAtLeast(31))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
status = await Permissions.RequestAsync<NotificationPermission>();
|
var context = Platform.AppContext;
|
||||||
return status == PermissionStatus.Granted;
|
var alarmManager = (AlarmManager?)context.GetSystemService(Context.AlarmService);
|
||||||
|
|
||||||
|
if (alarmManager is null || alarmManager.CanScheduleExactAlarms())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
var intent = new Intent(Settings.ActionRequestScheduleExactAlarm);
|
||||||
|
intent.SetData(global::Android.Net.Uri.Parse($"package:{context.PackageName}"));
|
||||||
|
intent.AddFlags(ActivityFlags.NewTask);
|
||||||
|
context.StartActivity(intent);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> GetVibrationEnabledAsync() =>
|
public Task<bool> GetVibrationEnabledAsync() =>
|
||||||
@@ -78,8 +96,8 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
|
|
||||||
CancelAllScheduled(context);
|
CancelAllScheduled(context);
|
||||||
|
|
||||||
var granted = await EnsurePermissionAsync();
|
var notificationStatus = await Permissions.CheckStatusAsync<NotificationPermission>();
|
||||||
if (!granted)
|
if (notificationStatus != PermissionStatus.Granted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SaveActionLabelsToPreferences();
|
SaveActionLabelsToPreferences();
|
||||||
@@ -143,10 +161,19 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
|
|
||||||
var when = triggerAt.ToUnixTimeMilliseconds();
|
var when = triggerAt.ToUnixTimeMilliseconds();
|
||||||
|
|
||||||
|
if (CanUseExactAlarms(context, alarmManager))
|
||||||
|
{
|
||||||
|
alarmManager.SetExactAndAllowWhileIdle(AlarmType.RtcWakeup, when, pendingIntent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (OperatingSystem.IsAndroidVersionAtLeast(23))
|
if (OperatingSystem.IsAndroidVersionAtLeast(23))
|
||||||
|
{
|
||||||
alarmManager.SetAndAllowWhileIdle(AlarmType.RtcWakeup, when, pendingIntent);
|
alarmManager.SetAndAllowWhileIdle(AlarmType.RtcWakeup, when, pendingIntent);
|
||||||
else
|
return;
|
||||||
alarmManager.Set(AlarmType.RtcWakeup, when, pendingIntent);
|
}
|
||||||
|
|
||||||
|
alarmManager.Set(AlarmType.RtcWakeup, when, pendingIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void ShowNotification(
|
internal static void ShowNotification(
|
||||||
@@ -293,6 +320,14 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
Preferences.Default.Remove(PrefScheduledIds);
|
Preferences.Default.Remove(PrefScheduledIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool CanUseExactAlarms(Context context, AlarmManager alarmManager)
|
||||||
|
{
|
||||||
|
if (!OperatingSystem.IsAndroidVersionAtLeast(31))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return alarmManager.CanScheduleExactAlarms();
|
||||||
|
}
|
||||||
|
|
||||||
private static PendingIntentFlags BuildPendingIntentFlags()
|
private static PendingIntentFlags BuildPendingIntentFlags()
|
||||||
{
|
{
|
||||||
var flags = PendingIntentFlags.UpdateCurrent;
|
var flags = PendingIntentFlags.UpdateCurrent;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256"><rect width="256" height="256" fill="#0B1620"/><text x="50%" y="55%" dominant-baseline="middle" text-anchor="middle" font-size="96" fill="#D9E6F2">C</text></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256"><rect width="256" height="256" fill="#0B1620"/><text x="50%" y="55%" dominant-baseline="middle" text-anchor="middle" font-size="100" fill="#D9E6F2">Cfs</text></svg>
|
||||||
|
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 229 B |
@@ -107,10 +107,10 @@ public sealed class PdfExportService : IPdfExportService
|
|||||||
var currentDay = weekStart.AddDays(i).Date;
|
var currentDay = weekStart.AddDays(i).Date;
|
||||||
var dayEntries = entries.Where(x => x.EntryDate.Date == currentDay).OrderBy(x => x.Timestamp).ToList();
|
var dayEntries = entries.Where(x => x.EntryDate.Date == currentDay).OrderBy(x => x.Timestamp).ToList();
|
||||||
|
|
||||||
var averageState = CalculateAverageState(dayEntries);
|
var worstState = CalculateWorstState(dayEntries);
|
||||||
var statusText = dayEntries.Count == 0
|
var statusText = dayEntries.Count == 0
|
||||||
? "—"
|
? "—"
|
||||||
: $"{GetStateText(averageState!.Value)} ({dayEntries.Count})";
|
: $"{GetStateText(worstState!.Value)} ({dayEntries.Count})";
|
||||||
|
|
||||||
var activities = dayEntries
|
var activities = dayEntries
|
||||||
.Where(x => x.ActivityId.HasValue)
|
.Where(x => x.ActivityId.HasValue)
|
||||||
@@ -128,8 +128,8 @@ public sealed class PdfExportService : IPdfExportService
|
|||||||
sb.AppendLine("<tr>");
|
sb.AppendLine("<tr>");
|
||||||
sb.AppendLine($"<td>{Encode(currentDay.ToString("ddd, dd.MM.yyyy"))}</td>");
|
sb.AppendLine($"<td>{Encode(currentDay.ToString("ddd, dd.MM.yyyy"))}</td>");
|
||||||
sb.AppendLine($"<td>{dayEntries.Count}</td>");
|
sb.AppendLine($"<td>{dayEntries.Count}</td>");
|
||||||
sb.AppendLine(averageState.HasValue
|
sb.AppendLine(worstState.HasValue
|
||||||
? StateCell(averageState.Value, statusText)
|
? StateCell(worstState.Value, statusText)
|
||||||
: "<td>—</td>");
|
: "<td>—</td>");
|
||||||
sb.AppendLine($"<td>{Encode(activities.Count > 0 ? string.Join(", ", activities) : "—")}</td>");
|
sb.AppendLine($"<td>{Encode(activities.Count > 0 ? string.Join(", ", activities) : "—")}</td>");
|
||||||
sb.AppendLine($"<td>{Encode(symptoms.Count > 0 ? string.Join(", ", symptoms) : "—")}</td>");
|
sb.AppendLine($"<td>{Encode(symptoms.Count > 0 ? string.Join(", ", symptoms) : "—")}</td>");
|
||||||
@@ -175,10 +175,10 @@ public sealed class PdfExportService : IPdfExportService
|
|||||||
var currentDay = new DateTime(year, month, day);
|
var currentDay = new DateTime(year, month, day);
|
||||||
var dayEntries = entries.Where(x => x.EntryDate.Date == currentDay.Date).OrderBy(x => x.Timestamp).ToList();
|
var dayEntries = entries.Where(x => x.EntryDate.Date == currentDay.Date).OrderBy(x => x.Timestamp).ToList();
|
||||||
|
|
||||||
var averageState = CalculateAverageState(dayEntries);
|
var worstState = CalculateWorstState(dayEntries);
|
||||||
var statusText = dayEntries.Count == 0
|
var statusText = dayEntries.Count == 0
|
||||||
? "—"
|
? "—"
|
||||||
: GetStateText(averageState!.Value);
|
: GetStateText(worstState!.Value);
|
||||||
|
|
||||||
var activities = dayEntries
|
var activities = dayEntries
|
||||||
.Where(x => x.ActivityId.HasValue)
|
.Where(x => x.ActivityId.HasValue)
|
||||||
@@ -196,8 +196,8 @@ public sealed class PdfExportService : IPdfExportService
|
|||||||
sb.AppendLine("<tr>");
|
sb.AppendLine("<tr>");
|
||||||
sb.AppendLine($"<td class=\"compact-day\">{Encode(currentDay.ToString("dd.MM."))}</td>");
|
sb.AppendLine($"<td class=\"compact-day\">{Encode(currentDay.ToString("dd.MM."))}</td>");
|
||||||
sb.AppendLine($"<td class=\"compact-count\">{dayEntries.Count}</td>");
|
sb.AppendLine($"<td class=\"compact-count\">{dayEntries.Count}</td>");
|
||||||
sb.AppendLine(averageState.HasValue
|
sb.AppendLine(worstState.HasValue
|
||||||
? StateCellCompact(averageState.Value, statusText)
|
? StateCellCompact(worstState.Value, statusText)
|
||||||
: "<td>—</td>");
|
: "<td>—</td>");
|
||||||
sb.AppendLine($"<td class=\"compact-activity\">{Encode(activities.Count > 0 ? string.Join(", ", activities) : "—")}</td>");
|
sb.AppendLine($"<td class=\"compact-activity\">{Encode(activities.Count > 0 ? string.Join(", ", activities) : "—")}</td>");
|
||||||
sb.AppendLine($"<td class=\"compact-symptoms\">{Encode(symptoms.Count > 0 ? string.Join(", ", symptoms) : "—")}</td>");
|
sb.AppendLine($"<td class=\"compact-symptoms\">{Encode(symptoms.Count > 0 ? string.Join(", ", symptoms) : "—")}</td>");
|
||||||
@@ -236,11 +236,11 @@ public sealed class PdfExportService : IPdfExportService
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var monthDate = new DateTime(year, month, 1);
|
var monthDate = new DateTime(year, month, 1);
|
||||||
var averageState = CalculateAverageState(monthEntries);
|
var worstState = CalculateWorstState(monthEntries);
|
||||||
|
|
||||||
var statusText = monthEntries.Count == 0
|
var statusText = monthEntries.Count == 0
|
||||||
? "—"
|
? "—"
|
||||||
: $"{GetStateText(averageState!.Value)} ({monthEntries.Count})";
|
: $"{GetStateText(worstState!.Value)} ({monthEntries.Count})";
|
||||||
|
|
||||||
var activities = monthEntries
|
var activities = monthEntries
|
||||||
.Where(x => x.ActivityId.HasValue)
|
.Where(x => x.ActivityId.HasValue)
|
||||||
@@ -258,8 +258,8 @@ public sealed class PdfExportService : IPdfExportService
|
|||||||
sb.AppendLine("<tr>");
|
sb.AppendLine("<tr>");
|
||||||
sb.AppendLine($"<td>{Encode(monthDate.ToString("MMMM"))}</td>");
|
sb.AppendLine($"<td>{Encode(monthDate.ToString("MMMM"))}</td>");
|
||||||
sb.AppendLine($"<td>{monthEntries.Count}</td>");
|
sb.AppendLine($"<td>{monthEntries.Count}</td>");
|
||||||
sb.AppendLine(averageState.HasValue
|
sb.AppendLine(worstState.HasValue
|
||||||
? StateCell(averageState.Value, statusText)
|
? StateCell(worstState.Value, statusText)
|
||||||
: "<td>—</td>");
|
: "<td>—</td>");
|
||||||
sb.AppendLine($"<td>{Encode(activities.Count > 0 ? string.Join(", ", activities) : "—")}</td>");
|
sb.AppendLine($"<td>{Encode(activities.Count > 0 ? string.Join(", ", activities) : "—")}</td>");
|
||||||
sb.AppendLine($"<td>{Encode(symptoms.Count > 0 ? string.Join(", ", symptoms) : "—")}</td>");
|
sb.AppendLine($"<td>{Encode(symptoms.Count > 0 ? string.Join(", ", symptoms) : "—")}</td>");
|
||||||
@@ -384,32 +384,23 @@ public sealed class PdfExportService : IPdfExportService
|
|||||||
return date.Date.AddDays(-diff);
|
return date.Date.AddDays(-diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HealthState? CalculateAverageState(IReadOnlyCollection<HealthEntry> entries)
|
private static HealthState? CalculateWorstState(IReadOnlyCollection<HealthEntry> entries)
|
||||||
{
|
{
|
||||||
if (entries.Count == 0)
|
if (entries.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var average = entries.Average(x => StateToNumber(x.State));
|
if (entries.Any(x => x.State == HealthState.Gray))
|
||||||
var rounded = (int)Math.Round(average, MidpointRounding.AwayFromZero);
|
return HealthState.Gray;
|
||||||
|
|
||||||
return rounded switch
|
if (entries.Any(x => x.State == HealthState.Red))
|
||||||
{
|
return HealthState.Red;
|
||||||
<= 0 => HealthState.Green,
|
|
||||||
1 => HealthState.Yellow,
|
if (entries.Any(x => x.State == HealthState.Yellow))
|
||||||
2 => HealthState.Red,
|
return HealthState.Yellow;
|
||||||
_ => HealthState.Gray
|
|
||||||
};
|
return HealthState.Green;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int StateToNumber(HealthState state) => state switch
|
|
||||||
{
|
|
||||||
HealthState.Green => 0,
|
|
||||||
HealthState.Yellow => 1,
|
|
||||||
HealthState.Red => 2,
|
|
||||||
HealthState.Gray => 3,
|
|
||||||
_ => 0
|
|
||||||
};
|
|
||||||
|
|
||||||
private static string ToCssHex(Color color)
|
private static string ToCssHex(Color color)
|
||||||
{
|
{
|
||||||
var r = (int)Math.Round(color.Red * 255);
|
var r = (int)Math.Round(color.Red * 255);
|
||||||
|
|||||||
@@ -9,12 +9,11 @@ public partial class MonthCellViewModel : ObservableObject
|
|||||||
public bool IsCurrentMonth { get; init; }
|
public bool IsCurrentMonth { get; init; }
|
||||||
public bool IsToday { get; init; }
|
public bool IsToday { get; init; }
|
||||||
public bool HasEntries { get; init; }
|
public bool HasEntries { get; init; }
|
||||||
public string AverageStateText { get; init; } = string.Empty;
|
|
||||||
public Color StateColor { get; init; } = Colors.Transparent;
|
public Color BackgroundColor { get; init; } = Colors.Transparent;
|
||||||
public Color TextColor { get; init; } = Colors.White;
|
public Color TextColor { get; init; } = Colors.White;
|
||||||
public Color BorderColor { get; init; } = Colors.Transparent;
|
public Color BorderColor { get; init; } = Colors.Transparent;
|
||||||
|
|
||||||
public bool IsPlaceholder => !IsCurrentMonth;
|
public bool IsPlaceholder => !IsCurrentMonth;
|
||||||
public bool ShowDayNumber => IsCurrentMonth;
|
public bool ShowDayNumber => IsCurrentMonth;
|
||||||
public bool ShowAverage => IsCurrentMonth && HasEntries;
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using cfs_tracker.Data;
|
using cfs_tracker.Data;
|
||||||
using cfs_tracker.Helpers;
|
using cfs_tracker.Helpers;
|
||||||
|
using cfs_tracker.Models;
|
||||||
using cfs_tracker.Services;
|
using cfs_tracker.Services;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using Microsoft.Maui.ApplicationModel;
|
using Microsoft.Maui.ApplicationModel;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace cfs_tracker.ViewModels;
|
namespace cfs_tracker.ViewModels;
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
private readonly HealthEntryRepository _healthEntryRepository;
|
private readonly HealthEntryRepository _healthEntryRepository;
|
||||||
private readonly AppearanceService _appearanceService;
|
private readonly AppearanceService _appearanceService;
|
||||||
private readonly AggregationService _aggregationService;
|
|
||||||
private readonly CalendarStateService _calendarStateService;
|
private readonly CalendarStateService _calendarStateService;
|
||||||
private readonly IPdfExportService _pdfExportService;
|
private readonly IPdfExportService _pdfExportService;
|
||||||
|
|
||||||
@@ -34,13 +33,11 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
public MonthViewModel(
|
public MonthViewModel(
|
||||||
HealthEntryRepository healthEntryRepository,
|
HealthEntryRepository healthEntryRepository,
|
||||||
AppearanceService appearanceService,
|
AppearanceService appearanceService,
|
||||||
AggregationService aggregationService,
|
|
||||||
CalendarStateService calendarStateService,
|
CalendarStateService calendarStateService,
|
||||||
IPdfExportService pdfExportService)
|
IPdfExportService pdfExportService)
|
||||||
{
|
{
|
||||||
_healthEntryRepository = healthEntryRepository;
|
_healthEntryRepository = healthEntryRepository;
|
||||||
_appearanceService = appearanceService;
|
_appearanceService = appearanceService;
|
||||||
_aggregationService = aggregationService;
|
|
||||||
_calendarStateService = calendarStateService;
|
_calendarStateService = calendarStateService;
|
||||||
_pdfExportService = pdfExportService;
|
_pdfExportService = pdfExportService;
|
||||||
|
|
||||||
@@ -80,7 +77,7 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
var date = new DateTime(monthStart.Year, monthStart.Month, day);
|
var date = new DateTime(monthStart.Year, monthStart.Month, day);
|
||||||
var dayEntries = entries.Where(x => x.EntryDate.Date == date.Date).ToList();
|
var dayEntries = entries.Where(x => x.EntryDate.Date == date.Date).ToList();
|
||||||
var average = _aggregationService.CalculateAverage(dayEntries);
|
var worstState = CalculateWorstState(dayEntries);
|
||||||
|
|
||||||
Cells.Add(new MonthCellViewModel
|
Cells.Add(new MonthCellViewModel
|
||||||
{
|
{
|
||||||
@@ -89,9 +86,8 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
IsCurrentMonth = true,
|
IsCurrentMonth = true,
|
||||||
IsToday = date.Date == DateTime.Today,
|
IsToday = date.Date == DateTime.Today,
|
||||||
HasEntries = dayEntries.Count > 0,
|
HasEntries = dayEntries.Count > 0,
|
||||||
AverageStateText = _aggregationService.ToDisplayText(average, _appearanceService),
|
BackgroundColor = GetCellBackgroundColor(worstState),
|
||||||
StateColor = _appearanceService.GetColor(average.State.ToAppearanceColorKey(), "#1F242B"),
|
TextColor = GetCellTextColor(worstState),
|
||||||
TextColor = _appearanceService.GetColor(AppearanceKeys.TextPrimary, "#DCE7F3"),
|
|
||||||
BorderColor = date.Date == DateTime.Today
|
BorderColor = date.Date == DateTime.Today
|
||||||
? _appearanceService.GetColor(AppearanceKeys.StateYellow, "#B89A42")
|
? _appearanceService.GetColor(AppearanceKeys.StateYellow, "#B89A42")
|
||||||
: _appearanceService.GetColor(AppearanceKeys.Border, "#2A3E55")
|
: _appearanceService.GetColor(AppearanceKeys.Border, "#2A3E55")
|
||||||
@@ -154,11 +150,46 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Color GetCellBackgroundColor(HealthState? state) => state switch
|
||||||
|
{
|
||||||
|
HealthState.Green => _appearanceService.GetColor(AppearanceKeys.StateGreen, "#4E8B69"),
|
||||||
|
HealthState.Yellow => _appearanceService.GetColor(AppearanceKeys.StateYellow, "#B89A42"),
|
||||||
|
HealthState.Red => _appearanceService.GetColor(AppearanceKeys.StateRed, "#A85C5C"),
|
||||||
|
HealthState.Gray => _appearanceService.GetColor(AppearanceKeys.StateGray, "#1F242B"),
|
||||||
|
_ => _appearanceService.GetColor(AppearanceKeys.SurfaceBackgroundAlt, "#1F242B")
|
||||||
|
};
|
||||||
|
|
||||||
|
private Color GetCellTextColor(HealthState? state) => state switch
|
||||||
|
{
|
||||||
|
HealthState.Yellow => Colors.Black,
|
||||||
|
HealthState.Green => Colors.White,
|
||||||
|
HealthState.Red => Colors.White,
|
||||||
|
HealthState.Gray => Colors.White,
|
||||||
|
_ => _appearanceService.GetColor(AppearanceKeys.TextPrimary, "#DCE7F3")
|
||||||
|
};
|
||||||
|
|
||||||
private static int GetMondayBasedColumnIndex(DayOfWeek dayOfWeek)
|
private static int GetMondayBasedColumnIndex(DayOfWeek dayOfWeek)
|
||||||
{
|
{
|
||||||
return dayOfWeek == DayOfWeek.Sunday ? 6 : ((int)dayOfWeek - 1);
|
return dayOfWeek == DayOfWeek.Sunday ? 6 : ((int)dayOfWeek - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HealthState? CalculateWorstState(IReadOnlyCollection<HealthEntry> entries)
|
||||||
|
{
|
||||||
|
if (entries.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Gray))
|
||||||
|
return HealthState.Gray;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Red))
|
||||||
|
return HealthState.Red;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Yellow))
|
||||||
|
return HealthState.Yellow;
|
||||||
|
|
||||||
|
return HealthState.Green;
|
||||||
|
}
|
||||||
|
|
||||||
private static MonthCellViewModel CreatePlaceholderCell()
|
private static MonthCellViewModel CreatePlaceholderCell()
|
||||||
{
|
{
|
||||||
return new MonthCellViewModel
|
return new MonthCellViewModel
|
||||||
@@ -168,8 +199,7 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
IsCurrentMonth = false,
|
IsCurrentMonth = false,
|
||||||
IsToday = false,
|
IsToday = false,
|
||||||
HasEntries = false,
|
HasEntries = false,
|
||||||
AverageStateText = string.Empty,
|
BackgroundColor = Colors.Transparent,
|
||||||
StateColor = Colors.Transparent,
|
|
||||||
TextColor = Colors.Transparent,
|
TextColor = Colors.Transparent,
|
||||||
BorderColor = Colors.Transparent
|
BorderColor = Colors.Transparent
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ public partial class NotificationScheduleItemViewModel : ObservableObject
|
|||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool sunday;
|
private bool sunday;
|
||||||
|
|
||||||
|
public string IsEnabledButtonText => IsEnabled ? "Aktiv" : "Inaktiv";
|
||||||
|
|
||||||
|
public IRelayCommand ToggleIsEnabledCommand { get; }
|
||||||
public IRelayCommand ToggleMondayCommand { get; }
|
public IRelayCommand ToggleMondayCommand { get; }
|
||||||
public IRelayCommand ToggleTuesdayCommand { get; }
|
public IRelayCommand ToggleTuesdayCommand { get; }
|
||||||
public IRelayCommand ToggleWednesdayCommand { get; }
|
public IRelayCommand ToggleWednesdayCommand { get; }
|
||||||
@@ -45,6 +48,7 @@ public partial class NotificationScheduleItemViewModel : ObservableObject
|
|||||||
|
|
||||||
public NotificationScheduleItemViewModel()
|
public NotificationScheduleItemViewModel()
|
||||||
{
|
{
|
||||||
|
ToggleIsEnabledCommand = new RelayCommand(() => IsEnabled = !IsEnabled);
|
||||||
ToggleMondayCommand = new RelayCommand(() => Monday = !Monday);
|
ToggleMondayCommand = new RelayCommand(() => Monday = !Monday);
|
||||||
ToggleTuesdayCommand = new RelayCommand(() => Tuesday = !Tuesday);
|
ToggleTuesdayCommand = new RelayCommand(() => Tuesday = !Tuesday);
|
||||||
ToggleWednesdayCommand = new RelayCommand(() => Wednesday = !Wednesday);
|
ToggleWednesdayCommand = new RelayCommand(() => Wednesday = !Wednesday);
|
||||||
@@ -54,6 +58,11 @@ public partial class NotificationScheduleItemViewModel : ObservableObject
|
|||||||
ToggleSundayCommand = new RelayCommand(() => Sunday = !Sunday);
|
ToggleSundayCommand = new RelayCommand(() => Sunday = !Sunday);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void OnIsEnabledChanged(bool value)
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(IsEnabledButtonText));
|
||||||
|
}
|
||||||
|
|
||||||
public int ToWeekdayMask()
|
public int ToWeekdayMask()
|
||||||
{
|
{
|
||||||
var mask = NotificationWeekdays.None;
|
var mask = NotificationWeekdays.None;
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ public partial class OptionsViewModel : ObservableObject
|
|||||||
public bool IsNotificationsTabSelected => SelectedTab == OptionsTab.Notifications;
|
public bool IsNotificationsTabSelected => SelectedTab == OptionsTab.Notifications;
|
||||||
public bool IsDataManagementTabSelected => SelectedTab == OptionsTab.DataManagement;
|
public bool IsDataManagementTabSelected => SelectedTab == OptionsTab.DataManagement;
|
||||||
|
|
||||||
|
public string NotificationVibrationButtonText => NotificationVibrationEnabled ? "Aktiv" : "Inaktiv";
|
||||||
|
|
||||||
public IAsyncRelayCommand DeleteAllDataCommand { get; }
|
public IAsyncRelayCommand DeleteAllDataCommand { get; }
|
||||||
public IAsyncRelayCommand SaveAppearanceCommand { get; }
|
public IAsyncRelayCommand SaveAppearanceCommand { get; }
|
||||||
public IAsyncRelayCommand ResetAppearanceCommand { get; }
|
public IAsyncRelayCommand ResetAppearanceCommand { get; }
|
||||||
@@ -74,6 +76,7 @@ public partial class OptionsViewModel : ObservableObject
|
|||||||
public IAsyncRelayCommand<NotificationScheduleItemViewModel> DeleteScheduleCommand { get; }
|
public IAsyncRelayCommand<NotificationScheduleItemViewModel> DeleteScheduleCommand { get; }
|
||||||
public IAsyncRelayCommand SaveDatabaseLocationCommand { get; }
|
public IAsyncRelayCommand SaveDatabaseLocationCommand { get; }
|
||||||
public IAsyncRelayCommand ClearExportsCommand { get; }
|
public IAsyncRelayCommand ClearExportsCommand { get; }
|
||||||
|
public IRelayCommand ToggleNotificationVibrationCommand { get; }
|
||||||
public IRelayCommand ShowAppearanceTabCommand { get; }
|
public IRelayCommand ShowAppearanceTabCommand { get; }
|
||||||
public IRelayCommand ShowNotificationsTabCommand { get; }
|
public IRelayCommand ShowNotificationsTabCommand { get; }
|
||||||
public IRelayCommand ShowDataManagementTabCommand { get; }
|
public IRelayCommand ShowDataManagementTabCommand { get; }
|
||||||
@@ -118,6 +121,11 @@ public partial class OptionsViewModel : ObservableObject
|
|||||||
SaveDatabaseLocationCommand = new AsyncRelayCommand(SaveDatabaseLocationAsync);
|
SaveDatabaseLocationCommand = new AsyncRelayCommand(SaveDatabaseLocationAsync);
|
||||||
ClearExportsCommand = new AsyncRelayCommand(ClearExportsAsync);
|
ClearExportsCommand = new AsyncRelayCommand(ClearExportsAsync);
|
||||||
|
|
||||||
|
ToggleNotificationVibrationCommand = new RelayCommand(() =>
|
||||||
|
{
|
||||||
|
NotificationVibrationEnabled = !NotificationVibrationEnabled;
|
||||||
|
});
|
||||||
|
|
||||||
ShowAppearanceTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Appearance);
|
ShowAppearanceTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Appearance);
|
||||||
ShowNotificationsTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Notifications);
|
ShowNotificationsTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Notifications);
|
||||||
ShowDataManagementTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.DataManagement);
|
ShowDataManagementTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.DataManagement);
|
||||||
@@ -135,6 +143,11 @@ public partial class OptionsViewModel : ObservableObject
|
|||||||
OnPropertyChanged(nameof(IsDataManagementTabSelected));
|
OnPropertyChanged(nameof(IsDataManagementTabSelected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void OnNotificationVibrationEnabledChanged(bool value)
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(NotificationVibrationButtonText));
|
||||||
|
}
|
||||||
|
|
||||||
public async Task LoadAsync()
|
public async Task LoadAsync()
|
||||||
{
|
{
|
||||||
await LoadAppearanceAsync();
|
await LoadAppearanceAsync();
|
||||||
@@ -447,7 +460,10 @@ public partial class OptionsViewModel : ObservableObject
|
|||||||
var granted = await _notificationScheduler.EnsurePermissionAsync();
|
var granted = await _notificationScheduler.EnsurePermissionAsync();
|
||||||
if (!granted)
|
if (!granted)
|
||||||
{
|
{
|
||||||
StatusText = "Benachrichtigungsberechtigung wurde nicht erlaubt.";
|
StatusText = OperatingSystem.IsAndroidVersionAtLeast(31)
|
||||||
|
? "Bitte Benachrichtigungen und exakte Alarme erlauben und danach erneut speichern."
|
||||||
|
: "Benachrichtigungsberechtigung wurde nicht erlaubt.";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,17 +85,20 @@ public partial class WeekViewModel : ObservableObject
|
|||||||
var date = WeekStart.AddDays(i);
|
var date = WeekStart.AddDays(i);
|
||||||
var dayEntries = entries.Where(x => x.EntryDate.Date == date.Date).ToList();
|
var dayEntries = entries.Where(x => x.EntryDate.Date == date.Date).ToList();
|
||||||
|
|
||||||
var morningAverage = _aggregationService.CalculateAverage(_aggregationService.FilterForDayPart(dayEntries, DayPart.Morning));
|
var morningEntries = _aggregationService.FilterForDayPart(dayEntries, DayPart.Morning).ToList();
|
||||||
var afternoonAverage = _aggregationService.CalculateAverage(_aggregationService.FilterForDayPart(dayEntries, DayPart.Afternoon));
|
var afternoonEntries = _aggregationService.FilterForDayPart(dayEntries, DayPart.Afternoon).ToList();
|
||||||
|
|
||||||
|
var morningWorstState = CalculateWorstState(morningEntries);
|
||||||
|
var afternoonWorstState = CalculateWorstState(afternoonEntries);
|
||||||
|
|
||||||
Days.Add(new WeekDaySummaryViewModel
|
Days.Add(new WeekDaySummaryViewModel
|
||||||
{
|
{
|
||||||
Date = date,
|
Date = date,
|
||||||
DateText = DateHelper.ToGermanShortDay(date),
|
DateText = DateHelper.ToGermanShortDay(date),
|
||||||
MorningText = _aggregationService.ToDisplayText(morningAverage, _appearanceService),
|
MorningText = GetStateText(morningWorstState),
|
||||||
AfternoonText = _aggregationService.ToDisplayText(afternoonAverage, _appearanceService),
|
AfternoonText = GetStateText(afternoonWorstState),
|
||||||
MorningColor = _appearanceService.GetColor(morningAverage.State.ToAppearanceColorKey(), "#1F242B"),
|
MorningColor = GetStateColor(morningWorstState),
|
||||||
AfternoonColor = _appearanceService.GetColor(afternoonAverage.State.ToAppearanceColorKey(), "#1F242B"),
|
AfternoonColor = GetStateColor(afternoonWorstState),
|
||||||
ActivitiesText = _aggregationService.BuildDistinctActivityText(dayEntries, activityMap),
|
ActivitiesText = _aggregationService.BuildDistinctActivityText(dayEntries, activityMap),
|
||||||
SymptomsText = _aggregationService.BuildDistinctSymptomText(dayEntries, symptomsMap)
|
SymptomsText = _aggregationService.BuildDistinctSymptomText(dayEntries, symptomsMap)
|
||||||
});
|
});
|
||||||
@@ -137,6 +140,7 @@ public partial class WeekViewModel : ObservableObject
|
|||||||
_calendarStateService.SelectedDate = SelectedDate;
|
_calendarStateService.SelectedDate = SelectedDate;
|
||||||
await RefreshAsync();
|
await RefreshAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task TodayAsync()
|
private async Task TodayAsync()
|
||||||
{
|
{
|
||||||
var today = DateTime.Today;
|
var today = DateTime.Today;
|
||||||
@@ -153,4 +157,37 @@ public partial class WeekViewModel : ObservableObject
|
|||||||
await RefreshAsync();
|
await RefreshAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetStateText(HealthState? state) => state switch
|
||||||
|
{
|
||||||
|
HealthState.Green => _appearanceService.GetText(AppearanceKeys.StatusGreenText, "Grün"),
|
||||||
|
HealthState.Yellow => _appearanceService.GetText(AppearanceKeys.StatusYellowText, "Gelb"),
|
||||||
|
HealthState.Red => _appearanceService.GetText(AppearanceKeys.StatusRedText, "Rot"),
|
||||||
|
HealthState.Gray => _appearanceService.GetText(AppearanceKeys.StatusGrayText, "Schwarz"),
|
||||||
|
_ => "-"
|
||||||
|
};
|
||||||
|
|
||||||
|
private Color GetStateColor(HealthState? state)
|
||||||
|
{
|
||||||
|
return state.HasValue
|
||||||
|
? _appearanceService.GetColor(state.Value.ToAppearanceColorKey(), "#1F242B")
|
||||||
|
: Colors.Transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HealthState? CalculateWorstState(IReadOnlyCollection<HealthEntry> entries)
|
||||||
|
{
|
||||||
|
if (entries.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Gray))
|
||||||
|
return HealthState.Gray;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Red))
|
||||||
|
return HealthState.Red;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Yellow))
|
||||||
|
return HealthState.Yellow;
|
||||||
|
|
||||||
|
return HealthState.Green;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+42
-12
@@ -1,11 +1,11 @@
|
|||||||
using cfs_tracker.Data;
|
using cfs_tracker.Data;
|
||||||
using cfs_tracker.Helpers;
|
using cfs_tracker.Helpers;
|
||||||
|
using cfs_tracker.Models;
|
||||||
using cfs_tracker.Services;
|
using cfs_tracker.Services;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using Microsoft.Maui.ApplicationModel;
|
using Microsoft.Maui.ApplicationModel;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace cfs_tracker.ViewModels;
|
namespace cfs_tracker.ViewModels;
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ public partial class YearViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
private readonly HealthEntryRepository _healthEntryRepository;
|
private readonly HealthEntryRepository _healthEntryRepository;
|
||||||
private readonly AppearanceService _appearanceService;
|
private readonly AppearanceService _appearanceService;
|
||||||
private readonly AggregationService _aggregationService;
|
|
||||||
private readonly CalendarStateService _calendarStateService;
|
private readonly CalendarStateService _calendarStateService;
|
||||||
private readonly IPdfExportService _pdfExportService;
|
private readonly IPdfExportService _pdfExportService;
|
||||||
|
|
||||||
@@ -34,13 +33,11 @@ public partial class YearViewModel : ObservableObject
|
|||||||
public YearViewModel(
|
public YearViewModel(
|
||||||
HealthEntryRepository healthEntryRepository,
|
HealthEntryRepository healthEntryRepository,
|
||||||
AppearanceService appearanceService,
|
AppearanceService appearanceService,
|
||||||
AggregationService aggregationService,
|
|
||||||
CalendarStateService calendarStateService,
|
CalendarStateService calendarStateService,
|
||||||
IPdfExportService pdfExportService)
|
IPdfExportService pdfExportService)
|
||||||
{
|
{
|
||||||
_healthEntryRepository = healthEntryRepository;
|
_healthEntryRepository = healthEntryRepository;
|
||||||
_appearanceService = appearanceService;
|
_appearanceService = appearanceService;
|
||||||
_aggregationService = aggregationService;
|
|
||||||
_calendarStateService = calendarStateService;
|
_calendarStateService = calendarStateService;
|
||||||
_pdfExportService = pdfExportService;
|
_pdfExportService = pdfExportService;
|
||||||
|
|
||||||
@@ -78,7 +75,7 @@ public partial class YearViewModel : ObservableObject
|
|||||||
|
|
||||||
var section = new MonthSectionViewModel
|
var section = new MonthSectionViewModel
|
||||||
{
|
{
|
||||||
Title = DateHelper.ToGermanMonthYear(monthStart)
|
Title = monthStart.ToString("MMMM")
|
||||||
};
|
};
|
||||||
|
|
||||||
var leadingEmptyCells = GetMondayBasedColumnIndex(monthStart.DayOfWeek);
|
var leadingEmptyCells = GetMondayBasedColumnIndex(monthStart.DayOfWeek);
|
||||||
@@ -89,7 +86,7 @@ public partial class YearViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
var date = new DateTime(monthStart.Year, monthStart.Month, day);
|
var date = new DateTime(monthStart.Year, monthStart.Month, day);
|
||||||
var dayEntries = entries.Where(x => x.EntryDate.Date == date.Date).ToList();
|
var dayEntries = entries.Where(x => x.EntryDate.Date == date.Date).ToList();
|
||||||
var average = _aggregationService.CalculateAverage(dayEntries);
|
var worstState = CalculateWorstState(dayEntries);
|
||||||
|
|
||||||
section.Cells.Add(new MonthCellViewModel
|
section.Cells.Add(new MonthCellViewModel
|
||||||
{
|
{
|
||||||
@@ -98,9 +95,8 @@ public partial class YearViewModel : ObservableObject
|
|||||||
IsCurrentMonth = true,
|
IsCurrentMonth = true,
|
||||||
IsToday = date.Date == DateTime.Today,
|
IsToday = date.Date == DateTime.Today,
|
||||||
HasEntries = dayEntries.Count > 0,
|
HasEntries = dayEntries.Count > 0,
|
||||||
AverageStateText = _aggregationService.ToDisplayText(average, _appearanceService),
|
BackgroundColor = GetCellBackgroundColor(worstState),
|
||||||
StateColor = _appearanceService.GetColor(average.State.ToAppearanceColorKey(), "#1F242B"),
|
TextColor = GetCellTextColor(worstState),
|
||||||
TextColor = _appearanceService.GetColor(AppearanceKeys.TextPrimary, "#DCE7F3"),
|
|
||||||
BorderColor = date.Date == DateTime.Today
|
BorderColor = date.Date == DateTime.Today
|
||||||
? _appearanceService.GetColor(AppearanceKeys.StateYellow, "#B89A42")
|
? _appearanceService.GetColor(AppearanceKeys.StateYellow, "#B89A42")
|
||||||
: _appearanceService.GetColor(AppearanceKeys.Border, "#2A3E55")
|
: _appearanceService.GetColor(AppearanceKeys.Border, "#2A3E55")
|
||||||
@@ -116,7 +112,7 @@ public partial class YearViewModel : ObservableObject
|
|||||||
|
|
||||||
private void UpdateHeader()
|
private void UpdateHeader()
|
||||||
{
|
{
|
||||||
HeaderText = DateHelper.ToGermanYear(SelectedDate);
|
HeaderText = SelectedDate.Year.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OpenDayAsync(MonthCellViewModel? item)
|
private async Task OpenDayAsync(MonthCellViewModel? item)
|
||||||
@@ -166,11 +162,46 @@ public partial class YearViewModel : ObservableObject
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Color GetCellBackgroundColor(HealthState? state) => state switch
|
||||||
|
{
|
||||||
|
HealthState.Green => _appearanceService.GetColor(AppearanceKeys.StateGreen, "#4E8B69"),
|
||||||
|
HealthState.Yellow => _appearanceService.GetColor(AppearanceKeys.StateYellow, "#B89A42"),
|
||||||
|
HealthState.Red => _appearanceService.GetColor(AppearanceKeys.StateRed, "#A85C5C"),
|
||||||
|
HealthState.Gray => _appearanceService.GetColor(AppearanceKeys.StateGray, "#1F242B"),
|
||||||
|
_ => _appearanceService.GetColor(AppearanceKeys.SurfaceBackgroundAlt, "#1F242B")
|
||||||
|
};
|
||||||
|
|
||||||
|
private Color GetCellTextColor(HealthState? state) => state switch
|
||||||
|
{
|
||||||
|
HealthState.Yellow => Colors.Black,
|
||||||
|
HealthState.Green => Colors.White,
|
||||||
|
HealthState.Red => Colors.White,
|
||||||
|
HealthState.Gray => Colors.White,
|
||||||
|
_ => _appearanceService.GetColor(AppearanceKeys.TextPrimary, "#DCE7F3")
|
||||||
|
};
|
||||||
|
|
||||||
private static int GetMondayBasedColumnIndex(DayOfWeek dayOfWeek)
|
private static int GetMondayBasedColumnIndex(DayOfWeek dayOfWeek)
|
||||||
{
|
{
|
||||||
return dayOfWeek == DayOfWeek.Sunday ? 6 : ((int)dayOfWeek - 1);
|
return dayOfWeek == DayOfWeek.Sunday ? 6 : ((int)dayOfWeek - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HealthState? CalculateWorstState(IReadOnlyCollection<HealthEntry> entries)
|
||||||
|
{
|
||||||
|
if (entries.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Gray))
|
||||||
|
return HealthState.Gray;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Red))
|
||||||
|
return HealthState.Red;
|
||||||
|
|
||||||
|
if (entries.Any(x => x.State == HealthState.Yellow))
|
||||||
|
return HealthState.Yellow;
|
||||||
|
|
||||||
|
return HealthState.Green;
|
||||||
|
}
|
||||||
|
|
||||||
private static MonthCellViewModel CreatePlaceholderCell()
|
private static MonthCellViewModel CreatePlaceholderCell()
|
||||||
{
|
{
|
||||||
return new MonthCellViewModel
|
return new MonthCellViewModel
|
||||||
@@ -180,8 +211,7 @@ public partial class YearViewModel : ObservableObject
|
|||||||
IsCurrentMonth = false,
|
IsCurrentMonth = false,
|
||||||
IsToday = false,
|
IsToday = false,
|
||||||
HasEntries = false,
|
HasEntries = false,
|
||||||
AverageStateText = string.Empty,
|
BackgroundColor = Colors.Transparent,
|
||||||
StateColor = Colors.Transparent,
|
|
||||||
TextColor = Colors.Transparent,
|
TextColor = Colors.Transparent,
|
||||||
BorderColor = Colors.Transparent
|
BorderColor = Colors.Transparent
|
||||||
};
|
};
|
||||||
|
|||||||
+81
-87
@@ -8,96 +8,90 @@
|
|||||||
Title="Monat"
|
Title="Monat"
|
||||||
BackgroundColor="{DynamicResource AppBackground}">
|
BackgroundColor="{DynamicResource AppBackground}">
|
||||||
|
|
||||||
<ScrollView>
|
<Grid RowDefinitions="Auto,Auto,Auto,*"
|
||||||
<VerticalStackLayout Padding="16" Spacing="16">
|
Padding="16"
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto"
|
RowSpacing="12">
|
||||||
VerticalOptions="Center">
|
|
||||||
<Button Text="←"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding PreviousMonthCommand}" />
|
|
||||||
<Label Grid.Column="1"
|
|
||||||
Text="{Binding HeaderText}"
|
|
||||||
HorizontalTextAlignment="Center"
|
|
||||||
VerticalTextAlignment="Center"
|
|
||||||
FontSize="20"
|
|
||||||
FontAttributes="Bold"
|
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
|
||||||
<Button Grid.Column="2"
|
|
||||||
Text="→"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding NextMonthCommand}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*"
|
<Grid Grid.Row="0"
|
||||||
ColumnSpacing="12">
|
ColumnDefinitions="Auto,*,Auto"
|
||||||
<Button Text="Heute"
|
ColumnSpacing="12">
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
<Button Text="◀"
|
||||||
Command="{Binding TodayCommand}" />
|
Command="{Binding PreviousMonthCommand}"
|
||||||
<Button Grid.Column="1"
|
Style="{StaticResource SecondaryButtonStyle}" />
|
||||||
Text="Export"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding ExportPdfCommand}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
<Label Grid.Column="1"
|
||||||
ColumnSpacing="4">
|
Text="{Binding HeaderText}"
|
||||||
<Label Text="Mo" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
HorizontalTextAlignment="Center"
|
||||||
<Label Grid.Column="1" Text="Di" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
VerticalTextAlignment="Center"
|
||||||
<Label Grid.Column="2" Text="Mi" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
FontSize="22"
|
||||||
<Label Grid.Column="3" Text="Do" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
FontAttributes="Bold"
|
||||||
<Label Grid.Column="4" Text="Fr" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
<Label Grid.Column="5" Text="Sa" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
|
||||||
<Label Grid.Column="6" Text="So" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<CollectionView ItemsSource="{Binding Cells}"
|
<Button Grid.Column="2"
|
||||||
SelectionMode="None">
|
Text="▶"
|
||||||
<CollectionView.ItemsLayout>
|
Command="{Binding NextMonthCommand}"
|
||||||
<GridItemsLayout Orientation="Vertical"
|
Style="{StaticResource SecondaryButtonStyle}" />
|
||||||
Span="7" />
|
</Grid>
|
||||||
</CollectionView.ItemsLayout>
|
|
||||||
<CollectionView.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
|
||||||
<Border Margin="2"
|
|
||||||
Padding="6"
|
|
||||||
Stroke="{Binding BorderColor}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}"
|
|
||||||
StrokeShape="RoundRectangle 10">
|
|
||||||
<Border.Triggers>
|
|
||||||
<DataTrigger TargetType="Border"
|
|
||||||
Binding="{Binding IsPlaceholder}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
|
||||||
<Setter Property="StrokeThickness" Value="0" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Border.Triggers>
|
|
||||||
|
|
||||||
<Border.GestureRecognizers>
|
<Grid Grid.Row="1"
|
||||||
<TapGestureRecognizer
|
ColumnDefinitions="*,*"
|
||||||
Command="{Binding Source={RelativeSource AncestorType={x:Type viewModels:MonthViewModel}}, Path=OpenDayCommand, x:DataType='viewModels:MonthViewModel'}"
|
ColumnSpacing="12">
|
||||||
CommandParameter="{Binding .}" />
|
<Button Text="Heute"
|
||||||
</Border.GestureRecognizers>
|
Command="{Binding TodayCommand}"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}" />
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Text="Export"
|
||||||
|
Command="{Binding ExportPdfCommand}"
|
||||||
|
Style="{StaticResource PrimaryButtonStyle}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<VerticalStackLayout Spacing="4">
|
<Grid Grid.Row="2"
|
||||||
<Label Text="{Binding DayNumberText}"
|
ColumnDefinitions="*,*,*,*,*,*,*"
|
||||||
IsVisible="{Binding ShowDayNumber}"
|
ColumnSpacing="6"
|
||||||
FontAttributes="Bold"
|
Padding="2,0">
|
||||||
TextColor="{Binding TextColor}" />
|
<Label Text="Mo" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Border Padding="4"
|
<Label Grid.Column="1" Text="Di" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
||||||
IsVisible="{Binding ShowAverage}"
|
<Label Grid.Column="2" Text="Mi" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
||||||
StrokeThickness="0"
|
<Label Grid.Column="3" Text="Do" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
||||||
StrokeShape="RoundRectangle 8"
|
<Label Grid.Column="4" Text="Fr" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
||||||
BackgroundColor="{Binding StateColor}">
|
<Label Grid.Column="5" Text="Sa" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Label Text="{Binding AverageStateText}"
|
<Label Grid.Column="6" Text="So" HorizontalTextAlignment="Center" TextColor="{DynamicResource TextMuted}" />
|
||||||
FontSize="11"
|
</Grid>
|
||||||
HorizontalTextAlignment="Center"
|
|
||||||
TextColor="White" />
|
<CollectionView Grid.Row="3"
|
||||||
</Border>
|
ItemsSource="{Binding Cells}"
|
||||||
</VerticalStackLayout>
|
SelectionMode="None">
|
||||||
</Border>
|
<CollectionView.ItemsLayout>
|
||||||
</DataTemplate>
|
<GridItemsLayout Orientation="Vertical"
|
||||||
</CollectionView.ItemTemplate>
|
Span="7"
|
||||||
</CollectionView>
|
VerticalItemSpacing="6"
|
||||||
</VerticalStackLayout>
|
HorizontalItemSpacing="6" />
|
||||||
</ScrollView>
|
</CollectionView.ItemsLayout>
|
||||||
|
|
||||||
|
<CollectionView.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
||||||
|
<Border Stroke="{Binding BorderColor}"
|
||||||
|
BackgroundColor="{Binding BackgroundColor}"
|
||||||
|
StrokeShape="RoundRectangle 10"
|
||||||
|
Padding="6"
|
||||||
|
MinimumHeightRequest="58">
|
||||||
|
<Border.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.OpenDayCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
</Border.GestureRecognizers>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Label Text="{Binding DayNumberText}"
|
||||||
|
IsVisible="{Binding ShowDayNumber}"
|
||||||
|
HorizontalTextAlignment="Center"
|
||||||
|
VerticalTextAlignment="Center"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
FontSize="15"
|
||||||
|
TextColor="{Binding TextColor}" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</CollectionView.ItemTemplate>
|
||||||
|
</CollectionView>
|
||||||
|
</Grid>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
+41
-10
@@ -154,8 +154,23 @@
|
|||||||
TextColor="{DynamicResource TextMuted}" />
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
ColumnSpacing="8">
|
ColumnSpacing="12">
|
||||||
<CheckBox IsChecked="{Binding NotificationVibrationEnabled}" />
|
<Button Text="{Binding NotificationVibrationButtonText}"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleNotificationVibrationCommand}"
|
||||||
|
VerticalOptions="Center">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding NotificationVibrationEnabled}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<VerticalStackLayout Grid.Column="1"
|
<VerticalStackLayout Grid.Column="1"
|
||||||
Spacing="2">
|
Spacing="2">
|
||||||
<Label Text="Vibration für Push-Nachrichten"
|
<Label Text="Vibration für Push-Nachrichten"
|
||||||
@@ -179,16 +194,26 @@
|
|||||||
Stroke="{DynamicResource Border}"
|
Stroke="{DynamicResource Border}"
|
||||||
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
||||||
<VerticalStackLayout Spacing="10">
|
<VerticalStackLayout Spacing="10">
|
||||||
<Grid ColumnDefinitions="*,Auto,Auto"
|
<Grid ColumnDefinitions="*,Auto"
|
||||||
ColumnSpacing="8">
|
ColumnSpacing="8">
|
||||||
<TimePicker Time="{Binding SelectedTime}" />
|
<TimePicker Time="{Binding SelectedTime}" />
|
||||||
<CheckBox Grid.Column="1"
|
|
||||||
IsChecked="{Binding IsEnabled}"
|
<Button Grid.Column="1"
|
||||||
VerticalOptions="Center" />
|
Text="{Binding IsEnabledButtonText}"
|
||||||
<Label Grid.Column="2"
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
Text="Aktiv"
|
Command="{Binding ToggleIsEnabledCommand}"
|
||||||
VerticalOptions="Center"
|
VerticalOptions="Center">
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding IsEnabled}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
||||||
@@ -207,6 +232,7 @@
|
|||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Button.Triggers>
|
</Button.Triggers>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Grid.Column="1"
|
<Button Grid.Column="1"
|
||||||
Text="Di"
|
Text="Di"
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
@@ -222,6 +248,7 @@
|
|||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Button.Triggers>
|
</Button.Triggers>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Grid.Column="2"
|
<Button Grid.Column="2"
|
||||||
Text="Mi"
|
Text="Mi"
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
@@ -237,6 +264,7 @@
|
|||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Button.Triggers>
|
</Button.Triggers>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Grid.Column="3"
|
<Button Grid.Column="3"
|
||||||
Text="Do"
|
Text="Do"
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
@@ -252,6 +280,7 @@
|
|||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Button.Triggers>
|
</Button.Triggers>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Grid.Column="4"
|
<Button Grid.Column="4"
|
||||||
Text="Fr"
|
Text="Fr"
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
@@ -267,6 +296,7 @@
|
|||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Button.Triggers>
|
</Button.Triggers>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Grid.Column="5"
|
<Button Grid.Column="5"
|
||||||
Text="Sa"
|
Text="Sa"
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
@@ -282,6 +312,7 @@
|
|||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Button.Triggers>
|
</Button.Triggers>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Grid.Column="6"
|
<Button Grid.Column="6"
|
||||||
Text="So"
|
Text="So"
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
|||||||
+79
-105
@@ -8,132 +8,106 @@
|
|||||||
Title="Jahr"
|
Title="Jahr"
|
||||||
BackgroundColor="{DynamicResource AppBackground}">
|
BackgroundColor="{DynamicResource AppBackground}">
|
||||||
|
|
||||||
<Grid Padding="16"
|
<Grid RowDefinitions="Auto,Auto,*"
|
||||||
RowSpacing="16"
|
Padding="16"
|
||||||
RowDefinitions="Auto,Auto,*">
|
RowSpacing="12">
|
||||||
|
|
||||||
|
<Grid Grid.Row="0"
|
||||||
|
ColumnDefinitions="Auto,*,Auto"
|
||||||
|
ColumnSpacing="12">
|
||||||
|
<Button Text="◀"
|
||||||
|
Command="{Binding PreviousYearCommand}"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}" />
|
||||||
|
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto"
|
|
||||||
VerticalOptions="Center">
|
|
||||||
<Button Text="←"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding PreviousYearCommand}" />
|
|
||||||
<Label Grid.Column="1"
|
<Label Grid.Column="1"
|
||||||
Text="{Binding HeaderText}"
|
Text="{Binding HeaderText}"
|
||||||
HorizontalTextAlignment="Center"
|
HorizontalTextAlignment="Center"
|
||||||
VerticalTextAlignment="Center"
|
VerticalTextAlignment="Center"
|
||||||
FontSize="20"
|
FontSize="22"
|
||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
<Button Grid.Column="2"
|
<Button Grid.Column="2"
|
||||||
Text="→"
|
Text="▶"
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
Command="{Binding NextYearCommand}"
|
||||||
Command="{Binding NextYearCommand}" />
|
Style="{StaticResource SecondaryButtonStyle}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="1"
|
<Grid Grid.Row="1"
|
||||||
ColumnDefinitions="*,*"
|
ColumnDefinitions="*,*"
|
||||||
ColumnSpacing="12">
|
ColumnSpacing="12">
|
||||||
<Button Text="Heute"
|
<Button Text="Heute"
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
Command="{Binding TodayCommand}"
|
||||||
Command="{Binding TodayCommand}" />
|
Style="{StaticResource SecondaryButtonStyle}" />
|
||||||
<Button Grid.Column="1"
|
<Button Grid.Column="1"
|
||||||
Text="Export"
|
Text="Export"
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
Command="{Binding ExportPdfCommand}"
|
||||||
Command="{Binding ExportPdfCommand}" />
|
Style="{StaticResource PrimaryButtonStyle}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<CollectionView Grid.Row="2"
|
<ScrollView Grid.Row="2">
|
||||||
ItemsSource="{Binding Months}"
|
<VerticalStackLayout BindableLayout.ItemsSource="{Binding Months}"
|
||||||
SelectionMode="None"
|
Spacing="14">
|
||||||
VerticalOptions="Fill"
|
<BindableLayout.ItemTemplate>
|
||||||
HorizontalOptions="Fill"
|
<DataTemplate x:DataType="viewModels:MonthSectionViewModel">
|
||||||
ItemSizingStrategy="MeasureAllItems">
|
<Border Stroke="{DynamicResource Border}"
|
||||||
<CollectionView.ItemTemplate>
|
BackgroundColor="{DynamicResource SurfaceBackground}"
|
||||||
<DataTemplate x:DataType="viewModels:MonthSectionViewModel">
|
StrokeShape="RoundRectangle 12"
|
||||||
<Border Padding="12"
|
Padding="10">
|
||||||
Margin="0,0,0,12"
|
<VerticalStackLayout Spacing="8">
|
||||||
Stroke="{DynamicResource Border}"
|
<Label Text="{Binding Title}"
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}"
|
FontSize="18"
|
||||||
StrokeShape="RoundRectangle 14">
|
FontAttributes="Bold"
|
||||||
<VerticalStackLayout Spacing="10">
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
<Label Text="{Binding Title}"
|
|
||||||
FontSize="18"
|
|
||||||
FontAttributes="Bold"
|
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
||||||
ColumnSpacing="4">
|
ColumnSpacing="4">
|
||||||
<Label Text="Mo" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
<Label Text="Mo" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Label Grid.Column="1" Text="Di" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
<Label Grid.Column="1" Text="Di" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Label Grid.Column="2" Text="Mi" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
<Label Grid.Column="2" Text="Mi" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Label Grid.Column="3" Text="Do" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
<Label Grid.Column="3" Text="Do" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Label Grid.Column="4" Text="Fr" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
<Label Grid.Column="4" Text="Fr" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Label Grid.Column="5" Text="Sa" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
<Label Grid.Column="5" Text="Sa" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
<Label Grid.Column="6" Text="So" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
<Label Grid.Column="6" Text="So" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<CollectionView ItemsSource="{Binding Cells}"
|
<CollectionView ItemsSource="{Binding Cells}"
|
||||||
SelectionMode="None"
|
SelectionMode="None">
|
||||||
ItemSizingStrategy="MeasureFirstItem">
|
<CollectionView.ItemsLayout>
|
||||||
<CollectionView.ItemsLayout>
|
<GridItemsLayout Orientation="Vertical"
|
||||||
<GridItemsLayout Orientation="Vertical"
|
Span="7"
|
||||||
Span="7" />
|
VerticalItemSpacing="4"
|
||||||
</CollectionView.ItemsLayout>
|
HorizontalItemSpacing="4" />
|
||||||
<CollectionView.ItemTemplate>
|
</CollectionView.ItemsLayout>
|
||||||
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
|
||||||
<Border Margin="2"
|
|
||||||
Padding="4"
|
|
||||||
WidthRequest="46"
|
|
||||||
HeightRequest="46"
|
|
||||||
Stroke="{Binding BorderColor}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}"
|
|
||||||
StrokeShape="RoundRectangle 8">
|
|
||||||
<Border.Triggers>
|
|
||||||
<DataTrigger TargetType="Border"
|
|
||||||
Binding="{Binding IsPlaceholder}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
|
||||||
<Setter Property="StrokeThickness" Value="0" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Border.Triggers>
|
|
||||||
|
|
||||||
<Border.GestureRecognizers>
|
<CollectionView.ItemTemplate>
|
||||||
<TapGestureRecognizer
|
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
||||||
Command="{Binding Source={RelativeSource AncestorType={x:Type viewModels:YearViewModel}}, Path=OpenDayCommand, x:DataType='viewModels:YearViewModel'}"
|
<Border Stroke="{Binding BorderColor}"
|
||||||
CommandParameter="{Binding .}" />
|
BackgroundColor="{Binding BackgroundColor}"
|
||||||
</Border.GestureRecognizers>
|
StrokeShape="RoundRectangle 8"
|
||||||
|
Padding="3"
|
||||||
|
MinimumHeightRequest="30">
|
||||||
|
<Border.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.OpenDayCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
</Border.GestureRecognizers>
|
||||||
|
|
||||||
<Grid RowDefinitions="Auto,*">
|
|
||||||
<Label Text="{Binding DayNumberText}"
|
<Label Text="{Binding DayNumberText}"
|
||||||
IsVisible="{Binding ShowDayNumber}"
|
IsVisible="{Binding ShowDayNumber}"
|
||||||
|
HorizontalTextAlignment="Center"
|
||||||
|
VerticalTextAlignment="Center"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
HorizontalTextAlignment="Center"
|
|
||||||
TextColor="{Binding TextColor}" />
|
TextColor="{Binding TextColor}" />
|
||||||
|
</Border>
|
||||||
<Border Grid.Row="1"
|
</DataTemplate>
|
||||||
IsVisible="{Binding ShowAverage}"
|
</CollectionView.ItemTemplate>
|
||||||
Margin="0,4,0,0"
|
</CollectionView>
|
||||||
Padding="2"
|
</VerticalStackLayout>
|
||||||
StrokeThickness="0"
|
</Border>
|
||||||
StrokeShape="RoundRectangle 5"
|
</DataTemplate>
|
||||||
BackgroundColor="{Binding StateColor}">
|
</BindableLayout.ItemTemplate>
|
||||||
<Label Text="{Binding AverageStateText}"
|
</VerticalStackLayout>
|
||||||
FontSize="9"
|
</ScrollView>
|
||||||
LineBreakMode="TailTruncation"
|
|
||||||
MaxLines="1"
|
|
||||||
HorizontalTextAlignment="Center"
|
|
||||||
TextColor="White" />
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</DataTemplate>
|
|
||||||
</CollectionView.ItemTemplate>
|
|
||||||
</CollectionView>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
</DataTemplate>
|
|
||||||
</CollectionView.ItemTemplate>
|
|
||||||
</CollectionView>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
Reference in New Issue
Block a user