Skip to content

Commit

Permalink
app: Show debug info for debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mikooomich committed Jan 2, 2025
1 parent 2d6d3ab commit 280c844
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
33 changes: 32 additions & 1 deletion app/src/main/java/com/dd3boh/outertune/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalFocusManager
Expand Down Expand Up @@ -297,7 +298,7 @@ class MainActivity : ComponentActivity() {
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
@SuppressLint(
"UnusedMaterial3ScaffoldPaddingParameter", "CoroutineCreationDuringComposition",
"StateFlowValueCalledInComposition"
"StateFlowValueCalledInComposition", "UnusedBoxWithConstraintsScope"
)
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -817,6 +818,36 @@ class MainActivity : ComponentActivity() {
}
}
}

if (BuildConfig.DEBUG) {
val debugColour = Color.Red
Column(
modifier = Modifier
.align(Alignment.BottomEnd)
.offset(y = 100.dp)
) {
Text(
text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE}) | ${BuildConfig.FLAVOR}",
style = MaterialTheme.typography.bodySmall,
color = debugColour
)
Text(
text = "${BuildConfig.APPLICATION_ID} | ${BuildConfig.BUILD_TYPE}",
style = MaterialTheme.typography.bodySmall,
color = debugColour
)
Text(
text = "${Build.BRAND} ${Build.DEVICE} (${Build.MODEL})",
style = MaterialTheme.typography.bodySmall,
color = debugColour
)
Text(
text = "${Build.VERSION.SDK_INT} (${Build.ID})",
style = MaterialTheme.typography.bodySmall,
color = debugColour
)
}
}
},
bottomBar = {
Box() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dd3boh.outertune.ui.screens.settings

import android.os.Build
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
Expand Down Expand Up @@ -31,6 +32,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
Expand Down Expand Up @@ -152,6 +154,52 @@ fun AboutScreen(
color = MaterialTheme.colorScheme.secondary
)

// debug info
if (BuildConfig.DEBUG) {
Spacer(Modifier.height(400.dp))
Row(
verticalAlignment = Alignment.Top,
) {
Text(
text = "Device info (Debug)",
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.Bold,
color = Color.Red,
modifier = Modifier.padding(top = 8.dp, bottom = 4.dp)
)
}

val info = listOf<String>(
"Device: ${Build.BRAND} ${Build.DEVICE} (${Build.MODEL})",
"Manufacturer: ${Build.MANUFACTURER}",
"HW: ${Build.BOARD} (${Build.HARDWARE})",
"ABIs: ${Build.SUPPORTED_ABIS.joinToString()})",
"Android: ${Build.VERSION.SDK_INT} (${Build.ID})",
Build.DISPLAY,
Build.PRODUCT,
Build.FINGERPRINT,
Build.VERSION.SECURITY_PATCH

// needs sdk 29 or 31
// Build.SKU ,
// Build.ODM_SKU ,
// Build.SOC_MODEL ,
// Build.SOC_MANUFACTURER ,
)

Column(
modifier = Modifier.padding(16.dp)
) {
info.forEach {
Text(
text = it,
style = MaterialTheme.typography.bodySmall,
color = Color.Red,
)
}
}
}

}

TopAppBar(
Expand Down

0 comments on commit 280c844

Please sign in to comment.