Started working on the Searching functionality for the Song view. #44
This commit is contained in:
@@ -64,6 +64,9 @@
|
|||||||
<PackageReference Include="sqlite-net-pcl">
|
<PackageReference Include="sqlite-net-pcl">
|
||||||
<Version>1.5.231</Version>
|
<Version>1.5.231</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="UXDivers.GorillaPlayer.SDK">
|
||||||
|
<Version>1.5.2</Version>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
||||||
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
|
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
|
||||||
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
|
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
|
||||||
|
|||||||
+47
-44
@@ -9771,113 +9771,113 @@ namespace Mear.Droid
|
|||||||
// aapt resource value: 0x7f0b0043
|
// aapt resource value: 0x7f0b0043
|
||||||
public const int character_counter_pattern = 2131427395;
|
public const int character_counter_pattern = 2131427395;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b004e
|
|
||||||
public const int download_notification_channel_name = 2131427406;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b004f
|
// aapt resource value: 0x7f0b004f
|
||||||
public const int exo_controls_fastforward_description = 2131427407;
|
public const int download_notification_channel_name = 2131427407;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0050
|
// aapt resource value: 0x7f0b0050
|
||||||
public const int exo_controls_fullscreen_description = 2131427408;
|
public const int exo_controls_fastforward_description = 2131427408;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0051
|
// aapt resource value: 0x7f0b0051
|
||||||
public const int exo_controls_next_description = 2131427409;
|
public const int exo_controls_fullscreen_description = 2131427409;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0052
|
// aapt resource value: 0x7f0b0052
|
||||||
public const int exo_controls_pause_description = 2131427410;
|
public const int exo_controls_next_description = 2131427410;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0053
|
// aapt resource value: 0x7f0b0053
|
||||||
public const int exo_controls_play_description = 2131427411;
|
public const int exo_controls_pause_description = 2131427411;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0054
|
// aapt resource value: 0x7f0b0054
|
||||||
public const int exo_controls_previous_description = 2131427412;
|
public const int exo_controls_play_description = 2131427412;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0055
|
// aapt resource value: 0x7f0b0055
|
||||||
public const int exo_controls_repeat_all_description = 2131427413;
|
public const int exo_controls_previous_description = 2131427413;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0056
|
// aapt resource value: 0x7f0b0056
|
||||||
public const int exo_controls_repeat_off_description = 2131427414;
|
public const int exo_controls_repeat_all_description = 2131427414;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0057
|
// aapt resource value: 0x7f0b0057
|
||||||
public const int exo_controls_repeat_one_description = 2131427415;
|
public const int exo_controls_repeat_off_description = 2131427415;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0058
|
// aapt resource value: 0x7f0b0058
|
||||||
public const int exo_controls_rewind_description = 2131427416;
|
public const int exo_controls_repeat_one_description = 2131427416;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0059
|
// aapt resource value: 0x7f0b0059
|
||||||
public const int exo_controls_shuffle_description = 2131427417;
|
public const int exo_controls_rewind_description = 2131427417;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b005a
|
// aapt resource value: 0x7f0b005a
|
||||||
public const int exo_controls_stop_description = 2131427418;
|
public const int exo_controls_shuffle_description = 2131427418;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b005b
|
// aapt resource value: 0x7f0b005b
|
||||||
public const int exo_download_completed = 2131427419;
|
public const int exo_controls_stop_description = 2131427419;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b005c
|
// aapt resource value: 0x7f0b005c
|
||||||
public const int exo_download_description = 2131427420;
|
public const int exo_download_completed = 2131427420;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b005d
|
// aapt resource value: 0x7f0b005d
|
||||||
public const int exo_download_downloading = 2131427421;
|
public const int exo_download_description = 2131427421;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b005e
|
// aapt resource value: 0x7f0b005e
|
||||||
public const int exo_download_failed = 2131427422;
|
public const int exo_download_downloading = 2131427422;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b005f
|
// aapt resource value: 0x7f0b005f
|
||||||
public const int exo_download_notification_channel_name = 2131427423;
|
public const int exo_download_failed = 2131427423;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0060
|
// aapt resource value: 0x7f0b0060
|
||||||
public const int exo_download_removing = 2131427424;
|
public const int exo_download_notification_channel_name = 2131427424;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0061
|
// aapt resource value: 0x7f0b0061
|
||||||
public const int exo_item_list = 2131427425;
|
public const int exo_download_removing = 2131427425;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b006f
|
|
||||||
public const int exo_media_action_repeat_all_description = 2131427439;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0070
|
|
||||||
public const int exo_media_action_repeat_off_description = 2131427440;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0071
|
|
||||||
public const int exo_media_action_repeat_one_description = 2131427441;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0062
|
// aapt resource value: 0x7f0b0062
|
||||||
public const int exo_track_bitrate = 2131427426;
|
public const int exo_item_list = 2131427426;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0b0070
|
||||||
|
public const int exo_media_action_repeat_all_description = 2131427440;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0b0071
|
||||||
|
public const int exo_media_action_repeat_off_description = 2131427441;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0b0072
|
||||||
|
public const int exo_media_action_repeat_one_description = 2131427442;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0063
|
// aapt resource value: 0x7f0b0063
|
||||||
public const int exo_track_mono = 2131427427;
|
public const int exo_track_bitrate = 2131427427;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0064
|
// aapt resource value: 0x7f0b0064
|
||||||
public const int exo_track_resolution = 2131427428;
|
public const int exo_track_mono = 2131427428;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0065
|
// aapt resource value: 0x7f0b0065
|
||||||
public const int exo_track_selection_auto = 2131427429;
|
public const int exo_track_resolution = 2131427429;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0066
|
// aapt resource value: 0x7f0b0066
|
||||||
public const int exo_track_selection_none = 2131427430;
|
public const int exo_track_selection_auto = 2131427430;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0067
|
// aapt resource value: 0x7f0b0067
|
||||||
public const int exo_track_selection_title_audio = 2131427431;
|
public const int exo_track_selection_none = 2131427431;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0068
|
// aapt resource value: 0x7f0b0068
|
||||||
public const int exo_track_selection_title_text = 2131427432;
|
public const int exo_track_selection_title_audio = 2131427432;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0069
|
// aapt resource value: 0x7f0b0069
|
||||||
public const int exo_track_selection_title_video = 2131427433;
|
public const int exo_track_selection_title_text = 2131427433;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b006a
|
// aapt resource value: 0x7f0b006a
|
||||||
public const int exo_track_stereo = 2131427434;
|
public const int exo_track_selection_title_video = 2131427434;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b006b
|
// aapt resource value: 0x7f0b006b
|
||||||
public const int exo_track_surround = 2131427435;
|
public const int exo_track_stereo = 2131427435;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b006c
|
// aapt resource value: 0x7f0b006c
|
||||||
public const int exo_track_surround_5_point_1 = 2131427436;
|
public const int exo_track_surround = 2131427436;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b006d
|
// aapt resource value: 0x7f0b006d
|
||||||
public const int exo_track_surround_7_point_1 = 2131427437;
|
public const int exo_track_surround_5_point_1 = 2131427437;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b006e
|
// aapt resource value: 0x7f0b006e
|
||||||
public const int exo_track_unknown = 2131427438;
|
public const int exo_track_surround_7_point_1 = 2131427438;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0b006f
|
||||||
|
public const int exo_track_unknown = 2131427439;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0044
|
// aapt resource value: 0x7f0b0044
|
||||||
public const int fab_transformation_scrim_behavior = 2131427396;
|
public const int fab_transformation_scrim_behavior = 2131427396;
|
||||||
@@ -9888,6 +9888,9 @@ namespace Mear.Droid
|
|||||||
// aapt resource value: 0x7f0b0046
|
// aapt resource value: 0x7f0b0046
|
||||||
public const int hide_bottom_view_on_scroll_behavior = 2131427398;
|
public const int hide_bottom_view_on_scroll_behavior = 2131427398;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0b004e
|
||||||
|
public const int library_name = 2131427406;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0b0000
|
// aapt resource value: 0x7f0b0000
|
||||||
public const int mr_button_content_description = 2131427328;
|
public const int mr_button_content_description = 2131427328;
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,12 @@
|
|||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
||||||
<!-- colorPrimary is used for the default action bar background -->
|
<!-- colorPrimary is used for the default action bar background -->
|
||||||
|
<!--
|
||||||
<item name="colorPrimary">#2196F3</item>
|
<item name="colorPrimary">#2196F3</item>
|
||||||
|
-->
|
||||||
|
<item name="colorPrimary">#222222</item>
|
||||||
<!-- colorPrimaryDark is used for the status bar -->
|
<!-- colorPrimaryDark is used for the status bar -->
|
||||||
<item name="colorPrimaryDark">#1976D2</item>
|
<item name="colorPrimaryDark">#000000</item>
|
||||||
<!-- colorAccent is used as the default value for colorControlActivated
|
<!-- colorAccent is used as the default value for colorControlActivated
|
||||||
which is used to tint widgets -->
|
which is used to tint widgets -->
|
||||||
<item name="colorAccent">#FF4081</item>
|
<item name="colorAccent">#FF4081</item>
|
||||||
|
|||||||
@@ -130,6 +130,9 @@
|
|||||||
<PackageReference Include="sqlite-net-pcl">
|
<PackageReference Include="sqlite-net-pcl">
|
||||||
<Version>1.5.231</Version>
|
<Version>1.5.231</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="UXDivers.GorillaPlayer.SDK">
|
||||||
|
<Version>1.5.2</Version>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
+21
-1
@@ -20,6 +20,13 @@
|
|||||||
|
|
||||||
<Color x:Key="EntryTextColor">#ffffee</Color>
|
<Color x:Key="EntryTextColor">#ffffee</Color>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<Color x:Key="SearchBarBackgroundColor">#ffffee</Color>
|
||||||
|
<Color x:Key="SearchBarCancelButtonColor">#999999</Color>
|
||||||
|
<Color x:Key="StaticResource SearchBarPlaceholderColor">#ffeeff</Color>
|
||||||
|
-->
|
||||||
|
<Color x:Key="StaticResource SearchBarTextColor">#ffffff</Color>
|
||||||
|
|
||||||
<Style TargetType="NavigationPage">
|
<Style TargetType="NavigationPage">
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource NavigationPageBackgroundColor}" />
|
<Setter Property="BackgroundColor" Value="{StaticResource NavigationPageBackgroundColor}" />
|
||||||
<Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPageColor}" />
|
<Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPageColor}" />
|
||||||
@@ -30,9 +37,14 @@
|
|||||||
</Style>
|
</Style>
|
||||||
<Style TargetType="TabbedPage">
|
<Style TargetType="TabbedPage">
|
||||||
<Setter Property="BarTextColor" Value="{StaticResource TabbedBarTextColor}" />
|
<Setter Property="BarTextColor" Value="{StaticResource TabbedBarTextColor}" />
|
||||||
|
<!--
|
||||||
<Setter Property="UnselectedTabColor" Value="{StaticResource TabbedUnselectedColor}" />
|
<Setter Property="UnselectedTabColor" Value="{StaticResource TabbedUnselectedColor}" />
|
||||||
|
-->
|
||||||
|
<Setter Property="UnselectedTabColor" Value="Green" />
|
||||||
|
<!--
|
||||||
<Setter Property="SelectedTabColor" Value="{StaticResource TabbedSelectedColor}" />
|
<Setter Property="SelectedTabColor" Value="{StaticResource TabbedSelectedColor}" />
|
||||||
<Setter Property="BarBackgroundColor" Value="Green" />
|
-->
|
||||||
|
<Setter Property="SelectedTabColor" Value="Yellow" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style TargetType="StackLayout">
|
<Style TargetType="StackLayout">
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource NavigationPageColor}" />
|
<Setter Property="BackgroundColor" Value="{StaticResource NavigationPageColor}" />
|
||||||
@@ -49,6 +61,14 @@
|
|||||||
<Style TargetType="Entry">
|
<Style TargetType="Entry">
|
||||||
<Setter Property="TextColor" Value="{StaticResource EntryTextColor}" />
|
<Setter Property="TextColor" Value="{StaticResource EntryTextColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
<!--
|
||||||
|
<Style TargetType="SearchBar">
|
||||||
|
<Setter Property="BackgroundColor" Value="{StaticResource SearchBarBackgroundColor}" />
|
||||||
|
<Setter Property="CancelButtonColor" Value="{StaticResource SearchBarCancelButtonColor}" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{StaticResource SearchBarPlaceholderColor}" />
|
||||||
|
<Setter Property="TextColor" Value="{StaticResource SearchBarTextColor}" />
|
||||||
|
</Style>
|
||||||
|
-->
|
||||||
|
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
@@ -13,7 +13,6 @@ namespace Mear
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
MainPage = new Landing();
|
MainPage = new Landing();
|
||||||
MainPage.SetValue(NavigationPage.BarBackgroundColorProperty, Color.Black);
|
|
||||||
MainPage.SetValue(NavigationPage.BarTextColorProperty, Color.White);
|
MainPage.SetValue(NavigationPage.BarTextColorProperty, Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<PackageReference Include="Plugin.MediaManager" Version="0.6.7" />
|
<PackageReference Include="Plugin.MediaManager" Version="0.6.7" />
|
||||||
<PackageReference Include="RestSharp" Version="106.6.9" />
|
<PackageReference Include="RestSharp" Version="106.6.9" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.5.231" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.5.231" />
|
||||||
|
<PackageReference Include="UXDivers.GorillaPlayer.SDK" Version="1.5.2" />
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Mear.ViewModels
|
|||||||
|
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
private void NotifyPropertyChanged(string propertyName)
|
protected void NotifyPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
if (PropertyChanged != null)
|
if (PropertyChanged != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,117 +13,151 @@ using Mear.Repositories.Remote;
|
|||||||
|
|
||||||
namespace Mear.ViewModels
|
namespace Mear.ViewModels
|
||||||
{
|
{
|
||||||
public class SongViewModel : BaseViewModel
|
public class SongViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
private ObservableCollection<Song> _songItems;
|
private ObservableCollection<Song> _songItems;
|
||||||
private Command _refreshSongs;
|
private Command _refreshSongs;
|
||||||
#endregion
|
private Command _searchSongsCommand;
|
||||||
|
private string _searchedText;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
public ObservableCollection<Song> SongItems
|
public ObservableCollection<Song> SongItems
|
||||||
{
|
{
|
||||||
get => _songItems;
|
get => _songItems;
|
||||||
set => _songItems = value;
|
set => _songItems = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command RefreshSongs
|
public Command RefreshSongs
|
||||||
{
|
{
|
||||||
get => _refreshSongs;
|
get => _refreshSongs;
|
||||||
set => _refreshSongs = value;
|
set => _refreshSongs = value;
|
||||||
}
|
}
|
||||||
#endregion
|
public Command SearchSongsCommand
|
||||||
|
{
|
||||||
|
get => _searchSongsCommand;
|
||||||
|
set => _searchSongsCommand = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SearchedText
|
||||||
|
{
|
||||||
|
get => _searchedText;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_searchedText = value;
|
||||||
|
NotifyPropertyChanged("SearchSong");
|
||||||
|
//SearchSongText(_searchedText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public SongViewModel()
|
public SongViewModel()
|
||||||
{
|
{
|
||||||
_songItems = new ObservableCollection<Song>();
|
_songItems = new ObservableCollection<Song>();
|
||||||
_refreshSongs = new Command(async () => await PopulateSongsAsync());
|
_refreshSongs = new Command(async () => await PopulateSongsAsync());
|
||||||
|
_searchSongsCommand = new Command(async () => await SearchSongText());
|
||||||
|
|
||||||
PopulateSongs();
|
PopulateSongs();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
public void PopulateSongs()
|
public void PopulateSongs()
|
||||||
{
|
{
|
||||||
var songRepo = new RemoteSongRepository();
|
var songRepo = new RemoteSongRepository();
|
||||||
var localSongRepo = new LocalSongRepository();
|
var localSongRepo = new LocalSongRepository();
|
||||||
var lclSongs = localSongRepo.RetrieveSongs();
|
var lclSongs = localSongRepo.RetrieveSongs();
|
||||||
var rmtSongs = songRepo.RetrieveSongs().OrderBy(s => s.Title).ToList();
|
var rmtSongs = songRepo.RetrieveSongs().OrderBy(s => s.Title).ToList();
|
||||||
var songs = new List<Song>();
|
var songs = new List<Song>();
|
||||||
if (lclSongs != null)
|
if (lclSongs != null)
|
||||||
{
|
{
|
||||||
lclSongs = lclSongs.OrderBy(s => s.Title).ToList();
|
lclSongs = lclSongs.OrderBy(s => s.Title).ToList();
|
||||||
songs = MergeSongs(lclSongs, rmtSongs);
|
songs = MergeSongs(lclSongs, rmtSongs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
songs = rmtSongs;
|
songs = rmtSongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var song in songs)
|
foreach (var song in songs)
|
||||||
{
|
{
|
||||||
_songItems.Add(song);
|
_songItems.Add(song);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Song> MergeSongs(List<Song> local, List<Song> remote)
|
private List<Song> MergeSongs(List<Song> local, List<Song> remote)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (Song lclSong in local)
|
foreach (Song lclSong in local)
|
||||||
{
|
{
|
||||||
Song song = remote.Find(s => (s.Title.Equals(lclSong.Title)));
|
Song song = remote.Find(s => (s.Title.Equals(lclSong.Title)));
|
||||||
remote.Remove(song);
|
remote.Remove(song);
|
||||||
remote.Add(lclSong);
|
remote.Add(lclSong);
|
||||||
}
|
}
|
||||||
|
|
||||||
return remote;
|
return remote;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var msg = ex.Message;
|
var msg = ex.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
private async Task PopulateSongsAsync()
|
private async Task PopulateSongsAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var songRepo = new RemoteSongRepository();
|
var songRepo = new RemoteSongRepository();
|
||||||
var localSongRepo = new LocalSongRepository();
|
var localSongRepo = new LocalSongRepository();
|
||||||
var lclSongs = localSongRepo.RetrieveSongs();
|
var lclSongs = localSongRepo.RetrieveSongs();
|
||||||
var rmtSongs = songRepo.RetrieveSongs().OrderBy(s => s.Title).ToList();
|
var rmtSongs = songRepo.RetrieveSongs().OrderBy(s => s.Title).ToList();
|
||||||
var songs = new List<Song>();
|
var songs = new List<Song>();
|
||||||
if (lclSongs != null)
|
if (lclSongs != null)
|
||||||
{
|
{
|
||||||
lclSongs = lclSongs.OrderBy(s => s.Title).ToList();
|
lclSongs = lclSongs.OrderBy(s => s.Title).ToList();
|
||||||
songs = MergeSongs(lclSongs, rmtSongs);
|
songs = MergeSongs(lclSongs, rmtSongs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
songs = rmtSongs;
|
songs = rmtSongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
_songItems.Clear();
|
_songItems.Clear();
|
||||||
|
|
||||||
foreach (var song in songs)
|
foreach (var song in songs)
|
||||||
{
|
{
|
||||||
_songItems.Add(song);
|
_songItems.Add(song);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var msg = ex.Message;
|
var msg = ex.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsRefreshing = false;
|
IsRefreshing = false;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
}
|
private async Task SearchSongText()
|
||||||
}
|
{
|
||||||
|
if (_searchedText == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var searchPhrase = _searchedText.Trim();
|
||||||
|
|
||||||
|
const int SEARCH_PHRASE_MIN_LENGTH = 3;
|
||||||
|
if (searchPhrase.Length < SEARCH_PHRASE_MIN_LENGTH) return; // SEARCH_PHRASE_MIN_LENGTH = 3
|
||||||
|
|
||||||
|
_songItems.Where(sng => sng.Title.Contains(_searchedText) || sng.Artist.Contains(_searchedText));
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,7 +13,13 @@
|
|||||||
</ContentPage.BindingContext>
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<ListView x:Name="SongListView"
|
<SearchBar x:Name="SearchSong"
|
||||||
|
Placeholder="Title, Artist"
|
||||||
|
SearchCommand="{Binding SearchSongsCommand}"
|
||||||
|
SearchCommandParameter="{Binding SearchedText, Source=x:Reference Search}"
|
||||||
|
Text="{Binding SerachedText, Mode=TwoWay}">
|
||||||
|
</SearchBar>
|
||||||
|
<ListView x:Name="SongListView"
|
||||||
ItemsSource="{Binding SongItems}"
|
ItemsSource="{Binding SongItems}"
|
||||||
VerticalOptions="FillAndExpand"
|
VerticalOptions="FillAndExpand"
|
||||||
HasUnevenRows="False"
|
HasUnevenRows="False"
|
||||||
|
|||||||
Reference in New Issue
Block a user