--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using System.ComponentModel;\r
+using System.Runtime.CompilerServices;\r
+\r
+namespace MusicPlayer.Common\r
+{\r
+ class PropertyNotifier : INotifyPropertyChanged\r
+ {\r
+ public event PropertyChangedEventHandler PropertyChanged;\r
+\r
+ protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)\r
+ {\r
+ if (Equals(storage, value))\r
+ {\r
+ return false;\r
+ }\r
+\r
+ storage = value;\r
+ OnPropertyChanged(propertyName);\r
+ return true;\r
+ }\r
+\r
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)\r
+ {\r
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));\r
+ }\r
+ }\r
+}\r
using System;\r
using System.Collections.Specialized;\r
using Tizen.Content.MediaContent;\r
-using System.Text;\r
+using MusicPlayer.Common;\r
\r
namespace MusicPlayer.Media\r
{\r
Album info = dataReader.Current;\r
albumList.Add(info.Id, info);\r
}\r
- Tizen.Log.Debug("MUSIC_PLAYER", "Total album retrived from database: " + albumList.Count);\r
+ Tizen.Log.Debug(Constants.LogTag, "Total album retrived from database: " + albumList.Count);\r
dataReader.Dispose();\r
return albumList;\r
}\r
-using System;\r
-using System.Collections.Specialized;\r
+using System.Collections.Specialized;\r
using System.Collections.Generic;\r
-using System.Text;\r
using Tizen.Content.MediaContent;\r
+using System;\r
+using MusicPlayer.Common;\r
+\r
\r
namespace MusicPlayer.Media\r
{\r
string info = (string)dataReader.Current;\r
artistList.Add(info);\r
}\r
- Tizen.Log.Debug("MUSIC_PLAYER", "Total artists retrived from database: " + artistList.Count);\r
+ Tizen.Log.Debug(Constants.LogTag, "Total artists retrived from database: " + artistList.Count);\r
dataReader.Dispose();\r
return artistList;\r
}\r
}\r
catch (ObjectDisposedException ex)\r
{\r
- Tizen.Log.Error("MUSIC_PLAYER", "ObjectDisposedException: " + ex.Message);\r
+ Tizen.Log.Error(Constants.LogTag, "ObjectDisposedException: " + ex.Message);\r
}\r
catch (InvalidOperationException ex)\r
{\r
- Tizen.Log.Error("MUSIC_PLAYER", "InvalidOperationException: " + ex.Message);\r
+ Tizen.Log.Error(Constants.LogTag, "InvalidOperationException: " + ex.Message);\r
}\r
catch (MediaDatabaseException ex)\r
{\r
- Tizen.Log.Error("MUSIC_PLAYER", "MediaDatabaseException: " + ex.Message);\r
+ Tizen.Log.Error(Constants.LogTag, "MediaDatabaseException: " + ex.Message);\r
}\r
catch (Exception ex)\r
{\r
- Tizen.Log.Error("MUSIC_PLAYER", "Unknown Exception: " + ex.Message);\r
+ Tizen.Log.Error(Constants.LogTag, "Unknown Exception: " + ex.Message);\r
}\r
\r
return count;\r
-using System;\r
-using System.Collections.Generic;\r
-using System.Text;\r
+using System.Collections.Generic;\r
using Tizen.Content.MediaContent;\r
+using MusicPlayer.Common;\r
\r
namespace MusicPlayer.Media\r
{\r
Playlist playlist = dataReader.Current;\r
playlists.Add(playlist);\r
}\r
- Tizen.Log.Debug("MUSIC_PLAYER", "PlayLists Count : " + playlists.Count);\r
+ Tizen.Log.Debug(Constants.LogTag, "PlayLists Count : " + playlists.Count);\r
return playlists;\r
}\r
\r
using System.Collections.Specialized;\r
using Tizen.Content.MediaContent;\r
+using MusicPlayer.Common;\r
\r
namespace MusicPlayer.Media\r
{\r
MediaInfo info = dataReader.Current;\r
mediaList.Add(info.Id, info);\r
}\r
- Tizen.Log.Debug("MUSIC_PLAYER", "Total track retrived from database: " + mediaList.Count);\r
+ Tizen.Log.Debug(Constants.LogTag, "Total track retrived from database: " + mediaList.Count);\r
dataReader.Dispose();\r
return mediaList;\r
}\r
--- /dev/null
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.Models\r
+{\r
+ class Track : PropertyNotifier\r
+ {\r
+ private string title;\r
+ private string album;\r
+ private string id;\r
+ private string artist;\r
+ private int duration;\r
+ private string thumbnailPath;\r
+ private string filePath;\r
+\r
+ public Track(Tizen.Content.MediaContent.AudioInfo audioInfo)\r
+ {\r
+ TrackTitle = audioInfo.Title;\r
+ AlbumName = audioInfo.Album;\r
+ Id = audioInfo.Id;\r
+ ArtistName = audioInfo.Artist;\r
+ Duration = audioInfo.Duration;\r
+ ThumbnailPath = audioInfo.ThumbnailPath;\r
+ FilePath = audioInfo.Path;\r
+ }\r
+\r
+ public string TrackTitle\r
+ {\r
+ get => title;\r
+ set => SetProperty(ref title, value);\r
+ }\r
+\r
+ public string AlbumName\r
+ {\r
+ get => album;\r
+ set\r
+ {\r
+ string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+ SetProperty(ref album, name);\r
+ }\r
+ }\r
+ public string ArtistName\r
+ {\r
+ get => artist;\r
+ set\r
+ {\r
+ string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+ SetProperty(ref artist, name);\r
+ }\r
+ }\r
+ public string Id\r
+ {\r
+ get => id;\r
+ set\r
+ {\r
+ id = value;\r
+ }\r
+ }\r
+ // TODO create new property of duration in string\r
+ public int Duration\r
+ {\r
+ get => duration;\r
+ set\r
+ {\r
+ duration = value;\r
+ }\r
+ }\r
+ public string ThumbnailPath\r
+ {\r
+ get => thumbnailPath;\r
+ set\r
+ {\r
+ string thumb = string.IsNullOrEmpty(value) ? Resources.GetImagePath() + "thumbnail.png" : value;\r
+ SetProperty(ref thumbnailPath, thumb);\r
+ }\r
+ }\r
+\r
+ public string FilePath\r
+ {\r
+ get => filePath;\r
+ set\r
+ {\r
+ filePath = value;\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+using System.Collections.Specialized;\r
+using MusicPlayer.Media;\r
+\r
+namespace MusicPlayer.Models\r
+{\r
+ public static class TrackDataProvider\r
+ {\r
+ private static OrderedDictionary tracksList;\r
+\r
+ static TrackDataProvider()\r
+ {\r
+ tracksList = Contents.GetTrackList();\r
+ Contents.MusicItemUpdate += OnMusicItemUpdate;\r
+ Contents.MusicDBUpdate += OnMusicDatabaseUpdate;\r
+ }\r
+\r
+ private static void OnMusicDatabaseUpdate(object sender, MusicDBUpdateEventArgs e)\r
+ {\r
+ tracksList = Contents.GetTrackList();\r
+ // TODO implement database update event handler\r
+ return;\r
+ }\r
+ private static void OnMusicItemUpdate(object sender, MusicItemUpdateEventArgs e)\r
+ {\r
+ // TODO implement database item update event handler\r
+ return;\r
+ }\r
+ public static OrderedDictionary CurrentTrackList()\r
+ {\r
+ return tracksList;\r
+ }\r
+\r
+ }\r
+}\r
{
protected override void OnCreate()
{
- Tizen.Log.Info("MUSIC_PLAYER", "OnCreate statrted");
+ Tizen.Log.Info(Constants.LogTag, "OnCreate statrted");
base.OnCreate();
Window window = Window.Instance;
window.BackgroundColor = Color.White;
window.KeyEvent += OnKeyEvent;
Size2D size = window.Size;
- Tizen.Log.Info("MUSIC_PLAYER", "Window Size: " + size.Width + "x" + size.Height);
+ Tizen.Log.Info(Constants.LogTag, "Window Size: " + size.Width + "x" + size.Height);
ViewManager manager = new ViewManager(Window.Instance);
}
static void Main(string[] args)
{
- Tizen.Log.Info("MUSIC_PLAYER", "Main statrted");
+ Tizen.Log.Info(Constants.LogTag, "Main statrted");
var app = new Application();
app.Run(args);
- Tizen.Log.Info("MUSIC_PLAYER", "Main finished");
+ Tizen.Log.Info(Constants.LogTag, "Main finished");
}
}
}
--- /dev/null
+using System.Collections;\r
+using System.Collections.Specialized;\r
+using System.Collections.ObjectModel;\r
+using MusicPlayer.Models;\r
+using Tizen.Content.MediaContent;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.ViewModels\r
+{\r
+ class TrackListViewModel : ObservableCollection<Track>\r
+ {\r
+ public TrackListViewModel()\r
+ {\r
+ }\r
+\r
+ public void CreateData(OrderedDictionary dict)\r
+ {\r
+ foreach(DictionaryEntry item in dict)\r
+ {\r
+ Add(new Track((AudioInfo)item.Value));\r
+ }\r
+ Tizen.Log.Debug(Constants.LogTag, "Observable list item count: " + this.Count);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+using System.Collections.Specialized;\r
+using MusicPlayer.Models;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.ViewModels\r
+{\r
+ class TrackViewModel : PropertyNotifier\r
+ {\r
+ private string trackCount;\r
+ private TrackListViewModel listViewModel;\r
+\r
+ public TrackViewModel()\r
+ {\r
+ OrderedDictionary trackList = TrackDataProvider.CurrentTrackList();\r
+ listViewModel = new TrackListViewModel();\r
+ listViewModel.CreateData(trackList);\r
+ listViewModel.CollectionChanged += OnTrackListChanges;\r
+ TrackCount = listViewModel.Count.ToString();\r
+ }\r
+\r
+ private void OnTrackListChanges(object sender, NotifyCollectionChangedEventArgs e)\r
+ {\r
+ TrackCount = listViewModel.Count.ToString();\r
+ }\r
+\r
+ public TrackListViewModel ListViewModel\r
+ {\r
+ get => listViewModel;\r
+ }\r
+\r
+ public string TrackCount\r
+ {\r
+ get => trackCount;\r
+ set => SetProperty(ref trackCount, value);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+using MusicPlayer.Common;\r
+using Tizen.NUI;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI.Binding;\r
+using Tizen.NUI.Components;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+ class BaseContentView : View\r
+ {\r
+ protected View titleView;\r
+ protected CollectionView collectionView;\r
+ public BaseContentView() : base()\r
+ {\r
+ WidthResizePolicy = ResizePolicyType.FillToParent;\r
+ HeightResizePolicy = ResizePolicyType.FillToParent;\r
+ Layout = new FlexLayout()\r
+ {\r
+ Direction = FlexLayout.FlexDirection.Column,\r
+ Padding = new Extents(64, 64, 0, 0),\r
+ };\r
+ titleView = new View()\r
+ {\r
+ WidthSpecification = LayoutParamPolicies.MatchParent,\r
+ HeightSpecification = 60,\r
+ Layout = new RelativeLayout()\r
+ {\r
+ Padding = new Extents(0, 0, 13, 13),\r
+ },\r
+ IsCreateByXaml = true,\r
+ };\r
+ base.Add(titleView);\r
+ FlexLayout.SetFlexGrow(titleView, 0);\r
+ FlexLayout.SetFlexShrink(titleView, 0);\r
+\r
+ collectionView = new CollectionView()\r
+ {\r
+ Size2D = new Size2D(1792, 108),\r
+ Margin = new Extents(0, 0, 0, 2),\r
+ BackgroundImage = Resources.GetImagePath() + "list_view_bg.png",\r
+ ItemsLayouter = new LinearLayouter(),\r
+ ItemTemplate = new DataTemplate(() =>\r
+ {\r
+ TrackLayout layout = new TrackLayout();\r
+ layout.Thumbnail.SetBinding(ImageView.ResourceUrlProperty, "ThumbnailPath");\r
+ layout.TitleText.SetBinding(TextLabel.TextProperty, "TrackTitle");\r
+ layout.SubtitletText.SetBinding(TextLabel.TextProperty, "ArtistName");\r
+ return layout;\r
+ }),\r
+ ScrollingDirection = ScrollableBase.Direction.Vertical,\r
+ WidthSpecification = LayoutParamPolicies.MatchParent,\r
+ HeightSpecification = LayoutParamPolicies.WrapContent,\r
+ SelectionMode = ItemSelectionMode.Single,\r
+ };\r
+ base.Add(collectionView);\r
+ FlexLayout.SetFlexGrow(collectionView, 1);\r
+ FlexLayout.SetFlexShrink(collectionView, 1);\r
+ }\r
+\r
+ protected override void Dispose(DisposeTypes type)\r
+ {\r
+ if (type == DisposeTypes.Explicit)\r
+ {\r
+ base.Remove(titleView);\r
+ titleView.Dispose();\r
+ titleView = null;\r
+\r
+ base.Remove(collectionView);\r
+ collectionView.Dispose();\r
+ collectionView = null;\r
+ }\r
+ base.Dispose(type);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+using System.Collections.Generic;\r
+using Tizen.NUI;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI.Components;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+ class BaseView : View\r
+ {\r
+ private View topView;\r
+ private View bottomView; // TODO Used this for MiniController UI\r
+ private View contentView;\r
+ private TextLabel titleLabel;\r
+ private Button backButton;\r
+ private Button moreButton;\r
+ private Button searchButton;\r
+ private Tab tabs;\r
+\r
+ // TODO these name strings are temporary...once the po files are added\r
+ // need to use Translatable names.\r
+ private static string[] TabNames = new string[]\r
+ {\r
+ "Playlists",\r
+ "Tracks",\r
+ "Albums",\r
+ "Artists",\r
+ };\r
+ public BaseView() : base()\r
+ {\r
+ WidthSpecification = LayoutParamPolicies.MatchParent;\r
+ HeightSpecification = LayoutParamPolicies.MatchParent;\r
+ Layout = new FlexLayout()\r
+ {\r
+ Direction = FlexLayout.FlexDirection.Column,\r
+ ItemsAlignment = FlexLayout.AlignmentType.FlexStart,\r
+ Justification = FlexLayout.FlexJustification.FlexStart,\r
+ };\r
+ topView = new View()\r
+ {\r
+ WidthSpecification = LayoutParamPolicies.MatchParent,\r
+ HeightSpecification = 120,\r
+ Layout = new RelativeLayout()\r
+ {\r
+ Padding = new Extents(64, 64, 30, 30),\r
+ },\r
+ };\r
+ base.Add(topView);\r
+ FlexLayout.SetFlexGrow(topView, 0);\r
+ FlexLayout.SetFlexShrink(topView, 0);\r
+ titleLabel = new TextLabel()\r
+ {\r
+ Text = "Music",\r
+ PixelSize = 40,\r
+ FontFamily = "BreezeSans",\r
+ TextColor = new Color(0.0f, 0.0078f, 0.0353f, 1.0f),\r
+ HorizontalAlignment = HorizontalAlignment.Begin,\r
+ Margin = new Extents(0, 0, 6, 6),\r
+ Ellipsis = true,\r
+ };\r
+ topView.Add(titleLabel);\r
+ RelativeLayout.SetLeftTarget(titleLabel, topView);\r
+ RelativeLayout.SetLeftRelativeOffset(titleLabel, 0.0f);\r
+ RelativeLayout.SetRightTarget(titleLabel, topView);\r
+ RelativeLayout.SetRightRelativeOffset(titleLabel, 1.0f);\r
+ RelativeLayout.SetFillHorizontal(titleLabel, true);\r
+\r
+ contentView = new View()\r
+ {\r
+ WidthSpecification = LayoutParamPolicies.MatchParent,\r
+ HeightSpecification = 876,\r
+ };\r
+ base.Add(contentView);\r
+ FlexLayout.SetFlexGrow(contentView, 1);\r
+ FlexLayout.SetFlexShrink(contentView, 1);\r
+\r
+ tabs = new Tab()\r
+ {\r
+ Size2D = new Size2D(Window.Instance.Size.Width, 84),\r
+ WidthSpecification = LayoutParamPolicies.MatchParent,\r
+ HeightSpecification = 84,\r
+ UnderLineBackgroundColor = Color.Blue,\r
+ UnderLineSize = new Size2D(1, 3),\r
+ PointSize = 25,\r
+ BackgroundColor = Color.White,\r
+ };\r
+ tabs.TextColorSelector = new ColorSelector\r
+ {\r
+ Normal = Color.Black,\r
+ Selected = Color.Magenta,\r
+ };\r
+ base.Add(tabs);\r
+ for(int i = 0; i<4; ++i)\r
+ {\r
+ Tab.TabItemData item = new Tab.TabItemData();\r
+ item.Text = TabNames[i];\r
+ tabs.AddItem(item);\r
+ }\r
+ tabs.SelectedItemIndex = 1;\r
+\r
+ backButton = null;\r
+ moreButton = null;\r
+ searchButton = null;\r
+ }\r
+\r
+ public Tab Tabs\r
+ {\r
+ get\r
+ {\r
+ return tabs;\r
+ }\r
+ }\r
+\r
+ public string Title\r
+ {\r
+ set\r
+ {\r
+ titleLabel.Text = value;\r
+ }\r
+ get\r
+ {\r
+ return titleLabel.Text;\r
+ }\r
+ }\r
+\r
+ public bool BackButton\r
+ {\r
+ set\r
+ {\r
+ if (value)\r
+ {\r
+ ButtonStyle buttonStyle = new ButtonStyle()\r
+ {\r
+ Icon = new ImageViewStyle()\r
+ {\r
+ ResourceUrl = Resources.GetImagePath() + "back_button.png",\r
+ },\r
+ IsSelectable = false,\r
+ IsEnabled = true,\r
+ };\r
+\r
+ backButton = new Button(buttonStyle)\r
+ {\r
+ Size2D = new Size2D(48, 48),\r
+ Margin = new Extents(0, 32, 6, 6),\r
+ };\r
+ topView.Add(backButton);\r
+\r
+ RelativeLayout.SetLeftRelativeOffset(backButton, 0.0f);\r
+ RelativeLayout.SetRightRelativeOffset(backButton, 0.0f);\r
+ RelativeLayout.SetHorizontalAlignment(backButton, RelativeLayout.Alignment.Start);\r
+\r
+ RelativeLayout.SetLeftTarget(titleLabel, backButton);\r
+ RelativeLayout.SetLeftRelativeOffset(titleLabel, 1.0f);\r
+ }\r
+ }\r
+ }\r
+\r
+ public bool MoreButton\r
+ {\r
+ set\r
+ {\r
+ if (value)\r
+ {\r
+ ButtonStyle buttonStyle = new ButtonStyle()\r
+ {\r
+ Icon = new ImageViewStyle()\r
+ {\r
+ ResourceUrl = Resources.GetImagePath() + "more_button.png",\r
+ },\r
+ IsSelectable = false,\r
+ IsEnabled = true,\r
+ };\r
+ moreButton = new Button(buttonStyle)\r
+ {\r
+ Size2D = new Size2D(48, 48),\r
+ Margin = new Extents(24, 0, 6, 6),\r
+ };\r
+ topView.Add(moreButton);\r
+ RelativeLayout.SetLeftRelativeOffset(moreButton, 1.0f);\r
+ RelativeLayout.SetRightRelativeOffset(moreButton, 1.0f);\r
+ RelativeLayout.SetHorizontalAlignment(moreButton, RelativeLayout.Alignment.End);\r
+\r
+ RelativeLayout.SetRightTarget(titleLabel, moreButton);\r
+ RelativeLayout.SetRightRelativeOffset(titleLabel, 0.0f);\r
+ }\r
+ }\r
+ }\r
+\r
+ public bool SearchButton\r
+ {\r
+ set\r
+ {\r
+ if (value)\r
+ {\r
+ ButtonStyle buttonStyle = new ButtonStyle()\r
+ {\r
+ Icon = new ImageViewStyle()\r
+ {\r
+ ResourceUrl = Resources.GetImagePath() + "search_icon.png",\r
+ },\r
+ IsSelectable = false,\r
+ IsEnabled = true,\r
+ };\r
+ searchButton = new Button(buttonStyle)\r
+ {\r
+ Size2D = new Size2D(96, 60),\r
+ BackgroundImage = Resources.GetImagePath() + "search_button_bg.png",\r
+ Margin = new Extents(0, 32, 0, 0),\r
+ };\r
+ topView.Add(searchButton);\r
+ RelativeLayout.SetRightTarget(searchButton, moreButton);\r
+ RelativeLayout.SetRightRelativeOffset(searchButton, 0.0f);\r
+ RelativeLayout.SetHorizontalAlignment(searchButton, RelativeLayout.Alignment.End);\r
+\r
+ RelativeLayout.SetLeftTarget(titleLabel, RelativeLayout.GetLeftTarget(titleLabel));\r
+ RelativeLayout.SetLeftRelativeOffset(titleLabel, RelativeLayout.GetLeftRelativeOffset(titleLabel));\r
+ RelativeLayout.SetRightTarget(titleLabel, searchButton);\r
+ RelativeLayout.SetRightRelativeOffset(titleLabel, 0.0f);\r
+ }\r
+ }\r
+ }\r
+\r
+ public View SetContent\r
+ {\r
+ set\r
+ {\r
+ contentView.Add(value);\r
+ }\r
+ }\r
+\r
+ protected override void Dispose(DisposeTypes type)\r
+ {\r
+ if (Disposed)\r
+ {\r
+ return;\r
+ }\r
+ if (type == DisposeTypes.Explicit)\r
+ {\r
+ List<View> children = topView?.Children;\r
+ foreach (View child in children)\r
+ {\r
+ topView.Remove(child);\r
+ child?.Dispose();\r
+ }\r
+ base.Remove(topView);\r
+ topView?.Dispose();\r
+ topView = null;\r
+\r
+ // Do not delete the children of contentview as they are not owned by BaseView\r
+ base.Remove(contentView);\r
+ contentView?.Dispose();\r
+ contentView = null;\r
+\r
+ base.Remove(tabs);\r
+ tabs?.Dispose();\r
+ tabs = null;\r
+\r
+ base.Remove(bottomView);\r
+ bottomView?.Dispose();\r
+ bottomView = null;\r
+ }\r
+\r
+ base.Dispose(type);\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+ class TrackLayout : RecyclerViewItem\r
+ {\r
+ private View itemSeperator;\r
+ private TextLabel titleLabel;\r
+ private TextLabel artistAndTimeLabel;\r
+ private ImageView icon;\r
+\r
+ private static int WIDTH = 1792;\r
+ private static int HEIGHT = 108;\r
+\r
+ private const int ICON_SIZE = 64;\r
+ private const int MARGIN = 16;\r
+ private const int PADDING = 32;\r
+ private const int SEPERATOR_HEIGHT = 1;\r
+ private const int LEFT_PADDING = 64;\r
+ private const int X = 0;\r
+\r
+ public TrackLayout(int width = 1792, int height = 108) : base()\r
+ {\r
+ base.OnInitialize();\r
+ base.IsCreateByXaml = true;\r
+ WIDTH = width;\r
+ HEIGHT = height;\r
+ WidthSpecification = WIDTH;\r
+ HeightSpecification = HEIGHT;\r
+\r
+ // to show the rounded rect of the bg\r
+ BackgroundColor = Color.Transparent;\r
+\r
+ icon = new ImageView()\r
+ {\r
+ WidthSpecification = ICON_SIZE,\r
+ HeightSpecification = ICON_SIZE,\r
+ IsCreateByXaml = true,\r
+ Position2D = new Position2D(X, ((HEIGHT / 2) - (ICON_SIZE / 2))),\r
+ };\r
+ base.Add(icon);\r
+\r
+ itemSeperator = new View()\r
+ {\r
+ WidthSpecification = (WIDTH - (2 * LEFT_PADDING)),\r
+ HeightSpecification = SEPERATOR_HEIGHT,\r
+ ExcludeLayouting = true,\r
+ Position2D = new Position2D(X, HEIGHT - SEPERATOR_HEIGHT),\r
+ BackgroundColor = new Color(0.75f, 0.79f, 0.82f, 1.0f)\r
+ };\r
+ base.Add(itemSeperator);\r
+\r
+ titleLabel = new TextLabel()\r
+ {\r
+ WidthSpecification = (WIDTH - (2 * LEFT_PADDING) - ICON_SIZE - PADDING),\r
+ HeightSpecification = 40,\r
+ TextColor = Color.Blue,\r
+ PixelSize = 32,\r
+ FontFamily = "BreezeSans",\r
+ VerticalAlignment = VerticalAlignment.Center,\r
+ IsCreateByXaml = true,\r
+ Position2D = new Position2D((X + ICON_SIZE + PADDING), MARGIN),\r
+ };\r
+ base.Add(titleLabel);\r
+\r
+ artistAndTimeLabel = new TextLabel()\r
+ {\r
+ WidthSpecification = (WIDTH - (2 * LEFT_PADDING) - ICON_SIZE - PADDING),\r
+ HeightSpecification = 36,\r
+ TextColor = Color.Black,\r
+ PixelSize = 28,\r
+ FontFamily = "BreezeSans",\r
+ VerticalAlignment = VerticalAlignment.Center,\r
+ IsCreateByXaml = true,\r
+ Position2D = new Position2D((X + ICON_SIZE + PADDING), MARGIN + 40)\r
+ };\r
+ base.Add(artistAndTimeLabel);\r
+ IsCreateByXaml = true;\r
+ }\r
+ public ImageView Thumbnail\r
+ {\r
+ get\r
+ {\r
+ return icon;\r
+ }\r
+ }\r
+ public TextLabel TitleText\r
+ {\r
+ get\r
+ {\r
+ return titleLabel;\r
+ }\r
+ }\r
+ public TextLabel SubtitletText\r
+ {\r
+ get\r
+ {\r
+ return artistAndTimeLabel;\r
+ }\r
+ }\r
+\r
+ protected override void Dispose(DisposeTypes type)\r
+ {\r
+ if(Disposed)\r
+ {\r
+ return;\r
+ }\r
+ if (type == DisposeTypes.Explicit)\r
+ {\r
+ base.Remove(itemSeperator);\r
+ itemSeperator?.Dispose();\r
+ itemSeperator = null;\r
+\r
+ base.Remove(icon);\r
+ icon?.Dispose();\r
+ icon = null;\r
+\r
+ base.Remove(titleLabel);\r
+ titleLabel?.Dispose();\r
+ titleLabel = null;\r
+\r
+ base.Remove(artistAndTimeLabel);\r
+ artistAndTimeLabel?.Dispose();\r
+ artistAndTimeLabel = null;\r
+ }\r
+\r
+ base.Dispose(type);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+using MusicPlayer.ViewModels;\r
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+using Tizen.NUI.Binding;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+ class TrackView : BaseContentView\r
+ {\r
+ private TrackViewModel viewModel;\r
+ private TextLabel trackCountLabel;\r
+ private Button playAllIcon; // TODO need to implement playall feature\r
+ private Button addToPlaylistIcon; // TODO need to implement playlist manager\r
+ public TrackView(TrackViewModel viewModel)\r
+ {\r
+ this.viewModel = viewModel;\r
+ collectionView.ItemsSource = viewModel.ListViewModel;\r
+ collectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;\r
+ collectionView.WidthSpecification = LayoutParamPolicies.WrapContent;\r
+ collectionView.SelectionMode = ItemSelectionMode.Single;\r
+ collectionView.SelectionChanged += OnTrackSelection;\r
+\r
+ trackCountLabel = new TextLabel()\r
+ {\r
+ PixelSize = 28,\r
+ Text = "TRACK COUNT",\r
+ TextColor = new Color(0.0f, 0.0784f, 0.2754f, 1.0f),\r
+ VerticalAlignment = VerticalAlignment.Center,\r
+ FontFamily = "BreezeSans",\r
+ IsCreateByXaml = true,\r
+ };\r
+ titleView.Add(trackCountLabel);\r
+ trackCountLabel.SetBinding(TextLabel.TextProperty, "TrackCount");\r
+ RelativeLayout.SetLeftTarget(trackCountLabel, titleView);\r
+ RelativeLayout.SetLeftRelativeOffset(trackCountLabel, 1.0f);\r
+ RelativeLayout.SetRightRelativeOffset(trackCountLabel, 0.0f);\r
+ RelativeLayout.SetFillHorizontal(trackCountLabel, true);\r
+ }\r
+\r
+ private void OnTrackSelection(object sender, SelectionChangedEventArgs e)\r
+ {\r
+\r
+ }\r
+\r
+ protected override void Dispose(DisposeTypes type)\r
+ {\r
+ if(Disposed)\r
+ {\r
+ return;\r
+ }\r
+ if(type == DisposeTypes.Explicit)\r
+ {\r
+ titleView.Remove(trackCountLabel);\r
+ trackCountLabel.Dispose();\r
+ trackCountLabel = null;\r
+\r
+ // TODO Uncomment after implementation is completed\r
+ //titleView.Remove(playAllIcon);\r
+ //playAllIcon.Dispose();\r
+ //playAllIcon = null;\r
+\r
+ //titleView.Remove(addToPlaylistIcon);\r
+ //addToPlaylistIcon.Dispose();\r
+ //addToPlaylistIcon = null;\r
+ }\r
+ base.Dispose(type);\r
+ }\r
+ }\r
+}\r
</ItemGroup>\r
\r
<ItemGroup>\r
- <PackageReference Include="Tizen.NET" Version="9.0.0.16239" />\r
+ <PackageReference Include="Tizen.NET" Version="9.0.0.16249" />\r
<PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
<PackageReference Include="Tizen.NUI.XamlBuild" Version="1.0.11" />\r
</ItemGroup>\r