Search in sources :

Example 1 with NewTabPageLayout

use of org.chromium.chrome.browser.ntp.NewTabPageLayout in project AndroidChromium by JackyAndroid.

the class NewTabPageRecyclerView method findAboveTheFoldView.

/**
     * Finds the above the fold view.
     * @return The View for above the fold or null, if it is not present.
     */
public NewTabPageLayout findAboveTheFoldView() {
    int aboveTheFoldPosition = getNewTabPageAdapter().getAboveTheFoldPosition();
    if (aboveTheFoldPosition == RecyclerView.NO_POSITION)
        return null;
    ViewHolder viewHolder = findViewHolderForAdapterPosition(aboveTheFoldPosition);
    if (viewHolder == null)
        return null;
    View view = viewHolder.itemView;
    if (!(view instanceof NewTabPageLayout))
        return null;
    return (NewTabPageLayout) view;
}
Also used : SectionHeaderViewHolder(org.chromium.chrome.browser.ntp.snippets.SectionHeaderViewHolder) NewTabPageLayout(org.chromium.chrome.browser.ntp.NewTabPageLayout) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 2 with NewTabPageLayout

use of org.chromium.chrome.browser.ntp.NewTabPageLayout in project AndroidChromium by JackyAndroid.

the class NewTabPageRecyclerView method updatePeekingCardAndHeader.

public void updatePeekingCardAndHeader() {
    NewTabPageLayout aboveTheFoldView = findAboveTheFoldView();
    if (aboveTheFoldView == null)
        return;
    SectionHeaderViewHolder header = findFirstHeader();
    if (header == null)
        return;
    header.updateDisplay(computeVerticalScrollOffset(), mHasSpaceForPeekingCard);
    CardViewHolder firstCard = findFirstCard();
    if (firstCard != null)
        updatePeekingCard(firstCard);
    // Update the space at the bottom, which needs to know about the height of the header.
    refreshBottomSpacing();
}
Also used : SectionHeaderViewHolder(org.chromium.chrome.browser.ntp.snippets.SectionHeaderViewHolder) NewTabPageLayout(org.chromium.chrome.browser.ntp.NewTabPageLayout)

Aggregations

NewTabPageLayout (org.chromium.chrome.browser.ntp.NewTabPageLayout)2 SectionHeaderViewHolder (org.chromium.chrome.browser.ntp.snippets.SectionHeaderViewHolder)2 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1