Layout fixes and Push fixes
- Layout und Kalender angepasst - Push status meldung angepasst für Android
This commit is contained in:
+2
-1
@@ -4,8 +4,9 @@ using cfs_tracker.ViewModels;
|
|||||||
using cfs_tracker.Views;
|
using cfs_tracker.Views;
|
||||||
using SQLitePCL;
|
using SQLitePCL;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
#if DEBUG
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
#endif
|
||||||
namespace cfs_tracker;
|
namespace cfs_tracker;
|
||||||
|
|
||||||
public static class MauiProgram
|
public static class MauiProgram
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using cfs_tracker.Data;
|
|||||||
using cfs_tracker.Helpers;
|
using cfs_tracker.Helpers;
|
||||||
using cfs_tracker.Models;
|
using cfs_tracker.Models;
|
||||||
using cfs_tracker.Services;
|
using cfs_tracker.Services;
|
||||||
|
using Microsoft.Maui.ApplicationModel;
|
||||||
|
|
||||||
namespace cfs_tracker.Platforms.Android;
|
namespace cfs_tracker.Platforms.Android;
|
||||||
|
|
||||||
@@ -19,6 +20,10 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
private const string PrefRedLabel = "notification_label_red";
|
private const string PrefRedLabel = "notification_label_red";
|
||||||
private const string PrefGrayLabel = "notification_label_gray";
|
private const string PrefGrayLabel = "notification_label_gray";
|
||||||
|
|
||||||
|
public const string ActionShowNotification = "cfs_tracker.action.SHOW_NOTIFICATION";
|
||||||
|
public const string ActionSaveStatus = "cfs_tracker.action.SAVE_STATUS";
|
||||||
|
public const string ActionOpenQuickEntry = "cfs_tracker.action.OPEN_QUICK_ENTRY";
|
||||||
|
|
||||||
public const string ExtraScheduleId = "schedule_id";
|
public const string ExtraScheduleId = "schedule_id";
|
||||||
public const string ExtraDayOfWeek = "day_of_week";
|
public const string ExtraDayOfWeek = "day_of_week";
|
||||||
public const string ExtraHour = "hour";
|
public const string ExtraHour = "hour";
|
||||||
@@ -28,6 +33,7 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
public const string ExtraDate = "date";
|
public const string ExtraDate = "date";
|
||||||
public const string ExtraStatus = "status";
|
public const string ExtraStatus = "status";
|
||||||
public const string ExtraCommit = "commit";
|
public const string ExtraCommit = "commit";
|
||||||
|
public const string ExtraNotificationId = "notification_id";
|
||||||
|
|
||||||
private readonly NotificationScheduleRepository _notificationScheduleRepository;
|
private readonly NotificationScheduleRepository _notificationScheduleRepository;
|
||||||
private readonly AppearanceService _appearanceService;
|
private readonly AppearanceService _appearanceService;
|
||||||
@@ -42,8 +48,12 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
|
|
||||||
public async Task<bool> EnsurePermissionAsync()
|
public async Task<bool> EnsurePermissionAsync()
|
||||||
{
|
{
|
||||||
var permission = await Permissions.RequestAsync<NotificationPermission>();
|
var status = await Permissions.CheckStatusAsync<NotificationPermission>();
|
||||||
return permission == PermissionStatus.Granted;
|
if (status == PermissionStatus.Granted)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
status = await Permissions.RequestAsync<NotificationPermission>();
|
||||||
|
return status == PermissionStatus.Granted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SyncAsync()
|
public async Task SyncAsync()
|
||||||
@@ -51,12 +61,13 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
var context = Platform.AppContext;
|
var context = Platform.AppContext;
|
||||||
EnsureChannel(context);
|
EnsureChannel(context);
|
||||||
|
|
||||||
|
CancelAllScheduled(context);
|
||||||
|
|
||||||
var granted = await EnsurePermissionAsync();
|
var granted = await EnsurePermissionAsync();
|
||||||
if (!granted)
|
if (!granted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SaveActionLabelsToPreferences();
|
SaveActionLabelsToPreferences();
|
||||||
CancelAllScheduled(context);
|
|
||||||
|
|
||||||
var schedules = await _notificationScheduleRepository.GetAllAsync();
|
var schedules = await _notificationScheduleRepository.GetAllAsync();
|
||||||
var requestKeys = new List<string>();
|
var requestKeys = new List<string>();
|
||||||
@@ -101,6 +112,7 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var intent = new Intent(context, typeof(CfsNotificationReceiver));
|
var intent = new Intent(context, typeof(CfsNotificationReceiver));
|
||||||
|
intent.SetAction(ActionShowNotification);
|
||||||
intent.PutExtra(ExtraScheduleId, scheduleId);
|
intent.PutExtra(ExtraScheduleId, scheduleId);
|
||||||
intent.PutExtra(ExtraDayOfWeek, (int)dayOfWeek);
|
intent.PutExtra(ExtraDayOfWeek, (int)dayOfWeek);
|
||||||
intent.PutExtra(ExtraHour, hour);
|
intent.PutExtra(ExtraHour, hour);
|
||||||
@@ -125,41 +137,20 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
internal static void ShowNotification(
|
internal static void ShowNotification(
|
||||||
Context context,
|
Context context,
|
||||||
int scheduleId,
|
int scheduleId,
|
||||||
|
DayOfWeek dayOfWeek,
|
||||||
string title,
|
string title,
|
||||||
string message)
|
string message)
|
||||||
{
|
{
|
||||||
EnsureChannel(context);
|
EnsureChannel(context);
|
||||||
|
|
||||||
var today = DateTime.Today.ToString("yyyy-MM-dd");
|
var today = DateTime.Today;
|
||||||
|
var todayText = today.ToString("yyyy-MM-dd");
|
||||||
|
var notificationId = BuildNotificationId(scheduleId, dayOfWeek);
|
||||||
|
|
||||||
var openQuickEntryIntent = BuildLaunchIntent(context, today, null, false);
|
var openPendingIntent = CreateOpenQuickEntryPendingIntent(context, notificationId, todayText);
|
||||||
var yellowIntent = BuildLaunchIntent(context, today, "yellow", true);
|
var yellowPendingIntent = CreateSaveStatusPendingIntent(context, notificationId, "yellow", todayText);
|
||||||
var redIntent = BuildLaunchIntent(context, today, "red", true);
|
var redPendingIntent = CreateSaveStatusPendingIntent(context, notificationId, "red", todayText);
|
||||||
var grayIntent = BuildLaunchIntent(context, today, "gray", true);
|
var grayPendingIntent = CreateSaveStatusPendingIntent(context, notificationId, "gray", todayText);
|
||||||
|
|
||||||
var openPendingIntent = PendingIntent.GetActivity(
|
|
||||||
context,
|
|
||||||
scheduleId * 10 + 1,
|
|
||||||
openQuickEntryIntent,
|
|
||||||
BuildPendingIntentFlags());
|
|
||||||
|
|
||||||
var yellowPendingIntent = PendingIntent.GetActivity(
|
|
||||||
context,
|
|
||||||
scheduleId * 10 + 2,
|
|
||||||
yellowIntent,
|
|
||||||
BuildPendingIntentFlags());
|
|
||||||
|
|
||||||
var redPendingIntent = PendingIntent.GetActivity(
|
|
||||||
context,
|
|
||||||
scheduleId * 10 + 3,
|
|
||||||
redIntent,
|
|
||||||
BuildPendingIntentFlags());
|
|
||||||
|
|
||||||
var grayPendingIntent = PendingIntent.GetActivity(
|
|
||||||
context,
|
|
||||||
scheduleId * 10 + 4,
|
|
||||||
grayIntent,
|
|
||||||
BuildPendingIntentFlags());
|
|
||||||
|
|
||||||
var yellowLabel = Preferences.Default.Get(PrefYellowLabel, "Gelb");
|
var yellowLabel = Preferences.Default.Get(PrefYellowLabel, "Gelb");
|
||||||
var redLabel = Preferences.Default.Get(PrefRedLabel, "Rot");
|
var redLabel = Preferences.Default.Get(PrefRedLabel, "Rot");
|
||||||
@@ -174,28 +165,45 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
.SetPriority((int)NotificationPriority.High)
|
.SetPriority((int)NotificationPriority.High)
|
||||||
.SetAutoCancel(true)
|
.SetAutoCancel(true)
|
||||||
.SetContentIntent(openPendingIntent)
|
.SetContentIntent(openPendingIntent)
|
||||||
|
.SetOnlyAlertOnce(true)
|
||||||
.AddAction(0, yellowLabel, yellowPendingIntent)
|
.AddAction(0, yellowLabel, yellowPendingIntent)
|
||||||
.AddAction(0, redLabel, redPendingIntent)
|
.AddAction(0, redLabel, redPendingIntent)
|
||||||
.AddAction(0, grayLabel, grayPendingIntent);
|
.AddAction(0, grayLabel, grayPendingIntent);
|
||||||
|
|
||||||
NotificationManagerCompat.From(context).Notify(scheduleId, builder.Build());
|
NotificationManagerCompat.From(context).Notify(notificationId, builder.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Intent BuildLaunchIntent(Context context, string date, string? status, bool commit)
|
private static PendingIntent CreateOpenQuickEntryPendingIntent(Context context, int notificationId, string date)
|
||||||
{
|
{
|
||||||
var launchIntent = context.PackageManager?.GetLaunchIntentForPackage(context.PackageName)
|
var launchIntent = context.PackageManager?.GetLaunchIntentForPackage(context.PackageName)
|
||||||
?? new Intent(context, typeof(MainActivity));
|
?? new Intent(context, typeof(MainActivity));
|
||||||
|
|
||||||
|
launchIntent.SetAction(ActionOpenQuickEntry);
|
||||||
launchIntent.AddFlags(ActivityFlags.SingleTop | ActivityFlags.ClearTop | ActivityFlags.NewTask);
|
launchIntent.AddFlags(ActivityFlags.SingleTop | ActivityFlags.ClearTop | ActivityFlags.NewTask);
|
||||||
launchIntent.PutExtra(ExtraRoute, "quickentry");
|
launchIntent.PutExtra(ExtraRoute, "quickentry");
|
||||||
launchIntent.PutExtra(ExtraDate, date);
|
launchIntent.PutExtra(ExtraDate, date);
|
||||||
|
launchIntent.PutExtra(ExtraNotificationId, notificationId);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(status))
|
return PendingIntent.GetActivity(
|
||||||
launchIntent.PutExtra(ExtraStatus, status);
|
context,
|
||||||
|
100000 + notificationId,
|
||||||
|
launchIntent,
|
||||||
|
BuildPendingIntentFlags());
|
||||||
|
}
|
||||||
|
|
||||||
launchIntent.PutExtra(ExtraCommit, commit);
|
private static PendingIntent CreateSaveStatusPendingIntent(Context context, int notificationId, string status, string date)
|
||||||
|
{
|
||||||
|
var intent = new Intent(context, typeof(CfsNotificationReceiver));
|
||||||
|
intent.SetAction(ActionSaveStatus);
|
||||||
|
intent.PutExtra(ExtraStatus, status);
|
||||||
|
intent.PutExtra(ExtraDate, date);
|
||||||
|
intent.PutExtra(ExtraNotificationId, notificationId);
|
||||||
|
|
||||||
return launchIntent;
|
return PendingIntent.GetBroadcast(
|
||||||
|
context,
|
||||||
|
BuildActionRequestCode(notificationId, status),
|
||||||
|
intent,
|
||||||
|
BuildPendingIntentFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void EnsureChannel(Context context)
|
internal static void EnsureChannel(Context context)
|
||||||
@@ -241,6 +249,8 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
var requestCode = BuildAlarmRequestCode(scheduleId, day);
|
var requestCode = BuildAlarmRequestCode(scheduleId, day);
|
||||||
|
|
||||||
var intent = new Intent(context, typeof(CfsNotificationReceiver));
|
var intent = new Intent(context, typeof(CfsNotificationReceiver));
|
||||||
|
intent.SetAction(ActionShowNotification);
|
||||||
|
|
||||||
var pendingIntent = PendingIntent.GetBroadcast(
|
var pendingIntent = PendingIntent.GetBroadcast(
|
||||||
context,
|
context,
|
||||||
requestCode,
|
requestCode,
|
||||||
@@ -248,7 +258,7 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
BuildPendingIntentFlags());
|
BuildPendingIntentFlags());
|
||||||
|
|
||||||
alarmManager.Cancel(pendingIntent);
|
alarmManager.Cancel(pendingIntent);
|
||||||
NotificationManagerCompat.From(context).Cancel(scheduleId);
|
NotificationManagerCompat.From(context).Cancel(BuildNotificationId(scheduleId, day));
|
||||||
}
|
}
|
||||||
|
|
||||||
Preferences.Default.Remove(PrefScheduledIds);
|
Preferences.Default.Remove(PrefScheduledIds);
|
||||||
@@ -282,6 +292,22 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
|
|||||||
return scheduleId * 10 + (int)day;
|
return scheduleId * 10 + (int)day;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int BuildNotificationId(int scheduleId, DayOfWeek day)
|
||||||
|
{
|
||||||
|
return 500000 + scheduleId * 10 + (int)day;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int BuildActionRequestCode(int notificationId, string status)
|
||||||
|
{
|
||||||
|
return status switch
|
||||||
|
{
|
||||||
|
"yellow" => 600000 + notificationId * 10 + 1,
|
||||||
|
"red" => 600000 + notificationId * 10 + 2,
|
||||||
|
"gray" => 600000 + notificationId * 10 + 3,
|
||||||
|
_ => 600000 + notificationId * 10
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private static IEnumerable<DayOfWeek> GetScheduledDays(int mask)
|
private static IEnumerable<DayOfWeek> GetScheduledDays(int mask)
|
||||||
{
|
{
|
||||||
var flags = (NotificationWeekdays)mask;
|
var flags = (NotificationWeekdays)mask;
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
using Android.Content;
|
using Android.Content;
|
||||||
|
using AndroidX.Core.App;
|
||||||
|
using cfs_tracker.Data;
|
||||||
|
using cfs_tracker.Models;
|
||||||
|
using Microsoft.Maui;
|
||||||
|
|
||||||
namespace cfs_tracker.Platforms.Android;
|
namespace cfs_tracker.Platforms.Android;
|
||||||
|
|
||||||
@@ -10,6 +14,20 @@ public sealed class CfsNotificationReceiver : BroadcastReceiver
|
|||||||
if (context is null || intent is null)
|
if (context is null || intent is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
switch (intent.Action)
|
||||||
|
{
|
||||||
|
case AndroidNotificationScheduler.ActionShowNotification:
|
||||||
|
HandleAlarmTriggered(context, intent);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AndroidNotificationScheduler.ActionSaveStatus:
|
||||||
|
HandleSaveStatus(context, intent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void HandleAlarmTriggered(Context context, Intent intent)
|
||||||
|
{
|
||||||
var scheduleId = intent.GetIntExtra(AndroidNotificationScheduler.ExtraScheduleId, 0);
|
var scheduleId = intent.GetIntExtra(AndroidNotificationScheduler.ExtraScheduleId, 0);
|
||||||
var dayOfWeek = (DayOfWeek)intent.GetIntExtra(AndroidNotificationScheduler.ExtraDayOfWeek, (int)DayOfWeek.Monday);
|
var dayOfWeek = (DayOfWeek)intent.GetIntExtra(AndroidNotificationScheduler.ExtraDayOfWeek, (int)DayOfWeek.Monday);
|
||||||
var hour = intent.GetIntExtra(AndroidNotificationScheduler.ExtraHour, 9);
|
var hour = intent.GetIntExtra(AndroidNotificationScheduler.ExtraHour, 9);
|
||||||
@@ -18,6 +36,7 @@ public sealed class CfsNotificationReceiver : BroadcastReceiver
|
|||||||
AndroidNotificationScheduler.ShowNotification(
|
AndroidNotificationScheduler.ShowNotification(
|
||||||
context,
|
context,
|
||||||
scheduleId,
|
scheduleId,
|
||||||
|
dayOfWeek,
|
||||||
"Wie geht es dir?",
|
"Wie geht es dir?",
|
||||||
"Tippe, um deinen Status einzutragen.");
|
"Tippe, um deinen Status einzutragen.");
|
||||||
|
|
||||||
@@ -28,4 +47,74 @@ public sealed class CfsNotificationReceiver : BroadcastReceiver
|
|||||||
hour,
|
hour,
|
||||||
minute);
|
minute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleSaveStatus(Context context, Intent intent)
|
||||||
|
{
|
||||||
|
var pendingResult = GoAsync();
|
||||||
|
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var statusText = intent.GetStringExtra(AndroidNotificationScheduler.ExtraStatus) ?? string.Empty;
|
||||||
|
var notificationId = intent.GetIntExtra(AndroidNotificationScheduler.ExtraNotificationId, 0);
|
||||||
|
|
||||||
|
if (!TryParseState(statusText, out var state))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var services = IPlatformApplication.Current?.Services;
|
||||||
|
var repository = services?.GetService(typeof(HealthEntryRepository)) as HealthEntryRepository;
|
||||||
|
|
||||||
|
if (repository is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
await repository.AddQuickEntryAsync(
|
||||||
|
state: state,
|
||||||
|
activityId: null,
|
||||||
|
activityDurationMinutes: null,
|
||||||
|
symptomIds: null,
|
||||||
|
timestamp: DateTime.Now,
|
||||||
|
source: EntrySource.App);
|
||||||
|
|
||||||
|
NotificationManagerCompat.From(context).Cancel(notificationId);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
pendingResult.Finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool TryParseState(string? value, out HealthState state)
|
||||||
|
{
|
||||||
|
switch ((value ?? string.Empty).Trim().ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "green":
|
||||||
|
case "gruen":
|
||||||
|
case "grün":
|
||||||
|
state = HealthState.Green;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case "yellow":
|
||||||
|
case "gelb":
|
||||||
|
state = HealthState.Yellow;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case "red":
|
||||||
|
case "rot":
|
||||||
|
state = HealthState.Red;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case "gray":
|
||||||
|
case "grey":
|
||||||
|
case "grau":
|
||||||
|
case "schwarz":
|
||||||
|
state = HealthState.Gray;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
state = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Android.App;
|
using Android.App;
|
||||||
|
using Android.Content;
|
||||||
using Android.Content.PM;
|
using Android.Content.PM;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using cfs_tracker.Services;
|
using cfs_tracker.Services;
|
||||||
@@ -23,25 +24,26 @@ public class MainActivity : MauiAppCompatActivity
|
|||||||
HandleNotificationIntent(Intent);
|
HandleNotificationIntent(Intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNewIntent(Android.Content.Intent? intent)
|
protected override void OnNewIntent(Intent? intent)
|
||||||
{
|
{
|
||||||
base.OnNewIntent(intent);
|
base.OnNewIntent(intent);
|
||||||
if (intent is not null)
|
if (intent is not null)
|
||||||
HandleNotificationIntent(intent);
|
HandleNotificationIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleNotificationIntent(Android.Content.Intent? intent)
|
private static void HandleNotificationIntent(Intent? intent)
|
||||||
{
|
{
|
||||||
if (intent is null)
|
if (intent is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!string.Equals(intent.Action, Platforms.Android.AndroidNotificationScheduler.ActionOpenQuickEntry, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return;
|
||||||
|
|
||||||
var route = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraRoute);
|
var route = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraRoute);
|
||||||
if (!string.Equals(route, "quickentry", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(route, "quickentry", StringComparison.OrdinalIgnoreCase))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var dateText = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraDate);
|
var dateText = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraDate);
|
||||||
var status = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraStatus);
|
|
||||||
var commit = intent.GetBooleanExtra(Platforms.Android.AndroidNotificationScheduler.ExtraCommit, false);
|
|
||||||
|
|
||||||
if (!DateTime.TryParse(dateText, out var date))
|
if (!DateTime.TryParse(dateText, out var date))
|
||||||
date = DateTime.Today;
|
date = DateTime.Today;
|
||||||
@@ -51,7 +53,13 @@ public class MainActivity : MauiAppCompatActivity
|
|||||||
if (navigator is null)
|
if (navigator is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
navigator.QueueQuickEntry(date, status, commit);
|
navigator.QueueQuickEntry(date);
|
||||||
_ = navigator.FlushAsync();
|
_ = navigator.FlushAsync();
|
||||||
|
|
||||||
|
intent.SetAction(string.Empty);
|
||||||
|
intent.RemoveExtra(Platforms.Android.AndroidNotificationScheduler.ExtraRoute);
|
||||||
|
intent.RemoveExtra(Platforms.Android.AndroidNotificationScheduler.ExtraDate);
|
||||||
|
intent.RemoveExtra(Platforms.Android.AndroidNotificationScheduler.ExtraStatus);
|
||||||
|
intent.RemoveExtra(Platforms.Android.AndroidNotificationScheduler.ExtraCommit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using Android;
|
using Android;
|
||||||
|
using Microsoft.Maui.ApplicationModel;
|
||||||
|
|
||||||
namespace cfs_tracker.Platforms.Android;
|
namespace cfs_tracker.Platforms.Android;
|
||||||
|
|
||||||
public class NotificationPermission : Permissions.BasePlatformPermission
|
public sealed class NotificationPermission : Permissions.BasePlatformPermission
|
||||||
{
|
{
|
||||||
public override (string androidPermission, bool isRuntime)[] RequiredPermissions
|
public override (string androidPermission, bool isRuntime)[] RequiredPermissions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,25 +17,34 @@ public sealed class NotificationNavigationService
|
|||||||
|
|
||||||
public async Task FlushAsync()
|
public async Task FlushAsync()
|
||||||
{
|
{
|
||||||
if (Shell.Current is null || string.IsNullOrWhiteSpace(_pendingDate))
|
if (string.IsNullOrWhiteSpace(_pendingDate))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var date = _pendingDate;
|
for (var attempt = 0; attempt < 20; attempt++)
|
||||||
var status = _pendingStatus;
|
{
|
||||||
var commit = _pendingCommit;
|
if (Shell.Current is not null)
|
||||||
|
{
|
||||||
|
var date = _pendingDate!;
|
||||||
|
var status = _pendingStatus;
|
||||||
|
var commit = _pendingCommit;
|
||||||
|
|
||||||
_pendingDate = null;
|
_pendingDate = null;
|
||||||
_pendingStatus = null;
|
_pendingStatus = null;
|
||||||
_pendingCommit = false;
|
_pendingCommit = false;
|
||||||
|
|
||||||
var route = $"{nameof(QuickEntryPage)}?date={Uri.EscapeDataString(date)}";
|
var route = $"{nameof(QuickEntryPage)}?date={Uri.EscapeDataString(date)}";
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(status))
|
if (!string.IsNullOrWhiteSpace(status))
|
||||||
route += $"&status={Uri.EscapeDataString(status)}";
|
route += $"&status={Uri.EscapeDataString(status)}";
|
||||||
|
|
||||||
if (commit)
|
if (commit)
|
||||||
route += "&commit=true";
|
route += "&commit=true";
|
||||||
|
|
||||||
await MainThread.InvokeOnMainThreadAsync(() => Shell.Current.GoToAsync(route));
|
await MainThread.InvokeOnMainThreadAsync(() => Shell.Current.GoToAsync(route));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Delay(150);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,4 +13,8 @@ public partial class MonthCellViewModel : ObservableObject
|
|||||||
public Color StateColor { get; init; } = Colors.Transparent;
|
public Color StateColor { 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 ShowDayNumber => IsCurrentMonth;
|
||||||
|
public bool ShowAverage => IsCurrentMonth && HasEntries;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ 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;
|
||||||
|
|
||||||
@@ -66,11 +67,14 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
|
|
||||||
var monthStart = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
|
var monthStart = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
|
||||||
var monthEnd = monthStart.AddMonths(1);
|
var monthEnd = monthStart.AddMonths(1);
|
||||||
|
var daysInMonth = DateTime.DaysInMonth(monthStart.Year, monthStart.Month);
|
||||||
|
|
||||||
var entries = await _healthEntryRepository.GetEntriesBetweenAsync(monthStart, monthEnd);
|
var entries = await _healthEntryRepository.GetEntriesBetweenAsync(monthStart, monthEnd);
|
||||||
Cells.Clear();
|
Cells.Clear();
|
||||||
|
|
||||||
var daysInMonth = DateTime.DaysInMonth(monthStart.Year, monthStart.Month);
|
var leadingEmptyCells = GetMondayBasedColumnIndex(monthStart.DayOfWeek);
|
||||||
|
for (var i = 0; i < leadingEmptyCells; i++)
|
||||||
|
Cells.Add(CreatePlaceholderCell());
|
||||||
|
|
||||||
for (var day = 1; day <= daysInMonth; day++)
|
for (var day = 1; day <= daysInMonth; day++)
|
||||||
{
|
{
|
||||||
@@ -93,17 +97,19 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
: _appearanceService.GetColor(AppearanceKeys.Border, "#2A3E55")
|
: _appearanceService.GetColor(AppearanceKeys.Border, "#2A3E55")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (Cells.Count % 7 != 0)
|
||||||
|
Cells.Add(CreatePlaceholderCell());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateHeader()
|
private void UpdateHeader()
|
||||||
{
|
{
|
||||||
var month = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
|
HeaderText = DateHelper.ToGermanMonthYear(SelectedDate.Date);
|
||||||
HeaderText = DateHelper.ToGermanMonthYear(month);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OpenDayAsync(MonthCellViewModel? item)
|
private async Task OpenDayAsync(MonthCellViewModel? item)
|
||||||
{
|
{
|
||||||
if (item is null)
|
if (item is null || !item.IsCurrentMonth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SelectedDate = item.Date.Date;
|
SelectedDate = item.Date.Date;
|
||||||
@@ -147,4 +153,25 @@ public partial class MonthViewModel : ObservableObject
|
|||||||
await RefreshAsync();
|
await RefreshAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int GetMondayBasedColumnIndex(DayOfWeek dayOfWeek)
|
||||||
|
{
|
||||||
|
return dayOfWeek == DayOfWeek.Sunday ? 6 : ((int)dayOfWeek - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MonthCellViewModel CreatePlaceholderCell()
|
||||||
|
{
|
||||||
|
return new MonthCellViewModel
|
||||||
|
{
|
||||||
|
Date = DateTime.MinValue,
|
||||||
|
DayNumberText = string.Empty,
|
||||||
|
IsCurrentMonth = false,
|
||||||
|
IsToday = false,
|
||||||
|
HasEntries = false,
|
||||||
|
AverageStateText = string.Empty,
|
||||||
|
StateColor = Colors.Transparent,
|
||||||
|
TextColor = Colors.Transparent,
|
||||||
|
BorderColor = Colors.Transparent
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,7 @@ 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 System;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace cfs_tracker.ViewModels;
|
namespace cfs_tracker.ViewModels;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ using cfs_tracker.Helpers;
|
|||||||
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 System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace cfs_tracker.ViewModels;
|
namespace cfs_tracker.ViewModels;
|
||||||
|
|
||||||
@@ -79,6 +81,10 @@ public partial class YearViewModel : ObservableObject
|
|||||||
Title = DateHelper.ToGermanMonthYear(monthStart)
|
Title = DateHelper.ToGermanMonthYear(monthStart)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var leadingEmptyCells = GetMondayBasedColumnIndex(monthStart.DayOfWeek);
|
||||||
|
for (var i = 0; i < leadingEmptyCells; i++)
|
||||||
|
section.Cells.Add(CreatePlaceholderCell());
|
||||||
|
|
||||||
for (var day = 1; day <= daysInMonth; day++)
|
for (var day = 1; day <= daysInMonth; day++)
|
||||||
{
|
{
|
||||||
var date = new DateTime(monthStart.Year, monthStart.Month, day);
|
var date = new DateTime(monthStart.Year, monthStart.Month, day);
|
||||||
@@ -101,6 +107,9 @@ public partial class YearViewModel : ObservableObject
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (section.Cells.Count % 7 != 0)
|
||||||
|
section.Cells.Add(CreatePlaceholderCell());
|
||||||
|
|
||||||
Months.Add(section);
|
Months.Add(section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +121,7 @@ public partial class YearViewModel : ObservableObject
|
|||||||
|
|
||||||
private async Task OpenDayAsync(MonthCellViewModel? item)
|
private async Task OpenDayAsync(MonthCellViewModel? item)
|
||||||
{
|
{
|
||||||
if (item is null)
|
if (item is null || !item.IsCurrentMonth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SelectedDate = item.Date.Date;
|
SelectedDate = item.Date.Date;
|
||||||
@@ -156,4 +165,25 @@ public partial class YearViewModel : ObservableObject
|
|||||||
await RefreshAsync();
|
await RefreshAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int GetMondayBasedColumnIndex(DayOfWeek dayOfWeek)
|
||||||
|
{
|
||||||
|
return dayOfWeek == DayOfWeek.Sunday ? 6 : ((int)dayOfWeek - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MonthCellViewModel CreatePlaceholderCell()
|
||||||
|
{
|
||||||
|
return new MonthCellViewModel
|
||||||
|
{
|
||||||
|
Date = DateTime.MinValue,
|
||||||
|
DayNumberText = string.Empty,
|
||||||
|
IsCurrentMonth = false,
|
||||||
|
IsToday = false,
|
||||||
|
HasEntries = false,
|
||||||
|
AverageStateText = string.Empty,
|
||||||
|
StateColor = Colors.Transparent,
|
||||||
|
TextColor = Colors.Transparent,
|
||||||
|
BorderColor = Colors.Transparent
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+25
-14
@@ -59,28 +59,39 @@
|
|||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
||||||
<Border Margin="2"
|
<Border Margin="2"
|
||||||
Padding="6"
|
Padding="6"
|
||||||
Stroke="{Binding BorderColor}"
|
Stroke="{Binding BorderColor}"
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}"
|
BackgroundColor="{DynamicResource SurfaceBackground}"
|
||||||
StrokeShape="RoundRectangle 10">
|
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>
|
<Border.GestureRecognizers>
|
||||||
<TapGestureRecognizer
|
<TapGestureRecognizer
|
||||||
Command="{Binding Source={RelativeSource AncestorType={x:Type viewModels:MonthViewModel}}, Path=OpenDayCommand, x:DataType='viewModels:MonthViewModel'}"
|
Command="{Binding Source={RelativeSource AncestorType={x:Type viewModels:MonthViewModel}}, Path=OpenDayCommand, x:DataType='viewModels:MonthViewModel'}"
|
||||||
CommandParameter="{Binding .}" />
|
CommandParameter="{Binding .}" />
|
||||||
</Border.GestureRecognizers>
|
</Border.GestureRecognizers>
|
||||||
|
|
||||||
<VerticalStackLayout Spacing="4">
|
<VerticalStackLayout Spacing="4">
|
||||||
<Label Text="{Binding DayNumberText}"
|
<Label Text="{Binding DayNumberText}"
|
||||||
FontAttributes="Bold"
|
IsVisible="{Binding ShowDayNumber}"
|
||||||
TextColor="{Binding TextColor}" />
|
FontAttributes="Bold"
|
||||||
|
TextColor="{Binding TextColor}" />
|
||||||
<Border Padding="4"
|
<Border Padding="4"
|
||||||
StrokeThickness="0"
|
IsVisible="{Binding ShowAverage}"
|
||||||
StrokeShape="RoundRectangle 8"
|
StrokeThickness="0"
|
||||||
BackgroundColor="{Binding StateColor}">
|
StrokeShape="RoundRectangle 8"
|
||||||
|
BackgroundColor="{Binding StateColor}">
|
||||||
<Label Text="{Binding AverageStateText}"
|
<Label Text="{Binding AverageStateText}"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
HorizontalTextAlignment="Center"
|
HorizontalTextAlignment="Center"
|
||||||
TextColor="White" />
|
TextColor="White" />
|
||||||
</Border>
|
</Border>
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
+439
-442
@@ -23,469 +23,466 @@
|
|||||||
<Setter Property="TextColor" Value="{DynamicResource ButtonPrimaryText}" />
|
<Setter Property="TextColor" Value="{DynamicResource ButtonPrimaryText}" />
|
||||||
<Setter Property="BackgroundColor" Value="{DynamicResource ButtonPrimaryBackground}" />
|
<Setter Property="BackgroundColor" Value="{DynamicResource ButtonPrimaryBackground}" />
|
||||||
<Setter Property="FontAttributes" Value="Bold" />
|
<Setter Property="FontAttributes" Value="Bold" />
|
||||||
|
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||||
|
<Setter Property="HorizontalOptions" Value="Start" />
|
||||||
|
<Setter Property="Margin" Value="0,0,10,10" />
|
||||||
</Style>
|
</Style>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<VerticalStackLayout Padding="16" Spacing="16">
|
<VerticalStackLayout Padding="16" Spacing="16">
|
||||||
<Label Text="Optionen"
|
<Label Text="Optionen"
|
||||||
FontSize="28"
|
FontSize="28"
|
||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
<Label Text="{Binding StatusText}"
|
<Label Text="{Binding StatusText}"
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
|
||||||
<Border Padding="12"
|
|
||||||
Stroke="{DynamicResource Border}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
|
||||||
<Grid ColumnDefinitions="*,*,*"
|
|
||||||
ColumnSpacing="10">
|
|
||||||
<Button Text="Aussehen"
|
|
||||||
Style="{StaticResource OptionsTabButtonStyle}"
|
|
||||||
Command="{Binding ShowAppearanceTabCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding IsAppearanceTabSelected}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="1"
|
|
||||||
Text="Push-Nachrichten"
|
|
||||||
Style="{StaticResource OptionsTabButtonStyle}"
|
|
||||||
Command="{Binding ShowNotificationsTabCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding IsNotificationsTabSelected}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="2"
|
|
||||||
Text="Datenverwaltung"
|
|
||||||
Style="{StaticResource OptionsTabButtonStyle}"
|
|
||||||
Command="{Binding ShowDataManagementTabCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding IsDataManagementTabSelected}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<VerticalStackLayout IsVisible="{Binding IsAppearanceTabSelected}"
|
|
||||||
Spacing="16">
|
|
||||||
<Border Padding="12"
|
<Border Padding="12"
|
||||||
Stroke="{DynamicResource Border}"
|
Stroke="{DynamicResource Border}"
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
<VerticalStackLayout Spacing="12">
|
<FlexLayout Direction="Row"
|
||||||
<Label Text="Aussehen"
|
Wrap="Wrap"
|
||||||
FontSize="20"
|
AlignItems="Start"
|
||||||
FontAttributes="Bold"
|
JustifyContent="Start">
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
<Button Text="Aussehen"
|
||||||
|
Style="{StaticResource OptionsTabButtonStyle}"
|
||||||
|
Command="{Binding ShowAppearanceTabCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding IsAppearanceTabSelected}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Label Text="Farben werden direkt im Feld angezeigt. Über "Farbe wählen" öffnet sich ein einzelner Farbdialog mit Zurücksetzen, Abbrechen und Übernehmen."
|
<Button Text="Push-Nachrichten"
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
Style="{StaticResource OptionsTabButtonStyle}"
|
||||||
|
Command="{Binding ShowNotificationsTabCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding IsNotificationsTabSelected}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<VerticalStackLayout x:Name="AppearanceColorsHost"
|
<Button Text="Datenverwaltung"
|
||||||
Spacing="10" />
|
Style="{StaticResource OptionsTabButtonStyle}"
|
||||||
|
Command="{Binding ShowDataManagementTabCommand}">
|
||||||
<VerticalStackLayout BindableLayout.ItemsSource="{Binding StatusTexts}"
|
<Button.Triggers>
|
||||||
Spacing="10">
|
<DataTrigger TargetType="Button"
|
||||||
<BindableLayout.ItemTemplate>
|
Binding="{Binding IsDataManagementTabSelected}"
|
||||||
<DataTemplate x:DataType="viewModels:AppearanceTextItemViewModel">
|
Value="True">
|
||||||
<VerticalStackLayout Spacing="4"
|
<Setter Property="BackgroundColor"
|
||||||
Padding="0,6">
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
<Label Text="{Binding Title}"
|
<Setter Property="TextColor"
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
<Entry Text="{Binding Value}" />
|
</DataTrigger>
|
||||||
</VerticalStackLayout>
|
</Button.Triggers>
|
||||||
</DataTemplate>
|
</Button>
|
||||||
</BindableLayout.ItemTemplate>
|
</FlexLayout>
|
||||||
</VerticalStackLayout>
|
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*"
|
|
||||||
ColumnSpacing="12">
|
|
||||||
<Button Text="Speichern"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding SaveAppearanceCommand}" />
|
|
||||||
<Button Grid.Column="1"
|
|
||||||
Text="Zurücksetzen"
|
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
|
||||||
Command="{Binding ResetAppearanceCommand}" />
|
|
||||||
</Grid>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
|
|
||||||
<VerticalStackLayout IsVisible="{Binding IsNotificationsTabSelected}"
|
|
||||||
Spacing="16">
|
|
||||||
<Border Padding="12"
|
|
||||||
Stroke="{DynamicResource Border}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
|
||||||
<VerticalStackLayout Spacing="12">
|
|
||||||
<Label Text="Push-Benachrichtigungen"
|
|
||||||
FontSize="20"
|
|
||||||
FontAttributes="Bold"
|
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
|
||||||
|
|
||||||
<Label Text="Ein Zeitblock kann auf mehreren Wochentagen aktiv sein."
|
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
|
||||||
|
|
||||||
<Button Text="Zeit hinzufügen"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding AddScheduleCommand}" />
|
|
||||||
|
|
||||||
<VerticalStackLayout BindableLayout.ItemsSource="{Binding NotificationSchedules}"
|
|
||||||
Spacing="10">
|
|
||||||
<BindableLayout.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="viewModels:NotificationScheduleItemViewModel">
|
|
||||||
<Border Padding="10"
|
|
||||||
Stroke="{DynamicResource Border}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
|
||||||
<VerticalStackLayout Spacing="10">
|
|
||||||
<Grid ColumnDefinitions="*,Auto,Auto"
|
|
||||||
ColumnSpacing="8">
|
|
||||||
<TimePicker Time="{Binding SelectedTime}" />
|
|
||||||
<CheckBox Grid.Column="1"
|
|
||||||
IsChecked="{Binding IsEnabled}"
|
|
||||||
VerticalOptions="Center" />
|
|
||||||
<Label Grid.Column="2"
|
|
||||||
Text="Aktiv"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
|
||||||
ColumnSpacing="6">
|
|
||||||
<Button Text="Mo"
|
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
|
||||||
Command="{Binding ToggleMondayCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding Monday}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="1"
|
|
||||||
Text="Di"
|
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
|
||||||
Command="{Binding ToggleTuesdayCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding Tuesday}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="2"
|
|
||||||
Text="Mi"
|
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
|
||||||
Command="{Binding ToggleWednesdayCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding Wednesday}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="3"
|
|
||||||
Text="Do"
|
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
|
||||||
Command="{Binding ToggleThursdayCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding Thursday}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="4"
|
|
||||||
Text="Fr"
|
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
|
||||||
Command="{Binding ToggleFridayCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding Friday}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="5"
|
|
||||||
Text="Sa"
|
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
|
||||||
Command="{Binding ToggleSaturdayCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding Saturday}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button Grid.Column="6"
|
|
||||||
Text="So"
|
|
||||||
Style="{StaticResource DayToggleButtonStyle}"
|
|
||||||
Command="{Binding ToggleSundayCommand}">
|
|
||||||
<Button.Triggers>
|
|
||||||
<DataTrigger TargetType="Button"
|
|
||||||
Binding="{Binding Sunday}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="BackgroundColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryBackground}" />
|
|
||||||
<Setter Property="TextColor"
|
|
||||||
Value="{DynamicResource ButtonSecondaryText}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Button.Triggers>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Button Text="Entfernen"
|
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
|
||||||
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteScheduleCommand}"
|
|
||||||
CommandParameter="{Binding .}" />
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
</DataTemplate>
|
|
||||||
</BindableLayout.ItemTemplate>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
|
|
||||||
<Button Text="Benachrichtigungszeiten speichern"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding SaveSchedulesCommand}" />
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
|
|
||||||
<VerticalStackLayout IsVisible="{Binding IsDataManagementTabSelected}"
|
|
||||||
Spacing="16">
|
|
||||||
<Border Padding="12"
|
|
||||||
Stroke="{DynamicResource Border}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
|
||||||
<VerticalStackLayout Spacing="12">
|
|
||||||
<Label Text="Tätigkeiten"
|
|
||||||
FontSize="20"
|
|
||||||
FontAttributes="Bold"
|
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,Auto"
|
|
||||||
ColumnSpacing="10">
|
|
||||||
<Entry Text="{Binding NewActivityName}"
|
|
||||||
Placeholder="Neue Tätigkeit" />
|
|
||||||
<Button Grid.Column="1"
|
|
||||||
Text="Hinzufügen"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding AddActivityCommand}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<VerticalStackLayout BindableLayout.ItemsSource="{Binding Activities}"
|
|
||||||
Spacing="10">
|
|
||||||
<BindableLayout.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="viewModels:ActivityManageItemViewModel">
|
|
||||||
<Border Padding="10"
|
|
||||||
Stroke="{DynamicResource Border}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
|
||||||
<VerticalStackLayout Spacing="8">
|
|
||||||
<Entry Text="{Binding Name}" />
|
|
||||||
<Label Text="{Binding UsageHint}"
|
|
||||||
FontSize="12"
|
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
|
||||||
<Grid ColumnDefinitions="*,*,*"
|
|
||||||
ColumnSpacing="8">
|
|
||||||
<Button Text="Speichern"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.SaveActivityCommand}"
|
|
||||||
CommandParameter="{Binding .}" />
|
|
||||||
<Button Grid.Column="1"
|
|
||||||
Text="Aktiv/Inaktiv"
|
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
|
||||||
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.ToggleActivityActiveCommand}"
|
|
||||||
CommandParameter="{Binding .}" />
|
|
||||||
<Button Grid.Column="2"
|
|
||||||
Text="Entfernen"
|
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
|
||||||
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteActivityCommand}"
|
|
||||||
CommandParameter="{Binding .}" />
|
|
||||||
</Grid>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
</DataTemplate>
|
|
||||||
</BindableLayout.ItemTemplate>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border Padding="12"
|
<VerticalStackLayout IsVisible="{Binding IsAppearanceTabSelected}"
|
||||||
Stroke="{DynamicResource Border}"
|
Spacing="16">
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
<Border Padding="12"
|
||||||
<VerticalStackLayout Spacing="12">
|
Stroke="{DynamicResource Border}"
|
||||||
<Label Text="Symptome"
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
FontSize="20"
|
<VerticalStackLayout Spacing="12">
|
||||||
FontAttributes="Bold"
|
<Label Text="Aussehen"
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
FontSize="20"
|
||||||
|
FontAttributes="Bold"
|
||||||
<Grid ColumnDefinitions="*,Auto"
|
|
||||||
ColumnSpacing="10">
|
|
||||||
<Entry Text="{Binding NewSymptomName}"
|
|
||||||
Placeholder="Neues Symptom" />
|
|
||||||
<Button Grid.Column="1"
|
|
||||||
Text="Hinzufügen"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding AddSymptomCommand}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<VerticalStackLayout BindableLayout.ItemsSource="{Binding Symptoms}"
|
|
||||||
Spacing="10">
|
|
||||||
<BindableLayout.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="viewModels:SymptomManageItemViewModel">
|
|
||||||
<Border Padding="10"
|
|
||||||
Stroke="{DynamicResource Border}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
|
||||||
<VerticalStackLayout Spacing="8">
|
|
||||||
<Entry Text="{Binding Name}" />
|
|
||||||
<Label Text="{Binding UsageHint}"
|
|
||||||
FontSize="12"
|
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
|
||||||
<Grid ColumnDefinitions="*,*,*"
|
|
||||||
ColumnSpacing="8">
|
|
||||||
<Button Text="Speichern"
|
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
|
||||||
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.SaveSymptomCommand}"
|
|
||||||
CommandParameter="{Binding .}" />
|
|
||||||
<Button Grid.Column="1"
|
|
||||||
Text="Aktiv/Inaktiv"
|
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
|
||||||
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.ToggleSymptomActiveCommand}"
|
|
||||||
CommandParameter="{Binding .}" />
|
|
||||||
<Button Grid.Column="2"
|
|
||||||
Text="Entfernen"
|
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
|
||||||
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteSymptomCommand}"
|
|
||||||
CommandParameter="{Binding .}" />
|
|
||||||
</Grid>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
</DataTemplate>
|
|
||||||
</BindableLayout.ItemTemplate>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<Border Padding="12"
|
|
||||||
Stroke="{DynamicResource Border}"
|
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
|
||||||
<VerticalStackLayout Spacing="12">
|
|
||||||
<Label Text="Datenbank"
|
|
||||||
FontSize="20"
|
|
||||||
FontAttributes="Bold"
|
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
|
||||||
|
|
||||||
<Label Text="{Binding CurrentDatabasePath, StringFormat='Aktiver Pfad: {0}'}"
|
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
|
||||||
|
|
||||||
<Grid ColumnDefinitions="Auto,*"
|
|
||||||
ColumnSpacing="8">
|
|
||||||
<CheckBox IsChecked="{Binding UseExternalDatabase}" />
|
|
||||||
<Label Grid.Column="1"
|
|
||||||
Text="Externe Datenbank verwenden"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Entry Text="{Binding ExternalDatabasePath}"
|
<Label Text="Pro Farbe wird nur noch Vorschau und Dialog-Button angezeigt. Der eigentliche Farbwert wird erst im Farbdialog bearbeitet."
|
||||||
Placeholder="Ordner oder Dateipfad für externe DB" />
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
|
||||||
<Label Text="Für SQLite ist ein externer Dateipfad sinnvoll. Für echte Mehrbenutzer-Synchronisierung ist später eher ein eigener Server oder eine API-Schicht besser geeignet."
|
<VerticalStackLayout x:Name="AppearanceColorsHost"
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
Spacing="10" />
|
||||||
|
|
||||||
<Button Text="Datenbankpfad speichern"
|
<VerticalStackLayout BindableLayout.ItemsSource="{Binding StatusTexts}"
|
||||||
Style="{StaticResource PrimaryButtonStyle}"
|
Spacing="10">
|
||||||
Command="{Binding SaveDatabaseLocationCommand}" />
|
<BindableLayout.ItemTemplate>
|
||||||
</VerticalStackLayout>
|
<DataTemplate x:DataType="viewModels:AppearanceTextItemViewModel">
|
||||||
</Border>
|
<VerticalStackLayout Spacing="4"
|
||||||
|
Padding="0,6">
|
||||||
|
<Label Text="{Binding Title}"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
<Entry Text="{Binding Value}" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</DataTemplate>
|
||||||
|
</BindableLayout.ItemTemplate>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
|
||||||
<Border Padding="12"
|
<Grid ColumnDefinitions="*,*"
|
||||||
Stroke="{DynamicResource Border}"
|
ColumnSpacing="12">
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
<Button Text="Speichern"
|
||||||
<VerticalStackLayout Spacing="12">
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
<Label Text="Alle Einträge löschen"
|
Command="{Binding SaveAppearanceCommand}" />
|
||||||
FontSize="20"
|
<Button Grid.Column="1"
|
||||||
FontAttributes="Bold"
|
Text="Zurücksetzen"
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
<Label Text="Zum Bestätigen 'löschen' eingeben."
|
Command="{Binding ResetAppearanceCommand}" />
|
||||||
TextColor="{DynamicResource TextMuted}" />
|
</Grid>
|
||||||
<Entry Text="{Binding DeleteConfirmationText}"
|
</VerticalStackLayout>
|
||||||
Placeholder="löschen" />
|
</Border>
|
||||||
<Button Text="Alles löschen"
|
</VerticalStackLayout>
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
|
||||||
Command="{Binding DeleteAllDataCommand}" />
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<Border Padding="12"
|
<VerticalStackLayout IsVisible="{Binding IsNotificationsTabSelected}"
|
||||||
Stroke="{DynamicResource Border}"
|
Spacing="16">
|
||||||
BackgroundColor="{DynamicResource SurfaceBackground}">
|
<Border Padding="12"
|
||||||
<VerticalStackLayout Spacing="10">
|
Stroke="{DynamicResource Border}"
|
||||||
<Label Text="Export"
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
FontAttributes="Bold"
|
<VerticalStackLayout Spacing="12">
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
<Label Text="Push-Benachrichtigungen"
|
||||||
|
FontSize="20"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
<Button Text="Export entleeren"
|
<Label Text="Ein Zeitblock kann auf mehreren Wochentagen aktiv sein."
|
||||||
Style="{StaticResource SecondaryButtonStyle}"
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
Command="{Binding ClearExportsCommand}" />
|
|
||||||
</VerticalStackLayout>
|
<Button Text="Zeit hinzufügen"
|
||||||
</Border>
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
|
Command="{Binding AddScheduleCommand}" />
|
||||||
|
|
||||||
|
<VerticalStackLayout BindableLayout.ItemsSource="{Binding NotificationSchedules}"
|
||||||
|
Spacing="10">
|
||||||
|
<BindableLayout.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="viewModels:NotificationScheduleItemViewModel">
|
||||||
|
<Border Padding="10"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
||||||
|
<VerticalStackLayout Spacing="10">
|
||||||
|
<Grid ColumnDefinitions="*,Auto,Auto"
|
||||||
|
ColumnSpacing="8">
|
||||||
|
<TimePicker Time="{Binding SelectedTime}" />
|
||||||
|
<CheckBox Grid.Column="1"
|
||||||
|
IsChecked="{Binding IsEnabled}"
|
||||||
|
VerticalOptions="Center" />
|
||||||
|
<Label Grid.Column="2"
|
||||||
|
Text="Aktiv"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
||||||
|
ColumnSpacing="6">
|
||||||
|
<Button Text="Mo"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleMondayCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding Monday}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Text="Di"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleTuesdayCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding Tuesday}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="2"
|
||||||
|
Text="Mi"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleWednesdayCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding Wednesday}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Text="Do"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleThursdayCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding Thursday}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="4"
|
||||||
|
Text="Fr"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleFridayCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding Friday}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="5"
|
||||||
|
Text="Sa"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleSaturdayCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding Saturday}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="6"
|
||||||
|
Text="So"
|
||||||
|
Style="{StaticResource DayToggleButtonStyle}"
|
||||||
|
Command="{Binding ToggleSundayCommand}">
|
||||||
|
<Button.Triggers>
|
||||||
|
<DataTrigger TargetType="Button"
|
||||||
|
Binding="{Binding Sunday}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="BackgroundColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryBackground}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{DynamicResource ButtonSecondaryText}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Button Text="Entfernen"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
|
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteScheduleCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</BindableLayout.ItemTemplate>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
|
||||||
|
<Button Text="Benachrichtigungszeiten speichern"
|
||||||
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
|
Command="{Binding SaveSchedulesCommand}" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
|
||||||
|
<VerticalStackLayout IsVisible="{Binding IsDataManagementTabSelected}"
|
||||||
|
Spacing="16">
|
||||||
|
<Border Padding="12"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
|
<VerticalStackLayout Spacing="12">
|
||||||
|
<Label Text="Tätigkeiten"
|
||||||
|
FontSize="20"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,Auto"
|
||||||
|
ColumnSpacing="10">
|
||||||
|
<Entry Text="{Binding NewActivityName}"
|
||||||
|
Placeholder="Neue Tätigkeit" />
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Text="Hinzufügen"
|
||||||
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
|
Command="{Binding AddActivityCommand}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<VerticalStackLayout BindableLayout.ItemsSource="{Binding Activities}"
|
||||||
|
Spacing="10">
|
||||||
|
<BindableLayout.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="viewModels:ActivityManageItemViewModel">
|
||||||
|
<Border Padding="10"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
||||||
|
<VerticalStackLayout Spacing="8">
|
||||||
|
<Entry Text="{Binding Name}" />
|
||||||
|
<Label Text="{Binding UsageHint}"
|
||||||
|
FontSize="12"
|
||||||
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
<Grid ColumnDefinitions="*,*,*"
|
||||||
|
ColumnSpacing="8">
|
||||||
|
<Button Text="Speichern"
|
||||||
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
|
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.SaveActivityCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Text="Aktiv/Inaktiv"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
|
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.ToggleActivityActiveCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
<Button Grid.Column="2"
|
||||||
|
Text="Entfernen"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
|
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteActivityCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
</Grid>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</BindableLayout.ItemTemplate>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Padding="12"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
|
<VerticalStackLayout Spacing="12">
|
||||||
|
<Label Text="Symptome"
|
||||||
|
FontSize="20"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,Auto"
|
||||||
|
ColumnSpacing="10">
|
||||||
|
<Entry Text="{Binding NewSymptomName}"
|
||||||
|
Placeholder="Neues Symptom" />
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Text="Hinzufügen"
|
||||||
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
|
Command="{Binding AddSymptomCommand}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<VerticalStackLayout BindableLayout.ItemsSource="{Binding Symptoms}"
|
||||||
|
Spacing="10">
|
||||||
|
<BindableLayout.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="viewModels:SymptomManageItemViewModel">
|
||||||
|
<Border Padding="10"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}">
|
||||||
|
<VerticalStackLayout Spacing="8">
|
||||||
|
<Entry Text="{Binding Name}" />
|
||||||
|
<Label Text="{Binding UsageHint}"
|
||||||
|
FontSize="12"
|
||||||
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
<Grid ColumnDefinitions="*,*,*"
|
||||||
|
ColumnSpacing="8">
|
||||||
|
<Button Text="Speichern"
|
||||||
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
|
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.SaveSymptomCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Text="Aktiv/Inaktiv"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
|
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.ToggleSymptomActiveCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
<Button Grid.Column="2"
|
||||||
|
Text="Entfernen"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
|
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteSymptomCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
</Grid>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</BindableLayout.ItemTemplate>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Padding="12"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
|
<VerticalStackLayout Spacing="12">
|
||||||
|
<Label Text="Datenbank"
|
||||||
|
FontSize="20"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
|
<Label Text="{Binding CurrentDatabasePath, StringFormat='Aktiver Pfad: {0}'}"
|
||||||
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="Auto,*"
|
||||||
|
ColumnSpacing="8">
|
||||||
|
<CheckBox IsChecked="{Binding UseExternalDatabase}" />
|
||||||
|
<Label Grid.Column="1"
|
||||||
|
Text="Externe Datenbank verwenden"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Entry Text="{Binding ExternalDatabasePath}"
|
||||||
|
Placeholder="Ordner oder Dateipfad für externe DB" />
|
||||||
|
|
||||||
|
<Label Text="Für SQLite ist ein externer Dateipfad sinnvoll. Für echte Mehrbenutzer-Synchronisierung ist später eher ein eigener Server oder eine API-Schicht besser geeignet."
|
||||||
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
|
||||||
|
<Button Text="Datenbankpfad speichern"
|
||||||
|
Style="{StaticResource PrimaryButtonStyle}"
|
||||||
|
Command="{Binding SaveDatabaseLocationCommand}" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Padding="12"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
|
<VerticalStackLayout Spacing="12">
|
||||||
|
<Label Text="Alle Einträge löschen"
|
||||||
|
FontSize="20"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
<Label Text="Zum Bestätigen 'löschen' eingeben."
|
||||||
|
TextColor="{DynamicResource TextMuted}" />
|
||||||
|
<Entry Text="{Binding DeleteConfirmationText}"
|
||||||
|
Placeholder="löschen" />
|
||||||
|
<Button Text="Alles löschen"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
|
Command="{Binding DeleteAllDataCommand}" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Padding="12"
|
||||||
|
Stroke="{DynamicResource Border}"
|
||||||
|
BackgroundColor="{DynamicResource SurfaceBackground}">
|
||||||
|
<VerticalStackLayout Spacing="10">
|
||||||
|
<Label Text="Export"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
|
<Button Text="Export entleeren"
|
||||||
|
Style="{StaticResource SecondaryButtonStyle}"
|
||||||
|
Command="{Binding ClearExportsCommand}" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
</VerticalStackLayout>
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</VerticalStackLayout>
|
</ScrollView>
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<Grid x:Name="ColorDialogOverlay"
|
<Grid x:Name="ColorDialogOverlay"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
|
|||||||
+21
-74
@@ -1,12 +1,9 @@
|
|||||||
using cfs_tracker.Helpers;
|
using cfs_tracker.Helpers;
|
||||||
using cfs_tracker.ViewModels;
|
using cfs_tracker.ViewModels;
|
||||||
using Microsoft.Maui.Controls;
|
using Microsoft.Maui.Layouts;
|
||||||
using Microsoft.Maui.Graphics;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace cfs_tracker.Views;
|
namespace cfs_tracker.Views;
|
||||||
|
|
||||||
@@ -103,8 +100,6 @@ public partial class OptionsPage : ContentPage
|
|||||||
var normalizedHex = NormalizeHex(item.Value, item.Fallback);
|
var normalizedHex = NormalizeHex(item.Value, item.Fallback);
|
||||||
item.Value = normalizedHex;
|
item.Value = normalizedHex;
|
||||||
item.PreviewColor = ColorUtility.ParseColor(normalizedHex, item.Fallback);
|
item.PreviewColor = ColorUtility.ParseColor(normalizedHex, item.Fallback);
|
||||||
var lastValidHex = normalizedHex;
|
|
||||||
var isUpdating = false;
|
|
||||||
|
|
||||||
var titleLabel = new Label
|
var titleLabel = new Label
|
||||||
{
|
{
|
||||||
@@ -121,90 +116,42 @@ public partial class OptionsPage : ContentPage
|
|||||||
};
|
};
|
||||||
defaultLabel.SetDynamicResource(Label.TextColorProperty, "TextMuted");
|
defaultLabel.SetDynamicResource(Label.TextColorProperty, "TextMuted");
|
||||||
|
|
||||||
var hexEntry = new Entry
|
|
||||||
{
|
|
||||||
Placeholder = "#112233",
|
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
|
||||||
ClearButtonVisibility = ClearButtonVisibility.WhileEditing,
|
|
||||||
BindingContext = item
|
|
||||||
};
|
|
||||||
hexEntry.SetBinding(Entry.TextProperty, nameof(AppearanceColorItemViewModel.Value), mode: BindingMode.TwoWay);
|
|
||||||
|
|
||||||
var previewBox = new BoxView
|
var previewBox = new BoxView
|
||||||
{
|
{
|
||||||
WidthRequest = 64,
|
WidthRequest = 84,
|
||||||
HeightRequest = 34,
|
HeightRequest = 42,
|
||||||
CornerRadius = 6,
|
CornerRadius = 8,
|
||||||
HorizontalOptions = LayoutOptions.Center,
|
HorizontalOptions = LayoutOptions.Start,
|
||||||
VerticalOptions = LayoutOptions.Center,
|
VerticalOptions = LayoutOptions.Center,
|
||||||
BindingContext = item
|
BindingContext = item,
|
||||||
|
Margin = new Thickness(0, 0, 10, 10)
|
||||||
};
|
};
|
||||||
previewBox.SetBinding(BoxView.ColorProperty, nameof(AppearanceColorItemViewModel.PreviewColor));
|
previewBox.SetBinding(BoxView.ColorProperty, nameof(AppearanceColorItemViewModel.PreviewColor));
|
||||||
|
|
||||||
var chooseButton = new Button
|
var chooseButton = new Button
|
||||||
{
|
{
|
||||||
Text = "Farbe wählen"
|
Text = "Farbe wählen",
|
||||||
|
LineBreakMode = LineBreakMode.WordWrap,
|
||||||
|
HorizontalOptions = LayoutOptions.Start,
|
||||||
|
VerticalOptions = LayoutOptions.Center,
|
||||||
|
Margin = new Thickness(0, 0, 0, 10)
|
||||||
};
|
};
|
||||||
chooseButton.SetDynamicResource(Button.BackgroundColorProperty, "ButtonSecondaryBackground");
|
chooseButton.SetDynamicResource(Button.BackgroundColorProperty, "ButtonSecondaryBackground");
|
||||||
chooseButton.SetDynamicResource(Button.TextColorProperty, "ButtonSecondaryText");
|
chooseButton.SetDynamicResource(Button.TextColorProperty, "ButtonSecondaryText");
|
||||||
chooseButton.Clicked += (_, _) => OpenColorDialog(item);
|
chooseButton.Clicked += (_, _) => OpenColorDialog(item);
|
||||||
|
|
||||||
var editorGrid = new Grid
|
var actionLayout = new FlexLayout
|
||||||
{
|
{
|
||||||
ColumnSpacing = 10,
|
Direction = FlexDirection.Row,
|
||||||
RowSpacing = 10,
|
Wrap = FlexWrap.Wrap,
|
||||||
ColumnDefinitions = new ColumnDefinitionCollection
|
AlignItems = FlexAlignItems.Center,
|
||||||
|
JustifyContent = FlexJustify.Start,
|
||||||
|
Children =
|
||||||
{
|
{
|
||||||
new ColumnDefinition { Width = GridLength.Star },
|
previewBox,
|
||||||
new ColumnDefinition { Width = new GridLength(80) },
|
chooseButton
|
||||||
new ColumnDefinition { Width = new GridLength(140) }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
editorGrid.Add(hexEntry);
|
|
||||||
editorGrid.Add(previewBox, 1, 0);
|
|
||||||
editorGrid.Add(chooseButton, 2, 0);
|
|
||||||
|
|
||||||
if (item is INotifyPropertyChanged notify)
|
|
||||||
{
|
|
||||||
notify.PropertyChanged += (_, args) =>
|
|
||||||
{
|
|
||||||
if (args.PropertyName == nameof(AppearanceColorItemViewModel.Value))
|
|
||||||
lastValidHex = NormalizeHex(item.Value, item.Fallback);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
hexEntry.TextChanged += (_, args) =>
|
|
||||||
{
|
|
||||||
if (isUpdating)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var text = args.NewTextValue?.Trim() ?? string.Empty;
|
|
||||||
if (!HexColorRegex.IsMatch(text))
|
|
||||||
return;
|
|
||||||
|
|
||||||
lastValidHex = NormalizeHex(text, item.Fallback);
|
|
||||||
item.PreviewColor = ColorUtility.ParseColor(lastValidHex, item.Fallback);
|
|
||||||
};
|
|
||||||
|
|
||||||
hexEntry.Unfocused += (_, _) =>
|
|
||||||
{
|
|
||||||
var text = hexEntry.Text?.Trim() ?? string.Empty;
|
|
||||||
isUpdating = true;
|
|
||||||
|
|
||||||
if (HexColorRegex.IsMatch(text))
|
|
||||||
{
|
|
||||||
lastValidHex = NormalizeHex(text, item.Fallback);
|
|
||||||
item.Value = lastValidHex;
|
|
||||||
item.PreviewColor = ColorUtility.ParseColor(lastValidHex, item.Fallback);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item.Value = lastValidHex;
|
|
||||||
item.PreviewColor = ColorUtility.ParseColor(lastValidHex, item.Fallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
isUpdating = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
var content = new VerticalStackLayout
|
var content = new VerticalStackLayout
|
||||||
{
|
{
|
||||||
@@ -213,7 +160,7 @@ public partial class OptionsPage : ContentPage
|
|||||||
{
|
{
|
||||||
titleLabel,
|
titleLabel,
|
||||||
defaultLabel,
|
defaultLabel,
|
||||||
editorGrid
|
actionLayout
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+33
-9
@@ -47,7 +47,7 @@
|
|||||||
SelectionMode="None"
|
SelectionMode="None"
|
||||||
VerticalOptions="Fill"
|
VerticalOptions="Fill"
|
||||||
HorizontalOptions="Fill"
|
HorizontalOptions="Fill"
|
||||||
ItemSizingStrategy="MeasureFirstItem">
|
ItemSizingStrategy="MeasureAllItems">
|
||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="viewModels:MonthSectionViewModel">
|
<DataTemplate x:DataType="viewModels:MonthSectionViewModel">
|
||||||
<Border Padding="12"
|
<Border Padding="12"
|
||||||
@@ -61,12 +61,25 @@
|
|||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
TextColor="{DynamicResource TextPrimary}" />
|
TextColor="{DynamicResource TextPrimary}" />
|
||||||
|
|
||||||
<FlexLayout Direction="Row"
|
<Grid ColumnDefinitions="*,*,*,*,*,*,*"
|
||||||
Wrap="Wrap"
|
ColumnSpacing="4">
|
||||||
AlignItems="Start"
|
<Label Text="Mo" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
JustifyContent="Start"
|
<Label Grid.Column="1" Text="Di" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
BindableLayout.ItemsSource="{Binding Cells}">
|
<Label Grid.Column="2" Text="Mi" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
<BindableLayout.ItemTemplate>
|
<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="5" Text="Sa" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
|
<Label Grid.Column="6" Text="So" HorizontalTextAlignment="Center" FontSize="11" TextColor="{DynamicResource TextMuted}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<CollectionView ItemsSource="{Binding Cells}"
|
||||||
|
SelectionMode="None"
|
||||||
|
ItemSizingStrategy="MeasureFirstItem">
|
||||||
|
<CollectionView.ItemsLayout>
|
||||||
|
<GridItemsLayout Orientation="Vertical"
|
||||||
|
Span="7" />
|
||||||
|
</CollectionView.ItemsLayout>
|
||||||
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
<DataTemplate x:DataType="viewModels:MonthCellViewModel">
|
||||||
<Border Margin="2"
|
<Border Margin="2"
|
||||||
Padding="4"
|
Padding="4"
|
||||||
@@ -75,6 +88,15 @@
|
|||||||
Stroke="{Binding BorderColor}"
|
Stroke="{Binding BorderColor}"
|
||||||
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}"
|
BackgroundColor="{DynamicResource SurfaceBackgroundAlt}"
|
||||||
StrokeShape="RoundRectangle 8">
|
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>
|
<Border.GestureRecognizers>
|
||||||
<TapGestureRecognizer
|
<TapGestureRecognizer
|
||||||
Command="{Binding Source={RelativeSource AncestorType={x:Type viewModels:YearViewModel}}, Path=OpenDayCommand, x:DataType='viewModels:YearViewModel'}"
|
Command="{Binding Source={RelativeSource AncestorType={x:Type viewModels:YearViewModel}}, Path=OpenDayCommand, x:DataType='viewModels:YearViewModel'}"
|
||||||
@@ -83,12 +105,14 @@
|
|||||||
|
|
||||||
<Grid RowDefinitions="Auto,*">
|
<Grid RowDefinitions="Auto,*">
|
||||||
<Label Text="{Binding DayNumberText}"
|
<Label Text="{Binding DayNumberText}"
|
||||||
|
IsVisible="{Binding ShowDayNumber}"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
HorizontalTextAlignment="Center"
|
HorizontalTextAlignment="Center"
|
||||||
TextColor="{Binding TextColor}" />
|
TextColor="{Binding TextColor}" />
|
||||||
|
|
||||||
<Border Grid.Row="1"
|
<Border Grid.Row="1"
|
||||||
|
IsVisible="{Binding ShowAverage}"
|
||||||
Margin="0,4,0,0"
|
Margin="0,4,0,0"
|
||||||
Padding="2"
|
Padding="2"
|
||||||
StrokeThickness="0"
|
StrokeThickness="0"
|
||||||
@@ -104,8 +128,8 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</BindableLayout.ItemTemplate>
|
</CollectionView.ItemTemplate>
|
||||||
</FlexLayout>
|
</CollectionView>
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
Reference in New Issue
Block a user