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:Main.java

@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static void resizeImageView(Context ctx, ImageView imgView) {
    WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    int width;//from   w  ww.j a  v  a  2 s  .c o  m
    // int height;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) {
        width = display.getWidth(); // deprecated
        // height = display.getHeight(); // deprecated
    } else {
        Point size = new Point();
        display.getSize(size);
        width = size.x;
        // height = size.y;
    }

    imgView.setMinimumHeight(width);
    imgView.setMinimumWidth(width);
    imgView.getLayoutParams().height = width;
    imgView.getLayoutParams().width = width;
}

From source file:com.github.omadahealth.slidepager.lib.views.SlideChartView.java

/**
 * Init the {@link android.graphics.Color} of the {@link #mChartBarList}
 *//* w  ww .  j  a v a  2s.co  m*/
private void initBarColorsAndSize() {
    for (ImageView imageView : mChartBarList) {
        imageView.setBackgroundColor(mChartBarColor);
        if (imageView.getId() != R.id.progress_bottom_axis) {
            imageView.setMinimumHeight((int) (mChartBarSize / 2.0f));
        }
    }
}

From source file:com.landenlabs.all_devtool.IconBaseFragment.java

/**
 * Show a 'LayerDrawable'  information.//from  w w  w  .  jav a2  s. co m
 *
 * @param imageView
 * @param row1
 * @param row2
 * @param iconD
 * @param layerIdx
 */
private void showLayerIcon(final ImageView imageView, TableRow row1, TableRow row2, Drawable iconD,
        int layerIdx) {

    if (iconD != null) {
        ImageView layerImageView = new ImageView(imageView.getContext());

        layerImageView.setImageDrawable(iconD);
        layerImageView.setPadding(10, 10, 10, 10);
        layerImageView.setMinimumHeight(8);
        layerImageView.setMinimumWidth(8);
        layerImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                imageView.setImageDrawable(((ImageView) v).getDrawable());
            }
        });

        TextView stateTextView = new TextView(imageView.getContext());
        stateTextView.setText(String.valueOf(layerIdx));
        stateTextView.setTextSize(12);
        stateTextView.setGravity(Gravity.CENTER);

        row1.addView(stateTextView);
        row2.addView(layerImageView);
    }
}

From source file:com.cleverua.test.thumbs.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, Drawable placeHolder) {
    // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys.
    if (url == null) {
        imageView.setImageDrawable(null);
        return;
    }

    if (removePotentialDownload(url, imageView)) {
        BitmapDownloaderTask task = new BitmapDownloaderTask(url, imageView);
        imageView.setImageDrawable(placeHolder);
        imageView.setTag(new WeakReference<BitmapDownloaderTask>(task));

        imageView.setMinimumHeight(156);

        pendingTasks.offerLast(task);
        if (loaderTask == null || loaderTask.getStatus() == AsyncTask.Status.FINISHED) {
            loaderTask = pendingTasks.poll();
            loaderTask.execute();
        }
    }
}

From source file:com.example.igorklimov.popularmoviesdemo.helpers.CustomAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    Log.d(LOG_TAG, "onCreateViewHolder: ");
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_movie, parent, false);
    ImageView posterImageView = (ImageView) view.findViewById(R.id.poster);
    boolean isTablet = Utility.isTabletPreference(mContext);
    if (mMinWidth == 0) {
        if (isTablet && mOrientation == Configuration.ORIENTATION_PORTRAIT) {
            mMinHeight = mRecyclerView.getHeight();
            mMinWidth = (int) (((double) mMinHeight / 278) * 185);
        } else {/*from ww w  .j a v a2  s  .  c  o  m*/
            mMinWidth = mRecyclerView.getWidth()
                    / (mOrientation == Configuration.ORIENTATION_LANDSCAPE || isTablet ? 3 : 2);
            mMinHeight = (int) (((double) mMinWidth / 185) * 278);
        }
    }
    posterImageView.setMinimumWidth(mMinWidth);
    posterImageView.setMinimumHeight(mMinHeight);
    return new ViewHolder(view);
}

From source file:com.color.droid.efficientimageloading.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  ww .j  av a2 s .c  om
private void forceDownload(String url, ImageView imageView) {
    // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys.
    if (url == null) {
        imageView.setImageDrawable(null);
        return;
    }

    if (cancelPotentialDownload(url, imageView)) {
        BitmapDownloaderTask task = new BitmapDownloaderTask(imageView);
        DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
        imageView.setImageDrawable(downloadedDrawable);
        imageView.setMinimumHeight(156);
        task.execute(url);
    }
}

From source file:com.example.imagedownloader.ImageDownloader.java

/**
 * Download the specified image from the Internet and binds it to the
 * provided ImageView. The binding is immediate if the image is found in the
 * cache and will be done asynchronously otherwise. A null bitmap will be
 * associated to the ImageView if an error occurs.
 * //from w  w  w  .j a  v  a  2  s.  c om
 * @param url
 *            The URL of the image to download.
 * @param imageView
 *            The ImageView to bind the downloaded image to.
 */
public void download(String url, ImageView imageView) {
    if (url == null) {
        imageView.setImageDrawable(null);
        return;
    }
    if (cancelPotentialDownload(url, imageView)) {
        BitmapDownloaderTask task = new BitmapDownloaderTask(imageView);
        DownloadedDrawable downloadedDrawable = new DownloadedDrawable(context.getResources(),
                mPlaceHolderBitmap, task);
        imageView.setImageDrawable(downloadedDrawable);
        imageView.setMinimumHeight(156);
        task.execute(url);
    }
}

From source file:com.image.oom.ImageUtil.java

private void forceDownload(String url, ImageView imageView) {
    // State sanity: url is guaranteed to never be null in
    // DownloadedDrawable and cache keys.
    if (url == null) {
        imageView.setImageDrawable(null);
        return;/*  w ww . j  a  v  a  2 s  . c o  m*/
    }

    if (cancelPotentialDownload(url, imageView)) {

        BitmapDownloaderTask task = new BitmapDownloaderTask(imageView);
        task = new BitmapDownloaderTask(imageView);
        DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
        imageView.setImageDrawable(downloadedDrawable);
        imageView.setMinimumHeight(156);
        task.execute(url);

    }
}

From source file:com.samsunghack.apps.android.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.
 *//* w  w  w  .  jav a  2  s .  co  m*/
private void forceDownload(String url, ImageView imageView) {
    // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys.
    if (url == null) {
        imageView.setImageDrawable(null);
        return;
    }

    if (cancelPotentialDownload(url, imageView)) {
        switch (mode) {

        case CORRECT:
            BitmapDownloaderTask task = new BitmapDownloaderTask(imageView);
            DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
            imageView.setImageDrawable(downloadedDrawable);
            imageView.setMinimumHeight(100);
            task.execute(url);
            break;
        }
    }
}

From source file:br.com.ettore.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.
 *//* www.j av  a2  s  . c om*/
private void forceDownload(String url, ImageView imageView) {
    // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys.
    if (url == null) {
        imageView.setImageDrawable(null);
        return;
    }

    if (cancelPotentialDownload(url, imageView)) {
        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);
            task.execute(url);
            break;

        case CORRECT:
            task = new BitmapDownloaderTask(imageView);
            DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
            imageView.setImageDrawable(downloadedDrawable);
            imageView.setMinimumHeight(156);
            task.execute(url);
            break;
        }
    }
}