Search in sources :

Example 1 with DividerItemDecoration

use of me.zhanghai.android.douya.ui.DividerItemDecoration in project Douya by DreaminginCodeZH.

the class BaseItemDataAdapter method createCelebrityListHolder.

protected CelebrityListHolder createCelebrityListHolder(ViewGroup parent) {
    CelebrityListHolder holder = new CelebrityListHolder(ViewUtils.inflate(R.layout.item_fragment_celebrity_list, parent));
    holder.celebrityList.setHasFixedSize(true);
    holder.celebrityList.setLayoutManager(new LinearLayoutManager(parent.getContext(), LinearLayoutManager.HORIZONTAL, false));
    holder.celebrityList.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.HORIZONTAL, R.drawable.transparent_divider_vertical_16dp, holder.celebrityList.getContext()));
    holder.celebrityList.setAdapter(new CelebrityListAdapter());
    return holder;
}
Also used : LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(me.zhanghai.android.douya.ui.DividerItemDecoration)

Example 2 with DividerItemDecoration

use of me.zhanghai.android.douya.ui.DividerItemDecoration 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);
}
Also used : HorizontalImageAdapter(me.zhanghai.android.douya.ui.HorizontalImageAdapter) OnHorizontalScrollListener(me.zhanghai.android.douya.ui.OnHorizontalScrollListener) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(me.zhanghai.android.douya.ui.DividerItemDecoration)

Example 3 with DividerItemDecoration

use of me.zhanghai.android.douya.ui.DividerItemDecoration in project Douya by DreaminginCodeZH.

the class SendBroadcastAttachmentLayout method init.

private void init() {
    ViewUtils.inflateInto(R.layout.send_broadcast_attachment_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 HorizontalUploadImageAdapter();
    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);
            }
        }
    });
}
Also used : OnHorizontalScrollListener(me.zhanghai.android.douya.ui.OnHorizontalScrollListener) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(me.zhanghai.android.douya.ui.DividerItemDecoration) HorizontalUploadImageAdapter(me.zhanghai.android.douya.ui.HorizontalUploadImageAdapter)

Example 4 with DividerItemDecoration

use of me.zhanghai.android.douya.ui.DividerItemDecoration in project Douya by DreaminginCodeZH.

the class BaseItemDataAdapter method createAwardListHolder.

protected AwardListHolder createAwardListHolder(ViewGroup parent) {
    AwardListHolder holder = new AwardListHolder(ViewUtils.inflate(R.layout.item_fragment_award_list, parent));
    holder.awardList.setHasFixedSize(true);
    holder.awardList.setLayoutManager(new LinearLayoutManager(parent.getContext(), LinearLayoutManager.HORIZONTAL, false));
    holder.awardList.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.HORIZONTAL, R.drawable.transparent_divider_vertical_16dp, holder.awardList.getContext()));
    holder.awardList.setAdapter(new ItemAwardListAdapter());
    return holder;
}
Also used : LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(me.zhanghai.android.douya.ui.DividerItemDecoration)

Example 5 with DividerItemDecoration

use of me.zhanghai.android.douya.ui.DividerItemDecoration in project Douya by DreaminginCodeZH.

the class BaseItemDataAdapter method createRecommendationListHolder.

protected RecommendationListHolder createRecommendationListHolder(ViewGroup parent) {
    RecommendationListHolder holder = new RecommendationListHolder(ViewUtils.inflate(R.layout.item_fragment_recommendation_list, parent));
    holder.recommendationList.setHasFixedSize(true);
    holder.recommendationList.setLayoutManager(new LinearLayoutManager(parent.getContext(), LinearLayoutManager.HORIZONTAL, false));
    holder.recommendationList.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.HORIZONTAL, R.drawable.transparent_divider_vertical_16dp, holder.recommendationList.getContext()));
    holder.recommendationList.setAdapter(new RecommendationListAdapter());
    return holder;
}
Also used : LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(me.zhanghai.android.douya.ui.DividerItemDecoration)

Aggregations

LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)6 DividerItemDecoration (me.zhanghai.android.douya.ui.DividerItemDecoration)6 HorizontalImageAdapter (me.zhanghai.android.douya.ui.HorizontalImageAdapter)2 OnHorizontalScrollListener (me.zhanghai.android.douya.ui.OnHorizontalScrollListener)2 HorizontalUploadImageAdapter (me.zhanghai.android.douya.ui.HorizontalUploadImageAdapter)1