use of me.zhanghai.android.douya.ui.HorizontalImageAdapter in project Douya by DreaminginCodeZH.
the class BaseItemDataAdapter method bindPhotoListHolder.
protected void bindPhotoListHolder(RecyclerView.ViewHolder holder, T item, List<Photo> photoList, boolean excludeFirstPhoto) {
PhotoListHolder photoListHolder = (PhotoListHolder) holder;
List<Photo> originalPhotoList = photoList;
if (excludeFirstPhoto) {
photoList = photoList.subList(1, photoList.size());
}
ViewUtils.setVisibleOrGone(photoListHolder.photoList, !photoList.isEmpty());
HorizontalImageAdapter adapter = (HorizontalImageAdapter) photoListHolder.photoList.getAdapter();
adapter.replace(photoList);
Context context = RecyclerViewUtils.getContext(holder);
adapter.setOnItemClickListener((parent, itemView, item_, photoPosition) -> {
if (excludeFirstPhoto) {
++photoPosition;
}
// TODO: Use PhotoAlbumGalleryActivity instead.
context.startActivity(GalleryActivity.makeImageListIntent(originalPhotoList, photoPosition, context));
});
photoListHolder.viewMoreButton.setOnClickListener(view -> {
// TODO
UriHandler.open(item.url + "photos", context);
});
}
use of me.zhanghai.android.douya.ui.HorizontalImageAdapter in project Douya by DreaminginCodeZH.
the class BroadcastLayout method init.
private void init() {
setOrientation(VERTICAL);
ViewUtils.inflateInto(R.layout.broadcast_layout, this);
ButterKnife.bind(this);
ViewCompat.setBackground(mImageListDescriptionLayout, DrawableUtils.makeScrimDrawable());
mImageList.setHasFixedSize(true);
mImageList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mImageList.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.HORIZONTAL, R.drawable.transparent_divider_vertical_2dp, getContext()));
mImageListAdapter = new HorizontalImageAdapter();
mImageList.setAdapter(mImageListAdapter);
mImageList.addOnScrollListener(new OnHorizontalScrollListener() {
private boolean mShowingDescription = true;
@Override
public void onScrolledLeft() {
if (!mShowingDescription) {
mShowingDescription = true;
ViewUtils.fadeIn(mImageListDescriptionLayout);
}
}
@Override
public void onScrolledRight() {
if (mShowingDescription) {
mShowingDescription = false;
ViewUtils.fadeOut(mImageListDescriptionLayout);
}
}
});
ViewUtils.setTextViewLinkClickable(mTextText);
ViewUtils.setTextViewLinkClickable(mRebroadcastedTextText);
TooltipUtils.setup(mLikeButton);
TooltipUtils.setup(mCommentButton);
// Handled by the OnLongClickListener set in bind().
// TooltipUtils.setup(mRebroadcastButton);
}
use of me.zhanghai.android.douya.ui.HorizontalImageAdapter in project Douya by DreaminginCodeZH.
the class BaseItemDataAdapter method createPhotoListHolder.
protected PhotoListHolder createPhotoListHolder(ViewGroup parent) {
PhotoListHolder holder = new PhotoListHolder(ViewUtils.inflate(R.layout.item_fragment_photo_list, parent));
holder.photoList.setHasFixedSize(true);
holder.photoList.setLayoutManager(new LinearLayoutManager(parent.getContext(), LinearLayoutManager.HORIZONTAL, false));
holder.photoList.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.HORIZONTAL, R.drawable.transparent_divider_vertical_4dp, holder.photoList.getContext()));
holder.photoList.setAdapter(new HorizontalImageAdapter());
return holder;
}
Aggregations