|
YAACC - UPNP Client and Server
|
Adapter for browsing devices. More...


Classes | |
| enum | SortMode |
| The order in which browsed items are shown. More... | |
| class | ViewHolder |
| enum | ViewMode |
| Which layout presents the currently-loaded items. More... | |
Public Member Functions | |
| BrowseContentItemAdapter (ContentListFragment contentListFragment, RecyclerView contentList, UpnpClient upnpClient, ProgressBar progressBar) | |
| SortMode | getSortMode () |
| ViewMode | getViewMode () |
| void | setViewMode (ViewMode mode) |
| Changes which layout presents the currently-loaded items. | |
| boolean | isNameAscending () |
| boolean | isDateAscending () |
| void | setSortMode (SortMode sortMode) |
| Changes the current sort mode. | |
| void | toggleDirection () |
Flips the currently-selected mode's own direction (Name: A-Z <-> Z-A; Date: newest-first <-> oldest-first), persists it, and reloads – same as setSortMode(SortMode). | |
| boolean | isDateSortAvailable () |
| boolean | isServerSortRejected () |
| void | markServerSortRejected () |
| Records that the server rejected a sorted Browse request for the current folder load, so later chunk requests skip straight to the unsorted request. | |
| long | getItemId (int position) |
| int | getItemViewType (int position) |
| Navigator | getNavigator () |
| boolean | isAllItemsFetched () |
| True when the whole folder is loaded (the screen loads it in batches while you scroll). | |
| SortCriterion[] | serverSortCriteria () |
| The sort criteria that the loading of this folder asks the server for: the date when sorted by date and the server did not refuse it, else none. | |
| void | setAllItemsFetched (boolean allItemsFetched) |
| Context | getContext () |
| boolean | isLoading () |
| boolean | isLoadFailed () |
| void | setLoadFailed (boolean loadFailed) |
| void | setLoading (boolean loading) |
| int | getItemCount () |
| void | addAll (Collection<? extends DIDLObject > newObjects) |
| void | clear () |
| void | release () |
| Ends the sort thread and drops a running sort; to be called when the adapter is not used any more (the view of its fragment is destroyed). | |
| Object | getItem (int position) |
| List< DIDLObject > | getObjects () |
| Returns the currently-loaded children in their current, on-screen order – i.e. | |
| BrowseContentItemAdapter.ViewHolder | onCreateViewHolder (ViewGroup parent, int viewType) |
| void | onBindViewHolder (final BrowseContentItemAdapter.ViewHolder holder, final int listPosition) |
| void | cancelRunningTasks () |
| void | removeTask (AsyncTask task) |
| void | onViewRecycled (ViewHolder holder) |
| DIDLObject | getFolder (int position) |
| void | loadMore () |
| void | loadMore (Long itemsToLoad, Integer scrollToPositionId) |
| void | scrollToPositionId (Integer id) |
Adapter for browsing devices.
| List< DIDLObject > de.yaacc.browser.BrowseContentItemAdapter.getObjects | ( | ) |
Returns the currently-loaded children in their current, on-screen order – i.e.
already reflecting whatever client-side sort mode and direction is active (see sortObjects()). Used by ContentListFragment#playAllChildsOfParentFrom(DIDLObject) (issue play-all-ignores-sort-order) to build a playback queue that matches what the user sees and tapped, instead of re-fetching the folder from the server in its unsorted default order.
Returns a defensive snapshot copy (wrapped unmodifiable) rather than a live view over objects, because this method is also called from a background thread (see ContentListFragment#, invoked from
playAllChildsOfParentFromContentItemPlayTask) while
#doInBackgroundobjects is mutated in place from the main thread (addAll/clear/sortObjects, driven by setSortMode/toggleDirection/loadMore). A live Collections.unmodifiableList(objects) view does not protect against that: a concurrent mutation while the background thread iterates/filters the view can still throw a ConcurrentModificationException or yield a torn read.
null. Referenced by de.yaacc.browser.ContentListFragment.playAllChildsOfParentFrom().

| boolean de.yaacc.browser.BrowseContentItemAdapter.isDateAscending | ( | ) |
true for oldest-first (ascending), false for newest-first (descending). Referenced by de.yaacc.browser.BrowseContentItemAdapter.serverSortCriteria().

| boolean de.yaacc.browser.BrowseContentItemAdapter.isDateSortAvailable | ( | ) |
dc:date property, i.e. date sorting is meaningful for the current folder. | boolean de.yaacc.browser.BrowseContentItemAdapter.isLoadFailed | ( | ) |
| boolean de.yaacc.browser.BrowseContentItemAdapter.isLoading | ( | ) |
| boolean de.yaacc.browser.BrowseContentItemAdapter.isNameAscending | ( | ) |
true for A-Z (ascending), false for Z-A. | boolean de.yaacc.browser.BrowseContentItemAdapter.isServerSortRejected | ( | ) |
orderBy-bearing) Browse request (a UPnP action failure, per issue #252's post-ship bug fix) – reset in clear(). While true, BrowseItemLoadTask skips the doomed sorted attempt entirely for subsequent chunk requests of the same folder load. Referenced by de.yaacc.browser.BrowseContentItemAdapter.serverSortCriteria().

| void de.yaacc.browser.BrowseContentItemAdapter.markServerSortRejected | ( | ) |
Records that the server rejected a sorted Browse request for the current folder load, so later chunk requests skip straight to the unsorted request.
Reset on clear() (i.e. on folder change or sort mode change).
| void de.yaacc.browser.BrowseContentItemAdapter.release | ( | ) |
Ends the sort thread and drops a running sort; to be called when the adapter is not used any more (the view of its fragment is destroyed).
The adapter can be used again, the thread is created on demand.
| SortCriterion[] de.yaacc.browser.BrowseContentItemAdapter.serverSortCriteria | ( | ) |
The sort criteria that the loading of this folder asks the server for: the date when sorted by date and the server did not refuse it, else none.
What loads the rest of the folder must ask the same way, or its offsets do not fit the part already loaded.

| void de.yaacc.browser.BrowseContentItemAdapter.setSortMode | ( | SortMode | sortMode | ) |
Changes the current sort mode.
If the mode actually changes, the currently loaded items are cleared and reloaded so the new mode can take effect server-side (see BrowseItemLoadTask) as well as client-side (see sortObjects()).
| void de.yaacc.browser.BrowseContentItemAdapter.setViewMode | ( | ViewMode | mode | ) |
Changes which layout presents the currently-loaded items.
Unlike setSortMode(SortMode), this never clears/reloads – the backing data doesn't change, only how it's drawn, so a plain notifyDataSetChanged() is enough. No-op if mode already matches the current mode.
| void de.yaacc.browser.BrowseContentItemAdapter.toggleDirection | ( | ) |
Flips the currently-selected mode's own direction (Name: A-Z <-> Z-A; Date: newest-first <-> oldest-first), persists it, and reloads – same as setSortMode(SortMode).
The other (not-currently-selected) mode's direction is left untouched, per issue #252 Group 4.