Search in sources :

Example 1 with ImagesListEntity

use of com.github.obsessive.simplifyreader.bean.ImagesListEntity in project SimplifyReader by chentao0707.

the class ImagesListFragment method initViewsAndEvents.

@Override
protected void initViewsAndEvents() {
    mListViewAdapter = new ListViewDataAdapter<ImagesListEntity>(new ViewHolderCreator<ImagesListEntity>() {

        @Override
        public ViewHolderBase<ImagesListEntity> createViewHolder(int position) {
            return new ViewHolderBase<ImagesListEntity>() {

                PLAImageView mItemImage;

                @Override
                public View createView(LayoutInflater layoutInflater) {
                    View convertView = layoutInflater.inflate(R.layout.list_item_images_list, null);
                    mItemImage = ButterKnife.findById(convertView, R.id.list_item_images_list_image);
                    return convertView;
                }

                @Override
                public void showData(int position, ImagesListEntity itemData) {
                    int width = itemData.getThumbnailWidth();
                    int height = itemData.getThumbnailHeight();
                    String imageUrl = itemData.getThumbnailUrl();
                    if (!CommonUtils.isEmpty(imageUrl)) {
                        ImageLoader.getInstance().displayImage(imageUrl, mItemImage);
                    }
                    mItemImage.setImageWidth(width);
                    mItemImage.setImageHeight(height);
                }
            };
        }
    });
    mListView.setOnItemClickListener(this);
    mListView.setOnLoadMoreListener(this);
    mListView.setAdapter(mListViewAdapter);
    mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.gplus_color_1), getResources().getColor(R.color.gplus_color_2), getResources().getColor(R.color.gplus_color_3), getResources().getColor(R.color.gplus_color_4));
    mSwipeRefreshLayout.setOnRefreshListener(this);
}
Also used : PLAImageView(com.github.obsessive.library.pla.PLAImageView) ViewHolderBase(com.github.obsessive.library.adapter.ViewHolderBase) LayoutInflater(android.view.LayoutInflater) ResponseImagesListEntity(com.github.obsessive.simplifyreader.bean.ResponseImagesListEntity) ImagesListEntity(com.github.obsessive.simplifyreader.bean.ImagesListEntity) ViewHolderCreator(com.github.obsessive.library.adapter.ViewHolderCreator) ImagesListView(com.github.obsessive.simplifyreader.view.ImagesListView) InjectView(butterknife.InjectView) PLAImageView(com.github.obsessive.library.pla.PLAImageView) View(android.view.View) PLALoadMoreListView(com.github.obsessive.simplifyreader.widgets.PLALoadMoreListView) PLAAdapterView(com.github.obsessive.library.pla.PLAAdapterView)

Aggregations

LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 InjectView (butterknife.InjectView)1 ViewHolderBase (com.github.obsessive.library.adapter.ViewHolderBase)1 ViewHolderCreator (com.github.obsessive.library.adapter.ViewHolderCreator)1 PLAAdapterView (com.github.obsessive.library.pla.PLAAdapterView)1 PLAImageView (com.github.obsessive.library.pla.PLAImageView)1 ImagesListEntity (com.github.obsessive.simplifyreader.bean.ImagesListEntity)1 ResponseImagesListEntity (com.github.obsessive.simplifyreader.bean.ResponseImagesListEntity)1 ImagesListView (com.github.obsessive.simplifyreader.view.ImagesListView)1 PLALoadMoreListView (com.github.obsessive.simplifyreader.widgets.PLALoadMoreListView)1