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

Added empty views to the PlayBack History, Queue,and Downloads #3060

Merged
merged 7 commits into from Apr 3, 2019

Conversation

@jatinkumarg
Copy link
Contributor

commented Mar 21, 2019

Added empty views to the PlayBack History, Queue, and Downloads

Closes #3052

@iadeelzafar

This comment has been minimized.

Copy link

commented Mar 21, 2019

Add gifs/screenshots please.

Copy link

left a comment

You can create a single empty view in the xml and then just update the text using the java files.

@jatinkumarg

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

Add gifs/screenshots please.

@jatinkumarg

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

You can create a single empty view in the xml and then just update the text using the java files.

Nice idea!

@ByteHamster

This comment has been minimized.

Copy link
Member

commented Mar 23, 2019

Thanks for working on the empty views.

You can create a single empty view in the xml and then just update the text using the java files.

I like that idea, too. Maybe you can then create a method for loading the empty views in a new class like de.danoeh.antennapod.view.EmptyViewHandler or even create a full object that you can use like the following:

EmptyViewHandler emptyView = new EmptyViewHandler(this);
emptyView.setTitle(R.string.xy);
emptyView.setMessage(R.string.xy);
emptyView.attachTo(getListView());
@jatinkumarg

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2019

Screenshots of Playback History, Queue and Downloads are same as before #3060 (comment).

New screenshots (Episodes):

@iadeelzafar

This comment has been minimized.

Copy link

commented Mar 27, 2019

Good job!

core/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
core/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
core/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
@@ -17,6 +17,41 @@
tools:itemCount="13"
tools:listitem="@layout/new_episodes_listitem" />

<LinearLayout

This comment has been minimized.

Copy link
@ByteHamster

ByteHamster Mar 29, 2019

Member

Why do those fragments need a copy of the empty view while all others can include the xml file? I don't like code duplication ;) If we want to change the style of the empty views, we have to change multiple locations.

This comment has been minimized.

Copy link
@jatinkumarg

jatinkumarg Mar 29, 2019

Author Contributor

@ByteHamster Do you want EmptyViewHandler class to handle empty views in episode fragments?

This comment has been minimized.

Copy link
@ByteHamster

ByteHamster Mar 29, 2019

Member

If that is possible, it would be great if it could be used everywhere.

This comment has been minimized.

Copy link
@jatinkumarg

jatinkumarg Mar 29, 2019

Author Contributor

So I did some research and I found RecyclerView doesn't support setEmptyView method and due to which we won't be able to add the empty view as we did for ListView in EmptyViewHandler class. Since ListView supports setEmptyView we were easily able to add empty view (layout from xml) to it.

This comment has been minimized.

Copy link
@ByteHamster

ByteHamster Mar 30, 2019

Member

I think you can use RecyclerView.getAdapter().registerAdapterDataObserver(). Then add another attachTo method that can attach to RecyclerView. If you inflate the view in the EmptyViewHandler constructor, the setMessage function can directly operate on the TextView and can therefore be called even after attach was already called.

This comment has been minimized.

Copy link
@jatinkumarg

jatinkumarg Mar 31, 2019

Author Contributor

I tried the way you recommened but it didn't worked for me. Can you try it?

This comment has been minimized.

Copy link
@ByteHamster

ByteHamster Apr 1, 2019

Member

I also did not manage to make it work properly :( Could you please do just one more thing? Include the layout with <include layout="@layout/empty_view_layout"/> instead of copying it to episodes and queue.

Copy link
Member

left a comment

I just tried your PR - looks awesome on a real device. Would be great if you could make it work directly with RecyclerViews but if you don't want to do that, feel free to tell me - then I will try to do it.

app/src/main/res/layout/all_episodes_fragment.xml Outdated Show resolved Hide resolved
@ByteHamster ByteHamster merged commit b6e50c6 into AntennaPod:develop Apr 3, 2019
1 check passed
1 check passed
ci/circleci Your tests passed on CircleCI!
Details
@ByteHamster

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.