Skip to content

Commit 8c73a7e

Browse files
committed
Add SmoothBtmBarDroid binding and update dependencies
Introduce SmoothBtmBarDroid binding project for SmoothBottomBar, including metadata and .aar. Update .gitignore and solution to include the new project. Reference SmoothBtmBarDroid in Dimmer.Droid and update multiple AndroidX/Media3 NuGet packages. Refactor ExoPlayerService to simplify notification player usage. Enhance HomePageFragment with a loading indicator for search. Add AboutAdditions.txt for binding guidance.
1 parent 3a678fb commit 8c73a7e

File tree

12 files changed

+196
-34
lines changed

12 files changed

+196
-34
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@
5151
/DimmerTQLUnitTest/bin/Release/net9.0
5252
/Dimmer/Dimmer/appsettings.json
5353
/Dimmer/Dimmer/Utils/ApiKeys.cs
54+
/SmoothBtmBarDroid/bin/Debug/net10.0-android
55+
/SmoothBtmBarDroid/obj
56+
/SmoothBtmBarDroid/bin/Debug/net9.0-android

Dimmer-MAUI.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hqub.Lastfm", "..\..\Last.f
1919
EndProject
2020
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParseLiveQuery", "..\..\Parse-LiveQueries-DOTNET-master\ParseLiveQuery\ParseLiveQuery.csproj", "{30B5E670-9A4F-E039-CDC4-1E6A29AEACE2}"
2121
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmoothBtmBarDroid", "SmoothBtmBarDroid\SmoothBtmBarDroid.csproj", "{AB1A0B0C-BA4F-4132-9E2E-D6AA421696A0}"
23+
EndProject
2224
Global
2325
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2426
Debug|Any CPU = Debug|Any CPU
@@ -59,6 +61,10 @@ Global
5961
{30B5E670-9A4F-E039-CDC4-1E6A29AEACE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
6062
{30B5E670-9A4F-E039-CDC4-1E6A29AEACE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
6163
{30B5E670-9A4F-E039-CDC4-1E6A29AEACE2}.Release|Any CPU.Build.0 = Release|Any CPU
64+
{AB1A0B0C-BA4F-4132-9E2E-D6AA421696A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65+
{AB1A0B0C-BA4F-4132-9E2E-D6AA421696A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
66+
{AB1A0B0C-BA4F-4132-9E2E-D6AA421696A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
67+
{AB1A0B0C-BA4F-4132-9E2E-D6AA421696A0}.Release|Any CPU.Build.0 = Release|Any CPU
6268
EndGlobalSection
6369
GlobalSection(SolutionProperties) = preSolution
6470
HideSolutionNode = FALSE

Dimmer/Dimmer.Droid/Dimmer.Droid.csproj

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,63 +45,64 @@
4545

4646
<ItemGroup>
4747
<!--<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.120" />-->
48-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
48+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.1" />
4949
<PackageReference Include="SkiaSharp.Views" Version="3.119.1" />
50-
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.11.0" />
50+
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.12.2.1" />
5151

5252

5353

54-
<PackageReference Include="Xamarin.AndroidX.Fragment" Version="1.8.9" />
54+
<PackageReference Include="Xamarin.AndroidX.Fragment" Version="1.8.9.1" />
5555

5656

5757

58-
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.8.9" />
58+
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.8.9.1" />
5959

6060

6161

62-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.9.4" />
62+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.10.0.1" />
6363

6464

6565
<!--<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />-->
6666

67-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.9.4" />
67+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.10.0.1" />
6868

6969

7070

71-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.9.4" />
71+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.10.0.1" />
7272

7373

7474

75-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.9.4" />
75+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.10.0.1" />
7676

7777

7878

79-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" Version="2.9.4" />
79+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" Version="2.10.0.1" />
8080

8181

8282

83-
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.8.1.1" />
83+
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.8.1.2" />
8484

85-
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.34" />
85+
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.35" />
8686

8787
<!-- Media3 Dependencies (Consolidated & Updated) -->
88-
<PackageReference Include="Xamarin.AndroidX.Media3.Common" Version="1.8.0" />
89-
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer" Version="1.8.0" />
88+
<PackageReference Include="Xamarin.AndroidX.Media3.Common" Version="1.9.0.1" />
89+
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer" Version="1.9.0.1" />
9090
<PackageReference Include="morelinq" Version="4.4.0" />
9191
<!-- Use only ONE reference -->
92-
<PackageReference Include="Xamarin.AndroidX.Media3.Extractor" Version="1.8.0" />
93-
<PackageReference Include="Xamarin.AndroidX.Media3.Session" Version="1.8.0" />
94-
<PackageReference Include="Xamarin.AndroidX.Media3.Ui" Version="1.8.0" />
95-
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer.Dash" Version="1.8.0" />
96-
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer.Hls" Version="1.8.0" />
97-
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer.SmoothStreaming" Version="1.8.0" />
98-
<PackageReference Include="Xamarin.AndroidX.Palette.Palette.Ktx" Version="1.0.0.27" />
99-
<PackageReference Include="Xamarin.AndroidX.SavedState" Version="1.4.0" />
100-
<PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="1.4.0" />
101-
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.13.0" />
92+
<PackageReference Include="Xamarin.AndroidX.Media3.Extractor" Version="1.9.0.1" />
93+
<PackageReference Include="Xamarin.AndroidX.Media3.Session" Version="1.9.0.1" />
94+
<PackageReference Include="Xamarin.AndroidX.Media3.Ui" Version="1.9.0.1" />
95+
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer.Dash" Version="1.9.0.1" />
96+
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer.Hls" Version="1.9.0.1" />
97+
<PackageReference Include="Xamarin.AndroidX.Media3.ExoPlayer.SmoothStreaming" Version="1.9.0.1" />
98+
<PackageReference Include="Xamarin.AndroidX.Palette.Palette.Ktx" Version="1.0.0.28" />
99+
<PackageReference Include="Xamarin.AndroidX.SavedState" Version="1.4.0.1" />
100+
<PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="1.4.0.1" />
101+
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.13.0.1" />
102102
</ItemGroup>
103103

104104
<ItemGroup>
105+
<ProjectReference Include="..\..\SmoothBtmBarDroid\SmoothBtmBarDroid.csproj" />
105106
<ProjectReference Include="..\Dimmer\Dimmer.csproj" />
106107
</ItemGroup>
107108

Dimmer/Dimmer.Droid/DimmerAudio/ExoPlayerService.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void RefreshNotification()
148148
{
149149
// Re-setting the player forces the PlayerNotificationManager to redraw
150150
_notifMgr.SetPlayer(null);
151-
_notifMgr.SetPlayer(notificationPlayer);
151+
_notifMgr.SetPlayer(player);
152152
}
153153
public void PrepareNext(SongModelView nextSong)
154154
{
@@ -274,7 +274,7 @@ public bool SetPreferredDevice(AudioOutputDevice dev)
274274

275275

276276

277-
private IPlayer? notificationPlayer;
277+
//private IPlayer? notificationPlayer;
278278
public async override void OnCreate()
279279
{
280280
base.OnCreate();
@@ -303,7 +303,7 @@ public async override void OnCreate()
303303

304304
.Build();
305305

306-
notificationPlayer = new QueueEnablingPlayerWrapper(player!);
306+
//notificationPlayer = new QueueEnablingPlayerWrapper(player!);
307307

308308

309309
player?.AddListener(new PlayerEventListener(this));
@@ -338,7 +338,7 @@ public async override void OnCreate()
338338
.SetCustomIconResId(Resource.Drawable.media3_icon_repeat_off)
339339
.Build();
340340

341-
mediaSession = new MediaSession.Builder(this, notificationPlayer)!
341+
mediaSession = new MediaSession.Builder(this, player)!
342342
.SetSessionActivity(pendingIntent)!
343343
.SetCallback(sessionCallback)!
344344
.SetId("Dimmer_MediaSession_Main")!
@@ -352,7 +352,7 @@ public async override void OnCreate()
352352
NotificationHelper.CreateChannel(this);
353353
_notifMgr = NotificationHelper.BuildManager(this, mediaSession!, CurrentSongContext);
354354

355-
_notifMgr.SetPlayer(notificationPlayer);
355+
_notifMgr.SetPlayer(player);
356356

357357

358358

@@ -1406,6 +1406,15 @@ public bool IsCommandAvailable(int command)
14061406
public void SetVideoTextureView(TextureView? textureView) => _realPlayer.SetVideoTextureView(textureView);
14071407
public void Stop() => _realPlayer.Stop();
14081408

1409+
public void Mute()
1410+
{
1411+
throw new NotImplementedException();
1412+
}
1413+
1414+
public void Unmute()
1415+
{
1416+
throw new NotImplementedException();
1417+
}
14091418
}
14101419
} // End ExoPlayerService class
14111420

Dimmer/Dimmer.Droid/ViewsAndPages/NativeViews/HomePageFragment.cs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
using Android.Views.InputMethods;
55

66
using AndroidX.CoordinatorLayout.Widget;
7+
using AndroidX.Lifecycle;
78
using AndroidX.RecyclerView.Widget;
89

910
using Dimmer.ViewsAndPages.NativeViews.DimmerLive;
1011
using Dimmer.ViewsAndPages.NativeViews.Misc;
1112
using Dimmer.ViewsAndPages.ViewUtils;
1213
using Dimmer.WinUI.UiUtils;
14+
using Google.Android.Material.Loadingindicator;
1315
using static Dimmer.ViewsAndPages.NativeViews.SongAdapter;
1416

1517

@@ -123,6 +125,7 @@ public override View OnCreateView(LayoutInflater inflater, ViewGroup? container,
123125
TextSize = 14
124126
};
125127
_searchBar.SetPadding(40, 30, 40, 30);
128+
126129
_searchBar.TextChanged += _searchBar_TextChanged;
127130
searchCard.AddView(_searchBar);
128131
// Help Button
@@ -134,7 +137,9 @@ public override View OnCreateView(LayoutInflater inflater, ViewGroup? container,
134137
};
135138
helpBtn.Click += (s, e) => OpenTqlGuide();
136139

137-
140+
loadingIndic = new LoadingIndicator(ctx);
141+
loadingIndic.Visibility = ViewStates.Gone;
142+
loadingIndic.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, AppUtil.DpToPx(80));
138143

139144
// Add items to Header
140145
headerLayout.AddView(menuBtn);
@@ -143,6 +148,7 @@ public override View OnCreateView(LayoutInflater inflater, ViewGroup? container,
143148

144149
// Add Header to Content
145150
contentLinear.AddView(headerLayout);
151+
contentLinear.AddView(loadingIndic);
146152

147153
// --- 3.1 Header Section (Menu + Search + Help) ---
148154
var headerTwoLayout = new LinearLayout(ctx)
@@ -371,9 +377,10 @@ private void SetupSwipeableFab(View view)
371377
private void _searchBar_TextChanged(object? sender, Android.Text.TextChangedEventArgs e)
372378
{
373379
var NewText = e.Text?.ToString();
374-
var started = e.Start;
375-
var AfterCount = e.AfterCount;
376-
var BeforeCount = e.BeforeCount;
380+
//var started = e.Start;
381+
//var AfterCount = e.AfterCount;
382+
//var BeforeCount = e.BeforeCount;
383+
loadingIndic.Visibility = ViewStates.Visible;
377384
MyViewModel.SearchSongForSearchResultHolder(NewText);
378385
}
379386

@@ -407,8 +414,24 @@ public void OpenTqlGuide()
407414
public override void OnResume()
408415
{
409416
base.OnResume();
410-
MyViewModel.PropertyChanged += ViewModel_PropertyChanged;
411-
417+
MyViewModel.WhenPropertyChange(nameof(MyViewModel.SearchResults),
418+
v => MyViewModel.SearchResults.Count)
419+
.ObserveOn(RxSchedulers.UI)
420+
.Subscribe(newCount =>
421+
{
422+
if (newCount>0)
423+
{
424+
loadingIndic.Visibility = ViewStates.Gone;
425+
}
426+
});
427+
_searchBar.FocusChange += (s, e) =>
428+
{
429+
var newFocus = e.HasFocus;
430+
if (!newFocus)
431+
{
432+
loadingIndic.Visibility = ViewStates.Gone;
433+
}
434+
};
412435
_isNavigating = false;
413436

414437
}
@@ -523,6 +546,7 @@ private void Fab_LongClick(object? sender, View.LongClickEventArgs e)
523546

524547
protected CompositeDisposable CompositeDisposables { get; } = new CompositeDisposable();
525548
public TextView songsCountTextView { get; private set; }
549+
public LoadingIndicator loadingIndic { get; private set; }
526550

527551
public override void OnDestroyView()
528552
{

Dimmer/Dimmer.Droid/ViewsAndPages/NativeViews/NowPlayingFragment.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ private ScrollView CreateExpandedPlayer(Context ctx)
506506
_viewModel.ToggleRepeatMode();
507507
};
508508
// Slider Logic
509+
510+
//_seekSlider.AddOnChangeListener
509511
_seekSlider.Touch += (s, e) =>
510512
{
511513
switch (e.Event?.Action)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Additions allow you to add arbitrary C# to the generated classes
2+
before they are compiled. This can be helpful for providing convenience
3+
methods or adding pure C# classes.
4+
5+
== Adding Methods to Generated Classes ==
6+
7+
Let's say the library being bound has a Rectangle class with a constructor
8+
that takes an x and y position, and a width and length size. It will look like
9+
this:
10+
11+
public partial class Rectangle
12+
{
13+
public Rectangle (int x, int y, int width, int height)
14+
{
15+
// JNI bindings
16+
}
17+
}
18+
19+
Imagine we want to add a constructor to this class that takes a Point and
20+
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
21+
with a partial class containing our new method:
22+
23+
public partial class Rectangle
24+
{
25+
public Rectangle (Point location, Size size) :
26+
this (location.X, location.Y, size.Width, size.Height)
27+
{
28+
}
29+
}
30+
31+
At compile time, the additions class will be added to the generated class
32+
and the final assembly will a Rectangle class with both constructors.
33+
34+
35+
== Adding C# Classes ==
36+
37+
Another thing that can be done is adding fully C# managed classes to the
38+
generated library. In the above example, let's assume that there isn't a
39+
Point class available in Java or our library. The one we create doesn't need
40+
to interact with Java, so we'll create it like a normal class in C#.
41+
42+
By adding a Point.cs file with this class, it will end up in the binding library:
43+
44+
public class Point
45+
{
46+
public int X { get; set; }
47+
public int Y { get; set; }
48+
}
50.6 KB
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net9.0-android</TargetFramework>
4+
<SupportedOSPlatformVersion>24</SupportedOSPlatformVersion>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<!--
8+
Enable trim analyzers for Android class libraries.
9+
To learn more, see: https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming
10+
-->
11+
<IsTrimmable>true</IsTrimmable>
12+
<!--
13+
NOTE: you can simply add .aar or .jar files in this directory to be included in the project.
14+
To learn more, see: https://learn.microsoft.com/dotnet/maui/migration/android-binding-projects
15+
-->
16+
</PropertyGroup>
17+
<ItemGroup>
18+
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.7.1.2" />
19+
<PackageReference Include="Xamarin.AndroidX.Navigation.Fragment" Version="2.9.6.1" />
20+
<PackageReference Include="Xamarin.AndroidX.Navigation.UI" Version="2.9.6.1" />
21+
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="2.3.0.1" />
22+
</ItemGroup>
23+
24+
25+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<enum-field-mappings>
2+
<!--
3+
This example converts the constants Fragment_id, Fragment_name,
4+
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
5+
to an enum called Android.Support.V4.App.FragmentTagType with values
6+
Id, Name, and Tag.
7+
8+
<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
9+
<field jni-name="Fragment_name" clr-name="Name" value="0" />
10+
<field jni-name="Fragment_id" clr-name="Id" value="1" />
11+
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
12+
</mapping>
13+
-->
14+
</enum-field-mappings>

0 commit comments

Comments
 (0)