From: aman.jeph Date: Tue, 2 Nov 2021 09:43:06 +0000 (+0530) Subject: Added Detail View options X-Git-Tag: submit/tizen/20211109.094344~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2919632e71db0eaa6b253af3cf884964c71d0f43;p=profile%2Fiot%2Fapps%2Fdotnet%2Fmusic-player.git Added Detail View options Fix dark theme support of some views Change-Id: Ie5b6ef89227368382cf0fa2a1a34acd50faf15fd Signed-off-by: aman.jeph --- diff --git a/music-player/Common/Conversion.cs b/music-player/Common/Conversion.cs new file mode 100755 index 0000000..f490731 --- /dev/null +++ b/music-player/Common/Conversion.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace MusicPlayer.Common +{ + public class Conversion + { + private const string MediaPath = "/opt/usr/home/owner/media"; + private const string DevicePath = "Device Storage"; + + static readonly string[] SizeSuffixes = + { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; + public static string BytesToPrefixMultipliers(Int64 value, int decimalPlaces = 1) + { + if (decimalPlaces < 0) { throw new ArgumentOutOfRangeException("decimalPlaces"); } + if (value < 0) { return "-" + BytesToPrefixMultipliers(-value, decimalPlaces); } + if (value == 0) { return string.Format("{0:n" + decimalPlaces + "} bytes", 0); } + + // mag is 0 for bytes, 1 for KB, 2, for MB, etc. + int mag = (int)Math.Log(value, 1024); + + // 1L << (mag * 10) == 2 ^ (10 * mag) + // [i.e. the number of bytes in the unit corresponding to mag] + decimal adjustedSize = (decimal)value / (1L << (mag * 10)); + + // make adjustment when the value is large enough that + // it would round up to 1000 or more + if (Math.Round(adjustedSize, decimalPlaces) >= 1000) + { + mag += 1; + adjustedSize /= 1024; + } + + return string.Format("{0:n" + decimalPlaces + "} {1}", + adjustedSize, + SizeSuffixes[mag]); + } + + public static string AbsolutePathToDevicePath(string absolutePath) + { + return absolutePath.Replace(MediaPath, DevicePath); + } + } +} diff --git a/music-player/Common/UIColors.cs b/music-player/Common/UIColors.cs index 3bf5a21..2562765 100755 --- a/music-player/Common/UIColors.cs +++ b/music-player/Common/UIColors.cs @@ -11,6 +11,7 @@ namespace MusicPlayer.Common public static readonly Color HEX001447 = new Color(0.0f, 0.0784f, 0.2784f, 1.0f); public static readonly Color HEXEEEFF1 = new Color(0.9333f, 0.9373f, 0.9450f, 1.0f); public static readonly Color HEX000C2B = new Color(0.0f, 0.0471f, 0.1686f, 1.0f); + public static readonly Color HEXC3CAD2 = new Color(0.7647f, 0.7922f, 0.8235f, 1.0f); public static readonly Color LyricsBackground = new Color(0.0f, 0.0f, 0.0f, 0.85f); public static readonly Color ItemSeperator = new Color(0.75f, 0.79f, 0.82f, 1.0f); diff --git a/music-player/Core/PlaybackHelper.cs b/music-player/Core/PlaybackHelper.cs index 2e27ae0..6f9c4ca 100755 --- a/music-player/Core/PlaybackHelper.cs +++ b/music-player/Core/PlaybackHelper.cs @@ -21,6 +21,13 @@ namespace MusicPlayer.Core playerViewModel = new PlayerViewModel(); playerView = new PlayerView(playerViewModel); playerView.BackKeyPressed += OnBackKeyPressed; + playerViewModel.ShowDetails += OnShowDetails; + } + + private void OnShowDetails(object sender, DetailOperationEventHandlerArgs e) + { + TrackDetailViewModel viewModel = new TrackDetailViewModel(e.MediaId); + TrackDetailView view = new TrackDetailView(viewModel); } public static PlaybackHelper Instance diff --git a/music-player/MediaContent/TrackContents.cs b/music-player/MediaContent/TrackContents.cs index e063518..355ba5c 100755 --- a/music-player/MediaContent/TrackContents.cs +++ b/music-player/MediaContent/TrackContents.cs @@ -134,5 +134,10 @@ namespace MusicPlayer.Media dataReader.Dispose(); return mediaList; } + + public static AudioInfo GetTrack(string mediaId) + { + return (AudioInfo)mediaInfo.SelectMedia(mediaId); + } } } diff --git a/music-player/Models/TrackExtension.cs b/music-player/Models/TrackExtension.cs new file mode 100755 index 0000000..28d1aa5 --- /dev/null +++ b/music-player/Models/TrackExtension.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Text; +using MusicPlayer.Common; + +namespace MusicPlayer.Models +{ + class TrackExtension : Track + { + public TrackExtension():base() + { + } + + public TrackExtension(Tizen.Content.MediaContent.AudioInfo audioInfo):base(audioInfo) + { + DateOfRecording = VerifyValue(audioInfo.DateRecorded); + TrackNumber = VerifyValue(audioInfo.TrackNumber); + Format = VerifyValue(audioInfo.MimeType); + BitDepth = VerifyValue(audioInfo.BitRate.ToString()); + SampleRate = VerifyValue(audioInfo.SampleRate.ToString()); + TrackSize = Conversion.BytesToPrefixMultipliers(audioInfo.FileSize); + Location = Conversion.AbsolutePathToDevicePath(audioInfo.Path); + } + + private string dateofRecording; + + public string DateOfRecording + { + get => dateofRecording; + set => SetProperty(ref dateofRecording, value); + } + + private string trackNumber; + + public string TrackNumber + { + get => trackNumber; + set => SetProperty(ref trackNumber, value); + } + + private string format; + + public string Format + { + get => format; + set => SetProperty(ref format, value); + } + + private string bitDepth; + + public string BitDepth + { + get => bitDepth; + set => SetProperty(ref bitDepth, value); + } + + private string sampleRate; + + public string SampleRate + { + get => sampleRate; + set => SetProperty(ref sampleRate, value); + } + + private string trackSize; + + public String TrackSize + { + get => trackSize; + set => SetProperty(ref trackSize, value); + } + + private string location; + + public string Location + { + get => location; + set => SetProperty(ref location, value); + } + + private string VerifyValue(string value) + { + if(string.IsNullOrEmpty(value)) + { + return "Unknown"; + } + return value; + } + } +} diff --git a/music-player/ViewModels/PlayerViewModel.cs b/music-player/ViewModels/PlayerViewModel.cs index 28a52a1..4eb4cf3 100755 --- a/music-player/ViewModels/PlayerViewModel.cs +++ b/music-player/ViewModels/PlayerViewModel.cs @@ -11,6 +11,15 @@ using System.Threading.Tasks; namespace MusicPlayer.ViewModels { + class DetailOperationEventHandlerArgs : EventArgs + { + public DetailOperationEventHandlerArgs(string mediaId) + { + MediaId = mediaId; + } + public string MediaId { get; private set; } + } + class PlayerViewModel : PropertyNotifier { public const string PlayState = "Play"; @@ -23,6 +32,8 @@ namespace MusicPlayer.ViewModels private Timer playbackTimer; private bool isVolumeChanging; + public event EventHandler ShowDetails; + public PlayerViewModel() { lyricsViewModel = new LyricsViewModel(); @@ -105,6 +116,11 @@ namespace MusicPlayer.ViewModels set => UpdatePlayingStatus(value); } + public void ShowDetailView() + { + ShowDetails?.Invoke(this, new DetailOperationEventHandlerArgs(playerModel.CurrentTrack.Id)); + } + public void SetPlayingList(ListViewModel trackListVM) { playingListViewModel.SetTrackListViewModel(trackListVM); diff --git a/music-player/ViewModels/TrackDetailViewModel.cs b/music-player/ViewModels/TrackDetailViewModel.cs new file mode 100755 index 0000000..0e84aa3 --- /dev/null +++ b/music-player/ViewModels/TrackDetailViewModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tizen.Content.MediaContent; +using MusicPlayer.Models; +using MusicPlayer.Media; +using MusicPlayer.Common; + +namespace MusicPlayer.ViewModels +{ + class TrackDetailViewModel + { + private TrackExtension trackExtensionModel; + + public TrackDetailViewModel(string mediaId) + { + AudioInfo audioInfo = Contents.GetTrack(mediaId); + trackExtensionModel = new TrackExtension(audioInfo); + } + + public TrackExtension Model => trackExtensionModel; + } +} diff --git a/music-player/Views/AlbumDetailView.cs b/music-player/Views/AlbumDetailView.cs index bcbf1cf..2c74b00 100755 --- a/music-player/Views/AlbumDetailView.cs +++ b/music-player/Views/AlbumDetailView.cs @@ -202,6 +202,7 @@ namespace MusicPlayer.Views private void UpdateCollectionView() { + collectionView.StyleName = "PlayingListBackground"; collectionView.ItemTemplate = new DataTemplate(() => { AlbumDetailLayout layout = new AlbumDetailLayout(); diff --git a/music-player/Views/ArtistDetailGroupLayout.cs b/music-player/Views/ArtistDetailGroupLayout.cs index c4d2b63..aeefd2f 100755 --- a/music-player/Views/ArtistDetailGroupLayout.cs +++ b/music-player/Views/ArtistDetailGroupLayout.cs @@ -31,6 +31,7 @@ namespace MusicPlayer.Views Size2D = new Size2D(Width, Height); // to show the rounded rect of the bg BackgroundColor = Color.Transparent; + ThemeChangeSensitive = true; icon = CreateIcon(); titleLabel = CreateTitleLabel(); @@ -70,7 +71,6 @@ namespace MusicPlayer.Views StyleName = "ItemLabel", ThemeChangeSensitive = true, Size2D = new Size2D((Width - (2 * LeftPadding) - IconSize - LayoutPadding), 40), - TextColor = UIColors.HEX001447, PixelSize = 32, FontFamily = "BreezeSans", VerticalAlignment = VerticalAlignment.Center, diff --git a/music-player/Views/BaseContentView.cs b/music-player/Views/BaseContentView.cs index d4da99a..d137ff3 100755 --- a/music-player/Views/BaseContentView.cs +++ b/music-player/Views/BaseContentView.cs @@ -58,9 +58,9 @@ namespace MusicPlayer.Views collectionView = new CollectionView() { ThemeChangeSensitive = true, + StyleName = "ListBackground", Size2D = new Size2D(1792, 108), Margin = new Extents(0, 0, 0, 2), - BackgroundImage = GetBackgroundImagePath(ThemeManager.PlatformThemeId), ItemsLayouter = new LinearLayouter(), ScrollingDirection = ScrollableBase.Direction.Vertical, WidthSpecification = LayoutParamPolicies.MatchParent, @@ -201,15 +201,6 @@ namespace MusicPlayer.Views OperationViewAdded?.Invoke(this, args); } - protected override void OnThemeChanged(object sender, ThemeChangedEventArgs e) - { - base.OnThemeChanged(sender, e); - if(e.IsPlatformThemeChanged) - { - collectionView.BackgroundImage = GetBackgroundImagePath(e.PlatformThemeId); - } - } - protected override void Dispose(DisposeTypes type) { if(Disposed) @@ -242,17 +233,6 @@ namespace MusicPlayer.Views base.Dispose(type); } - private string GetBackgroundImagePath(string platformThemeId) - { - if (platformThemeId.Equals(AppConstants.DarkPlatformThemeId)) - { - return Resources.GetImagePath() + "dark/list_view_bg.png"; - } - else - { - return Resources.GetImagePath() + "light/list_view_bg.png"; - } - } private void OnSubContentOperationViewAdd(object sender, OperationViewAddEventArgs e) { DismissMoreMenu(); diff --git a/music-player/Views/BaseSubContentView.cs b/music-player/Views/BaseSubContentView.cs index 2de9156..2b15bd0 100755 --- a/music-player/Views/BaseSubContentView.cs +++ b/music-player/Views/BaseSubContentView.cs @@ -24,6 +24,7 @@ namespace MusicPlayer.Views { WidthResizePolicy = ResizePolicyType.FillToParent; HeightResizePolicy = ResizePolicyType.FillToParent; + ThemeChangeSensitive = true; StyleName = "AppBackground"; listContainer = new View() @@ -97,9 +98,9 @@ namespace MusicPlayer.Views collectionView = new CollectionView() { ThemeChangeSensitive = true, + StyleName = "ListBackground", //Size2D = new Size2D(1792, 108), Margin = new Extents(0, 0, 0, 2), - BackgroundImage = GetBackgroundImagePath(ThemeManager.PlatformThemeId), ItemsLayouter = new LinearLayouter(), ScrollingDirection = ScrollableBase.Direction.Vertical, WidthSpecification = LayoutParamPolicies.MatchParent, @@ -151,18 +152,6 @@ namespace MusicPlayer.Views } - private string GetBackgroundImagePath(string platformThemeId) - { - if (platformThemeId.Equals(AppConstants.DarkPlatformThemeId)) - { - return Resources.GetImagePath() + "dark/list_view_bg.png"; - } - else - { - return Resources.GetImagePath() + "light/list_view_bg.png"; - } - } - protected override void Dispose(DisposeTypes type) { if(Disposed) diff --git a/music-player/Views/BaseView.cs b/music-player/Views/BaseView.cs index 8b4daae..452f79a 100755 --- a/music-player/Views/BaseView.cs +++ b/music-player/Views/BaseView.cs @@ -96,7 +96,6 @@ namespace MusicPlayer.Views item.Text = TabNames[i]; tabs.AddItem(item); } - tabs.SelectedItemIndex = 1; backButton = null; moreButton = null; @@ -179,20 +178,9 @@ namespace MusicPlayer.Views { if (value) { - ButtonStyle buttonStyle = new ButtonStyle() - { - Icon = new ImageViewStyle() - { - ResourceUrl = Resources.GetImagePath() + "search_icon.png", - }, - IsSelectable = false, - IsEnabled = true, - }; - searchButton = new Button(buttonStyle) + searchButton = new Button("SearchButton") { ThemeChangeSensitive = true, - Size2D = new Size2D(96, 60), - BackgroundImage = Resources.GetImagePath() + "search_button_bg.png", Margin = new Extents(24, 0, 0, 0), }; topView.Add(searchButton); diff --git a/music-player/Views/PlayerView.cs b/music-player/Views/PlayerView.cs index 4e15ed2..4dace26 100755 --- a/music-player/Views/PlayerView.cs +++ b/music-player/Views/PlayerView.cs @@ -211,7 +211,14 @@ namespace MusicPlayer.Views OnDeleteClicked(); }; - moreMenu.Items = new MenuItem[] { share, delete }; + var details = new MenuItem { Text = "Details" }; + details.Clicked += (object o, ClickedEventArgs e) => + { + moreMenu?.Dismiss(); + viewModel.ShowDetailView(); + }; + + moreMenu.Items = new MenuItem[] { share, delete, details }; moreMenu.Post(); } diff --git a/music-player/Views/PlayingListView.cs b/music-player/Views/PlayingListView.cs index c7b7c91..91443bb 100755 --- a/music-player/Views/PlayingListView.cs +++ b/music-player/Views/PlayingListView.cs @@ -20,7 +20,8 @@ namespace MusicPlayer.Views this.viewModel = viewModel; collectionView = new CollectionView() { - BackgroundImage = GetBackgroundImagePath(ThemeManager.PlatformThemeId), + ThemeChangeSensitive = true, + StyleName = "PlayingListBackground", ItemsSource = this.viewModel.TrackListVM, ItemsLayouter = new LinearLayouter(), ItemTemplate = new DataTemplate(() => @@ -58,18 +59,5 @@ namespace MusicPlayer.Views { collectionView.ItemsSource = viewModel.TrackListVM; } - - private string GetBackgroundImagePath(string platformThemeId) - { - if (platformThemeId.Equals(AppConstants.DarkPlatformThemeId)) - { - return Resources.GetImagePath() + "dark/list_view_bg.png"; - } - else - { - return Resources.GetImagePath() + "light/list_view_bg.png"; - } - } - } } diff --git a/music-player/Views/PlaylistSelectorView.cs b/music-player/Views/PlaylistSelectorView.cs index 2e1c2ac..bb56cb8 100755 --- a/music-player/Views/PlaylistSelectorView.cs +++ b/music-player/Views/PlaylistSelectorView.cs @@ -105,7 +105,7 @@ namespace MusicPlayer.Views IsSelectable = false, }; - createNewPlaylistButton = new Button(buttonStyle) + createNewPlaylistButton = new Button("PlaylistCreate") { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 108, @@ -115,13 +115,14 @@ namespace MusicPlayer.Views IsSelectable = false, ItemAlignment = LinearLayout.Alignment.CenterVertical, }; + createNewPlaylistButton.TextAlignment = HorizontalAlignment.Begin; createNewPlaylistButton.BindingContext = viewModel; createNewPlaylistButton.SetBinding(Button.IsEnabledProperty, "CanCreatePlaylist"); selectPlaylistContentArea.Add(createNewPlaylistButton); View itemSeperator = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, - HeightSpecification = 1, + HeightSpecification = 2, BackgroundColor = UIColors.ItemSeperator, Margin = new Extents(64, 64, 0, 0), }; @@ -158,6 +159,8 @@ namespace MusicPlayer.Views { collectionView = new CollectionView() { + ThemeChangeSensitive = true, + StyleName = "ListBackground", Size2D = new Size2D(1184, 108), ItemsLayouter = new LinearLayouter(), ScrollingDirection = ScrollableBase.Direction.Vertical, @@ -177,13 +180,15 @@ namespace MusicPlayer.Views FlexLayout.SetFlexShrink(collectionView, 1); collectionView.ItemTemplate = new DataTemplate(() => { - DefaultLinearItem layout = new DefaultLinearItem(); + DefaultLinearItem layout = new DefaultLinearItem("LinearItem"); layout.WidthSpecification = LayoutParamPolicies.MatchParent; layout.HeightSpecification = 108; + layout.Seperator.BackgroundColor = UIColors.ItemSeperator; layout.Seperator.Padding = new Extents(0, 0, 0, 0); layout.Seperator.Margin = new Extents(0, 0, 0, 0); layout.Seperator.WidthSpecification = LayoutParamPolicies.MatchParent; layout.Label.SetBinding(TextLabel.TextProperty, "PlaylistName"); + layout.Label.FontStyle = UIFontStyles.NormalLight; layout.Padding = new Extents(0, 0, 0, 0); layout.Margin = new Extents(0, 0, 0, 0); return layout; @@ -295,9 +300,9 @@ namespace MusicPlayer.Views AddInputArea(); View itemSeperator = new View() { + BackgroundColor = UIColors.ItemSeperator, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 1, - BackgroundColor = UIColors.HEX001447, }; createPlaylistContentArea.Add(itemSeperator); underText = new TextLabel("ItemLabel") @@ -329,11 +334,12 @@ namespace MusicPlayer.Views }; textField = new TextField() { + ThemeChangeSensitive = true, + StyleName = "TextField", + PixelSize = 32, Size2D = new Size2D(928, 48), - BackgroundColor = Color.White, Position2D = new Position2D(0, 0), Margin = new Extents(0, 48, 0, 0), - TextColor = UIColors.HEX001447, FontStyle = UIFontStyles.NormalLight, MaxLength = 65, }; diff --git a/music-player/Views/SearchView.cs b/music-player/Views/SearchView.cs index 7b17896..424483a 100755 --- a/music-player/Views/SearchView.cs +++ b/music-player/Views/SearchView.cs @@ -183,8 +183,9 @@ namespace MusicPlayer.Views { collectionView = new CollectionView() { + ThemeChangeSensitive = true, + StyleName = "ListBackground", Size2D = new Size2D(1792, 108), - BackgroundImage = Resources.GetImagePath() + "list_view_bg.png", Padding = new Extents(0, 0, 0, 0), ItemsLayouter = new LinearLayouter(), ItemTemplate = new DataTemplate(() => diff --git a/music-player/Views/SelectorView.cs b/music-player/Views/SelectorView.cs index a07be4f..d861212 100755 --- a/music-player/Views/SelectorView.cs +++ b/music-player/Views/SelectorView.cs @@ -82,7 +82,6 @@ namespace MusicPlayer.Views Text = url, Position2D = new Position2D(x, y), IsEnabled = false, - IsSelectable = true, }; return button; } @@ -271,9 +270,10 @@ namespace MusicPlayer.Views { CollectionView collectionView = new CollectionView() { + ThemeChangeSensitive = true, + StyleName = "ListBackground", Size2D = new Size2D(1792, 108), Margin = new Extents(LayoutPadding, LayoutPadding, 0, 0), - BackgroundImage = Resources.GetImagePath() + "list_view_bg.png", ItemsLayouter = new LinearLayouter(), ScrollingDirection = ScrollableBase.Direction.Vertical, HeightSpecification = LayoutParamPolicies.WrapContent, diff --git a/music-player/Views/TrackDetailView.cs b/music-player/Views/TrackDetailView.cs new file mode 100755 index 0000000..840d413 --- /dev/null +++ b/music-player/Views/TrackDetailView.cs @@ -0,0 +1,207 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tizen.NUI; +using Tizen.NUI.Binding; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using MusicPlayer.Common; +using MusicPlayer.ViewModels; + +namespace MusicPlayer.Views +{ + class TrackDetailView : Navigator + { + private ContentPage contentPage; + private ScrollableBase scrollableBase; + private TrackDetailViewModel viewModel; + private View itemRootView; + public TrackDetailView(TrackDetailViewModel viewModel) : base() + { + this.viewModel = viewModel; + WidthResizePolicy = ResizePolicyType.FillToParent; + HeightResizePolicy = ResizePolicyType.FillToParent; + Window.Instance.Add(this); + AddContentPage(); + AddDetailInfo(); + Popped += OnPoped; + BackKeyPressed += OnBackKeyPressed; + } + + private void OnBackKeyPressed(object sender, EventArgs e) + { + this.Pop(); + } + + protected override void Dispose(DisposeTypes type) + { + if(Disposed) + { + return; + } + if(type == DisposeTypes.Explicit) + { + BackKeyPressed -= OnBackKeyPressed; + RecursivelyDisposeChildren(itemRootView); + scrollableBase.RemoveAllChildren(true); + scrollableBase.Dispose(); + scrollableBase = null; + itemRootView = null; + if(contentPage.IsOnWindow) + { + View parent = contentPage.GetParent() as View; + parent?.Remove(contentPage); + } + contentPage.Dispose(); + contentPage = null; + } + base.Dispose(type); + } + + private void RecursivelyDisposeChildren(View view) + { + while(view.ChildCount > 0) + { + View child = view.GetChildAt(0); + RecursivelyDisposeChildren(child); + view.Remove(child); + child.Dispose(); + child = null; + } + } + + private void OnPoped(object sender, PoppedEventArgs e) + { + if(PageCount <= 0) + { + RemoveDetailsPage(); + } + } + + private void RemoveDetailsPage() + { + Window.Instance.Remove(this); + Dispose(DisposeTypes.Explicit); + } + + private ScrollableBase CreateScrollView() + { + scrollableBase = new ScrollableBase() + { + ThemeChangeSensitive = true, + StyleName = "ListBackground", + WidthSpecification = LayoutParamPolicies.MatchParent, + HeightSpecification = 836, + Margin = new Extents(64, 64, 0, 0), + ScrollingDirection = ScrollableBase.Direction.Vertical, + }; + return scrollableBase; + } + + private View AddDummyMiniController() + { + View view = new View() + { + WidthSpecification = LayoutParamPolicies.MatchParent, + HeightSpecification = 124, + BackgroundColor = Color.Magenta, + }; + return view; + } + + private View CreateContent() + { + View view = new View() + { + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + Layout = new LinearLayout() + { + LinearOrientation = LinearLayout.Orientation.Vertical, + }, + }; + view.Add(CreateScrollView()); + //view.Add(AddDummyMiniController()); + return view; + } + + private void AddContentPage() + { + contentPage = new ContentPage() + { + AppBar = new AppBar() + { + Title = "Details", + }, + Content = CreateContent(), + }; + base.PushWithTransition(contentPage); + } + + private View CreateDetailLayout(string title, string propertyName) + { + View view = new View() + { + BackgroundColor = Color.Transparent, + Size2D = new Size2D(1664, 108), + BindingContext = viewModel.Model, + }; + + TextLabel titleLabel = new TextLabel() + { + ThemeChangeSensitive = true, + StyleName = "DetailTitle", + FontStyle = UIFontStyles.NormalLight, + Text = title, + }; + view.Add(titleLabel); + + TextLabel subtitle = new TextLabel() + { + ThemeChangeSensitive = true, + StyleName = "DetailSubTitle", + FontStyle = UIFontStyles.AllNormal, + }; + subtitle.SetBinding(TextLabel.TextProperty, propertyName); + view.Add(subtitle); + + View itemSaperator = new View() + { + BackgroundColor = UIColors.HEXC3CAD2, + Size2D = new Size2D(1664, 1), + Position2D = new Position2D(0, 107), + }; + view.Add(itemSaperator); + + return view; + } + + private void AddItem(View item, int x, int y) + { + item.Position2D = new Position2D(x, y); + itemRootView.Add(item); + } + + private void AddDetailInfo() + { + itemRootView = new View() + { + BackgroundColor = Color.Transparent, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FitToChildren, + }; + scrollableBase.Add(itemRootView); + AddItem(CreateDetailLayout("Title", "TrackTitle"), 64, 0); + AddItem(CreateDetailLayout("Artist", "ArtistName"), 64, 108); + AddItem(CreateDetailLayout("Album", "AlbumName"), 64, 216); + AddItem(CreateDetailLayout("Length", "Duration"), 64, 324); + AddItem(CreateDetailLayout("Date of Recording", "DateOfRecording"), 64, 432); + AddItem(CreateDetailLayout("Track Number", "TrackNumber"), 64, 540); + AddItem(CreateDetailLayout("Format", "Format"), 64, 648); + AddItem(CreateDetailLayout("Bit Depth", "BitDepth"), 64, 756); + AddItem(CreateDetailLayout("Sample Rate", "SampleRate"), 64, 864); + AddItem(CreateDetailLayout("Size", "TrackSize"), 64, 972); + AddItem(CreateDetailLayout("Location", "Location"), 64, 1080); + } + } +} diff --git a/music-player/res/images/dark/search_button_bg.png b/music-player/res/images/dark/search_button_bg.png new file mode 100755 index 0000000..d7457a2 Binary files /dev/null and b/music-player/res/images/dark/search_button_bg.png differ diff --git a/music-player/res/images/search_button_bg.png b/music-player/res/images/search_button_bg.png deleted file mode 100755 index b969e8a..0000000 Binary files a/music-player/res/images/search_button_bg.png and /dev/null differ diff --git a/music-player/res/images/search_icon.png b/music-player/res/images/search_icon.png deleted file mode 100755 index bb06301..0000000 Binary files a/music-player/res/images/search_icon.png and /dev/null differ diff --git a/music-player/res/themes/dark.xaml b/music-player/res/themes/dark.xaml index 288b548..580761c 100755 --- a/music-player/res/themes/dark.xaml +++ b/music-player/res/themes/dark.xaml @@ -9,6 +9,8 @@ Id="DarkTheme"> + + @@ -183,11 +185,11 @@ Id="DarkTheme"> - + - + @@ -213,11 +215,38 @@ Id="DarkTheme"> - + + + + + *Resource*/images/dark/search_icon.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/music-player/res/themes/light.xaml b/music-player/res/themes/light.xaml index 807249b..d42a9c7 100755 --- a/music-player/res/themes/light.xaml +++ b/music-player/res/themes/light.xaml @@ -9,6 +9,8 @@ Id="LightTheme"> + + @@ -183,11 +185,11 @@ Id="LightTheme"> - + - + @@ -213,11 +215,38 @@ Id="LightTheme"> - + + + + + *Resource*/images/light/search_icon.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file