mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Finalize wallpaper UX.
Co-authored-by: Greyson Parrelli <greyson@signal.org> Co-authored-by: Alan Evans <alan@signal.org>
This commit is contained in:
committed by
Greyson Parrelli
parent
a8ad1e718e
commit
c244a98962
@@ -30,15 +30,17 @@ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration {
|
||||
private final StickyHeaderAdapter adapter;
|
||||
private final boolean renderInline;
|
||||
private final boolean sticky;
|
||||
private final int type;
|
||||
|
||||
/**
|
||||
* @param adapter the sticky header adapter to use
|
||||
*/
|
||||
public StickyHeaderDecoration(StickyHeaderAdapter adapter, boolean renderInline, boolean sticky) {
|
||||
public StickyHeaderDecoration(StickyHeaderAdapter adapter, boolean renderInline, boolean sticky, int type) {
|
||||
this.adapter = adapter;
|
||||
this.headerCache = new HashMap<>();
|
||||
this.renderInline = renderInline;
|
||||
this.sticky = sticky;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,9 +90,9 @@ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration {
|
||||
if (headerHolder == null) {
|
||||
|
||||
if (key != StickyHeaderAdapter.NO_HEADER_ID) {
|
||||
headerHolder = adapter.onCreateHeaderViewHolder(parent, position);
|
||||
headerHolder = adapter.onCreateHeaderViewHolder(parent, position, type);
|
||||
//noinspection unchecked
|
||||
adapter.onBindHeaderViewHolder(headerHolder, position);
|
||||
adapter.onBindHeaderViewHolder(headerHolder, position, type);
|
||||
}
|
||||
|
||||
if (headerHolder == null) {
|
||||
@@ -221,7 +223,7 @@ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration {
|
||||
* @param position position in the adapter
|
||||
* @return a view holder for the created view
|
||||
*/
|
||||
T onCreateHeaderViewHolder(ViewGroup parent, int position);
|
||||
T onCreateHeaderViewHolder(ViewGroup parent, int position, int type);
|
||||
|
||||
/**
|
||||
* Updates the header view to reflect the header data for the given position.
|
||||
@@ -229,7 +231,7 @@ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration {
|
||||
* @param viewHolder the header view holder
|
||||
* @param position the header's item position
|
||||
*/
|
||||
void onBindHeaderViewHolder(T viewHolder, int position);
|
||||
void onBindHeaderViewHolder(T viewHolder, int position, int type);
|
||||
|
||||
int getItemCount();
|
||||
}
|
||||
|
||||
@@ -20,18 +20,18 @@ public final class RecyclerViewConcatenateAdapterStickyHeader extends Recycle
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateHeaderViewHolder(ViewGroup parent, int position) {
|
||||
return getForPosition(position).transform(p -> p.first().onCreateHeaderViewHolder(parent, p.second())).orNull();
|
||||
public RecyclerView.ViewHolder onCreateHeaderViewHolder(ViewGroup parent, int position, int type) {
|
||||
return getForPosition(position).transform(p -> p.first().onCreateHeaderViewHolder(parent, p.second(), type)).orNull();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position, int type) {
|
||||
Optional<Pair<StickyHeaderDecoration.StickyHeaderAdapter, Integer>> forPosition = getForPosition(position);
|
||||
|
||||
if (forPosition.isPresent()) {
|
||||
Pair<StickyHeaderDecoration.StickyHeaderAdapter, Integer> stickyHeaderAdapterIntegerPair = forPosition.get();
|
||||
//noinspection unchecked
|
||||
stickyHeaderAdapterIntegerPair.first().onBindHeaderViewHolder(viewHolder, stickyHeaderAdapterIntegerPair.second());
|
||||
stickyHeaderAdapterIntegerPair.first().onBindHeaderViewHolder(viewHolder, stickyHeaderAdapterIntegerPair.second(), type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user