Skip to content

Commit 4c84f98

Browse files
committed
Refactor LastFM login flow and adjust window sizing
- Switched to LastFMLoginFragment in TransitionActivity for login flow - Improved LastFMLoginFragment: clarified view model usage, updated input label, and added dark mode hint color - Refactored login logic to use async login instead of immediate navigation - Reduced default MAUI window size to 600x600 and minimum height to 600 - Updated .csproj.user to use a more descriptive emulator profile name
1 parent 0fba79d commit 4c84f98

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

Dimmer/Dimmer.Droid/Dimmer.Droid.csproj.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<SelectedDevice>pixel_7_-_api_35</SelectedDevice>
55
<SelectedPlatformGroup>Emulator</SelectedPlatformGroup>
6-
<ActiveDebugProfile>pixel_7_-_api_35</ActiveDebugProfile>
6+
<ActiveDebugProfile>Pixel 7 - API 35 (Android 15.0 - API 35)</ActiveDebugProfile>
77
<DefaultDevice>pixel_7_-_api_35</DefaultDevice>
88
</PropertyGroup>
99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

Dimmer/Dimmer.Droid/ViewsAndPages/NativeViews/Activity/TransitionActivity.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,8 @@ private void NavigateToId(int id)
492492

493493
break;
494494
case 102:
495-
selectedFrag = new LastFmInfoFragment( MyViewModel);
495+
496+
selectedFrag = new LastFMLoginFragment( "toLastFMInfo", MyViewModel);
496497
tag = "LastFMFragment";
497498
break;
498499
case 103:

Dimmer/Dimmer.Droid/ViewsAndPages/NativeViews/DimmerLive/LastFMViews/LastFMLoginFragment.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ namespace Dimmer.ViewsAndPages.NativeViews.DimmerLive.LastFMViews;
99
using System.Reactive.Disposables;
1010

1111
using Dimmer.ViewModel;
12-
12+
using Dimmer.WinUI.UiUtils;
1313
using ProgressBar = Android.Widget.ProgressBar;
1414

1515

1616
public class LastFMLoginFragment : Fragment
1717
{
1818
private readonly string _transitionName;
19-
private readonly BaseViewModelAnd _baseViewModel;
19+
private readonly BaseViewModelAnd MyViewModel;
2020

2121
public SettingsViewModel? settingsVM { get; }
2222

@@ -32,7 +32,7 @@ public class LastFMLoginFragment : Fragment
3232
public LastFMLoginFragment(string transitionName, BaseViewModelAnd baseViewModel)
3333
{
3434
_transitionName = transitionName;
35-
_baseViewModel = baseViewModel;
35+
MyViewModel = baseViewModel;
3636

3737
settingsVM = MainApplication.ServiceProvider.GetService<SettingsViewModel>();
3838
}
@@ -76,7 +76,8 @@ public override View OnCreateView(LayoutInflater inflater, ViewGroup? container,
7676
_errorText.SetPadding(0, 0, 0, 20);
7777

7878
// Inputs
79-
_userLayout = CreateInput(ctx, "Username");
79+
_userLayout = CreateInput(ctx, "Last FM Username");
80+
_userLayout.HintTextColor = UiBuilder.IsDark(ctx) ? AppUtil.ToColorStateList(Color.Red ): AppUtil.ToColorStateList(Color.White);
8081
_userEdit = (TextInputEditText)_userLayout.EditText!;
8182

8283

@@ -112,12 +113,7 @@ public async override void OnResume()
112113
base.OnResume();
113114
settingsVM.IsBusy = true;
114115

115-
SessionManagementViewModel sessionMgtVM = MainApplication.ServiceProvider.GetRequiredService<SessionManagementViewModel>();
116-
117-
_baseViewModel.NavigateToAnyPageOfGivenType(this, new LastFmInfoFragment(_baseViewModel), "CloudDataFragment");
118-
119-
settingsVM.IsBusy = false;
120-
return;
116+
121117

122118
// 1. Two-way binding for Inputs
123119

@@ -151,9 +147,9 @@ public override void OnPause()
151147

152148
private async void ActionBtn_Click(object? sender, EventArgs e)
153149
{
154-
155-
150+
BaseViewModel.LastFMName = string.IsNullOrEmpty(_userEdit.Text) ? string.Empty : _userEdit.Text ;
156151

152+
await MyViewModel.LoginToLastfm();
157153
}
158154

159155
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)

Dimmer/Dimmer.WinUI/Views/MAUIPages/DimmerMAUIWin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ protected override void OnCreated()
112112
MyViewModel.windowManager.TrackWindow(this);
113113
base.OnCreated();
114114
var nativeWindow = PlatUtils.GetNativeWindowFromMAUIWindow(this);
115-
PlatUtils.MoveAndResizeCenter(nativeWindow, new Windows.Graphics.SizeInt32(600, 700));
116-
MinimumHeight = 700;
115+
PlatUtils.MoveAndResizeCenter(nativeWindow, new Windows.Graphics.SizeInt32(600, 600));
116+
MinimumHeight = 600;
117117
MaximumWidth = 600;
118118

119119
#if DEBUG

0 commit comments

Comments
 (0)