Search in sources :

Example 56 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-ObservableScrollView by ksoichiro.

the class ViewPagerTabRecyclerViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
    Activity parentActivity = getActivity();
    final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
    recyclerView.setHasFixedSize(false);
    View headerView = LayoutInflater.from(parentActivity).inflate(R.layout.padding, null);
    UiTestUtils.setDummyDataWithHeader(getActivity(), recyclerView, headerView);
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        // Scroll to the specified offset after layout
        Bundle args = getArguments();
        if (args != null && args.containsKey(ARG_INITIAL_POSITION)) {
            final int initialPosition = args.getInt(ARG_INITIAL_POSITION, 0);
            ScrollUtils.addOnGlobalLayoutListener(recyclerView, new Runnable() {

                @Override
                public void run() {
                    recyclerView.scrollVerticallyToPosition(initialPosition);
                }
            });
        }
        recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) Bundle(android.os.Bundle) Activity(android.app.Activity) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) View(android.view.View)

Example 57 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-ObservableScrollView by ksoichiro.

the class ActionBarControlRecyclerViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_actionbarcontrolrecyclerview);
    ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.recycler);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);
    recyclerView.setScrollViewCallbacks(this);
    setDummyData(recyclerView);
}
Also used : ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 58 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-ObservableScrollView by ksoichiro.

the class BaseActivity method setDummyDataWithHeader.

protected void setDummyDataWithHeader(RecyclerView recyclerView, int headerHeight) {
    View headerView = new View(this);
    headerView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, headerHeight));
    headerView.setMinimumHeight(headerHeight);
    // This is required to disable header's list selector effect
    headerView.setClickable(true);
    setDummyDataWithHeader(recyclerView, headerView);
}
Also used : AbsListView(android.widget.AbsListView) RecyclerView(android.support.v7.widget.RecyclerView) GridView(android.widget.GridView) View(android.view.View) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView)

Example 59 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-ObservableScrollView by ksoichiro.

the class ViewPagerTab2RecyclerViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
    Activity parentActivity = getActivity();
    final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
    recyclerView.setHasFixedSize(false);
    UiTestUtils.setDummyData(getActivity(), recyclerView);
    recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) Activity(android.app.Activity) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) View(android.view.View)

Example 60 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-ObservableScrollView by ksoichiro.

the class ViewPagerTab2RecyclerViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
    Activity parentActivity = getActivity();
    final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
    recyclerView.setHasFixedSize(false);
    setDummyData(recyclerView);
    recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) Activity(android.app.Activity) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) View(android.view.View)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1778 View (android.view.View)1237 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1106 TextView (android.widget.TextView)384 GridLayoutManager (android.support.v7.widget.GridLayoutManager)234 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)225 ImageView (android.widget.ImageView)210 ArrayList (java.util.ArrayList)190 Toolbar (android.support.v7.widget.Toolbar)137 Intent (android.content.Intent)117 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)102 ViewGroup (android.view.ViewGroup)101 Nullable (android.support.annotation.Nullable)99 Context (android.content.Context)96 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)96 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)93 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)93 Bundle (android.os.Bundle)92 Test (org.junit.Test)90 Paint (android.graphics.Paint)80