use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.
the class APublishFragment method refreshUI.
/**
* 刷新视图
*/
void refreshUI() {
if (getPublishBean() == null)
return;
PublishBean bean = getPublishBean();
// 显示图片
if (bean.getExtras() != null && (bean.getPics() != null || bean.getParams().containsKey("url"))) {
String[] images = bean.getPics();
if (images == null) {
images = new String[] { bean.getParams().getParameter("url") };
}
if (TextUtils.isEmpty(editContent.getText().toString().trim()) && TextUtils.isEmpty(getPublishBean().getText())) {
// getPublishBean().setText(getString(R.string.publish_share_pic) + " ");
}
// 修改为支持多图
if (true) {
layImageCover.setVisibility(View.GONE);
picShow.setVisibility(View.GONE);
}
ImageConfig config = new ImageConfig();
config.setLoadfaildRes(R.drawable.bg_timeline_loading);
config.setLoadingRes(R.drawable.bg_timeline_loading);
config.setMaxWidth(SystemUtils.getScreenWidth(getActivity()));
config.setMaxHeight(SystemUtils.getScreenHeight(getActivity()) / 2);
config.setBitmapCompress(TimelineBitmapCompress.class);
config.setProgress(new PublishDownloadProcess());
if (layPicContainer != null) {
layPicContainer.removeAllViews();
scrollPicContainer.setVisibility(View.VISIBLE);
}
for (String path : images) {
View itemView = View.inflate(getActivity(), R.layout.item_publish_pic, null);
ImageView img = (ImageView) itemView.findViewById(R.id.img);
itemView.setTag(path);
itemView.setOnClickListener(onPictureClickListener);
if (path.toString().startsWith("content://")) {
Logger.v(TAG, "相册图片地址, path = " + path);
config.setDownloaderClass(ContentProviderDownloader.class);
} else if (path.toString().startsWith("http://") || path.toString().startsWith("https://")) {
Logger.v(TAG, "网络图片地址, path = " + path);
} else {
path = path.toString().replace("file://", "");
Logger.v(TAG, "拍照图片地址, path = " + path);
// 扫描文件
SystemUtils.scanPhoto(getActivity(), new File(path));
config.setDownloaderClass(SdcardDownloader.class);
}
BitmapLoader.getInstance().display(this, path, img, config);
if (layPicContainer != null) {
layPicContainer.addView(itemView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
}
}
} else {
if (scrollPicContainer != null)
scrollPicContainer.setVisibility(View.GONE);
layImageCover.setVisibility(View.GONE);
picShow.setVisibility(View.GONE);
}
// 文字内容
if (!TextUtils.isEmpty(bean.getText())) {
editContent.setText(bean.getText());
// 如果是意见反馈,不默认将光标移动到最后
if (bean.getExtras() != null && bean.getExtras().containsKey("feedback"))
;
else
editContent.setSelection(editContent.getText().toString().length());
}
}
use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.
the class PublishStatusFragment method newPublishBean.
@Override
PublishBean newPublishBean() {
PublishBean bean = new PublishBean();
bean.setStatus(PublishStatus.create);
bean.setType(PublishType.status);
Params params = new Params();
// 默认所有人可见
params.addParameter("visible", "0");
bean.setParams(params);
return bean;
}
use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.
the class PublishManager method cancelPublish.
public void cancelPublish() {
removeMessages(publishDelay);
PublishBean bean = publishQueue.poll();
if (bean != null) {
bean.setStatus(PublishStatus.draft);
PublishDB.addPublish(bean, loggedIn);
publishNotifier.notifyPublishCancelled(bean);
refreshDraftbox();
onPublish(publishQueue.peek());
}
}
use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.
the class PublishManager method publishInit.
/**
* 将添加状态的消息都加入到队列当中
*/
public void publishInit() {
List<PublishBean> beans = PublishDB.getPublishOfAddStatus(loggedIn);
for (PublishBean bean : beans) publishQueue.add(bean);
onPublish(publishQueue.peek());
}
use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.
the class PublishManager method handleMessage.
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch(msg.what) {
case publishDelay:
PublishBean bean = (PublishBean) msg.obj;
onPublish(bean);
break;
}
}
Aggregations