xmlns:Views="clr-namespace:TVMediaHub.Tizen.Views"
MusicInfo="{Binding Information}">
+ <Utils:NinePatch x:Name="Shadow"
+ Source=""
+ VerticalOptions="CenterAndExpand"
+ HorizontalOptions="CenterAndExpand"
+ Aspect="Fill"/>
<StackLayout Orientation="Vertical" x:Name="TextArea" BackgroundColor="#171717" Spacing="0"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2518}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.2821}">
<Label x:Name="AlbumTitle"
FontFamily="BreezeSans"
LineBreakMode="TailTruncation"
- Opacity="0.6"/>
+ Opacity="0.5"/>
</StackLayout>
<Image x:Name="AlbumCover"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2518}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.0951}"
Source="img_music_nocover_focused.png"/>
<Button x:Name="FocusArea"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.496}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.81}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2518}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.0951}"
Opacity="0"
Clicked="OnItemClicked"
Focused="OnItemFocused"
using System;
using System.ComponentModel;
using Tizen.Content.MediaContent;
+using Tizen.Xamarin.Forms.Extension;
using TVMediaHub.Tizen.DataModels;
using TVMediaHub.Tizen.Utils;
using TVMediaHub.Tizen.ViewModels;
}
}
+ /// <summary>
+ /// An EventHandler for focus event of the item
+ /// </summary>
+ public EventHandler OnFocusedEventHandler;
+ /// <summary>
+ /// An EventHandler for unfocus event of the item
+ /// </summary>
+ public EventHandler OnUnfocusedEventHandler;
+
+ /// <summary>
+ /// Bounds for TextArea when item is unfocused
+ /// </summary>
+ private Rectangle TextAreaNormalBounds;
+ /// <summary>
+ /// Bounds for TextArea when item is focused
+ /// </summary>
+ private Rectangle TextAreaFocusedBounds;
/// <summary>
/// A constructor
{
InitializeComponent();
InitializeSize();
+ InitializeLabel();
PropertyChanged += MusicItemPropertyChanged;
}
/// <summary>
+ /// A method for initializing font and slide effect
+ /// </summary>
+ public void InitializeLabel()
+ {
+ SongTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
+ Artist.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
+ AlbumTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Light);
+
+ SlideEffect.SetSlideDuration(SongTitle, 15000);
+ SlideEffect.SetSlideMode(SongTitle, SlideMode.Auto);
+
+ SlideEffect.SetSlideDuration(Artist, 15000);
+ SlideEffect.SetSlideMode(Artist, SlideMode.Auto);
+
+ SlideEffect.SetSlideDuration(AlbumTitle, 15000);
+ SlideEffect.SetSlideMode(AlbumTitle, SlideMode.Auto);
+ }
+
+ /// <summary>
/// A method for initializing size of the items that are used in this class
/// </summary>
private void InitializeSize()
{
+ int h28 = SizeUtils.GetHeightSize(28);
+ int h32 = SizeUtils.GetHeightSize(32);
+ int w32 = SizeUtils.GetWidthSize(32);
+ int h134 = SizeUtils.GetHeightSize(134);
+ int w134 = SizeUtils.GetWidthSize(134);
+ int w382 = SizeUtils.GetWidthSize(382);
+ int w446 = SizeUtils.GetWidthSize(446);
+
WidthRequest = SizeUtils.GetWidthSize(716);
HeightRequest = SizeUtils.GetHeightSize(270);
- AlbumCover.WidthRequest = SizeUtils.GetWidthSize(134);
- AlbumCover.HeightRequest = SizeUtils.GetHeightSize(134);
- TextArea.WidthRequest = SizeUtils.GetWidthSize(446);
- TextArea.HeightRequest = SizeUtils.GetHeightSize(134);
- SongTitle.WidthRequest = SizeUtils.GetWidthSize(382);
- SongTitle.HeightRequest = SizeUtils.GetHeightSize(32);
+
+ TextAreaNormalBounds = new Rectangle(SizeUtils.GetWidthSize(202), SizeUtils.GetHeightSize(68), w446, SizeUtils.GetHeightSize(134));
+ TextAreaFocusedBounds = new Rectangle(SizeUtils.GetWidthSize(206), SizeUtils.GetHeightSize(64), w446, SizeUtils.GetHeightSize(142));
+
+ AlbumCover.WidthRequest = w134;
+ AlbumCover.HeightRequest = h134;
+
+ TextArea.WidthRequest = w446;
+ TextArea.HeightRequest = h134;
+
+ SongTitle.WidthRequest = w382;
+ SongTitle.HeightRequest = h32;
SongTitle.FontSize = SizeUtils.GetFontSize(28);
- SongTitle.Margin = new Thickness(SizeUtils.GetWidthSize(32), SizeUtils.GetHeightSize(18), SizeUtils.GetWidthSize(32), 0);
- SongTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
- Artist.WidthRequest = SizeUtils.GetWidthSize(382);
- Artist.HeightRequest = SizeUtils.GetHeightSize(32);
- Artist.Margin = new Thickness(SizeUtils.GetWidthSize(32), SizeUtils.GetHeightSize(12), SizeUtils.GetWidthSize(32), 0);
- Artist.FontSize = SizeUtils.GetFontSize(28);
- Artist.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
- AlbumTitle.WidthRequest = SizeUtils.GetWidthSize(382);
- AlbumTitle.HeightRequest = SizeUtils.GetHeightSize(28);
- AlbumTitle.Margin = new Thickness(SizeUtils.GetWidthSize(32), SizeUtils.GetHeightSize(4), SizeUtils.GetWidthSize(32), 0);
+ SongTitle.Margin = new Thickness(w32, SizeUtils.GetHeightSize(18), w32, 0);
+
+ Artist.WidthRequest = w382;
+ Artist.HeightRequest = h28;
+ Artist.Margin = new Thickness(w32, SizeUtils.GetHeightSize(12), w32, 0);
+ Artist.FontSize = SizeUtils.GetFontSize(24);
+
+ AlbumTitle.WidthRequest = w382;
+ AlbumTitle.HeightRequest = h28;
+ AlbumTitle.Margin = new Thickness(w32, SizeUtils.GetHeightSize(4), w32, 0);
AlbumTitle.FontSize = SizeUtils.GetFontSize(24);
- AlbumTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Light);
+
}
/// <summary>
/// <param name="e">A Focus event's argument</param>
private void OnItemFocused(object sender, FocusEventArgs e)
{
- DbgPort.D("MusicItem is focused : " + (MusicInfo.MediaContentInformation as AudioInformation).Title);
+ Easing easing = new Easing(EasingFunction.EasyIn1);
+ TextArea.LayoutTo(TextAreaFocusedBounds, 300, easing);
+
+ AlbumCover.ScaleTo(1.0597, 300, easing);
+ TextArea.BackgroundColor = Color.FromHex("ffffff");
+
+ SongTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Medium);
+ SongTitle.TextColor = Color.FromHex("000000");
+ SlideEffect.SetHasSlide(SongTitle, true);
+
+
+ Artist.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Medium);
+ Artist.Opacity = 0.8;
+ Artist.TextColor = Color.FromHex("000000");
+ SlideEffect.SetHasSlide(Artist, true);
+
+ AlbumTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
+ AlbumTitle.Opacity = 0.7;
+ AlbumTitle.TextColor = Color.FromHex("000000");
+ SlideEffect.SetHasSlide(AlbumTitle, true);
+
+ OnFocusedEventHandler?.Invoke(sender, e);
}
/// <summary>
/// <param name="e">A Focus event's argument</param>
private void OnItemUnfocused(object sender, FocusEventArgs e)
{
- DbgPort.D("MusicItem is unfocused : " + (MusicInfo.MediaContentInformation as AudioInformation).Title);
+ Easing easing = new Easing(EasingFunction.EasyIn2);
+ TextArea.LayoutTo(TextAreaNormalBounds, 300, easing);
+
+ AlbumCover.ScaleTo(1.0, 300, easing);
+ TextArea.BackgroundColor = Color.FromHex("171717");
+
+ SongTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
+ SongTitle.TextColor = Color.FromHex("ffffff");
+ SlideEffect.SetHasSlide(SongTitle, false);
+
+ Artist.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
+ Artist.Opacity = 0.6;
+ Artist.TextColor = Color.FromHex("ffffff");
+ SlideEffect.SetHasSlide(Artist, false);
+
+ AlbumTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Light);
+ AlbumTitle.Opacity = 0.5;
+ AlbumTitle.TextColor = Color.FromHex("ffffff");
+ SlideEffect.SetHasSlide(AlbumTitle, false);
}
/// <summary>
AlbumTitle.Text = info.Album;
}
}
+
}
}
\ No newline at end of file