com.nostra13.universalimageloader.core.imageaware.ImageViewAware Java Examples

The following examples show how to use com.nostra13.universalimageloader.core.imageaware.ImageViewAware. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BraceletImageLoader$RoundBitmapDisplayer.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public void display(Bitmap bitmap, ImageAware imageaware, LoadedFrom loadedfrom)
{
    if (!(imageaware instanceof ImageViewAware))
    {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    }
    Bitmap bitmap1 = Util.clipToRoundBitmap(bitmap);
    ImageView imageview = (ImageView)imageaware.getWrappedView();
    if (bitmap1 == null || imageview == null)
    {
        return;
    } else
    {
        imageview.setBackground(new BitmapDrawable(imageview.getResources(), bitmap1));
        return;
    }
}
 
Example #2
Source File: VideoRow.java    From talk-android with MIT License 6 votes vote down vote up
Bitmap tryLoadBitmap(ImageViewAware imageAware) {
    Bitmap bitmap = null;
    try {
        java.io.File imageFile = diskCache.get(getMessage().get_id());
        if (imageFile != null && imageFile.exists() && imageFile.length() > 0) {
            ViewScaleType viewScaleType = imageAware.getScaleType();
            ImageSize imageSize = ImageSizeUtils.defineTargetSizeForView(imageAware, new ImageSize(MainApp.CONTEXT.getResources().getDisplayMetrics().widthPixels, MainApp.CONTEXT.getResources().getDisplayMetrics().heightPixels));
            ImageDecodingInfo decodingInfo = new ImageDecodingInfo(getMessage().get_id(),
                    ImageDownloader.Scheme.FILE.wrap(imageFile.getAbsolutePath()), getMessage().get_id(), imageSize, viewScaleType,
                    new BaseImageDownloader(MainApp.CONTEXT), options);
            bitmap = decoder.decode(decodingInfo);
            MainApp.memoryCache.put(getMessage().get_id(), bitmap);
        }
    } catch (Exception ignored) {
        ignored.printStackTrace();
    }
    return bitmap;
}
 
Example #3
Source File: RoundedBitmapDisplayer.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
}
 
Example #4
Source File: RoundedVignetteBitmapDisplayer.java    From letv with Apache License 2.0 5 votes vote down vote up
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    if (imageAware instanceof ImageViewAware) {
        imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, this.cornerRadius, this.margin));
        return;
    }
    throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
}
 
Example #5
Source File: CreditsAdapter.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
    ViewHolder holder;
    if (view == null) {
        view = View.inflate(mContext, R.layout.fragment_credits_item_list, null);
        holder = new ViewHolder(view);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }

    Credit credit = mCredits.get(position);
    holder.title.setText(credit.getName());
    holder.subtitle.setText(credit.getContribution());
    holder.container.setOnClickListener(view1 -> {
        String link = credit.getLink();
        if (URLUtil.isValidUrl(link)) {
            try {
                mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
            } catch (ActivityNotFoundException e) {
                LogUtil.e(Log.getStackTraceString(e));
            }
        }
    });

    if (credit.getContribution().length() == 0) {
        holder.subtitle.setVisibility(View.GONE);
    } else {
        holder.subtitle.setVisibility(View.VISIBLE);
    }

    ImageLoader.getInstance().displayImage(credit.getImage(),
            new ImageViewAware(holder.image), mOptions.build(),
            new ImageSize(144, 144), null, null);
    return view;
}
 
Example #6
Source File: CircleBitmapDisplayer.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    if (!(imageAware instanceof ImageViewAware)) {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    }

    imageAware.setImageDrawable(new CircleDrawable(bitmap, strokeColor, strokeWidth));
}
 
Example #7
Source File: CreditsAdapter.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
    ViewHolder holder;
    if (view == null) {
        view = View.inflate(mContext, R.layout.fragment_credits_item_list, null);
        holder = new ViewHolder(view);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }

    Credit credit = mCredits.get(position);
    holder.title.setText(credit.getName());
    holder.subtitle.setText(credit.getContribution());
    holder.container.setOnClickListener(view1 -> {
        String link = credit.getLink();
        if (URLUtil.isValidUrl(link)) {
            try {
                mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
            } catch (ActivityNotFoundException e) {
                LogUtil.e(Log.getStackTraceString(e));
            }
        }
    });

    if (credit.getContribution().length() == 0) {
        holder.subtitle.setVisibility(View.GONE);
    } else {
        holder.subtitle.setVisibility(View.VISIBLE);
    }

    ImageLoader.getInstance().displayImage(credit.getImage(),
            new ImageViewAware(holder.image), mOptions.build(),
            new ImageSize(144, 144), null, null);
    return view;
}
 
Example #8
Source File: ImageSizeTest.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	mActivity = new Activity();

	// Make and set view with some prelim values to test
	mView = new TestImageView(mActivity);
	mView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
	mView.measure(View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY));

	mImageAware = new ImageViewAware(mView);
}
 
Example #9
Source File: ImageSizeTest.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    mActivity = new Activity();

    // Make and set view with some prelim values to test
    mView = new TestImageView(mActivity);
    mView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mView.measure(View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY));

    mImageAware = new ImageViewAware(mView);
}
 
Example #10
Source File: RoundedBitmapDisplayer.java    From letv with Apache License 2.0 5 votes vote down vote up
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    if (imageAware instanceof ImageViewAware) {
        imageAware.setImageDrawable(new RoundedDrawable(bitmap, this.cornerRadius, this.margin));
        return;
    }
    throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
}
 
Example #11
Source File: WallpaperDetailsCategoryAdapter.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Category category = mCategories.get(position);
    holder.title.setText(category.getName());

    ImageLoader.getInstance().displayImage(
            category.getThumbUrl(),
            new ImageViewAware(holder.image),
            mOptions.build(),
            ImageConfig.getBigThumbnailSize(),
            null,
            null);
}
 
Example #12
Source File: CreditsAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
    ViewHolder holder;
    if (view == null) {
        view = View.inflate(mContext, R.layout.fragment_credits_item_list, null);
        holder = new ViewHolder(view);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }

    Credit credit = mCredits.get(position);
    holder.title.setText(credit.getName());
    holder.subtitle.setText(credit.getContribution());
    holder.container.setOnClickListener(view1 -> {
        String link = credit.getLink();
        if (URLUtil.isValidUrl(link)) {
            try {
                mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
            } catch (ActivityNotFoundException e) {
                LogUtil.e(Log.getStackTraceString(e));
            }
        }
    });

    if (credit.getContribution().length() == 0) {
        holder.subtitle.setVisibility(View.GONE);
    } else {
        holder.subtitle.setVisibility(View.VISIBLE);
    }

    ImageLoader.getInstance().displayImage(credit.getImage(),
            new ImageViewAware(holder.image), mOptions.build(),
            new ImageSize(144, 144), null, null);
    return view;
}
 
Example #13
Source File: IconsAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    holder.name.setText(mIcons.get(position).getTitle());

    ImageLoader.getInstance().displayImage("drawable://" + mIcons.get(position).getRes(),
            new ImageViewAware(holder.icon), mOptions.build(),
            new ImageSize(144, 144), null, null);
}
 
Example #14
Source File: RoundedBitmapDisplayer.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
}
 
Example #15
Source File: RoundedVignetteBitmapDisplayer.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
}
 
Example #16
Source File: ImageSizeTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	mActivity = new Activity();

	// Make and set view with some prelim values to test
	mView = new TestImageView(mActivity);
	mView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
	mView.measure(View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY));

	mImageAware = new ImageViewAware(mView);
}
 
Example #17
Source File: RoundedVignetteBitmapDisplayer.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    if (!(imageAware instanceof ImageViewAware)) {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    }

    imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
}
 
Example #18
Source File: RoundedCircleBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware,
		LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException(
				"ImageAware should wrap ImageView. ImageViewAware is expected.");
	}
	imageAware.setImageDrawable(new RoundedDrawable(bitmap, margin));
}
 
Example #19
Source File: CircleBorderBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware,
		LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException(
				"ImageAware should wrap ImageView. ImageViewAware is expected.");
	}
	imageAware
			.setImageDrawable(new RoundedDrawable(bitmap, margin, border));
}
 
Example #20
Source File: CircleBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new CircleDrawable(bitmap, strokeColor, strokeWidth));
}
 
Example #21
Source File: RoundedBitmapDisplayer.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
}
 
Example #22
Source File: RoundedVignetteBitmapDisplayer.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
}
 
Example #23
Source File: CircleBitmapDisplayer.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new CircleDrawable(bitmap, strokeColor, strokeWidth));
}
 
Example #24
Source File: ThumbViewActivity.java    From PinchImageView with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_thumb_view);

    final DisplayImageOptions thumbOptions = new DisplayImageOptions.Builder().cacheInMemory(true).build();
    final ImageLoader imageLoader = Global.getImageLoader(getApplicationContext());

    final ViewGroup root = (ViewGroup) findViewById(R.id.root);
    int l = root.getChildCount();
    for (int i = 0; i < l; i++) {
        final int fi = i;
        final ImageView thumb = (ImageView) ((ViewGroup) root.getChildAt(i)).getChildAt(0);
        final ImageViewAware thumbAware = new ImageViewAware(thumb);
        final String url = Global.getTestImage(i).getThumb(100, 100).url;
        imageLoader.displayImage(url, thumbAware, thumbOptions);
        thumb.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ThumbViewActivity.this, PicViewActivity.class);
                intent.putExtra("image", Global.getTestImage(fi));
                ImageSize targetSize = new ImageSize(thumbAware.getWidth(), thumbAware.getHeight());
                String memoryCacheKey = MemoryCacheUtils.generateKey(url, targetSize);
                intent.putExtra("cache_key", memoryCacheKey);
                Rect rect = new Rect();
                thumb.getGlobalVisibleRect(rect);
                intent.putExtra("rect", rect);
                intent.putExtra("scaleType", thumb.getScaleType());
                startActivity(intent);
            }
        });
    }
}
 
Example #25
Source File: UILImageLoader.java    From GalleryFinal with Apache License 2.0 5 votes vote down vote up
@Override
public void displayImage(Activity activity, String path, GFImageView imageView, Drawable defaultDrawable, int width, int height) {
    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .cacheOnDisk(false)
            .cacheInMemory(false)
            .bitmapConfig(mImageConfig)
            .build();
    ImageSize imageSize = new ImageSize(width, height);
    ImageLoader.getInstance().displayImage("file://" + path, new ImageViewAware(imageView), options, imageSize, null, null);
}
 
Example #26
Source File: RoundedBitmapDisplayer.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void display(Bitmap bitmap, ImageAware imageaware, LoadedFrom loadedfrom)
{
    if (!(imageaware instanceof ImageViewAware))
    {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    } else
    {
        imageaware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
        return;
    }
}
 
Example #27
Source File: RoundedVignetteBitmapDisplayer.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void display(Bitmap bitmap, ImageAware imageaware, LoadedFrom loadedfrom)
{
    if (!(imageaware instanceof ImageViewAware))
    {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    } else
    {
        imageaware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
        return;
    }
}
 
Example #28
Source File: OldRoundedBitmapDisplayer.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}
	Bitmap roundedBitmap = roundCorners(bitmap, (ImageViewAware) imageAware, roundPixels);
	imageAware.setImageBitmap(roundedBitmap);
}
 
Example #29
Source File: RoundedBitmapDisplayer.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
}
 
Example #30
Source File: CircleBitmapDisplayer.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new CircleDrawable(bitmap, strokeColor, strokeWidth));
}