public const string TimeFormat = @"mm\:ss";
public const string LightPlatformThemeId = "org.tizen.default-light-theme";
public const string DarkPlatformThemeId = "org.tizen.default-dark-theme";
- public const string FavouritePlaylist = "Favourite";
- public const string RecentlyAddedPlaylist = "Recently Added";
/// <summary>
/// Maxcount 102 is including User playlist and System Playlist [Favourite, Recently Added].
get => albumName;\r
set\r
{\r
- string text = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+ string text = string.IsNullOrEmpty(value) ? TextResources.Resources.IDS_UNKNOWN : value;\r
SetProperty(ref albumName, text);\r
}\r
}\r
get => artistName;\r
set\r
{\r
- string text = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+ string text = string.IsNullOrEmpty(value) ? TextResources.Resources.IDS_UNKNOWN : value;\r
SetProperty(ref artistName, text);\r
}\r
}\r
get => artistName;
set
{
- string text = string.IsNullOrEmpty(value) ? "Unknown" : value;
+ string text = string.IsNullOrEmpty(value) ? TextResources.Resources.IDS_UNKNOWN : value;
SetProperty(ref artistName, text);
}
}
get => albumName;\r
set\r
{\r
- string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+ string name = string.IsNullOrEmpty(value) ? TextResources.Resources.IDS_UNKNOWN : value;\r
SetProperty(ref albumName, name);\r
}\r
}\r
get => artistName;\r
set\r
{\r
- string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+ string name = string.IsNullOrEmpty(value) ? TextResources.Resources.IDS_UNKNOWN : value;\r
SetProperty(ref artistName, name);\r
}\r
}\r
{
if(string.IsNullOrEmpty(value))
{
- return "Unknown";
+ return TextResources.Resources.IDS_UNKNOWN;
}
return value;
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
+ public class Resources {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
-
+
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
+ public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("music-player.TextResources.Resources", typeof(Resources).Assembly);
return resourceMan;
}
}
-
+
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
+ public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
resourceCulture = value;
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Add.
/// </summary>
- internal static string IDS_ADD {
+ public static string IDS_ADD {
get {
return ResourceManager.GetString("IDS_ADD", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Add playlist name.
/// </summary>
- internal static string IDS_ADD_PLAYLIST_NAME {
+ public static string IDS_ADD_PLAYLIST_NAME {
get {
return ResourceManager.GetString("IDS_ADD_PLAYLIST_NAME", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Add to playlist.
/// </summary>
- internal static string IDS_ADD_TO_PLAYLIST {
+ public static string IDS_ADD_TO_PLAYLIST {
get {
return ResourceManager.GetString("IDS_ADD_TO_PLAYLIST", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Album.
/// </summary>
- internal static string IDS_ALBUM {
+ public static string IDS_ALBUM {
get {
return ResourceManager.GetString("IDS_ALBUM", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Albums.
/// </summary>
- internal static string IDS_ALBUMS {
+ public static string IDS_ALBUMS {
get {
return ResourceManager.GetString("IDS_ALBUMS", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Artist.
/// </summary>
- internal static string IDS_ARTIST {
+ public static string IDS_ARTIST {
get {
return ResourceManager.GetString("IDS_ARTIST", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Artists.
/// </summary>
- internal static string IDS_ARTISTS {
+ public static string IDS_ARTISTS {
get {
return ResourceManager.GetString("IDS_ARTISTS", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
- internal static string IDS_CANCEL {
+ public static string IDS_CANCEL {
get {
return ResourceManager.GetString("IDS_CANCEL", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Can't enter more than 64 characters..
/// </summary>
- internal static string IDS_CANT_ENTER_MORE_CHAR {
+ public static string IDS_CANT_ENTER_MORE_CHAR {
get {
return ResourceManager.GetString("IDS_CANT_ENTER_MORE_CHAR", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Create.
/// </summary>
- internal static string IDS_CREATE {
+ public static string IDS_CREATE {
get {
return ResourceManager.GetString("IDS_CREATE", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to + Create new playlist.
/// </summary>
- internal static string IDS_CREATE_NEW_PLAYLIST {
+ public static string IDS_CREATE_NEW_PLAYLIST {
get {
return ResourceManager.GetString("IDS_CREATE_NEW_PLAYLIST", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Create playlist.
/// </summary>
- internal static string IDS_CREATE_PLAYLIST {
+ public static string IDS_CREATE_PLAYLIST {
get {
return ResourceManager.GetString("IDS_CREATE_PLAYLIST", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Delete.
/// </summary>
- internal static string IDS_DELETE {
+ public static string IDS_DELETE {
get {
return ResourceManager.GetString("IDS_DELETE", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Details.
/// </summary>
- internal static string IDS_DETAILS {
+ public static string IDS_DETAILS {
get {
return ResourceManager.GetString("IDS_DETAILS", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Done.
/// </summary>
- internal static string IDS_DONE {
+ public static string IDS_DONE {
get {
return ResourceManager.GetString("IDS_DONE", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Enter Playlist Name.
/// </summary>
- internal static string IDS_ENTER_PLAYLIST_NAME {
+ public static string IDS_ENTER_PLAYLIST_NAME {
get {
return ResourceManager.GetString("IDS_ENTER_PLAYLIST_NAME", resourceCulture);
}
}
-
+
+ /// <summary>
+ /// Looks up a localized string similar to Favourite.
+ /// </summary>
+ public static string IDS_FAVOURITE {
+ get {
+ return ResourceManager.GetString("IDS_FAVOURITE", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Music.
/// </summary>
- internal static string IDS_MUSIC {
+ public static string IDS_MUSIC {
get {
return ResourceManager.GetString("IDS_MUSIC", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to No items in folder.
/// </summary>
- internal static string IDS_NO_ITEMS_IN_FOLDER {
+ public static string IDS_NO_ITEMS_IN_FOLDER {
get {
return ResourceManager.GetString("IDS_NO_ITEMS_IN_FOLDER", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to No playlists available.
/// </summary>
- internal static string IDS_NO_PLAYLIST_AVAIL {
+ public static string IDS_NO_PLAYLIST_AVAIL {
get {
return ResourceManager.GetString("IDS_NO_PLAYLIST_AVAIL", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to No results found.
/// </summary>
- internal static string IDS_NO_RESULT_FOUND {
+ public static string IDS_NO_RESULT_FOUND {
get {
return ResourceManager.GetString("IDS_NO_RESULT_FOUND", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Ok.
/// </summary>
- internal static string IDS_OK {
+ public static string IDS_OK {
get {
return ResourceManager.GetString("IDS_OK", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Playlist.
/// </summary>
- internal static string IDS_PLAYLIST {
+ public static string IDS_PLAYLIST {
get {
return ResourceManager.GetString("IDS_PLAYLIST", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Playlist name already in use..
/// </summary>
- internal static string IDS_PLAYLIST_NAME_USED {
+ public static string IDS_PLAYLIST_NAME_USED {
get {
return ResourceManager.GetString("IDS_PLAYLIST_NAME_USED", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Playlists.
/// </summary>
- internal static string IDS_PLAYLISTS {
+ public static string IDS_PLAYLISTS {
get {
return ResourceManager.GetString("IDS_PLAYLISTS", resourceCulture);
}
}
-
+
+ /// <summary>
+ /// Looks up a localized string similar to Recently Added.
+ /// </summary>
+ public static string IDS_RECENTLY_ADDED {
+ get {
+ return ResourceManager.GetString("IDS_RECENTLY_ADDED", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Remove.
/// </summary>
- internal static string IDS_REMOVE {
+ public static string IDS_REMOVE {
get {
return ResourceManager.GetString("IDS_REMOVE", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Search.
/// </summary>
- internal static string IDS_SEARCH {
+ public static string IDS_SEARCH {
get {
return ResourceManager.GetString("IDS_SEARCH", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Search music.
/// </summary>
- internal static string IDS_SEARCH_MUSIC {
+ public static string IDS_SEARCH_MUSIC {
get {
return ResourceManager.GetString("IDS_SEARCH_MUSIC", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Select All.
/// </summary>
- internal static string IDS_SELECT_ALL {
+ public static string IDS_SELECT_ALL {
get {
return ResourceManager.GetString("IDS_SELECT_ALL", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Select Items.
/// </summary>
- internal static string IDS_SELECT_ITEMS {
+ public static string IDS_SELECT_ITEMS {
get {
return ResourceManager.GetString("IDS_SELECT_ITEMS", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Selected.
/// </summary>
- internal static string IDS_SELECTED {
+ public static string IDS_SELECTED {
get {
return ResourceManager.GetString("IDS_SELECTED", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Share.
/// </summary>
- internal static string IDS_SHARE {
+ public static string IDS_SHARE {
get {
return ResourceManager.GetString("IDS_SHARE", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to This Track will be Deleted.
/// </summary>
- internal static string IDS_THIS_TRACK_WILL_BE_DELETED {
+ public static string IDS_THIS_TRACK_WILL_BE_DELETED {
get {
return ResourceManager.GetString("IDS_THIS_TRACK_WILL_BE_DELETED", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Track.
/// </summary>
- internal static string IDS_TRACK {
+ public static string IDS_TRACK {
get {
return ResourceManager.GetString("IDS_TRACK", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Tracks.
/// </summary>
- internal static string IDS_TRACKS {
+ public static string IDS_TRACKS {
get {
return ResourceManager.GetString("IDS_TRACKS", resourceCulture);
}
}
-
+
/// <summary>
/// Looks up a localized string similar to Type Here.
/// </summary>
- internal static string IDS_TYPE_HERE {
+ public static string IDS_TYPE_HERE {
get {
return ResourceManager.GetString("IDS_TYPE_HERE", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to Unknown.
+ /// </summary>
+ public static string IDS_UNKNOWN {
+ get {
+ return ResourceManager.GetString("IDS_UNKNOWN", resourceCulture);
+ }
+ }
}
}
<data name="IDS_ENTER_PLAYLIST_NAME" xml:space="preserve">
<value>Enter Playlist Name</value>
</data>
+ <data name="IDS_FAVOURITE" xml:space="preserve">
+ <value>Favourite</value>
+ </data>
<data name="IDS_MUSIC" xml:space="preserve">
<value>Music</value>
</data>
<data name="IDS_PLAYLIST_NAME_USED" xml:space="preserve">
<value>Playlist name already in use.</value>
</data>
+ <data name="IDS_RECENTLY_ADDED" xml:space="preserve">
+ <value>Recently Added</value>
+ </data>
<data name="IDS_REMOVE" xml:space="preserve">
<value>Remove</value>
</data>
<data name="IDS_TYPE_HERE" xml:space="preserve">
<value>Type Here</value>
</data>
+ <data name="IDS_UNKNOWN" xml:space="preserve">
+ <value>Unknown</value>
+ </data>
</root>
\ No newline at end of file
<data name="IDS_ENTER_PLAYLIST_NAME" xml:space="preserve">
<value>재생 목록 이름 입력</value>
</data>
+ <data name="IDS_FAVOURITE" xml:space="preserve">
+ <value>파부라이트</value>
+ </data>
<data name="IDS_MUSIC" xml:space="preserve">
<value>음악</value>
</data>
<data name="IDS_PLAYLIST_NAME_USED" xml:space="preserve">
<value>이미 사용 중인 재생 목록 이름입니다.</value>
</data>
+ <data name="IDS_RECENTLY_ADDED" xml:space="preserve">
+ <value>최근에 추가되었습니다.</value>
+ </data>
<data name="IDS_REMOVE" xml:space="preserve">
<value>제거하다</value>
</data>
<data name="IDS_TYPE_HERE" xml:space="preserve">
<value>여기에 입력</value>
</data>
+ <data name="IDS_UNKNOWN" xml:space="preserve">
+ <value>미상</value>
+ </data>
</root>
\ No newline at end of file
<data name="IDS_ENTER_PLAYLIST_NAME" xml:space="preserve">
<value>Enter Playlist Name</value>
</data>
+ <data name="IDS_FAVOURITE" xml:space="preserve">
+ <value>Favourite</value>
+ </data>
<data name="IDS_MUSIC" xml:space="preserve">
<value>Music</value>
</data>
<data name="IDS_PLAYLIST_NAME_USED" xml:space="preserve">
<value>Playlist name already in use.</value>
</data>
+ <data name="IDS_RECENTLY_ADDED" xml:space="preserve">
+ <value>Recently Added</value>
+ </data>
<data name="IDS_REMOVE" xml:space="preserve">
<value>Remove</value>
</data>
<data name="IDS_TYPE_HERE" xml:space="preserve">
<value>Type Here</value>
</data>
+ <data name="IDS_UNKNOWN" xml:space="preserve">
+ <value>Unknown</value>
+ </data>
</root>
\ No newline at end of file
get => albumName;\r
set\r
{\r
- string text = string.Equals(value,"Unknown") ? null : value;\r
+ string text = string.Equals(value, TextResources.Resources.IDS_UNKNOWN) ? null : value;\r
SetProperty(ref albumName, text);\r
}\r
}\r
get => artistName;\r
set\r
{\r
- string text = string.Equals(value, "Unknown") ? null : value;\r
+ string text = string.Equals(value, TextResources.Resources.IDS_UNKNOWN) ? null : value;\r
SetProperty(ref artistName, text);\r
}\r
}\r
albumListViewModel.Clear();
groupListViewModel.Clear();
- string text = string.Equals(ArtistName, "Unknown") ? "" : ArtistName;
+ string text = string.Equals(ArtistName, TextResources.Resources.IDS_UNKNOWN) ? "" : ArtistName;
List<Album> albumList = ArtistDataProvider.GetArtistAlbumList(text);
albumListViewModel.CreateData(albumList);
PlaylistId = playlistId;
PlaylistName = playlist.Name;
IsDefaultPlaylist = false;
- if(PlaylistName == AppConstants.RecentlyAddedPlaylist || PlaylistName == AppConstants.FavouritePlaylist)
+ if(PlaylistName == TextResources.Resources.IDS_RECENTLY_ADDED || PlaylistName == TextResources.Resources.IDS_FAVOURITE)
{
IsDefaultPlaylist = true;
}
{
if (playlist != null)
{
- if (playlist.Name == AppConstants.FavouritePlaylist || playlist.Name == AppConstants.RecentlyAddedPlaylist)
+ if (playlist.Name == TextResources.Resources.IDS_FAVOURITE || playlist.Name == TextResources.Resources.IDS_RECENTLY_ADDED)
{
continue;
}
private void AddDefaultPlaylist(List<PlaylistData> list)
{
// Deleting the Favourite and Recently Added first always so that we can add member correctly again.
- Playlist favouritePlaylist = CreateDefaultPlaylist(AppConstants.FavouritePlaylist, Resources.GetImagePath() + "favourite_playlist.png");
- Playlist recentlyAddedPlaylist = CreateDefaultPlaylist(AppConstants.RecentlyAddedPlaylist, Resources.GetImagePath() + "recently_added_playlist.png");
+ Playlist favouritePlaylist = CreateDefaultPlaylist(TextResources.Resources.IDS_FAVOURITE, Resources.GetImagePath() + "favourite_playlist.png");
+ Playlist recentlyAddedPlaylist = CreateDefaultPlaylist(TextResources.Resources.IDS_RECENTLY_ADDED, Resources.GetImagePath() + "recently_added_playlist.png");
Tuple<int, int> memberCounts = AddMemberToDefaultList(favouritePlaylist, recentlyAddedPlaylist);
list.Add(new PlaylistData(recentlyAddedPlaylist.Id, recentlyAddedPlaylist.Name, GetTrackCountText(memberCounts.Item1), recentlyAddedPlaylist.ThumbnailPath));
list.Add(new PlaylistData(favouritePlaylist.Id, favouritePlaylist.Name, GetTrackCountText(memberCounts.Item2), favouritePlaylist.ThumbnailPath));
{
if (playlist != null)
{
- if (playlist.Name == AppConstants.FavouritePlaylist || playlist.Name == AppConstants.RecentlyAddedPlaylist)
+ if (playlist.Name == TextResources.Resources.IDS_FAVOURITE || playlist.Name == TextResources.Resources.IDS_RECENTLY_ADDED)
{
continue;
}
Name = "AlbumDetailView";\r
this.viewModel = viewModel;\r
LinearLayout baseLayout = new LinearLayout();\r
- if(DeviceInfo.IsPortrait)\r
+ if (DeviceInfo.IsPortrait)\r
{\r
baseLayout.LinearOrientation = LinearLayout.Orientation.Vertical;\r
baseLayout.VerticalAlignment = VerticalAlignment.Top;\r
Add(listContainer);\r
AddAlbumArt();\r
AddAlbumInfo();\r
+\r
+ SetTitleText(viewModel.AlbumName);\r
TouchEvent += (object source, TouchEventArgs e) => false;\r
}\r
-\r
+ protected override void SetTitleText(string text)\r
+ {\r
+ if (text == null || text == TextResources.Resources.IDS_UNKNOWN)\r
+ {\r
+ titleText = "IDS_UNKNOWN";\r
+ }\r
+ else\r
+ {\r
+ titleText = text;\r
+ }\r
+ }\r
public override string GetTitleText()\r
{\r
- return albumNameLabel.Text;\r
+ return titleText;\r
}\r
\r
public override void UpdateSubContentMoreButtonItems(Menu moreMenu)\r
\r
protected override void Dispose(DisposeTypes type)\r
{\r
- if(Disposed)\r
+ if (Disposed)\r
{\r
return;\r
}\r
- if(type == DisposeTypes.Explicit)\r
+ if (type == DisposeTypes.Explicit)\r
{\r
if (albumInfoView != null)\r
{\r
BackgroundColor = Color.Transparent,\r
Layout = new LinearLayout()\r
{\r
- LinearOrientation = LinearLayout.Orientation.Vertical,\r
- VerticalAlignment = VerticalAlignment.Center,\r
- HorizontalAlignment = HorizontalAlignment.Center,\r
+ LinearOrientation = LinearLayout.Orientation.Vertical,\r
+ VerticalAlignment = VerticalAlignment.Center,\r
+ HorizontalAlignment = HorizontalAlignment.Center,\r
},\r
Weight = 0.5f\r
};\r
{\r
class AlbumView : BaseContentView\r
{\r
- private readonly AlbumViewModel viewModel;\r
+ private AlbumViewModel viewModel;\r
private TextLabel albumCountLabel;\r
private TextLabel albumTitleLabel;\r
private bool isTrackListEmpty;\r
{\r
Name = "AlbumView";\r
this.viewModel = viewModel;\r
- viewModel.ListViewModel.CollectionChanged += OnListViewModelCollectionChanged;\r
+ this.viewModel.ListViewModel.CollectionChanged += OnListViewModelCollectionChanged;\r
isTrackListEmpty = viewModel.ListViewModel.Count == 0;\r
collectionView.ItemsSource = viewModel.ListViewModel;\r
collectionView.ItemTemplate = new DataTemplate(() =>\r
return;\r
}\r
MusicAlbum currentAlbum = (MusicAlbum)collectionView.SelectedItem;\r
- SubContentViewAddEventArgs albumDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.AlbumDetails, currentAlbum.AlbumName, currentAlbum);\r
+\r
+ string titleText = currentAlbum.AlbumName;\r
+ if (titleText == null || titleText == TextResources.Resources.IDS_UNKNOWN)\r
+ {\r
+ titleText = "IDS_UNKNOWN";\r
+ }\r
+\r
+ SubContentViewAddEventArgs albumDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.AlbumDetails, titleText, currentAlbum);\r
OnSubViewAdd(albumDetailViewArgs);\r
// this is to clear the selected item\r
collectionView.SelectedItem = null;\r
OnOperationViewAdd(operationEventArgs);\r
}\r
\r
+ public override void ResetViewModel()\r
+ {\r
+ viewModel = new AlbumViewModel();\r
+ viewModel.ListViewModel.CollectionChanged += OnListViewModelCollectionChanged;\r
+ collectionView.ItemsSource = viewModel.ListViewModel;\r
+ }\r
+\r
}\r
}\r
using MusicPlayer.Common;
using MusicPlayer.Models;
using MusicPlayer.Views.Utils;
+using Tizen.System;
+using System;
namespace MusicPlayer.Views
{
class ArtistDetailView : BaseSubContentView
{
- private readonly ArtistDetailViewModel viewModel;
-
+ private ArtistDetailViewModel viewModel;
public ArtistDetailView(ArtistDetailViewModel viewModel) : base()
{
this.viewModel = viewModel;
- countLabel.BindingContext = viewModel;
+ countLabel.BindingContext = this.viewModel;
countLabel.SetBinding(TextLabel.TextProperty, "TotalCount");
UpdateCollectionView();
Add(listContainer);
TouchEvent += (object source, TouchEventArgs e) => false;
+ SetTitleText(viewModel.ArtistName);
+ SystemSettings.LocaleLanguageChanged += LanguageChangedCallback;
+ }
+
+ private void LanguageChangedCallback(object sender, LocaleLanguageChangedEventArgs e)
+ {
+ string artistName = this.viewModel.ArtistName;
+ viewModel = new ArtistDetailViewModel(new Artist(artistName));
+ countLabel.BindingContext = viewModel;
+ UpdateCollectionView();
+ }
+
+ protected override void SetTitleText(string text)
+ {
+ if (text == null || text == TextResources.Resources.IDS_UNKNOWN)
+ {
+ titleText = "IDS_UNKNOWN";
+ }
+ else
+ {
+ titleText = text;
+ }
}
public override string GetTitleText()
{
- return viewModel.ArtistName;
+ return titleText;
}
public override void UpdateSubContentMoreButtonItems(Menu moreMenu)
{
class ArtistView : BaseContentView
{
- private readonly ArtistViewModel viewModel;
+ private ArtistViewModel viewModel;
private TextLabel artistCountLabel;
private TextLabel artistTitleLabel;
private bool isTrackListEmpty;
return;
}
Artist currentArtist = (Artist)collectionView.SelectedItem;
- SubContentViewAddEventArgs artistDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.ArtistDetails, currentArtist.ArtistName, currentArtist);
+ string titleText = (currentArtist.ArtistName == null || currentArtist.ArtistName == TextResources.Resources.IDS_UNKNOWN) ? "IDS_UNKNOWN" : currentArtist.ArtistName;
+ SubContentViewAddEventArgs artistDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.ArtistDetails, titleText, currentArtist);
OnSubViewAdd(artistDetailViewArgs);
// this is to clear the selected item
collectionView.SelectedItem = null;
OnOperationViewAdd(operationEventArgs);
}
+
+ public override void ResetViewModel()
+ {
+ viewModel = new ArtistViewModel();
+ collectionView.ItemsSource = viewModel.ListViewModel;
+ viewModel.ListViewModel.CollectionChanged += OnListViewModelCollectionChanged;
+ }
}
}
\ No newline at end of file
DismissMoreMenu();
OnOperationViewAdd(e);
}
+
+ //Override this method to recreate the base content view to reflect translation on title text
+ public virtual void ResetViewModel()
+ {
+ return;
+ }
}
}
protected CollectionView collectionView;
protected View noItemView;
protected LottieAnimationView noItemsAnimation;
+ protected string titleText;
public event EventHandler<OperationViewAddEventArgs> SubContentOperationViewAdd;
return string.Empty;
}
+ protected virtual void SetTitleText(string text)
+ {
+ titleText = text;
+ }
+
public virtual void UpdateSubContentMoreButtonItems(Menu moreMenu)
{
private Button searchButton;
private TabView tabs;
private BaseContentView baseContentView;
+ private string title;
// TODO these name strings are temporary...once the po files are added
// need to use Translatable names.
};
topView.Add(titleLabel);
titleLabel.SetBinding(TextLabel.TextProperty, "Title");
+ titleLabel.SetBinding(TextLabel.TranslatableTextProperty, "Title");
RelativeLayout.SetLeftTarget(titleLabel, topView);
RelativeLayout.SetLeftRelativeOffset(titleLabel, 0.0f);
RelativeLayout.SetRightTarget(titleLabel, topView);
searchButton = null;
}
+ public void resetTitleLabel( bool backButtonShown)
+ {
+ if (titleLabel != null)
+ {
+ topView.Remove(titleLabel);
+ }
+
+ titleLabel = new TextLabel()
+ {
+ StyleName = "PageLabel",
+ ThemeChangeSensitive = true,
+ PixelSize = 40.SpToPx(),
+ FontFamily = "BreezeSans",
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Center,
+ Ellipsis = true,
+ FontStyle = UIFontStyles.NormalLight,
+ };
+
+ topView.Add(titleLabel);
+ titleLabel.SetBinding(TextLabel.TextProperty, "Title");
+
+ RelativeLayout.SetLeftTarget(titleLabel, topView);
+ RelativeLayout.SetLeftRelativeOffset(titleLabel, 0.0f);
+ RelativeLayout.SetRightTarget(titleLabel, topView);
+ RelativeLayout.SetRightRelativeOffset(titleLabel, 1.0f);
+ RelativeLayout.SetFillHorizontal(titleLabel, true);
+
+ if (backButton != null && backButtonShown)
+ {
+ RelativeLayout.SetLeftTarget(titleLabel, backButton);
+ RelativeLayout.SetLeftRelativeOffset(titleLabel, 1.0f);
+ }
+ }
+
public TabView Tabs
{
get => tabs;
public string Title
{
- get => titleLabel.Text;
- set { titleLabel.Text = value;}
+ get
+ {
+ return this.title;
+ }
+ set
+ {
+ bool backButtonShown = (value != "IDS_MUSIC");
+ resetTitleLabel(backButtonShown);
+ Tizen.Log.Debug(AppConstants.LogTag, $"Changing value from {this.title} to {value}");
+ if (value.Contains("IDS"))
+ {
+ titleLabel.TranslatableText = value;
+ titleLabel.Text = null;
+ }
+ else
+ {
+ titleLabel.TranslatableText = null;
+ titleLabel.Text = value;
+ }
+ this.title = value;
+ }
}
public bool BackButton
else
{
BackButton = false;
- Title = "Music";
+ Title = "IDS_MUSIC";
}
contentView.Add(view);
baseContentView = view;
if (baseContentView != null)
{
BackButton = false;
- Title = "Music";
+ Title = "IDS_MUSIC";
baseContentView.RemoveSubContentView();
+ Tizen.Log.Debug(AppConstants.LogTag, "Back called");
}
}
{
AddNoItemView();
}
+
+ SetTitleText(viewModel.PlaylistName);
+ }
+
+ protected override void SetTitleText(string text)
+ {
+ if (text == TextResources.Resources.IDS_FAVOURITE)
+ {
+ titleText = "IDS_FAVOURITE";
+ }
+ else if (text == TextResources.Resources.IDS_RECENTLY_ADDED)
+ {
+ titleText = "IDS_RECENTLY_ADDED";
+ }
+ else
+ {
+ titleText = text;
+ }
}
private void OnListViewModelCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
public override string GetTitleText()
{
- return viewModel.PlaylistName;
+ return titleText;
}
public override void DeleteSubView()
private TextLabel playlistCountLabel;
private TextLabel playlistTitleLabel;
private Button playlistCreateButton;
- private readonly PlaylistViewModel viewModel;
+ private PlaylistViewModel viewModel;
public PlaylistView(PlaylistViewModel viewModel)
{
Margin = new Extents(0, 4, 0, 0).SpToPx(),
};
titleView.Add(playlistCountLabel);
- playlistCountLabel.BindingContext = viewModel;
+ playlistCountLabel.BindingContext = this.viewModel;
playlistCountLabel.SetBinding(TextLabel.TextProperty, "PlaylistCount");
playlistTitleLabel = new TextLabel()
return;
}
PlaylistModel playlistModel = (PlaylistModel)collectionView.SelectedItem;
- SubContentViewAddEventArgs playlistDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.PlaylistDetails, playlistModel.PlaylistName, playlistModel.PlaylistId);
+
+ string titleText = playlistModel.PlaylistName;
+ if (titleText == TextResources.Resources.IDS_FAVOURITE)
+ {
+ titleText = "IDS_FAVOURITE";
+ }
+ else if (titleText == TextResources.Resources.IDS_RECENTLY_ADDED)
+ {
+ titleText = "IDS_RECENTLY_ADDED";
+ }
+
+ SubContentViewAddEventArgs playlistDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.PlaylistDetails, titleText, playlistModel.PlaylistId);
OnSubViewAdd(playlistDetailViewArgs);
// this is clear the selected item
collectionView.SelectedItem = null;
OperationViewAddEventArgs operationEventArgs = new OperationViewAddEventArgs(OperationViewType.Delete, ContentViewType.Playlist, viewModel.UserPlaylistViewModel);
OnOperationViewAdd(operationEventArgs);
}
+
+ public override void ResetViewModel()
+ {
+ this.viewModel = new PlaylistViewModel();
+ collectionView.ItemsSource = this.viewModel.ListViewModel;
+ }
}
}
if (searchModel.ItemType == 0)
{
Artist currentArtist = searchModel.ArtistDetail;
- SubContentViewAddEventArgs artistDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.ArtistDetails, currentArtist.ArtistName, currentArtist);
+ string titleText = (currentArtist.ArtistName == null || currentArtist.ArtistName == TextResources.Resources.IDS_UNKNOWN)? "IDS_UNKONOW" : currentArtist.ArtistName;
+ SubContentViewAddEventArgs artistDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.ArtistDetails, titleText, currentArtist);
LaunchDetailView?.Invoke(this, artistDetailViewArgs);
}
else if (searchModel.ItemType == 1)
{
MusicAlbum currentAlbum = searchModel.AlbumDetail;
- SubContentViewAddEventArgs albumDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.AlbumDetails, currentAlbum.AlbumName, currentAlbum);
+ string titleText = (currentAlbum.AlbumName == null || currentAlbum.AlbumName == TextResources.Resources.IDS_UNKNOWN) ? "IDS_UNKONOW" : currentAlbum.AlbumName;
+ SubContentViewAddEventArgs albumDetailViewArgs = new SubContentViewAddEventArgs(SubContentViewType.AlbumDetails, titleText, currentAlbum);
LaunchDetailView?.Invoke(this, albumDetailViewArgs);
}
else if (searchModel.ItemType == 2)
{
artistItem.IsSelected = false;
string text = artistItem.ArtistName;
- if (text == "Unknown")
+ if (text == TextResources.Resources.IDS_UNKNOWN)
{
text = string.Empty;
}
{
artistItem.IsSelected = true;
string text = artistItem.ArtistName;
- if (text == "Unknown")
+ if (text == TextResources.Resources.IDS_UNKNOWN)
{
text = string.Empty;
}
{\r
class TrackView : BaseContentView\r
{\r
- private readonly TrackViewModel viewModel;\r
+ private TrackViewModel viewModel;\r
private TextLabel trackCountLabel;\r
private TextLabel trackTitleLabel;\r
private Button playAllWithShuffle;\r
OperationViewAddEventArgs operationEventArgs = new OperationViewAddEventArgs(OperationViewType.AddToPlaylist, ContentViewType.Track, viewModel.ListViewModel);\r
OnOperationViewAdd(operationEventArgs);\r
}\r
+\r
+ public override void ResetViewModel()\r
+ {\r
+ viewModel = new TrackViewModel();\r
+ viewModel.ListViewModel.CollectionChanged += OnListViewModelCollectionChanged;\r
+ collectionView.ItemsSource = viewModel.ListViewModel;\r
+ }\r
}\r
}\r
public ViewLibrary()
{
contentViewDictionary = new Dictionary<int, BaseContentView>();
- foreach(int i in Enum.GetValues(typeof(ContentViewType)))
+ foreach (int contentViewId in Enum.GetValues(typeof(ContentViewType)))
{
- contentViewDictionary[i] = null;
+ contentViewDictionary[contentViewId] = null;
}
contentViewFactory = new ConcreteContentViewFactory();
public BaseContentView GetContentView(ContentViewType type)
{
- if(contentViewDictionary[(int)type] == null)
+ if (contentViewDictionary[(int)type] == null)
{
contentViewDictionary[(int)type] = contentViewFactory.GetContentView(type);
}
public View AddOperationView(OperationViewType type, ContentViewType contentType, object viewModelData, object otherData)
{
- return operationViewFactory.AddOperationView(type, contentType, viewModelData, otherData);
+ return operationViewFactory.AddOperationView(type, contentType, viewModelData, otherData);
+ }
+
+ public void ClearView()
+ {
+ foreach (int contentViewId in Enum.GetValues(typeof(ContentViewType)))
+ {
+ contentViewDictionary[contentViewId]?.ResetViewModel();
+ }
}
}
}
using MusicPlayer.Views.Utils;
using MusicPlayer.Common;
using MusicPlayer.Core;
+using Tizen.System;
namespace MusicPlayer.Views
{
UpdateTheme(e.PlatformThemeId);
}
};
+ SystemSettings.LocaleLanguageChanged += LanguageChangedCallback;
+ }
+
+ private void LanguageChangedCallback(object sender, LocaleLanguageChangedEventArgs e)
+ {
+ Tizen.Log.Debug(AppConstants.LogTag, $"LocalChangedCallback : {e.Value}");
+ ResetBaseContentView();
}
private void SetTheme(string path)
{
baseView = new BaseView()
{
- Title = "Music",
+ Title = "IDS_MUSIC",
MoreButton = true,
SearchButton = true,
};
private void OnSubViewAdded(object sender, SubContentViewAddEventArgs subViewAddEventArgs)
{
BaseSubContentView baseSubContentView = viewLibrary.GetSubContentView(subViewAddEventArgs.SubViewType, subViewAddEventArgs.ViewModelData);
- baseView.AddSubViewContent(subViewAddEventArgs.TitleText, baseSubContentView);
+ baseView.AddSubViewContent(baseSubContentView.GetTitleText(), baseSubContentView);
+ Tizen.Log.Debug(AppConstants.LogTag, $"Subview with title : {baseSubContentView.GetTitleText()} {subViewAddEventArgs.TitleText} added");
}
private void OnOperationViewAdded(object sender, OperationViewAddEventArgs e)
Tizen.Log.Error(AppConstants.LogTag, "Adding " + currentContentView?.Name);
}
}
+
+ private void ResetBaseContentView()
+ {
+ BaseContentView previousContentView = viewLibrary.GetContentView((ContentViewType)previousIndex);
+ baseView.RemoveContent(previousContentView);
+ previousContentView?.HideView();
+ if (previousContentView != null)
+ {
+ previousContentView.SubContentViewAdded -= OnSubViewAdded;
+ previousContentView.OperationViewAdded -= OnOperationViewAdded;
+ }
+ viewLibrary.ClearView();
+
+ BaseContentView currentContentView = viewLibrary.GetContentView((ContentViewType)previousIndex);
+ currentContentView?.ShowView();
+
+ baseView.SetContent(currentContentView);
+ if (currentContentView != null)
+ {
+ currentContentView.SubContentViewAdded += OnSubViewAdded;
+ currentContentView.OperationViewAdded += OnOperationViewAdded;
+ }
+ }
}
}
\r
<ItemGroup>\r
<EmbeddedResource Update="TextResources\Resources.resx">\r
- <Generator>ResXFileCodeGenerator</Generator>\r
+ <Generator>PublicResXFileCodeGenerator</Generator>\r
<LastGenOutput>Resources.Designer.cs</LastGenOutput>\r
</EmbeddedResource>\r
</ItemGroup>\r