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;
}
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);
}
}
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;
}
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;
}
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);
}
Aggregations