Skip to content
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

Add ability to sort by runtime #3084

Merged
merged 5 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,6 @@
mGridHeight = Math.round(display.heightPixels / getResources().getDisplayMetrics().density - 130.6f);
mGridWidth = Math.round(display.widthPixels / getResources().getDisplayMetrics().density);

sortOptions = new HashMap<>();
{
sortOptions.put(0, new SortOption(getString(R.string.lbl_name), ItemSortBy.SortName, SortOrder.ASCENDING));
sortOptions.put(1, new SortOption(getString(R.string.lbl_date_added), ItemSortBy.DateCreated + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(2, new SortOption(getString(R.string.lbl_premier_date), ItemSortBy.PremiereDate + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(3, new SortOption(getString(R.string.lbl_rating), ItemSortBy.OfficialRating + "," + ItemSortBy.SortName, SortOrder.ASCENDING));
sortOptions.put(4, new SortOption(getString(R.string.lbl_community_rating), ItemSortBy.CommunityRating + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(5, new SortOption(getString(R.string.lbl_critic_rating), ItemSortBy.CriticRating + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(6, new SortOption(getString(R.string.lbl_last_played), ItemSortBy.DatePlayed + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
}

mActivity = getActivity();

Expand All @@ -172,6 +162,22 @@
else
setGridPresenter(new HorizontalGridPresenter());

sortOptions = new HashMap<>();
{
sortOptions.put(0, new SortOption(getString(R.string.lbl_name), ItemSortBy.SortName, SortOrder.ASCENDING));
sortOptions.put(1, new SortOption(getString(R.string.lbl_date_added), ItemSortBy.DateCreated + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(2, new SortOption(getString(R.string.lbl_premier_date), ItemSortBy.PremiereDate + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(3, new SortOption(getString(R.string.lbl_rating), ItemSortBy.OfficialRating + "," + ItemSortBy.SortName, SortOrder.ASCENDING));
sortOptions.put(4, new SortOption(getString(R.string.lbl_community_rating), ItemSortBy.CommunityRating + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(5, new SortOption(getString(R.string.lbl_critic_rating), ItemSortBy.CriticRating + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
sortOptions.put(6, new SortOption(getString(R.string.lbl_last_played), ItemSortBy.DatePlayed + "," + ItemSortBy.SortName, SortOrder.DESCENDING));
if(mFolder.getType() == BaseItemKind.COLLECTION_FOLDER){
nielsvanvelzen marked this conversation as resolved.
Show resolved Hide resolved
String type = mFolder.getCollectionType() != null ? mFolder.getCollectionType().toLowerCase() : "";
Fixed Show fixed Hide fixed
nielsvanvelzen marked this conversation as resolved.
Show resolved Hide resolved
if(type.equals(CollectionType.Movies))
nielsvanvelzen marked this conversation as resolved.
Show resolved Hide resolved
sortOptions.put(7, new SortOption(getString(R.string.lbl_runtime), ItemSortBy.Runtime + "," + ItemSortBy.SortName, SortOrder.ASCENDING));
}
}

setDefaultGridRowCols(mPosterSizeSetting, mImageType);
setAutoCardGridValues();
setupQueries();
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<string name="lbl_ends">"Ends"</string>
<string name="lbl_directed_by">"Directed by"</string>
<string name="lbl_last_played">"Last played "</string>
<string name="lbl_runtime">Runtime</string>
<string name="lbl_other_options">Other options</string>
<string name="lbl_people">People</string>
<string name="lbl_videos">Videos</string>
Expand Down