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

Contextual menu for multi selecting episodes #5130

Merged

Conversation

peakvalleytech
Copy link
Contributor

Here is a working build I did implementing your mockup: https://drive.google.com/file/d/1A0fMp7SemlpHHltod-x0MQsDRn9TZDwg/view

I'm not close to done, but I wanted to get your feedback on it before I proceed further.

What I added:

@ByteHamster
Copy link
Member

Oh, I thought you would do the subscriptions screen, not the episodes screen :) I have not tried it yet but I skimmed the code. Some thoughts:

  • I think it would be good to still show the context menu on long press. Only when clicking a new "select" entry there (or, alternatively, when clicking it in the 3-dot-menu), then enter the ActionMode. Reason is that it would otherwise make the more common action (changing a single episode) need a lot more clicks.
  • When having the ActionMode, I don't think we need the FAB anymore. The actions can directly be added to the ActionMode.

@peakvalleytech
Copy link
Contributor Author

idk, it seems odd to have it has an option in the context menu. How about adding a 3-dot like button next to the play button. That is very common UI pattern. With this approach, we will be implementing 2 common patterns versus 1. It seems like a very good choice to me.

Regarding the FAB. I think with our current design we should keep it. Current users are already familiar with it. And, it is better than having it at the top where users need to reach for it.

If we're deciding whether to add a FAB, I would have been against it, as like you said, it is unnecessary with the action mode. But having an already implemented FAB. Why get rid of the work just to regress to a poorer UX?

I vote to keep it.

@ByteHamster
Copy link
Member

How about adding a 3-dot like button next to the play button.

I think this will clutter the screen too much. Please use the long-press menu for now. Changing that later would be pretty easy, so I would rather go with as few muscle-memory breaking changes for now.

Regarding the FAB. I think with our current design we should keep it. Current users are already familiar with it. And, it is better than having it at the top where users need to reach for it.

Okay 👍 I think it will be slightly harder to implement than the ActionMode but I agree :)

@peakvalleytech
Copy link
Contributor Author

After thinking it over, I agree that having it in the context menu wouldn't be such a bad idea. So let's do that.

Thanks, it actually isn't too hard. I've already implemented it, and works it works nicely.

@peakvalleytech
Copy link
Contributor Author

@ByteHamster i am ready for you to review my latest commit. The multi-select is not working on FeedItemListFragment. If you approve of it, I will proceed with migrating the rest of the views that use episode multi-select.
To reduce code, I suggest that all fragments that use episode multi-select should have common base classes containing the multi-select logic. Is that ok with you?

@ByteHamster
Copy link
Member

To reduce code, I suggest that all fragments that use episode multi-select should have common base classes containing the multi-select logic. Is that ok with you?

This makes it harder to modularize and test the code. I think it would be better to do it the other way around: Extract the common parts (like ActionBinding) to their own classes. Then these things can be included in all classes that need them. They can then also be tested independently of the UI.

app/src/main/res/menu/episodes.xml Outdated Show resolved Hide resolved
@@ -9,17 +9,17 @@
app:showAsAction="always">
<menu>
<item android:id="@+id/sort_title_a_z"
android:title="@string/sort_title_a_z"/>
android:title="@string/sort_title_a_z"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't reformat the file, unless you really need to change it. We don't have clear guidelines for xml formatting currently, so it should just be kept as it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still unrelated changes here :)

core/src/main/res/values/attrs.xml Outdated Show resolved Hide resolved
@peakvalleytech
Copy link
Contributor Author

I'll take a look at the comments soon. Thanks for the reply.

@keunes
Copy link
Member

keunes commented Apr 27, 2021

I'm downloading a bunch of 'debug' artifects to try out - let me know when I can/should do that for this PR. Eager to try it out :)

@peakvalleytech
Copy link
Contributor Author

I'm downloading a bunch of 'debug' artifects to try out - let me know when I can/should do that for this PR. Eager to try it out :)

I should have something ready soon.

@peakvalleytech
Copy link
Contributor Author

Hey @ByteHamster,
I just pushed a new commit. Still waiting for your response. Hope all is well.

@ByteHamster
Copy link
Member

Still waiting for your response. Hope all is well.

Sorry, I can't check AntennaPod every day (it's done in my free time). Could you please clean up some of the code here? It contains a lot of commented code and changes to unrelated files. That would make it a lot easier to review.

I just played around with it. It does feel pretty nice. There seems to be a problem though, where wrong episodes can get changed. Also, pressing the "Select all" button twice brings everything into a broken state that always affects all episodes, regardless of what you select.

Other issues I found:

  • The ActionBar icons are in fact wrong in the light theme (there is already a comment about this above)
  • The items no longer have a Ripple effect when they are normally pressed. I think selection would be easier to handle using a state-list-drawable
  • The selected color is a bit too strong, in my opinion. Maybe @keunes has an idea for what color to use instead of the accent blue.
  • When pressing the back button, the ActionMode closes but the FAB stays

@peakvalleytech
Copy link
Contributor Author

Sorry, I can't check AntennaPod every day (it's done in my free time). Could you please clean up some of the code here? It contains a lot of commented code and changes to unrelated files. That would make it a lot easier to review.

Ok that is fine. I'll go and send a new commit soon.

@keunes
Copy link
Member

keunes commented May 6, 2021

I'll have a look at the colour later (probably over the weekend)

@peakvalleytech
Copy link
Contributor Author

I'll have a look at the colour later (probably over the weekend)

@keunes have you had the chance to look at this PR yet?

@ByteHamster
Copy link
Member

I was thinking maybe we could use the action button to indicate selection state. When an episode is not selected, just keep it empty. When an episode is selected, display a check mark (blue copy of the drawable). Then we don't have problems with the contrast when setting a backgroubd. Also, the action button still showing "download" could be confusing otherwise.

@peakvalleytech
Copy link
Contributor Author

I was thinking maybe we could use the action button to indicate selection state. When an episode is not selected, just keep it empty. When an episode is selected, display a check mark (blue copy of the drawable). Then we don't have problems with the contrast when setting a backgroubd. Also, the action button still showing "download" could be confusing otherwise.

Yeah that will work nicely. So should I proceed with porting it to the other screens (Queue, Downloads, ... etc.)? Let me know if you need any more changes, especially related to the architecture.

@peakvalleytech
Copy link
Contributor Author

@ByteHamster Actually, after looking at the code, I don't think the actionbutton can be changed easilty. I suggest hiding it while in multi select mode.

I think we can make it work if we change the color. Maybe to a light gray for light theme and dark gray for dark theme.

That is how it is usally done by other apps. It will be better UX.

If you want to still do the checkmark approach. I can add a checkmark view to the EpisodeItemViewHolder. Would that be ok with you?

@ByteHamster
Copy link
Member

I just removed 2 of the 3 lists that store which episodes are selected and also did a bit of cleanup. I think I am happy with the code structure now. Please have another look again to see if I overlooked something.

Copy link
Contributor Author

@peakvalleytech peakvalleytech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed 2 of the 3 lists that store which episodes are selected and also did a bit of cleanup. I think I am happy with the code structure now. Please have another look again to see if I overlooked something.

@ByteHamster I looked at the code a bit, but haven't tested it. I didn't code it like that on a whim. This was the result of a lot of manual testing. Let's hope you didn't break anything. :) After I test it, i'll give you an update.

android:id="@+id/selectCheckBox"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it.

@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/episode_actions"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the name was amibiguous too. It was from the original author. Just wasn't sure if you would approve of the rename. I'll rename it as per suggestion.

android:visibility="gone"
app:sdMainFabClosedSrc="@drawable/ic_fab_edit"
app:sdOverlayLayout="@id/fabSDOverlay" />
</ScrollView>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

@peakvalleytech
Copy link
Contributor Author

peakvalleytech commented Jun 19, 2021

@ByteHamster Ok, i've reviewed your changes. And I am also happy with the code structure.

Just added one last commit to remove the previous multi-select option.

Now that we have implemented it for FeedItemListFragment. We just need to implement it for the rest of the screens that need episode multi select.

I believe those are (at least those that currently have multi-select)
CompletedDownloadsFragment
QueueFragment

Should we merge and close this PR or wait till we have it implemented for the rest of the screens?
I think we should merge this and open a new PR for better organization.

@ByteHamster
Copy link
Member

I think we should merge this and open a new PR for better organization.

Yeah

I just noticed a little problem before merging this. All screens (eg playback history) now show the multi-select context menu item, even if they don't support multi select.

@peakvalleytech
Copy link
Contributor Author

peakvalleytech commented Jun 20, 2021

I think we should merge this and open a new PR for better organization.

Yeah

Ok, once we get this merged we can start work on implementing it for the other fragments.
These are QeueFragment and CompletedDownloadsFragment, right?

I just noticed a little problem before merging this. All screens (eg playback history) now show the multi-select context menu item, even if they don't support multi select.

I'll fix this today.

@ByteHamster
Copy link
Member

Your most recent commit breaks long-pressing in select mode (for "select all above")

@ByteHamster ByteHamster merged commit 323f1f6 into AntennaPod:develop Jun 29, 2021
@ByteHamster
Copy link
Member

Thanks :)

@peakvalleytech
Copy link
Contributor Author

Thanks :)

My pleasure. Now to start on migrating the other screens to use this multi select. Any suggestions on how this should be done?

The two other screens that use multi select are the QeueFragment and thd CompletedDownloadsFragment. I know the UI is about to under go major changes so I want to avoid doing work that will end up being thrown away anyway. The only screen I know for certain will not be changed is the Queue. Should i start with that?

@peakvalleytech peakvalleytech deleted the contextual-multi-episode-select branch August 21, 2021 00:17
@antennapod-bot
Copy link

This pull request has been mentioned on AntennaPod Forum. There might be relevant details there:

https://forum.antennapod.org/t/antennapod-2-4-release-notes/1300/1

@antennapod-bot
Copy link

This pull request has been mentioned on AntennaPod Forum. There might be relevant details there:

https://forum.antennapod.org/t/antennapod-2-4-release-notes/1300/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants