Search in sources :

Example 1 with ImageAdapter

use of com.lauren.simplenews.images.ImageAdapter in project SimpleNews by liuling07.

the class ImageFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_image, null);
    mSwipeRefreshWidget = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_widget);
    mSwipeRefreshWidget.setColorSchemeResources(R.color.primary, R.color.primary_dark, R.color.primary_light, R.color.accent);
    mSwipeRefreshWidget.setOnRefreshListener(this);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recycle_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mAdapter = new ImageAdapter(getActivity().getApplicationContext());
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.addOnScrollListener(mOnScrollListener);
    onRefresh();
    return view;
}
Also used : ImageAdapter(com.lauren.simplenews.images.ImageAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(com.lauren.simplenews.images.view.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)1 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageAdapter (com.lauren.simplenews.images.ImageAdapter)1 ImageView (com.lauren.simplenews.images.view.ImageView)1