Example usage for android.widget ImageView setMinimumHeight

List of usage examples for android.widget ImageView setMinimumHeight

Introduction

In this page you can find the example usage for android.widget ImageView setMinimumHeight.

Prototype

@RemotableViewMethod
public void setMinimumHeight(int minHeight) 

Source Link

Document

Sets the minimum height of the view.

Usage

From source file:com.nd.pad.GreenBrowser.util.ImageDownloader.java

/**
 * Same as download but the image is always downloaded and the cache is not used. Kept private at the moment as its
 * interest is not clear.//  w  w  w. j a  va 2  s. c o  m
 */
private void forceDownload(String url, ImageView imageView, int width, int height, String parentFullFileName,
        int loadingDrawable_ID, int failDrawable_ID, boolean isSaveLocal, ImageDownLoaderAction action) {
    // State sanity: url is guaranteed to never be null in
    // DownloadedDrawable and cache keys.
    if (url == null) {
        imageView.setImageResource(failDrawable_ID);
        return;
    }
    if (cancelPotentialDownload(url, imageView)) {
        /*modeCORRECT*/
        switch (mode) {
        case NO_ASYNC_TASK:
            Bitmap bitmap = downloadBitmap(url);
            addBitmapToCache(url, bitmap);
            imageView.setImageBitmap(bitmap);
            break;

        case NO_DOWNLOADED_DRAWABLE:
            imageView.setMinimumHeight(156);
            BitmapDownloaderTask task = new BitmapDownloaderTask(imageView, failDrawable_ID, isSaveLocal,
                    action);
            task.execute(url);
            break;

        case CORRECT:
            task = new BitmapDownloaderTask(imageView, width, height, parentFullFileName, failDrawable_ID,
                    isSaveLocal, action);
            DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task, loadingDrawable_ID);
            imageView.setImageDrawable(downloadedDrawable);
            imageView.setMinimumHeight(156);
            try {
                task.execute(url);
            } catch (RejectedExecutionException localRejectedExecutionException) {
            }
            break;
        }
    }
}

From source file:com.pongme.utils.ImageDownloader.java

/**
 * Same as download but the image is always downloaded and the cache is not
 * used. Kept private at the moment as its interest is not clear.
 *//*from www.  j  a v  a2 s  . c o  m*/
private BitmapDownloaderTask forceDownload(String url, ImageView imageView, BitmapDrawable tempImage) {
    // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys.
    BitmapDownloaderTask task = null;

    if (url == null) {
        imageView.setImageDrawable(null);
        // imageView.setImageResource(R.drawable.home_img_download);
        return null;
    }

    int w = 0, h = 0;
    LayoutParams params = imageView.getLayoutParams();
    if (params != null) {
        w = params.width;
        h = params.height;
    }

    // Change Task attributes if exist intead of Cancel

    if (refactorPotentialDownload(url, imageView, w, h)) {
        switch (mode) {
        case NO_ASYNC_TASK:
            Bitmap bitmap = downloadBitmap(url, w, h);
            addBitmapToCache(url, bitmap);
            imageView.setImageBitmap(bitmap);
            break;

        case NO_DOWNLOADED_DRAWABLE:
            imageView.setMinimumHeight(96);
            imageView.setMinimumWidth(128);
            task = new BitmapDownloaderTask(imageView, w, h);
            task.execute(url);
            break;

        case CORRECT:
            task = new BitmapDownloaderTask(imageView, w, h);
            DownloadedDrawable downloadedDrawable = null;
            if (tempImage != null) {
                downloadedDrawable = new DownloadedDrawable(task, tempImage);
            } else {
                downloadedDrawable = new DownloadedDrawable(task);
            }

            int minWith = 0;
            int minheight = 0;
            if (params != null) {
                minWith = params.width;
                minheight = params.height;
            }

            imageView.setImageDrawable(downloadedDrawable);
            imageView.setMinimumWidth(minWith);
            imageView.setMinimumHeight(minheight);

            task.execute(url);
            break;
        }
    }

    return task;
}

From source file:com.nd.teacherplatform.util.ImageDownloader.java

/**
 * Same as download but the image is always downloaded and the cache is not
 * used. Kept private at the moment as its interest is not clear.
 *//* w  w  w.  j  av a  2s.  co m*/
private void forceDownload(String url, ImageView imageView, int width, int height, String parentFullFileName,
        int loadingDrawable_ID, int failDrawable_ID, boolean isSaveLocal, ImageDownLoaderAction action) {
    // State sanity: url is guaranteed to never be null in
    // DownloadedDrawable and cache keys.
    if (url == null) {
        imageView.setImageResource(failDrawable_ID);
        return;
    }
    if (cancelPotentialDownload(url, imageView)) {
        /* modeCORRECT */
        switch (mode) {
        case NO_ASYNC_TASK:
            Bitmap bitmap = downloadBitmap(url);
            addBitmapToCache(url, bitmap);
            imageView.setImageBitmap(bitmap);
            break;

        case NO_DOWNLOADED_DRAWABLE:
            imageView.setMinimumHeight(156);
            BitmapDownloaderTask task = new BitmapDownloaderTask(imageView, failDrawable_ID, isSaveLocal,
                    action);
            task.execute(url);
            break;

        case CORRECT:
            task = new BitmapDownloaderTask(imageView, width, height, parentFullFileName, failDrawable_ID,
                    isSaveLocal, action);
            DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task, loadingDrawable_ID);
            imageView.setImageDrawable(downloadedDrawable);
            imageView.setMinimumHeight(156);
            try {
                task.execute(url);
            } catch (RejectedExecutionException localRejectedExecutionException) {
            }
            break;
        }
    }
}