Search in sources :

Example 1 with RefreshLayout

use of com.hippo.refreshlayout.RefreshLayout in project EhViewer by seven332.

the class GalleryListScene method onCreateView2.

@Nullable
@Override
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.scene_gallery_list, container, false);
    Context context = getContext2();
    Assert.assertNotNull(context);
    Resources resources = context.getResources();
    mHideActionFabSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mShowActionFab = true;
    View mainLayout = ViewUtils.$$(view, R.id.main_layout);
    ContentLayout contentLayout = (ContentLayout) ViewUtils.$$(mainLayout, R.id.content_layout);
    mRecyclerView = contentLayout.getRecyclerView();
    FastScroller fastScroller = contentLayout.getFastScroller();
    RefreshLayout refreshLayout = contentLayout.getRefreshLayout();
    mSearchLayout = (SearchLayout) ViewUtils.$$(mainLayout, R.id.search_layout);
    mSearchBar = (SearchBar) ViewUtils.$$(mainLayout, R.id.search_bar);
    mFabLayout = (FabLayout) ViewUtils.$$(mainLayout, R.id.fab_layout);
    mSearchFab = ViewUtils.$$(mainLayout, R.id.search_fab);
    int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.gallery_padding_top_search_bar);
    int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab);
    mViewTransition = new ViewTransition(contentLayout, mSearchLayout);
    mHelper = new GalleryListHelper();
    mHelper.setEmptyString(resources.getString(R.string.gallery_list_empty_hit));
    contentLayout.setHelper(mHelper);
    contentLayout.getFastScroller().setOnDragHandlerListener(this);
    mAdapter = new GalleryListAdapter(inflater, resources, mRecyclerView, Settings.getListMode());
    mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
    mRecyclerView.setDrawSelectorOnTop(true);
    mRecyclerView.hasFixedSize();
    mRecyclerView.setClipToPadding(false);
    mRecyclerView.setOnItemClickListener(this);
    mRecyclerView.setOnItemLongClickListener(this);
    mRecyclerView.addOnScrollListener(mOnScrollListener);
    fastScroller.setPadding(fastScroller.getPaddingLeft(), fastScroller.getPaddingTop() + paddingTopSB, fastScroller.getPaddingRight(), fastScroller.getPaddingBottom());
    refreshLayout.setHeaderTranslationY(paddingTopSB);
    mLeftDrawable = new DrawerArrowDrawable(context);
    mRightDrawable = new AddDeleteDrawable(context);
    mSearchBar.setLeftDrawable(mLeftDrawable);
    mSearchBar.setRightDrawable(mRightDrawable);
    mSearchBar.setHelper(this);
    mSearchBar.setOnStateChangeListener(this);
    setSearchBarHint(context, mSearchBar);
    mSearchLayout.setHelper(this);
    mSearchLayout.setPadding(mSearchLayout.getPaddingLeft(), mSearchLayout.getPaddingTop() + paddingTopSB, mSearchLayout.getPaddingRight(), mSearchLayout.getPaddingBottom() + paddingBottomFab);
    mFabLayout.setAutoCancel(true);
    mFabLayout.setExpanded(false);
    mFabLayout.setHidePrimaryFab(false);
    mFabLayout.setOnClickFabListener(this);
    mFabLayout.setOnExpandListener(this);
    addAboveSnackView(mFabLayout);
    mActionFabDrawable = new AddDeleteDrawable(context);
    mActionFabDrawable.setColor(resources.getColor(R.color.primary_drawable_dark));
    mFabLayout.getPrimaryFab().setImageDrawable(mActionFabDrawable);
    mSearchFab.setOnClickListener(this);
    mSearchBarMover = new SearchBarMover(this, mSearchBar, mRecyclerView, mSearchLayout);
    // Update list url builder
    onUpdateUrlBuilder();
    // Restore state
    int newState = mState;
    mState = STATE_NORMAL;
    setState(newState, false);
    // Only refresh for the first time
    if (!mHasFirstRefresh) {
        mHasFirstRefresh = true;
        mHelper.firstRefresh();
    }
    guideQuickSearch();
    return view;
}
Also used : Context(android.content.Context) ViewTransition(com.hippo.view.ViewTransition) FastScroller(com.hippo.easyrecyclerview.FastScroller) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerView(android.support.v7.widget.RecyclerView) Point(android.graphics.Point) SearchBarMover(com.hippo.widget.SearchBarMover) ContentLayout(com.hippo.widget.ContentLayout) RefreshLayout(com.hippo.refreshlayout.RefreshLayout) DrawerArrowDrawable(com.hippo.drawable.DrawerArrowDrawable) Resources(android.content.res.Resources) AddDeleteDrawable(com.hippo.drawable.AddDeleteDrawable) Nullable(android.support.annotation.Nullable)

Example 2 with RefreshLayout

use of com.hippo.refreshlayout.RefreshLayout in project EhViewer by seven332.

the class FavoritesScene method onCreateView2.

@Nullable
@Override
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.scene_favorites, container, false);
    ContentLayout contentLayout = (ContentLayout) view.findViewById(R.id.content_layout);
    mRecyclerView = contentLayout.getRecyclerView();
    FastScroller fastScroller = contentLayout.getFastScroller();
    RefreshLayout refreshLayout = contentLayout.getRefreshLayout();
    mSearchBar = (SearchBar) ViewUtils.$$(view, R.id.search_bar);
    mFabLayout = (FabLayout) ViewUtils.$$(view, R.id.fab_layout);
    Context context = getContext2();
    Assert.assertNotNull(context);
    Resources resources = context.getResources();
    int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.gallery_padding_top_search_bar);
    mHelper = new FavoritesHelper();
    mHelper.setEmptyString(resources.getString(R.string.gallery_list_empty_hit));
    contentLayout.setHelper(mHelper);
    contentLayout.getFastScroller().setOnDragHandlerListener(this);
    mAdapter = new FavoritesAdapter(inflater, resources, mRecyclerView, Settings.getListMode());
    mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
    mRecyclerView.setDrawSelectorOnTop(true);
    mRecyclerView.hasFixedSize();
    mRecyclerView.setClipToPadding(false);
    mRecyclerView.setOnItemClickListener(this);
    mRecyclerView.setOnItemLongClickListener(this);
    mRecyclerView.setChoiceMode(EasyRecyclerView.CHOICE_MODE_MULTIPLE_CUSTOM);
    mRecyclerView.setCustomCheckedListener(this);
    fastScroller.setPadding(fastScroller.getPaddingLeft(), fastScroller.getPaddingTop() + paddingTopSB, fastScroller.getPaddingRight(), fastScroller.getPaddingBottom());
    refreshLayout.setHeaderTranslationY(paddingTopSB);
    mLeftDrawable = new DrawerArrowDrawable(context);
    mSearchBar.setLeftDrawable(mLeftDrawable);
    mSearchBar.setRightDrawable(DrawableManager.getDrawable(context, R.drawable.v_magnify_x24));
    mSearchBar.setHelper(this);
    mSearchBar.setAllowEmptySearch(false);
    updateSearchBar();
    mSearchBarMover = new SearchBarMover(this, mSearchBar, mRecyclerView);
    mFabLayout.setExpanded(false, false);
    mFabLayout.setAutoCancel(false);
    mFabLayout.setHidePrimaryFab(true);
    mFabLayout.setOnClickFabListener(this);
    addAboveSnackView(mFabLayout);
    // Restore search mode
    if (mSearchMode) {
        mSearchMode = false;
        enterSearchMode(false);
    }
    // Only refresh for the first time
    if (!mHasFirstRefresh) {
        mHasFirstRefresh = true;
        mHelper.firstRefresh();
    }
    guideCollections();
    return view;
}
Also used : Context(android.content.Context) ContentLayout(com.hippo.widget.ContentLayout) RefreshLayout(com.hippo.refreshlayout.RefreshLayout) DrawerArrowDrawable(com.hippo.drawable.DrawerArrowDrawable) FastScroller(com.hippo.easyrecyclerview.FastScroller) Resources(android.content.res.Resources) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerView(android.support.v7.widget.RecyclerView) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) SearchBarMover(com.hippo.widget.SearchBarMover) Nullable(android.support.annotation.Nullable)

Aggregations

Context (android.content.Context)2 Resources (android.content.res.Resources)2 Point (android.graphics.Point)2 Nullable (android.support.annotation.Nullable)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 ShowcaseView (com.github.amlcurran.showcaseview.ShowcaseView)2 DrawerArrowDrawable (com.hippo.drawable.DrawerArrowDrawable)2 EasyRecyclerView (com.hippo.easyrecyclerview.EasyRecyclerView)2 FastScroller (com.hippo.easyrecyclerview.FastScroller)2 RefreshLayout (com.hippo.refreshlayout.RefreshLayout)2 ContentLayout (com.hippo.widget.ContentLayout)2 SearchBarMover (com.hippo.widget.SearchBarMover)2 SuppressLint (android.annotation.SuppressLint)1 AddDeleteDrawable (com.hippo.drawable.AddDeleteDrawable)1 ViewTransition (com.hippo.view.ViewTransition)1