-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Show comment replies #7244
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
Show comment replies #7244
Conversation
AudricV
left a comment
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 review is from a quick look at your changes. I will not review your PR.
9c8b01f to
ead685e
Compare
|
How do you load more reply pages? If I understand the code correctly, the current implementation only shows the first one. |
Co-authored-by: Mohammed Anas <[email protected]>
I figured out how to avoid the |
5795138 to
a6f68fc
Compare
|
I have the core functionality up and running |
|
Can't wait to see this in app! |
|
@BratishkaErik if you have nothing to add to the discussion, please just react with a thumbs up to the PR. |
|
Is there anything that reviewers/maintainers want from me/this pull request in order to get merged? I don't have a free time until next weekend to work on anything, but if there is anything to help this PR, it would be appreciated to know. |
|
@golfinq We just need a team dev to get enough free time to review this PR. |
Stypox
left a comment
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.
As I explain in the comments the structure needs some work, but it's nothing too difficult after all. Thank you for the PR :-)
| android:textAppearance="@style/TextAppearance.AppCompat.Small" | ||
| android:textSize="@dimen/video_item_search_upload_date_text_size" /> | ||
|
|
||
| <androidx.recyclerview.widget.RecyclerView |
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 I understood correctly TeamNewPipe/NewPipeExtractor#703, a reply-comment could have replies itself, but this PR introduces support only for 1 level of reply depth. This would work fine for YouTube, but it would be problematic for other services, so the replyRecyclerView should be added dynamically. Doing this might not be best practice, since the layouts recycled in recycler views should not be built dynamically, but since the amount of comments we expect users to open is much smaller than the total number of comments, I don't think creating a few more views every time an expanded comment is shown would hurt performance whatsoever. Note: if you do this remember to cleanup the recycler view previously created, if there is one, before creating a new one.
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.
I was hoping that by reusing the 'InfoListAdapter` the comment views which were created would automatically have the reply handling code inside of it. How are the comment views which are being created here different than the ones which are created in the main comment holding view?
| if (item.getReplies() == null) { | ||
| repliesView.setVisibility(View.GONE); | ||
| showReplies.setVisibility(View.GONE); | ||
| } else if (item.getRepliesOpen()) { |
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.
As I said in the extractor, this method should be removed from there and implemented here in the frontend. The usual approach would be to create an item to use in the RecyclerView that wraps around CommentsInfoItem but also has a field isExpanded. This option is not viable, though, since in NewPipe lists use a common pattern to load, reload, etc., so changing the type of data fed to the recycler view without changing the type of data returned by the extractor is not doable without huge code changes (and we don't want those). A solution that would also be suitable for the multiple-depth replies implementation (see my other comment), would be to just keep a static Set<CommentsInfoItem> somewhere storing a common list of expanded CommentsInfoItems (common meaning that it will be accessed by all (even nested) RecyclerViews' CommentsInfoItem.updateFromItem()) . When the user expands a comment view the related CommentsInfoItem should be added to the Set, when the user unexpands the same comment it should be removed and when the RecyclerView tries to load a comment using CommentsInfoItemHolder.updateFromItem(item) it is expanded based on whether item belongs to the set.
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.
@litetex do you have any idea whether this can be achieved in a better way, without storing any separate data in RecyclerViews (since that data would be lost when the comment view is recycled)?
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.
@Stypox At first: Welcome back.
Whoa that's a lot of info.
do you have any idea whethe ...
No I don't - currently.
I think I would have to look at this in more detail to get an answer to that, however some ideas from my side to make nested commets working:
- ViewModel which holds the data?
- Write a custom Custom component for this?
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.
@golfinq ping ;-)
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.
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.
as it currently stands this code can't handle recursive levels of replies
This is what I could guess by looking at the code, but I might be wrong since I couldn't test. But the problem is also the fact that you shouldn't store data about whether the replies menu is open or not in an object coming from the extractor. The extractor shouldn't have anything to do with the UI.
|
|
||
| import android.view.View; | ||
| import android.view.ViewGroup; | ||
| import android.widget.ImageView; |
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.
Is there a particular reason you added this code in CommentsInfoItemHolder and not CommentsMiniInfoItemHolder like all other comments code?
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.
It was probably left over from something else I was trying to do, should be straight forward to move it to where it is used
|
Oh, btw @golfinq, could you fix the build so that I can take a look at the apk? I think you forgot to update the extractor commit |
| addRepliesToUI(parentInfoItem); | ||
| } | ||
|
|
||
| @SuppressLint("SetTextI18n") |
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.
There is a reason why Android Studio gives you this warning: you shouldn't hardcode strings, put them in the strings.xml resource file instead.
| if (item.getReplies() == null) { | ||
| repliesView.setVisibility(View.GONE); | ||
| showReplies.setVisibility(View.GONE); | ||
| } else if (item.getRepliesOpen()) { |
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.
as it currently stands this code can't handle recursive levels of replies
This is what I could guess by looking at the code, but I might be wrong since I couldn't test. But the problem is also the fact that you shouldn't store data about whether the replies menu is open or not in an object coming from the extractor. The extractor shouldn't have anything to do with the UI.
|
I don't really have time at the moment to work on this, so I am going to convert it to a draft until I can properly work on everyone's suggestions. |
|
Honestly, I am not sure. This will require time I don't currently have IRL.
I would also have to re-familiarize myself with java and the code to get
back up to speed, which is a non-trivial task.
…On Wed, Mar 2, 2022 at 6:56 PM Prince Cooper ***@***.***> wrote:
Undraft when 😂
—
Reply to this email directly, view it on GitHub
<#7244 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOMH7IJVAR4E6YKBONG7JP3U575ZLANCNFSM5F6ZLSGA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@golfinq Then closing this PR for now. You can reopen it if/when you resume working on it. |
|
I'm willing to work on this. Does Newpipe have a way for forks to build APKs with your CI service or does the build have to be local? What are the things that need to be fixed? |
|
You don't have to do anything to get the CI to build APKs for you; pushing a branch to your fork should be sufficient. |
|
So, I just push, and it builds? Cool. So, what are the problems? |
|
I'm not too sure myself, but reading the comments and reviews here should give you an idea. |
|
I'm going to start out with a rebase, just to get myself situated. |
|
Will the actions be counted towards my limit or the team's limit? |
|
I believe there's no limit on public repositories. |
|
I had to manually run it, it doesn't work on push. |
|
Hmm, actually, I think it runs automatically only on push to a pull request branch or to |
|
Oh, ok. I'm getting some style errors, so I'm trying to fix that. |
|
I somehow got |
|
Oh, I messed up the rebase. |
|
I'll open up a new PR. |
|
I just need approval to start running CI tests. |
|
@golfinq can this pull request be resurrected? Or are you still too busy? |
|
There was some good work done on cleaning it up, but it really really needs someone who is familiar with the newpipe infrastructure (or someone who is willing to dig through it and learn how) to find out how to extract and implement the extraction for the 2nd page of replies. There was discussuon that the ui should be changed to a page which pulls up from the bottom which I like a lot more but I wouldnt know how to implement. As it stands the core stuff in this PR is okay, but async/java stuff isnt my strength right now and the people who would know the core code stuff are difficult to get responses from. I've kinda moved on from this and while I still do use newpipe; its kind of a mess to dig through the source code and figure out "okay to do this I use this class and then input this into this and need to call all of these functions and this data goes here and can be accessed with this class". If I was to work on this again I would want through documentation of everything, which is a lot of work. Dont blame NewPipe devs though as supporting youtube and everything else makes it very very difficult to do what NewPipe does and that requires complicated code. |
|
I appreciate the update on the current situation, thank you! There are some people at #2277 who might be able to finish what was started here. |
|
I am glad to see people still trying to implement this! It's why my NewPipe Repo will never be deleted - as I think this PR was the furthest anyone got. Just to add on my previous post: If anyone reading this has any android dev knowledge (or is willing to learn it) please write some API documentation for NewPipe. Even if you are a complete beginner, if you can read code and are willing to follow the "open source" trail for something in android studio - you can write documentation. Even basic, but organized, documentation help people become developers which means more active development overall. |
What is it?
Description of the changes in your PR
Adds a "Show Replies" for the comments with replies for Youtube; when clicked, the first page of replies is displayed below the comment.
Before/After Screenshots/Screen Record
(Ignore the different themes)
Before Clicking:

After Clicking:

Fixes the following issue(s)
Relies on the following changes
Due diligence