use of org.aisen.weibo.sina.sinasdk.bean.WeiBoUser in project AisenWeiBo by wangdan.
the class CommentItemView method onBindData.
@Override
public void onBindData(View convertView, StatusComment data, int position) {
WeiBoUser user = data.getUser();
if (user != null) {
BitmapLoader.getInstance().display(fragment, AisenUtils.getUserPhoto(user), imgPhoto, ImageConfigUtils.getLargePhotoConfig());
BizFragment.createBizFragment(fragment).userShow(imgPhoto, user);
txtName.setText(AisenUtils.getUserScreenName(user));
} else {
BizFragment.createBizFragment(fragment).userShow(imgPhoto, null);
txtName.setText(R.string.error_cmts);
imgPhoto.setImageResource(R.drawable.user_placeholder);
}
txtContent.setContent(AisenUtils.getCommentText(data.getText()));
AisenUtils.setTextSize(txtContent);
String createAt = AisenUtils.convDate(data.getCreated_at());
String from = String.format("%s", Html.fromHtml(data.getSource()));
String desc = String.format("%s %s", createAt, from);
txtDesc.setText(desc);
// 源评论
if (data.getReply_comment() != null) {
layRe.setVisibility(View.VISIBLE);
txtReContent.setContent(AisenUtils.getCommentText(data.getReply_comment().getText()));
AisenUtils.setTextSize(txtReContent);
if (data.getReply_comment().getUser() != null) {
BitmapLoader.getInstance().display(fragment, AisenUtils.getUserPhoto(data.getReply_comment().getUser()), imgRePhoto, ImageConfigUtils.getLargePhotoConfig());
BizFragment.createBizFragment(fragment).userShow(imgRePhoto, data.getReply_comment().getUser());
} else {
BizFragment.createBizFragment(fragment).userShow(imgRePhoto, null);
}
} else {
layRe.setVisibility(View.GONE);
}
if (layStatus != null) {
if (data.getStatus() != null && mStatus == null) {
layDivider.setVisibility(View.VISIBLE);
layStatus.setVisibility(View.VISIBLE);
layStatus.setTag(data.getStatus());
layStatus.setOnClickListener(this);
txtStatusContent.setContent(data.getStatus().getText());
AisenUtils.setTextSize(txtStatusContent);
String image = null;
// 先取微博的第一张图
StatusContent status = data.getStatus();
if (status != null && status.getRetweeted_status() != null)
status = status.getRetweeted_status();
if (status == null || status.getPic_urls() == null || status.getPic_urls().length == 0) {
} else {
image = status.getPic_urls()[0].getThumbnail_pic();
}
// 没图就取头像
if (TextUtils.isEmpty(image) && status.getUser() != null) {
image = status.getUser().getAvatar_large();
}
if (!TextUtils.isEmpty(image)) {
imgView.setVisibility(View.VISIBLE);
ImageConfig config = new ImageConfig();
config.setId("comments");
config.setLoadfaildRes(R.drawable.bg_timeline_loading);
config.setLoadingRes(R.drawable.bg_timeline_loading);
config.setMaxWidth(300);
config.setMaxHeight(300);
config.setBitmapCompress(TimelineThumbBitmapCompress.class);
BitmapLoader.getInstance().display(fragment, image, imgView, config);
} else {
imgView.setVisibility(View.GONE);
}
BizFragment.createBizFragment(fragment).bindOnTouchListener(txtStatusContent);
} else {
layDivider.setVisibility(View.GONE);
layStatus.setVisibility(View.GONE);
}
}
if (btnMenus != null) {
btnMenus.setTag(data);
btnMenus.setOnClickListener(this);
}
}
use of org.aisen.weibo.sina.sinasdk.bean.WeiBoUser in project AisenWeiBo by wangdan.
the class PublishStatusRepostFragment method layoutInit.
@Override
protected void layoutInit(LayoutInflater inflater, Bundle savedInstanceState) {
super.layoutInit(inflater, savedInstanceState);
btnOverflow.setVisibility(View.GONE);
editContent.setHint(R.string.publish_share_def);
if (getPublishBean().getStatusContent().getRetweeted_status() != null || getPublishBean().getExtras() != null && getPublishBean().getExtras().containsKey("weiguan")) {
WeiBoUser user = getPublishBean().getStatusContent().getUser();
if (user != null) {
editContent.setText(String.format("//@%s:%s", user.getScreen_name(), getPublishBean().getStatusContent().getText()));
if (getPublishBean().getExtras() != null && getPublishBean().getExtras().containsKey("weiguan"))
editContent.setText(String.format("→_→%s", editContent.getText().toString()));
} else {
showMessage(R.string.publish_status_none);
return;
}
}
// 当转发,内容为空时,自动添加"转发微博"
if (TextUtils.isEmpty(editContent.getText().toString().trim())) {
// editContent.setText(R.string.publish_also_repost);
// editContent.setSelection(editContent.getText().toString().length());
}
StatusContent status = getPublishBean().getStatusContent().getRetweeted_status() != null ? getPublishBean().getStatusContent().getRetweeted_status() : getPublishBean().getStatusContent();
txtContent.setText(AisenUtils.getCommentText(status.getText()));
if (status.getUser() != null)
BitmapLoader.getInstance().display(this, AisenUtils.getUserPhoto(status.getUser()), imgPhoto, ImageConfigUtils.getLargePhotoConfig());
checkBox.setText(R.string.publish_cmt_to_user);
checkBox.setChecked("3".equals(getPublishBean().getParams().getParameter("is_comment")));
checkBox.setOnCheckedChangeListener(this);
((BaseActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
((BaseActivity) getActivity()).getSupportActionBar().setTitle(R.string.title_repost);
}
use of org.aisen.weibo.sina.sinasdk.bean.WeiBoUser in project AisenWeiBo by wangdan.
the class SearchHeaderView method onClick.
@Override
public void onClick(View v) {
final SearchsResultUser data = (SearchsResultUser) v.getTag();
WeiBoUser user = new WeiBoUser();
user.setId(data.getId());
user.setIdstr(data.getId());
if (data.isFollowing()) {
BizFragment.createBizFragment(fragment).destoryFriendship(user, new BizFragment.OnDestoryFriendshipCallback() {
@Override
public void onFriendshipDestoryed(WeiBoUser targetUser) {
data.setFollowing(false);
basicRecycleViewAdapter.notifyDataSetChanged();
}
});
} else {
BizFragment.createBizFragment(fragment).createFriendship(user, new BizFragment.OnCreateFriendshipCallback() {
@Override
public void onFriendshipCreated(WeiBoUser targetUser) {
data.setFollowing(true);
basicRecycleViewAdapter.notifyDataSetChanged();
}
});
}
}
use of org.aisen.weibo.sina.sinasdk.bean.WeiBoUser in project AisenWeiBo by wangdan.
the class APublishFragment method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1000 && resultCode == Activity.RESULT_OK) {
WeiBoUser user = (WeiBoUser) data.getSerializableExtra("bean");
Editable editAble = editContent.getEditableText();
int start = editContent.getSelectionStart();
editAble.insert(start, String.format("@%s ", user.getScreen_name()));
} else if (requestCode == 3333 && resultCode == Activity.RESULT_OK) {
if (data != null) {
String[] pics = data.getStringArrayExtra("pics");
if (pics != null) {
getPublishBean().setPics(pics);
onPicChanged(pics);
refreshUI();
}
}
} else {
if (photoChoice != null)
photoChoice.onActivityResult(requestCode, resultCode, data);
}
}
use of org.aisen.weibo.sina.sinasdk.bean.WeiBoUser in project AisenWeiBo by wangdan.
the class MentionSuggestionFragment method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MentionSuggestionBean bean = getAdapterItems().get(position);
WeiBoUser friend = bean.getUser();
if (friend == null) {
friend = new WeiBoUser();
friend.setIdstr(bean.getSuggestUser().getUid());
friend.setScreen_name(bean.getSuggestUser().getNickname());
new UserShowTask().execute(friend.getScreen_name());
} else {
FriendMentionDB.addFriend(friend);
}
Intent data = new Intent();
data.putExtra("bean", friend);
getActivity().setResult(Activity.RESULT_OK, data);
getActivity().finish();
}
Aggregations