I am developing a chat and i use Recyclerview to show the messages. When the message is an image i use Glide to display it. Using glide i use the override function to show the image with specific dimensions. However this does not work very good because not all the phones have the same resolution and size.
bitmap?.let {
           //meaning the image is landscape view
                    if (bitmap.width > bitmap.height)
                        Glide.with(Application.instance)
                            .load(fileInfo.localUri)
                            .apply(RequestOptions().override(500, 250))
                            .into(holder.sntImageView)
                    else
                        Glide.with(Application.instance)
                            .load(fileInfo.localUri)
                            .apply(RequestOptions().override(250, 500))
                            .into(holder.sntImageView)
                    holder.sendingProgress.visibility = View.GONE
                    holder.sntBubble.visibility = View.GONE
                    holder.sntImageView.visibility = View.VISIBLE
                } ?: run {
                    holder.sntImageView.visibility = View.GONE
                    holder.sendingProgress.visibility = View.GONE
                    holder.sntBody.text = "Unable to decode image"
                }
So my question is how to use Glide so that the image has almost the half of the screen instead of 500, 250...?
 
    