Skip to content

Commit

Permalink
fix: Remove sticky headers from Attendees fragment (#1636)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShridharGoel authored and iamareebjamal committed May 8, 2019
1 parent 6329349 commit 1bd8dc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
import com.eventyay.organizer.utils.SearchUtils;
import com.mikepenz.fastadapter.FastAdapter;
import com.mikepenz.fastadapter.adapters.ItemAdapter;
import com.timehop.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import javax.inject.Inject;
Expand Down Expand Up @@ -67,7 +66,6 @@ public class AttendeesFragment extends BaseFragment<AttendeesPresenter> implemen
private static final int SORTBYNAME = 0;

private FastAdapter<Attendee> fastAdapter;
private StickyHeaderAdapter<Attendee> stickyHeaderAdapter;

private final ScanningDecider scanningDecider = new ScanningDecider();

Expand Down Expand Up @@ -151,7 +149,6 @@ private void sortAttendees(int sortBy) {
fastItemAdapter.withComparator((Attendee a1, Attendee a2) -> a1.getFirstname().compareTo(a2.getFirstname()), true);
}
fastItemAdapter.setNewList(getPresenter().getAttendees());
stickyHeaderAdapter.setSortByName(sortBy == SORTBYTICKET);
binding.setVariable(BR.attendees, getPresenter().getAttendees());
binding.executePendingBindings();
}
Expand Down Expand Up @@ -188,7 +185,6 @@ protected int getTitle() {
public void onStop() {
super.onStop();
refreshLayout.setOnRefreshListener(null);
//stickyHeaderAdapter.unregisterAdapterDataObserver(adapterDataObserver);
if (searchView != null)
searchView.setOnQueryTextListener(null);
}
Expand Down Expand Up @@ -235,9 +231,7 @@ private void setupRecyclerView() {
}
);

stickyHeaderAdapter = new StickyHeaderAdapter<>();
stickyHeaderAdapter.setSortByName(false);
fastAdapter = FastAdapter.with(Arrays.asList(fastItemAdapter, stickyHeaderAdapter));
fastAdapter = FastAdapter.with(Collections.singletonList(fastItemAdapter));
fastAdapter.setHasStableIds(true);
fastAdapter.withEventHook(new AttendeeItemCheckInEvent(this));

Expand Down Expand Up @@ -268,13 +262,10 @@ public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(swipeController);
itemTouchHelper.attachToRecyclerView(recyclerView);

final StickyRecyclerHeadersDecoration decoration = new StickyRecyclerHeadersDecoration(stickyHeaderAdapter);
recyclerView.addItemDecoration(decoration);
observer = new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
decoration.invalidateHeaders();
}
};
fastAdapter.registerAdapterDataObserver(observer);
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions app/src/main/res/layout/attendee_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
android:gravity="center"
android:orientation="horizontal"
android:foreground="?selectableItemBackground"
android:layout_margin="@dimen/spacing_extra_small"
style="@style/ItemPadding">

<LinearLayout
Expand Down

0 comments on commit 1bd8dc9

Please sign in to comment.