Search in sources :

Example 6 with RoundingParams

use of com.facebook.drawee.generic.RoundingParams in project actor-platform by actorapp.

the class BackgroundPreviewView method init.

public void init(int width, int height, int corenerRadius) {
    this.width = width;
    this.height = height;
    GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
    GenericDraweeHierarchy hierarchy = builder.setFadeDuration(200).setRoundingParams(new RoundingParams().setCornersRadius(corenerRadius).setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY)).build();
    setHierarchy(hierarchy);
}
Also used : GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) RoundingParams(com.facebook.drawee.generic.RoundingParams)

Example 7 with RoundingParams

use of com.facebook.drawee.generic.RoundingParams in project actor-platform by actorapp.

the class AvatarView method init.

public void init(int size, float placeholderTextSize) {
    this.size = size;
    this.placeholderTextSize = placeholderTextSize;
    GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
    GenericDraweeHierarchy hierarchy = builder.setFadeDuration(200).setRoundingParams(new RoundingParams().setRoundAsCircle(true).setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY)).build();
    setHierarchy(hierarchy);
}
Also used : GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) RoundingParams(com.facebook.drawee.generic.RoundingParams)

Example 8 with RoundingParams

use of com.facebook.drawee.generic.RoundingParams 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)

Example 9 with RoundingParams

use of com.facebook.drawee.generic.RoundingParams in project actor-platform by actorapp.

the class DialogView method initStyles.

protected void initStyles() {
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources()).setFadeDuration(0).setRoundingParams(new RoundingParams().setRoundAsCircle(true)).build();
    draweeHolder = DraweeHolder.create(hierarchy, getContext());
    draweeHolder.getTopLevelDrawable().setCallback(this);
    setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Screen.dp(72)));
    setDividerPaddingLeft(Screen.dp(72));
// setLayerType(LAYER_TYPE_HARDWARE, null);
}
Also used : GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) RecyclerView(android.support.v7.widget.RecyclerView) RoundingParams(com.facebook.drawee.generic.RoundingParams)

Example 10 with RoundingParams

use of com.facebook.drawee.generic.RoundingParams in project fresco by facebook.

the class DraweeRoundedCornersFragment method changeDraweeViewScaleType.

private void changeDraweeViewScaleType(SimpleDraweeView draweeView, ScaleType scaleType, @Nullable PointF focusPoint) {
    final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
    hierarchy.setActualImageScaleType(scaleType);
    hierarchy.setActualImageFocusPoint(focusPoint != null ? focusPoint : new PointF(0.5f, 0.5f));
    final RoundingParams roundingParams = Preconditions.checkNotNull(hierarchy.getRoundingParams());
    hierarchy.setRoundingParams(roundingParams);
}
Also used : GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) PointF(android.graphics.PointF) RoundingParams(com.facebook.drawee.generic.RoundingParams)

Aggregations

RoundingParams (com.facebook.drawee.generic.RoundingParams)11 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)7 View (android.view.View)5 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)5 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)4 Resources (android.content.res.Resources)2 Animatable (android.graphics.drawable.Animatable)2 Uri (android.net.Uri)2 ViewGroup (android.view.ViewGroup)2 CompoundButton (android.widget.CompoundButton)2 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)2 ControllerListener (com.facebook.drawee.controller.ControllerListener)2 DraweeController (com.facebook.drawee.interfaces.DraweeController)2 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageManager (android.content.pm.PackageManager)1 PointF (android.graphics.PointF)1 Drawable (android.graphics.drawable.Drawable)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 Nullable (android.support.annotation.Nullable)1