Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Cleanup BaseRvAdapter #84

Merged
merged 8 commits into from
Apr 10, 2022
Merged

Cleanup BaseRvAdapter #84

merged 8 commits into from
Apr 10, 2022

Conversation

Goooler
Copy link
Owner

@Goooler Goooler commented Apr 10, 2022

To be more idiomatic in Kotlin.

@Goooler Goooler added this to the 1.6.0 milestone Apr 10, 2022
@@ -60,7 +55,7 @@ abstract class BaseRvDiffAdapter<M : IDiffVhModelType> :

@LayoutRes
override fun getItemViewType(@IntRange(from = 0) position: Int): Int =
getItem(position)?.viewType ?: 0
getItem(position).viewType
Copy link
Owner Author

Choose a reason for hiding this comment

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

    protected T getItem(int position) {
        return mDiffer.getCurrentList().get(position);
    }
    @NonNull
    public List<T> getCurrentList() {
        return mReadOnlyList;
    }

@@ -51,4 +49,35 @@ interface IRvAdapter<M : IVhModelType> {
* Get item by position.
*/
fun getModel(@IntRange(from = 0) position: Int): M?

operator fun get(@IntRange(from = 0) position: Int): M?
Copy link
Owner Author

Choose a reason for hiding this comment

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

@Goooler Goooler merged commit eaeb043 into trunk Apr 10, 2022
@Goooler Goooler deleted the adapter branch April 10, 2022 09:54
Goooler added a commit that referenced this pull request Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant