{\r
class ListItemLayout : RecyclerViewItem\r
{\r
- private static bool AnimationRequired;\r
-\r
private const int IconSize = 64;\r
private const int SeperatorHeight = 2;\r
\r
private Button playPauseIcon;\r
private bool isAnimating = false;\r
private bool isPlayingStatus = false;\r
+ private bool isAnimationRequired = false;\r
\r
public static readonly BindableProperty IsPlayingProperty = BindableProperty.Create(nameof(IsPlaying), typeof(bool), typeof(ListItemLayout), false, propertyChanged: (bindable, oldValue, newValue) =>\r
{\r
public ListItemLayout(bool animationRequired = false) : base()\r
{\r
OnInitialize();\r
- AnimationRequired = animationRequired;\r
+ isAnimationRequired = animationRequired;\r
WidthSpecification = LayoutParamPolicies.MatchParent;\r
HeightSpecification = 108.SpToPx();\r
BackgroundColor = Color.Transparent;\r
{\r
subtitleLabel.TextColor = UIColors.HEX1473E6;\r
}\r
- if(AnimationRequired == true && isAnimating == false)\r
+ if(isAnimationRequired && isAnimating == false)\r
{\r
isAnimating = AddAnimation();\r
}\r
- else if(AnimationRequired == false && isPlayingStatus == false )\r
+ else if(isAnimationRequired == false && isPlayingStatus == false )\r
{\r
isPlayingStatus = AddPlayingStatus();\r
}\r
else\r
{\r
UpdateLabelColors();\r
- if(AnimationRequired == true && isAnimating)\r
+ if(isAnimationRequired && isAnimating)\r
{\r
RemoveAnimation();\r
isAnimating = false;\r
}\r
- else if(AnimationRequired == false && isPlayingStatus == true)\r
+ else if(isAnimationRequired == false && isPlayingStatus == true)\r
{\r
RemovePlayingStatus();\r
isPlayingStatus = false;\r
AddRiveAnimation();
lyricsViewModel.TrackThumbState += OnTrackStateChanged;
- // This is set to the binding after the Lyrics is added to scene graph.
- // If we set the binding before view is added to scene-graph/window than binding doesn't seem to work.
- AddedToWindow += OnAddedToWindow;
+ BindingContextChanged += OnBindingContextChanged;
}
- private void OnAddedToWindow(object sender, System.EventArgs e)
+ private void OnBindingContextChanged(object sender, System.EventArgs e)
{
+ //Don't set BindingContext for LyricsView in this callback. this will cause a infinite recursive loop.
+ //Only set Binding context for children of LyricsView class
thumbView.BindingContext = lyricsViewModel.lyricsModel;
thumbView.SetBinding(ImageView.ResourceUrlProperty, "ThumbPath");
thumbView.Dispose();
thumbView = null;
lyricsViewModel.TrackThumbState -= OnTrackStateChanged;
- AddedToWindow -= OnAddedToWindow;
+ BindingContextChanged -= OnBindingContextChanged;
}
base.Dispose(type);
}
};
rightView.Add(controlsView);
AddControlElements();
+ rightView.BindingContextChanged += OnControlsViewContextChanged;
+ }
+
+ private void OnControlsViewContextChanged(object sender, EventArgs e)
+ {
+ shuffleButton.BindingContext = viewModel.playingListViewModel;
+ shuffleButton.SetBinding(MultiStateButton.CustomStateProperty, "ShuffleButtonState");
+
+ prevButton.BindingContext = viewModel;
+ prevButton.SetBinding(IsEnabledProperty, "HasPreviousTrack");
+
+ playButton.BindingContext = viewModel;
+ playButton.SetBinding(MultiStateButton.CustomStateProperty, "PlayButtonState");
+
+ nextButton.BindingContext = viewModel;
+ nextButton.SetBinding(IsEnabledProperty, "HasNextTrack");
+
+ repeatButton.BindingContext = viewModel.playingListViewModel;
+ repeatButton.SetBinding(MultiStateButton.CustomStateProperty, "RepeatButtonState");
+
+ volumeSlider.BindingContext = viewModel;
+ volumeSlider.SetBinding(Slider.CurrentValueProperty, "VolumeLevel");
}
private void AddTitleLabel()
{
viewModel.FavouriteStatusChanged();
};
+
+ actionButtonView.BindingContextChanged += (object o, System.EventArgs e) =>
+ {
+ favouriteButton.BindingContext = viewModel;
+ favouriteButton.SetBinding(MultiStateButton.CustomStateProperty, "FavouriteButtonState");
+ };
}
private void OnListButtonClicked(object sender, ClickedEventArgs e)
}
}
+ public override string GetTitleText()
+ {
+ return viewModel.PlaylistName;
+ }
+
public override void DeleteSubView()
{
base.DeleteSubView();
</ItemGroup>\r
\r
<ItemGroup>\r
- <PackageReference Include="Tizen.NET" Version="10.0.0.17133" />\r
+ <PackageReference Include="Tizen.NET" Version="10.0.0.17150" />\r
<PackageReference Include="Tizen.NET.Sdk" Version="1.1.7" />\r
</ItemGroup>\r
\r