From bd26b649f0bff41adf16ea8cbd7fc727e37552b1 Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Mon, 12 Aug 2024 11:04:54 +0200 Subject: [PATCH] Use system background for main activity in landscape --- .../gmail/simetist/stereophoniccalculator/MainActivity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/gmail/simetist/stereophoniccalculator/MainActivity.kt b/app/src/main/java/com/gmail/simetist/stereophoniccalculator/MainActivity.kt index 143d6b6..433e159 100644 --- a/app/src/main/java/com/gmail/simetist/stereophoniccalculator/MainActivity.kt +++ b/app/src/main/java/com/gmail/simetist/stereophoniccalculator/MainActivity.kt @@ -27,6 +27,7 @@ import android.content.res.Configuration import android.graphics.Color import android.os.Bundle import android.util.Log +import android.util.TypedValue import android.view.KeyEvent import android.view.View import android.view.ViewGroup @@ -679,7 +680,10 @@ class MainActivity : AppCompatActivity() { ViewGroup.LayoutParams.MATCH_PARENT ) // Set background color for graphicsFrameLayout - graphicsViewLayout.setBackgroundColor(Color.BLACK) + val backgroundColorValue = TypedValue() + theme.resolveAttribute(android.R.attr.colorBackground, backgroundColorValue, true) + val backgroundColor = backgroundColorValue.data + graphicsViewLayout.setBackgroundColor(backgroundColor) } graphicsView.resetCache()