Fix recycleview article positions #163

Merged
AmineB merged 2 commits from davidoskky/ReaderForSelfoss-multiplatform:incorrectArticles into master 2024-11-20 08:31:34 +00:00
Contributor

The articles were being opened by setting a click listener on the binding.
In card view this was being done through a function and as such it used the overall viewbind of the recyclerview rather than the binding of the item viewholder. I'm not really sure as to why it previously worked and then stopped doing so.
Now the functions are more explicit to avoid future errors.
Pulled up a few members from ItemCardAdapter and ItemListAdapter to ItemAdapter.

Types of changes

  • [ x ] I have read the CONTRIBUTING document.
  • [ x ] My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • [ x ] All new and existing tests passed.
  • [ x ] This is NOT translation related.

This closes issue #162

The articles were being opened by setting a click listener on the binding. In card view this was being done through a function and as such it used the overall viewbind of the recyclerview rather than the binding of the item viewholder. I'm not really sure as to why it previously worked and then stopped doing so. Now the functions are more explicit to avoid future errors. Pulled up a few members from ItemCardAdapter and ItemListAdapter to ItemAdapter. ## Types of changes - [ x ] I have read the **CONTRIBUTING** document. - [ x ] My code follows the code style of this project. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ x ] All new and existing tests passed. - [ x ] This is **NOT** translation related. This closes issue #162
davidoskky added 1 commit 2024-11-19 01:00:04 +00:00
The articles were being opened by setting a click listener on the binding.
In card view this was being done through a function and as such it used the overall viewbind of the view rather than the binding of the item viewholder.
Now the functions are more explicit to avoid future errors.
Pulled up a few members from ItemCardAdapter and ItemListAdapter to ItemAdapter.
AmineB requested changes 2024-11-19 19:46:44 +00:00
Dismissed
@ -663,4 +659,0 @@
private fun updateItems(adapterItems: ArrayList<SelfossModel.Item>) {
items = adapterItems
}
Owner

This was needed so the HomeActivity have an updated items array. This should be added back here and in the adapters.

This was needed so the `HomeActivity` have an updated `items` array. This should be added back here and in the adapters.
@ -100,2 +84,2 @@
handleClickListeners(holder.bindingAdapterPosition)
handleLinkOpening(holder.bindingAdapterPosition)
handleClickListeners(binding, position)
openLink(binding, position)
Owner

openLink function does not open the link. It should be renamed. I think that handleLinkOpening was pretty clear.

`openLink` function does not open the link. It should be renamed. I think that `handleLinkOpening` was pretty clear.
AmineB marked this conversation as resolved
@ -72,1 +78,4 @@
protected fun openLink(holderBinding: ViewBinding, position: Int) {
holderBinding.root.setOnClickListener {
Log.d(
Owner

This log is not needed anymore

This log is not needed anymore
AmineB marked this conversation as resolved
davidoskky added 1 commit 2024-11-20 00:32:28 +00:00
Removed in the previous commit, the item adapter accepts a method to update the articles list in the home page.
Renamed the method to make its objective more clear.
Removed a debugging log.
Reverted change to function name.
Author
Contributor

Sorry, I pushed a bit too quickly. I’ve reverted the changes and renamed updateItems in the adapter to updateHomeItems to make its purpose clearer.

Sorry, I pushed a bit too quickly. I’ve reverted the changes and renamed `updateItems` in the adapter to `updateHomeItems` to make its purpose clearer.
AmineB approved these changes 2024-11-20 08:31:26 +00:00
AmineB merged commit 62f58fbc00 into master 2024-11-20 08:31:34 +00:00
Owner

Thanks !

Thanks !
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Louvorg/ReaderForSelfoss-multiplatform#163
No description provided.