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

Update RecyclerView & Groupie libraries #7261

Merged
merged 1 commit into from
Oct 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ ext {
icepickVersion = '3.2.0'
exoPlayerVersion = '2.12.3'
googleAutoServiceVersion = '1.0'
groupieVersion = '2.9.0'
groupieVersion = '2.10.0'
markwonVersion = '4.6.2'

leakCanaryVersion = '2.5'
Expand Down Expand Up @@ -211,11 +211,14 @@ dependencies {
implementation 'androidx.media:media:1.4.2'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
implementation "androidx.room:room-rxjava3:${androidxRoomVersion}"
kapt "androidx.room:room-compiler:${androidxRoomVersion}"
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// Newer version specified to prevent accessibility regressions with RecyclerView, see:
// https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
litetex marked this conversation as resolved.
Show resolved Hide resolved
implementation 'androidx.webkit:webkit:1.4.0'
implementation 'com.google.android.material:material:1.2.1'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private int getFocusedPosition() {
final View focusedItem = itemsList.getFocusedChild();
final RecyclerView.ViewHolder itemHolder =
itemsList.findContainingViewHolder(focusedItem);
return itemHolder.getAdapterPosition();
return itemHolder.getBindingAdapterPosition();
} catch (final NullPointerException e) {
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ public void handleError() {
//////////////////////////////////////////////////////////////////////////*/

public int getSuggestionMovementFlags(@NonNull final RecyclerView.ViewHolder viewHolder) {
final int position = viewHolder.getAdapterPosition();
final int position = viewHolder.getBindingAdapterPosition();
if (position == RecyclerView.NO_POSITION) {
return 0;
}
Expand All @@ -1099,7 +1099,7 @@ public int getSuggestionMovementFlags(@NonNull final RecyclerView.ViewHolder vie
}

public void onSuggestionItemSwiped(@NonNull final RecyclerView.ViewHolder viewHolder) {
final int position = viewHolder.getAdapterPosition();
final int position = viewHolder.getBindingAdapterPosition();
final String query = suggestionListAdapter.getItem(position).query;
final Disposable onDelete = historyRecordManager.deleteSearchHistory(query)
.observeOn(AndroidSchedulers.mainThread())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,8 @@ public boolean onMove(@NonNull final RecyclerView recyclerView,
return false;
}

final int sourceIndex = source.getAdapterPosition();
final int targetIndex = target.getAdapterPosition();
final int sourceIndex = source.getBindingAdapterPosition();
final int targetIndex = target.getBindingAdapterPosition();
final boolean isSwapped = itemListAdapter.swapItems(sourceIndex, targetIndex);
if (isSwapped) {
saveChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class FeedGroupReorderDialog : DialogFragment() {
source: RecyclerView.ViewHolder,
target: RecyclerView.ViewHolder
): Boolean {
val sourceIndex = source.adapterPosition
val targetIndex = target.adapterPosition
val sourceIndex = source.bindingAdapterPosition
val targetIndex = target.bindingAdapterPosition

groupAdapter.notifyItemMoved(sourceIndex, targetIndex)
Collections.swap(groupOrderedIdList, sourceIndex, targetIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public boolean isItemViewSwipeEnabled() {

@Override
public void onSwiped(final RecyclerView.ViewHolder viewHolder, final int swipeDir) {
onSwiped(viewHolder.getAdapterPosition());
onSwiped(viewHolder.getBindingAdapterPosition());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ public boolean onMove(@NonNull final RecyclerView recyclerView,
return false;
}

final int sourceIndex = source.getAdapterPosition();
final int targetIndex = target.getAdapterPosition();
final int sourceIndex = source.getBindingAdapterPosition();
final int targetIndex = target.getBindingAdapterPosition();
instanceListAdapter.swapItems(sourceIndex, targetIndex);
return true;
}
Expand All @@ -322,7 +322,7 @@ public boolean isItemViewSwipeEnabled() {
@Override
public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder,
final int swipeDir) {
final int position = viewHolder.getAdapterPosition();
final int position = viewHolder.getBindingAdapterPosition();
// do not allow swiping the selected instance
if (instanceList.get(position).getUrl().equals(selectedInstance.getUrl())) {
instanceListAdapter.notifyItemChanged(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ public boolean onMove(@NonNull final RecyclerView recyclerView,
return false;
}

final int sourceIndex = source.getAdapterPosition();
final int targetIndex = target.getAdapterPosition();
final int sourceIndex = source.getBindingAdapterPosition();
final int targetIndex = target.getBindingAdapterPosition();
selectedTabsAdapter.swapItems(sourceIndex, targetIndex);
return true;
}
Expand All @@ -318,7 +318,7 @@ public boolean isItemViewSwipeEnabled() {
@Override
public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder,
final int swipeDir) {
final int position = viewHolder.getAdapterPosition();
final int position = viewHolder.getBindingAdapterPosition();
tabList.remove(position);
selectedTabsAdapter.notifyItemRemoved(position);

Expand Down