-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added navigation buttons "Next section" and "Random song" #385
Conversation
… letter with respect to the current song. * Navigation button (Orange) is added to select a random song.
UpdateSongViews(); | ||
UpdateScrollbar(); | ||
} | ||
|
||
private void setFirstLetters(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow naming conventions (should be SetFirstLetters
)
_songs | ||
.OfType<SongViewType>() | ||
.Select(song => song.SongEntry.NameNoParenthesis) | ||
.Where(name => name != null && name.Any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string.IsNullOrEmpty
may be better here.
} | ||
|
||
private string GetNextLetterOrNumber(string input){ | ||
string firstCharacter = input.Substring(0, 1).ToUpper();; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should become input[0].ToUpper()
. A string.IsNullOrEmpty
check should also be added above to prevent errors. If an error state is needed (or in this case, ""
is returned), it may be favorable to return char?
(where ""
would become null
).
string firstCharacter = input.Substring(0, 1).ToUpper();; | ||
|
||
int indexOfActualLetter = songsFirstLetter.FindIndex(letter => { | ||
return Char.ToString(letter) == firstCharacter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If above comment occurs, this can become letter == firstCharacter
return Char.ToString(letter) == firstCharacter; | ||
}); | ||
|
||
bool isLast = indexOfActualLetter == (songsFirstLetter.Count() - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use songsFirstLetter.Count
instead of songsFirstLetter.Count()
.
string nextCharacter = GetNextLetterOrNumber(song.SongEntry.NameNoParenthesis); | ||
|
||
var index = _songs.FindIndex(skip, song => { | ||
return song is SongViewType songType && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda can be simplified to song => [RETURN VALUE]
instead of song => { return [RETURN VALUE] }
I'd suggest making orange the button to go to the next section, to match how RB/CH do it. Random song might also be better in a separate menu that contains other less common options as well, but I don't think we have that implemented currently so a button should be fine for now. |
Hi @EliteAsian123 , I have already made the requested changes. |
…410) * * Added navigation button (Blue) "Next section" that selects the next letter with respect to the current song. * Navigation button (Orange) is added to select a random song. * Changes made based on conversation [#385] * * The navigation bar is updated to show the following action for pressing the search and sort buttons * Improvement of the sorting code and addition of sorting by year, genre, album and charter. * The code that performs song sorting (SongSorting.cs) is separated from the class that performs song selection (SongSelection.cs). * Changes made as a result of the discussion #410
Added navigation button (Blue) "Next section" that selects the next letter with respect to the current song.
Navigation button (Orange) is added to select a random song.