{
private View selectPlaylistContentArea;
private View createPlaylistContentArea;
- private View searchBox;
+ private View inputArea;
private Button createNewPlaylistButton;
private TextLabel noListText;
private TextLabel underText;
Size2D = new Size2D(1184, 660),
Title = "Add to playlist",
Content = selectPlaylistContentArea,
- Actions = new List<View> { selectPlaylistCancelButton},
+ Actions = new List<View> { selectPlaylistCancelButton },
Padding = new Extents(0, 0, 0, 0),
Margin = new Extents(0, 0, 0, 0),
};
Size2D = new Size2D(1184, 465),
Title = "Create playlist",
Content = createPlaylistContentArea,
- Actions = new List<View> { createPlaylistCancelButton , createPlaylistCreateButton },
+ Actions = new List<View> { createPlaylistCancelButton, createPlaylistCreateButton },
Padding = new Extents(0, 0, 0, 0),
Margin = new Extents(0, 0, 0, 0),
};
Margin = new Extents(0, 0, 0, 24),
};
createPlaylistContentArea.Add(textLabel);
- AddSearchBox();
+ AddInputArea();
View itemSeperator = new View()
{
WidthSpecification = LayoutParamPolicies.MatchParent,
createPlaylistContentArea.Add(underText);
}
- private void AddSearchBox()
+ private void AddInputArea()
{
- searchBox = new View()
+ inputArea = new View()
{
Size2D = new Size2D(1024, 48),
Layout = new FlexLayout()
};
crossButton.Clicked += CrossButtonClicked;
- searchBox.Add(textField);
- searchBox.Add(crossButton);
- createPlaylistContentArea.Add(searchBox);
+ inputArea.Add(textField);
+ inputArea.Add(crossButton);
+ createPlaylistContentArea.Add(inputArea);
}
private void TextFieldTextChanged(object sender, TextField.TextChangedEventArgs e)
createPlaylistCreateButton.IsSelectable = true;
createPlaylistCreateButton.IsEnabled = true;
}
- if(searchText.Length > 64)
+ if (searchText.Length > 64)
{
Notification.MakeToast("Maximum number of characters reached.", Notification.ToastCenter).Post(Notification.ToastShort);
underText.Text = "Can't enter more than 64 characters.";
RemoveTheCreatePopup();
Window.Instance.Add(selectPlaylistDialog);
Playlist playlist = PlaylistManager.Instance.AddPlaylist(textField.Text);
- PlaylistModel playlistModel = new PlaylistModel(new PlaylistData(playlist.Id,playlist.Name, viewModel.GetTrackCountForPlaylist(playlist.Id), playlist.ThumbnailPath));
+ PlaylistModel playlistModel = new PlaylistModel(new PlaylistData(playlist.Id, playlist.Name, viewModel.GetTrackCountForPlaylist(playlist.Id), playlist.ThumbnailPath));
collectionView.SelectedItem = playlistModel;
}
else
}
if (type == DisposeTypes.Explicit)
{
- selectPlaylistDialog?.Dispose();
- selectPlaylistDialog = null;
- createPlaylistDialog?.Dispose();
- createPlaylistDialog = null;
-
- searchBox?.Remove(textField);
+ inputArea?.Remove(textField);
textField?.Dispose();
textField = null;
- searchBox?.Remove(crossButton);
+ inputArea?.Remove(crossButton);
crossButton?.Dispose();
crossButton = null;
- if(selectPlaylistContentArea != null)
+ if (selectPlaylistContentArea != null)
{
List<View> children = selectPlaylistContentArea.Children;
- foreach(View child in children)
+ while (children.Count > 0)
{
+ View child = children[0];
selectPlaylistContentArea.Remove(child);
child?.Dispose();
}
- selectPlaylistContentArea.Dispose();
}
if (createPlaylistContentArea != null)
{
List<View> children = createPlaylistContentArea.Children;
- foreach (View child in children)
+ while (children.Count > 0)
{
+ View child = children[0];
createPlaylistContentArea.Remove(child);
child?.Dispose();
}
- createPlaylistContentArea.Dispose();
- createPlaylistContentArea = null;
}
-
createNewPlaylistButton = null;
- collectionView?.Dispose();
collectionView = null;
- noListText?.Dispose();
noListText = null;
- searchBox = null;
+ inputArea = null;
underText = null;
+ selectPlaylistDialog?.Dispose();
+ selectPlaylistDialog = null;
+ createPlaylistDialog?.Dispose();
+ createPlaylistDialog = null;
+ selectPlaylistContentArea = null;
+ createPlaylistContentArea = null;
+
selectPlaylistCancelButton?.Dispose();
selectPlaylistCancelButton = null;
createPlaylistCancelButton?.Dispose();
createPlaylistCancelButton = null;
createPlaylistCreateButton?.Dispose();
createPlaylistCreateButton = null;
-
}
+
base.Dispose(type);
}
private void BackButtonClicked(object sender, ClickedEventArgs e)
{
- Window.Instance.Remove(this);
- //DeleteSearchView();
+ DeleteSearchView();
}
private void AddCollectionView()
object selectedObject = collectionView.SelectedItem;
if (selectedObject is SearchModel)
{
- Window.Instance.Remove(this);
SearchModel searchModel = (SearchModel)selectedObject;
if (searchModel.ItemType == 0)
{
{
Track currentTrack = searchModel.TrackDetail;
viewModel.PlayTrack(currentTrack);
- //DeleteSearchView();
}
+ DeleteSearchView();
}
}
public void DeleteSearchView()
{
+ Window.Instance.Remove(this);
Dispose(DisposeTypes.Explicit);
}
if (searchBox != null)
{
List<View> children = searchBox.Children;
- foreach (View child in children)
+ while (children.Count > 0)
{
+ View child = children[0];
searchBox.Remove(child);
child?.Dispose();
}
if (topView != null)
{
List<View> children = topView.Children;
- foreach (View child in children)
+ while (children.Count > 0)
{
+ View child = children[0];
topView.Remove(child);
child?.Dispose();
}
topView = null;
}
- if (!noItemFound && collectionView != null)
+ if (noItemFound)
{
- base.Remove(collectionView);
+ base.Remove(noItemView);
}
- else if(noItemFound && noItemView != null)
+ else
{
- base.Remove(noItemView);
+ base.Remove(collectionView);
}
if (collectionView != null)
if (noItemView != null)
{
List<View> children = noItemView.Children;
- foreach (View child in children)
+ while (children.Count > 0)
{
+ View child = children[0];
noItemView.Remove(child);
- child.Dispose();
+ child?.Dispose();
}
noItemView.Dispose();
noItemView = null;