Search in sources :

Example 1 with PhotoGirl

use of com.zhjh.androidnews.bean.PhotoGirl in project AndroidNews by zhjohow.

the class PhotosFragment method initView.

@Override
public void initView() {
    if (getArguments() != null) {
        mPhotoType = getArguments().getString(AppConstant.PHOTO_TYPE);
    }
    adapter = new CommonRecycleViewAdapter<PhotoGirl>(getContext(), R.layout.item_photo) {

        @Override
        public void convert(ViewHolderHelper helper, final PhotoGirl photoGirl) {
            ImageView imageView = helper.getView(R.id.iv_photo);
            Glide.with(mContext).load(photoGirl.getThumbUrl()).diskCacheStrategy(DiskCacheStrategy.SOURCE).placeholder(R.drawable.ic_image_loading).error(R.drawable.ic_empty_picture).centerCrop().override(1090, 1090 * 3 / 4).crossFade().into(imageView);
            imageView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    PhotosDetailActivity.startAction(mContext, photoGirl.getThumbUrl());
                }
            });
        }
    };
    irc.setAdapter(adapter);
    irc.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
    irc.setOnLoadMoreListener(this);
    irc.setOnRefreshListener(this);
    // fab.setOnClickListener(new View.OnClickListener() {
    // @Override
    // public void onClick(View view) {
    // irc.smoothScrollToPosition(0);
    // }
    // });
    mPresenter.getPhotosListDataRequest(mPhotoType, SIZE, mStartPage);
}
Also used : ViewHolderHelper(com.aspsine.irecyclerview.universaladapter.ViewHolderHelper) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) ImageView(android.widget.ImageView) IRecyclerView(com.aspsine.irecyclerview.IRecyclerView) ImageView(android.widget.ImageView) LoadMoreFooterView(com.aspsine.irecyclerview.widget.LoadMoreFooterView) View(android.view.View) PhotoGirl(com.zhjh.androidnews.bean.PhotoGirl)

Aggregations

StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 IRecyclerView (com.aspsine.irecyclerview.IRecyclerView)1 ViewHolderHelper (com.aspsine.irecyclerview.universaladapter.ViewHolderHelper)1 LoadMoreFooterView (com.aspsine.irecyclerview.widget.LoadMoreFooterView)1 PhotoGirl (com.zhjh.androidnews.bean.PhotoGirl)1