Search in sources :

Example 1 with DefaultDisplayer

use of org.aisen.android.component.bitmaploader.display.DefaultDisplayer 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);
    }
}
Also used : ImageConfig(org.aisen.android.component.bitmaploader.core.ImageConfig) DefaultDisplayer(org.aisen.android.component.bitmaploader.display.DefaultDisplayer)

Example 2 with DefaultDisplayer

use of org.aisen.android.component.bitmaploader.display.DefaultDisplayer 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();
}
Also used : ImageConfig(org.aisen.android.component.bitmaploader.core.ImageConfig) DefaultDisplayer(org.aisen.android.component.bitmaploader.display.DefaultDisplayer) AttacherInterface(org.aisen.weibo.sina.ui.widget.photoview.AttacherInterface) WaveView(org.aisen.weibo.sina.ui.widget.WaveView) PhotoView(org.aisen.weibo.sina.ui.widget.photoview.PhotoView) View(android.view.View) File(java.io.File)

Example 3 with DefaultDisplayer

use of org.aisen.android.component.bitmaploader.display.DefaultDisplayer in project AisenWeiBo by wangdan.

the class ImageConfigUtils method getPhotoConfig.

public static ImageConfig getPhotoConfig() {
    ImageConfig config = new ImageConfig();
    config.setLoadingRes(R.drawable.user_placeholder);
    config.setLoadfaildRes(R.drawable.user_placeholder);
    config.setDisplayer(new DefaultDisplayer());
    return config;
}
Also used : ImageConfig(org.aisen.android.component.bitmaploader.core.ImageConfig) DefaultDisplayer(org.aisen.android.component.bitmaploader.display.DefaultDisplayer)

Example 4 with DefaultDisplayer

use of org.aisen.android.component.bitmaploader.display.DefaultDisplayer in project AisenWeiBo by wangdan.

the class ImageConfigUtils method getLargePhotoConfig.

public static ImageConfig getLargePhotoConfig() {
    ImageConfig config = new ImageConfig();
    config.setId("large");
    config.setDisplayer(new DefaultDisplayer());
    config.setLoadingRes(R.drawable.user_placeholder);
    config.setLoadfaildRes(R.drawable.user_placeholder);
    return config;
}
Also used : ImageConfig(org.aisen.android.component.bitmaploader.core.ImageConfig) DefaultDisplayer(org.aisen.android.component.bitmaploader.display.DefaultDisplayer)

Example 5 with DefaultDisplayer

use of org.aisen.android.component.bitmaploader.display.DefaultDisplayer in project AisenWeiBo by wangdan.

the class ProfilePagerFragment method setProfile.

private void setProfile() {
    // 封面
    ImageConfig coverConfig = new ImageConfig();
    coverConfig.setLoadfaildRes(R.drawable.bg_banner_dialog);
    coverConfig.setLoadingRes(R.drawable.bg_banner_dialog);
    coverConfig.setDisplayer(new DefaultDisplayer());
    BitmapLoader.getInstance().display(this, mUser.getCover_image_phone(), imgCover, coverConfig);
    // 名字
    // fuck 2014-09-04 当名字过长大于10个字时,截取部分文字
    //        int maxLength = AisenUtils.getStrLength("一二三四五六七八九十");
    int maxLength = AisenUtils.getStrLength("一二三四五");
    if (AisenUtils.getStrLength(mUser.getName()) > maxLength) {
        StringBuffer sb = new StringBuffer();
        int index = 0;
        while (AisenUtils.getStrLength(sb.toString()) < maxLength) {
            if (index >= mUser.getName().length())
                break;
            sb.append(mUser.getName().charAt(index));
            index++;
        }
        sb.append("...");
        txtName.setText(sb.toString());
    } else {
        txtName.setText(mUser.getScreen_name());
    }
    // 头像
    File avatarFile = BitmapLoader.getInstance().getCacheFile(AisenUtils.getUserPhoto(mUser));
    if (avatarFile.exists()) {
        Bitmap bitmap = BitmapFactory.decodeFile(avatarFile.getAbsolutePath());
        imgAvatar.setImageBitmap(bitmap);
        collapsingToolbarLayout.setAvatarBitmap(bitmap);
    } else {
        ImageConfig config = new ImageConfig();
        config.setId("large");
        config.setDisplayer(new DefaultDisplayer());
        config.setLoadingRes(R.drawable.user_placeholder);
        config.setLoadfaildRes(R.drawable.user_placeholder);
        config.setProgress(new DownloadProcess() {

            @Override
            public void finishedDownload(byte[] bytes) {
                super.finishedDownload(bytes);
                collapsingToolbarLayout.setAvatarBitmap(BitmapFactory.decodeByteArray(bytes, 0, bytes.length));
            }
        });
        BitmapLoader.getInstance().display(this, AisenUtils.getUserPhoto(mUser), imgAvatar, config);
    }
    // 性别
    imgGender.setVisibility(View.VISIBLE);
    if ("m".equals(mUser.getGender()))
        imgGender.setImageResource(R.drawable.list_male);
    else if ("f".equals(mUser.getGender()))
        imgGender.setImageResource(R.drawable.list_female);
    else
        imgGender.setVisibility(View.GONE);
    // 认证
    AisenUtils.setImageVerified(imgVerified, mUser);
    // 关注数
    txtFriendsCounter.setText(String.format(getString(R.string.profile_friends), AisenUtils.getCounter(mUser.getFriends_count())));
    // 粉丝数
    txtFollowersCounter.setText(String.format(getString(R.string.profile_followers), AisenUtils.getCounter(mUser.getFollowers_count())));
    // 简介
    txtDesc.setText(mUser.getDescription());
    // 简介
    if (!TextUtils.isEmpty(mUser.getDescription()))
        txtDesc.setText(mUser.getDescription());
    else
        txtDesc.setText(getString(R.string.profile_des_none));
}
Also used : ImageConfig(org.aisen.android.component.bitmaploader.core.ImageConfig) Bitmap(android.graphics.Bitmap) DefaultDisplayer(org.aisen.android.component.bitmaploader.display.DefaultDisplayer) DownloadProcess(org.aisen.android.component.bitmaploader.download.DownloadProcess) File(java.io.File)

Aggregations

ImageConfig (org.aisen.android.component.bitmaploader.core.ImageConfig)5 DefaultDisplayer (org.aisen.android.component.bitmaploader.display.DefaultDisplayer)5 File (java.io.File)2 Bitmap (android.graphics.Bitmap)1 View (android.view.View)1 DownloadProcess (org.aisen.android.component.bitmaploader.download.DownloadProcess)1 WaveView (org.aisen.weibo.sina.ui.widget.WaveView)1 AttacherInterface (org.aisen.weibo.sina.ui.widget.photoview.AttacherInterface)1 PhotoView (org.aisen.weibo.sina.ui.widget.photoview.PhotoView)1