Search in sources :

Example 46 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project remusic by aa112901.

the class PlaylistDetailFragment method onCreateView.

@TargetApi(21)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_playlist_detail, container, false);
    albumArt = (ImageView) rootView.findViewById(R.id.album_art);
    albumTitle = (TextView) rootView.findViewById(R.id.album_title);
    albumDetails = (TextView) rootView.findViewById(R.id.album_details);
    albumArtSmall = (SimpleDraweeView) rootView.findViewById(R.id.albumArtSmall);
    toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    toolbar.setPadding(0, CommonUtils.getStatusHeight(getActivity()) / 2, 0, 0);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    collapsingToolbarLayout = (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
    appBarLayout = (AppBarLayout) rootView.findViewById(R.id.app_bar);
    // recyclerView.setEnabled(false);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setHasFixedSize(true);
    setUpEverything();
    return rootView;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) TargetApi(android.annotation.TargetApi)

Example 47 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project ride-read-android by Ride-Read.

the class NineGridImgView method layoutChildrenView.

/**
 * 布局 ImageView
 */
private void layoutChildrenView() {
    if (mImgDataList == null) {
        return;
    }
    int childrenCount = mImgDataList.size();
    for (int i = 0; i < childrenCount; i++) {
        SimpleDraweeView childrenView = (SimpleDraweeView) getChildAt(i);
        if (mAdapter != null) {
            mAdapter.onDisplayImage(getContext(), childrenView, mImgDataList.get(i));
        }
        int rowNum = i / mColumnCount;
        int columnNum = i % mColumnCount;
        int left = (mGridSize + mGap) * columnNum + getPaddingLeft();
        int top = (mGridSize + mGap) * rowNum + getPaddingTop();
        int right = left + mGridSize;
        int bottom = top + mGridSize;
        childrenView.layout(left, top, right, bottom);
    }
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView)

Example 48 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project ride-read-android by Ride-Read.

the class NineGridImgViewAdapter method generateImageView.

protected SimpleDraweeView generateImageView(Context context) {
    SimpleDraweeView imageView = new GridImgView(context);
    imageView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
    return imageView;
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView)

Example 49 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project ride-read-android by Ride-Read.

the class CommentsAdapter method getItemView.

@Override
public View getItemView(int position, View convertView, ViewHolder viewHolder, ViewGroup viewGroup) {
    SimpleDraweeView sdv_thumb_avatar = viewHolder.getView(R.id.sdv_thumb_avatar);
    TextView tv_thumb_username = viewHolder.getView(R.id.tv_thumb_username);
    TextView tv_thumb_time = viewHolder.getView(R.id.tv_thumb_time);
    TextView tv_thumb_content = viewHolder.getView(R.id.tv_thumb_content);
    Comment comment = getItem(position);
    ImgLoader.getInstance().displayImage(comment.getFaceUrl(), sdv_thumb_avatar);
    tv_thumb_username.setText(comment.getUsername());
    tv_thumb_time.setText(TimeUtils.getFriendlyTimeSpanByNow(comment.getCreatedAt()));
    tv_thumb_content.setText(comment.getMsg());
    sdv_thumb_avatar.setOnClickListener(v -> {
        Bundle bundle = new Bundle();
        bundle.putInt(UserMomentsActivity.SELECTED_UID, comment.getUid());
        bundle.putString(UserMomentsActivity.SELECTED_USERNAME, comment.getUsername());
        ((BaseActivity) mContext).gotoActivity(UserMomentsActivity.class, bundle);
    });
    return convertView;
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) Comment(com.rideread.rideread.data.result.Comment) Bundle(android.os.Bundle) BaseActivity(com.rideread.rideread.common.base.BaseActivity) TextView(android.widget.TextView)

Example 50 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project ride-read-android by Ride-Read.

the class MomentDetailActivity method refreshView.

private void refreshView() {
    View momentHeader = initMomentHeader();
    mCurMomentUser = mCurMoment.getUser();
    if (null != mCurMomentUser) {
        ImgLoader.getInstance().displayImage(mCurMoment.getUser().getFaceUrl(), mImgAvatar);
        mTvName.setText(mCurMomentUser.getUsername());
        mTvTime.setText(TimeUtils.getFriendlyTimeSpanByNow(mCurMoment.getCreatedAt()));
        int isFollowInt = mCurMomentUser.getIsFollowed();
        isAttention = isFollowInt == 0 || isFollowInt == 1;
        mBtnAttention.setBackgroundResource(isAttention ? R.drawable.icon_attented : R.drawable.icon_attention);
        mTvMomentText.setText(mCurMoment.getMsg());
        mTvCommentCount.setText("评论 " + mCurMoment.getComment().size());
        mThumbUpCount = mCurMoment.getThumbsUp().size();
        mTvThumbCount.setText(Integer.toString(mThumbUpCount));
        if (mCurMomentUser.getUid() == UserUtils.getUid())
            mBtnAttention.setVisibility(View.GONE);
        mImgAvatar.setOnClickListener(v -> {
            Bundle bundle = new Bundle();
            bundle.putInt(UserMomentsActivity.SELECTED_UID, mCurMomentUser.getUid());
            bundle.putString(UserMomentsActivity.SELECTED_USERNAME, mCurMomentUser.getUsername());
            gotoActivity(UserMomentsActivity.class, bundle);
        });
        mBtnAttention.setOnClickListener(v -> {
            if (isAttention) {
                ApiUtils.unfollow(mCurMomentUser.getUid(), new BaseCallback<BaseModel<DefJsonResult>>() {

                    @Override
                    protected void onSuccess(BaseModel<DefJsonResult> model) throws Exception {
                        mBtnAttention.setBackgroundResource(R.drawable.icon_attention);
                        isAttention = !isAttention;
                    }
                });
            } else {
                ApiUtils.follow(mCurMomentUser.getUid(), new BaseCallback<BaseModel<DefJsonResult>>() {

                    @Override
                    protected void onSuccess(BaseModel<DefJsonResult> model) throws Exception {
                        mBtnAttention.setBackgroundResource(R.drawable.icon_attented);
                        isAttention = !isAttention;
                    }
                });
            }
        });
        List<String> pictures = mCurMoment.getPictures();
        if (!ListUtils.isEmpty(pictures)) {
            mNineGridImgView.setAdapter(nineGridAdapter);
            mNineGridImgView.setImagesData(pictures);
            mNineGridImgView.setVisibility(View.VISIBLE);
        } else {
            mNineGridImgView.setVisibility(View.GONE);
        }
    }
    List<ThumbsUpUser> thumbsUpUsers = mCurMoment.getThumbsUp();
    SimpleDraweeView thumbUpUserAvatar;
    RoundingParams roundingParams = RoundingParams.fromCornersRadius(4f);
    roundingParams.setRoundAsCircle(true);
    for (ThumbsUpUser thumbsUpUser : thumbsUpUsers) {
        thumbUpUserAvatar = new SimpleDraweeView(this);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams((int) ScreenUtils.dp2px(28f), (int) ScreenUtils.dp2px(28f));
        thumbUpUserAvatar.setLayoutParams(params);
        thumbUpUserAvatar.getHierarchy().setRoundingParams(roundingParams);
        ImgLoader.getInstance().displayImage(thumbsUpUser.getFaceUrl(), thumbUpUserAvatar);
        mHllThumpUps.addView(thumbUpUserAvatar);
        if (UserUtils.getUid() == thumbsUpUser.getUid()) {
            myAvatar = thumbUpUserAvatar;
        }
        if (!mHllThumpUps.canAddView()) {
            break;
        }
    }
    if (!ListUtils.isEmpty(thumbsUpUsers)) {
        mHllThumpUps.setOnClickListener(v -> {
            Bundle bundle = new Bundle();
            bundle.putInt(ThumbsUpUserActivity.MOMENT_ID, mCurMoment.getMid());
            gotoActivity(ThumbsUpUserActivity.class, bundle);
        });
    }
    for (ThumbsUpUser thumbsUpUser : thumbsUpUsers) {
        if (thumbsUpUser.getUid() == UserUtils.getUid()) {
            isThumbsUp = true;
            break;
        }
    }
    mBtnThumbsUp.setBackgroundResource(isThumbsUp ? R.drawable.ic_thumb_up_on : R.drawable.ic_thumb_up_off);
    mLvComments.addHeaderView(momentHeader);
    mAdapter = new CommentsAdapter(this);
    mCommentList = mCurMoment.getComment();
    mAdapter.setItems(mCommentList);
    mLvComments.setAdapter(mAdapter);
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) Bundle(android.os.Bundle) ThumbsUpUser(com.rideread.rideread.data.result.ThumbsUpUser) ViewGroup(android.view.ViewGroup) CommentsAdapter(com.rideread.rideread.common.adapter.CommentsAdapter) BindView(butterknife.BindView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) NineGridImgView(com.rideread.rideread.common.widget.NineGridImgView.NineGridImgView) TextView(android.widget.TextView) ListView(android.widget.ListView) DefJsonResult(com.rideread.rideread.data.result.DefJsonResult) BaseModel(com.rideread.rideread.function.net.retrofit.BaseModel) RoundingParams(com.facebook.drawee.generic.RoundingParams)

Aggregations

SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)58 View (android.view.View)30 TextView (android.widget.TextView)20 Uri (android.net.Uri)8 DraweeController (com.facebook.drawee.interfaces.DraweeController)8 Intent (android.content.Intent)6 ImageView (android.widget.ImageView)5 RecyclerView (android.support.v7.widget.RecyclerView)4 Button (android.widget.Button)4 TintImageView (com.bilibili.magicasakura.widgets.TintImageView)4 RoundingParams (com.facebook.drawee.generic.RoundingParams)4 Animatable (android.graphics.drawable.Animatable)3 ViewGroup (android.view.ViewGroup)3 AdapterView (android.widget.AdapterView)3 CompoundButton (android.widget.CompoundButton)3 LinearLayout (android.widget.LinearLayout)3 SwitchCompat (androidx.appcompat.widget.SwitchCompat)3 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)3 ControllerListener (com.facebook.drawee.controller.ControllerListener)3 ProgressBarDrawable (com.facebook.drawee.drawable.ProgressBarDrawable)3