credo-science / credo-detector-android

CREDO detector as Android application
Other
6 stars 11 forks source link

To simple preview size setting. #35

Open Hannibal-pl opened 6 years ago

Hannibal-pl commented 6 years ago

You assume that preview sizes are returned in descending order.

  val sizes = parameters.supportedPreviewSizes
        //val index = sizes.size/2 // ~medium resolution
        val index = if (ConfigurationInfo(this).isFullFrame) 0 else sizes.size/2
        for (size in sizes) {
            Log.d(TAG, "width: ${size.width}, height: ${size.height}")
        }
        Log.d(TAG,"will use: ${sizes[index].width}, height: ${sizes[index].height}")
        parameters.setPreviewSize(sizes[index].width, sizes[index].height)

This is not true on Gooclever TAB 813G. It return as first the lowest resolution. You should check sizes directly (ie. width*height) or sort this list by resolution size before.