From 21ac7ea2f569f169670a6ad539bbb0342cb40efd Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Fri, 10 May 2024 17:42:03 +0200 Subject: [PATCH] reduce black borders with split screens --- app/src/main/java/xdsopl/robot36/MainActivity.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/xdsopl/robot36/MainActivity.java b/app/src/main/java/xdsopl/robot36/MainActivity.java index 9933d16..11485a1 100644 --- a/app/src/main/java/xdsopl/robot36/MainActivity.java +++ b/app/src/main/java/xdsopl/robot36/MainActivity.java @@ -584,12 +584,15 @@ public class MainActivity extends AppCompatActivity { } private void createScope(Configuration config) { - int width = scopeBuffer.width; - int height = scopeBuffer.height / 2; + int screenWidthDp = config.screenWidthDp; + int screenHeightDp = config.screenHeightDp; + int freqPlotHeightDp = 64; if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) - height /= 2; + screenWidthDp /= 2; else - height = Math.min(Math.max((width * (config.screenHeightDp - 101)) / config.screenWidthDp, height / 2), height); + screenHeightDp -= freqPlotHeightDp; + int width = scopeBuffer.width; + int height = Math.min(Math.max((width * screenHeightDp) / screenWidthDp, 496), scopeBuffer.height / 2); scopeBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); int stride = scopeBuffer.width; int offset = stride * (scopeBuffer.line + scopeBuffer.height / 2 - height);