Search in sources :

Example 1 with StickyHeaderViewHolder

use of org.thoughtcrime.securesms.conversation.ConversationAdapter.StickyHeaderViewHolder in project Signal-Android by WhisperSystems.

the class LastSeenHeader method getHeader.

@Override
@NonNull
protected RecyclerView.ViewHolder getHeader(RecyclerView parent, StickyHeaderAdapter stickyAdapter, int position) {
    StickyHeaderViewHolder viewHolder = new StickyHeaderViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.conversation_item_last_seen, parent, false));
    adapter.onBindLastSeenViewHolder(viewHolder, position);
    int widthSpec = View.MeasureSpec.makeMeasureSpec(parent.getWidth(), View.MeasureSpec.EXACTLY);
    int heightSpec = View.MeasureSpec.makeMeasureSpec(parent.getHeight(), View.MeasureSpec.UNSPECIFIED);
    int childWidth = ViewGroup.getChildMeasureSpec(widthSpec, parent.getPaddingLeft() + parent.getPaddingRight(), viewHolder.itemView.getLayoutParams().width);
    int childHeight = ViewGroup.getChildMeasureSpec(heightSpec, parent.getPaddingTop() + parent.getPaddingBottom(), viewHolder.itemView.getLayoutParams().height);
    viewHolder.itemView.measure(childWidth, childHeight);
    viewHolder.itemView.layout(0, 0, viewHolder.itemView.getMeasuredWidth(), viewHolder.itemView.getMeasuredHeight());
    return viewHolder;
}
Also used : StickyHeaderViewHolder(org.thoughtcrime.securesms.conversation.ConversationAdapter.StickyHeaderViewHolder) NonNull(androidx.annotation.NonNull)

Example 2 with StickyHeaderViewHolder

use of org.thoughtcrime.securesms.conversation.ConversationAdapter.StickyHeaderViewHolder in project Signal-Android by signalapp.

the class LastSeenHeader method getHeader.

@Override
@NonNull
protected RecyclerView.ViewHolder getHeader(RecyclerView parent, StickyHeaderAdapter stickyAdapter, int position) {
    StickyHeaderViewHolder viewHolder = new StickyHeaderViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.conversation_item_last_seen, parent, false));
    adapter.onBindLastSeenViewHolder(viewHolder, position);
    int widthSpec = View.MeasureSpec.makeMeasureSpec(parent.getWidth(), View.MeasureSpec.EXACTLY);
    int heightSpec = View.MeasureSpec.makeMeasureSpec(parent.getHeight(), View.MeasureSpec.UNSPECIFIED);
    int childWidth = ViewGroup.getChildMeasureSpec(widthSpec, parent.getPaddingLeft() + parent.getPaddingRight(), viewHolder.itemView.getLayoutParams().width);
    int childHeight = ViewGroup.getChildMeasureSpec(heightSpec, parent.getPaddingTop() + parent.getPaddingBottom(), viewHolder.itemView.getLayoutParams().height);
    viewHolder.itemView.measure(childWidth, childHeight);
    viewHolder.itemView.layout(0, 0, viewHolder.itemView.getMeasuredWidth(), viewHolder.itemView.getMeasuredHeight());
    return viewHolder;
}
Also used : StickyHeaderViewHolder(org.thoughtcrime.securesms.conversation.ConversationAdapter.StickyHeaderViewHolder) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)2 StickyHeaderViewHolder (org.thoughtcrime.securesms.conversation.ConversationAdapter.StickyHeaderViewHolder)2