-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Recycler view for Episodes Fragment #1336
Conversation
|
||
private final Context context; | ||
private final ItemAccess itemAccess; | ||
private final ActionButtonCallback actionButtonCallback; | ||
private final ActionButtonUtils actionButtonUtils; | ||
private final boolean showOnlyNewEpisodes; | ||
private final MainActivity mainActivity; |
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.
Should not really cause an activity leak (as long as we set the adapter in the activity to null), but I could sleep better if this was a WeakReference
Just had an idea to get rid of the stupid AllEpisodesFragment constructor warning. We simply change the attributes to methods.
|
progLoading = (ProgressBar) root.findViewById(R.id.progLoading); | ||
listView = (RecyclerView) root.findViewById(android.R.id.list); | ||
layoutManager = new LinearLayoutManager(getActivity()); | ||
listView.setLayoutManager(layoutManager); |
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.
listView.setHasFixedSize(true);
listView → recyclerView?
Also, you can take https://github.com/mfietz/AntennaPod/blob/recyclerview/app/src/main/java/de/danoeh/antennapod/view/DividerItemDecoration.java and
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), null);
listView.addItemDecoration(itemDecoration);
Fresh develop installation, one feed subscribed, short playing around in episodes, upgrade to this PR:
|
editor.putInt(PREF_KEY_LIST_SELECTION, 0); | ||
editor.putInt(PREF_KEY_LIST_TOP, 0); | ||
editor.putInt(PREF_SCROLL_POSITION, 0); | ||
editor.putInt(PREF_SCROLL_OFFSET, 0); |
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.
editor.putFloat(PREF_SCROLL_OFFSET, 0.0f);
Snackbar snackbar = Snackbar.make(root, getString(R.string.removed_item), | ||
Snackbar.LENGTH_LONG); | ||
snackbar.setAction(getString(R.string.undo), v -> { | ||
DBWriter.addFavoriteItem(item); |
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.
Unfortunately this doesn't put it back in the same position it was in before, that may be confusing.
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 is probably the solution, however we'd have to update our supportlib use to 23 to get it: http://stackoverflow.com/a/32190462/6839
(though someone else suggests a hack/workaround to use in the meantime). That could be promising. It would also get rid of the runnable business we have to do for NewEpisodesFragment.
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.
hm, couldn't we just create an Pair<FeedItem,Integer> that also holds the position and submit that to snackbar for undo?
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.
We're not really tracking position in favorites at this point. It mostly reflects the order you added things. Not sure I want to worry about order just to resolve this issue.
Another solution, which might make more sense anyways, is to sort the items in Favorites. We could use the date the item was published or just sort alphabetically by title.
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 you want to get started on this (and you think it's minimally acceptable) you could merge now while we work on this solution in another issue/PR.
After discussion with @mfietz we're going to get this in to 1.4 since DSLV is causing crashes for people. |
Recycler view for Episodes Fragment
This swaps our use of DSLV for recycler view in the Episodes Fragment.
We SHOULD NOT merge this in for 1.4. Instead this will be targeted for the next version where we can build on in for RecyclerView in the Queue.
I've integrated the use of SnackBar as demonstrated by @mfietz. Ideally we'd do something more like this: https://github.com/hudomju/android-swipe-to-dismiss-undo, but we'd need it to be compatible with api 10.