use of org.aisen.android.component.bitmaploader.core.ImageConfig in project AisenWeiBo by wangdan.
the class WallpaperSettingActivity method onSetWallpaper.
@Override
public void onSetWallpaper(boolean success) {
setWaveBackground(setting, true, R.drawable.ic_set_wallpaper_normal, 0);
if (success) {
ImageConfig config = new ImageConfig();
config.setLoadfaildRes(R.drawable.bg_timeline_loading);
config.setLoadingRes(R.drawable.bg_timeline_loading);
config.setDownloaderClass(SdcardDownloader.class);
config.setDisplayer(new DefaultDisplayer());
BitmapLoader.getInstance().display(null, origFile.getAbsolutePath(), photoView, config);
}
}
use of org.aisen.android.component.bitmaploader.core.ImageConfig in project AisenWeiBo by wangdan.
the class WallpaperSettingActivity method setupPhotoView.
private void setupPhotoView(Bundle savedInstanceState) {
photoView.setOnPhotoTapListener(new AttacherInterface.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
finish();
}
});
if (getIntent().getExtras().containsKey(Intent.EXTRA_STREAM)) {
thumbFile = new File(getPath((Uri) getIntent().getParcelableExtra(Intent.EXTRA_STREAM)));
origURL = getIntent().getExtras().getString("origURL");
if (!TextUtils.isEmpty(origURL)) {
Logger.d("Wallpaper", origURL);
origFile = BitmapLoader.getInstance().getCacheFile(origURL);
WallpaperDownloadTask.bindWallpaper(this, origURL, KeyGenerator.generateMD5(origURL), this);
}
if (getFile().exists()) {
ImageConfig config = new ImageConfig();
config.setLoadfaildRes(R.drawable.bg_timeline_loading);
config.setLoadingRes(R.drawable.bg_timeline_loading);
config.setDownloaderClass(SdcardDownloader.class);
config.setDisplayer(new DefaultDisplayer());
BitmapLoader.getInstance().display(null, getFile().getAbsolutePath(), photoView, config);
return;
}
}
finish();
}
use of org.aisen.android.component.bitmaploader.core.ImageConfig in project AisenWeiBo by wangdan.
the class ImageConfigUtils method getPhotoCoverConfig.
public static ImageConfig getPhotoCoverConfig() {
ImageConfig config = new ImageConfig();
config.setLoadingRes(R.drawable.bg_banner_dialog);
config.setLoadfaildRes(R.drawable.bg_banner_dialog);
return config;
}
use of org.aisen.android.component.bitmaploader.core.ImageConfig 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.android.component.bitmaploader.core.ImageConfig 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());
}
}
Aggregations