Skip to content

Commit

Permalink
Add scrolling, adapt buttons to M3
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc2822 committed May 3, 2024
1 parent 8d24027 commit 45adc4c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
16 changes: 7 additions & 9 deletions app/src/main/kotlin/at/bitfire/davdroid/ui/DebugInfoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ class DebugInfoActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)

setContent {
M2Theme {
DebugInfoScreen(
model,
onShareFile = { shareFile(it) },
onShareZipFile = { onShareZipFile(it) },
onViewFile = { viewFile(it) },
onNavUp = { onNavigateUp() }
)
}
DebugInfoScreen(
model,
onShareFile = { shareFile(it) },
onShareZipFile = { onShareZipFile(it) },
onViewFile = { viewFile(it) },
onNavUp = { onNavigateUp() }
)
}
}

Expand Down
39 changes: 23 additions & 16 deletions app/src/main/kotlin/at/bitfire/davdroid/ui/DebugInfoScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package at.bitfire.davdroid.ui
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Adb
import androidx.compose.material.icons.rounded.BugReport
Expand All @@ -12,12 +14,12 @@ import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -135,9 +137,10 @@ fun DebugInfoScreen(
topBar = {
BasicTopAppBar(
titleStringRes = R.string.debug_info_title,
onNavigateUp = { onNavUp() }
onNavigateUp = onNavUp
)
}
},
modifier = Modifier.verticalScroll(rememberScrollState())
) { paddingValues ->

LaunchedEffect(error) {
Expand Down Expand Up @@ -176,12 +179,13 @@ fun DebugInfoScreen(
icon = Icons.Rounded.Share,
modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp)
) {
TextButton(
OutlinedButton(
onClick = onShareZip,
enabled = !zipProgress
enabled = !zipProgress,
modifier = Modifier.padding(bottom = 4.dp)
) {
Text(
stringResource(R.string.debug_info_archive_share).uppercase()
stringResource(R.string.debug_info_archive_share)
)
}
}
Expand All @@ -196,12 +200,13 @@ fun DebugInfoScreen(
icon = Icons.Rounded.Info,
modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp)
) {
TextButton(
OutlinedButton(
enabled = showDebugInfo,
onClick = onViewDebugFile
onClick = onViewDebugFile,
modifier = Modifier.padding(bottom = 4.dp)
) {
Text(
stringResource(R.string.debug_info_view_details).uppercase()
stringResource(R.string.debug_info_view_details)
)
}
}
Expand All @@ -215,11 +220,12 @@ fun DebugInfoScreen(
icon = Icons.Rounded.BugReport,
modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp)
) {
TextButton(
onClick = onViewDebugFile
OutlinedButton(
onClick = onViewDebugFile,
modifier = Modifier.padding(bottom = 4.dp)
) {
Text(
stringResource(R.string.debug_info_view_details).uppercase()
stringResource(R.string.debug_info_view_details)
)
}
}
Expand Down Expand Up @@ -264,11 +270,12 @@ fun DebugInfoScreen(
icon = Icons.Rounded.BugReport,
modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp)
) {
TextButton(
onClick = onShareLogsFile
OutlinedButton(
onClick = onShareLogsFile,
modifier = Modifier.padding(bottom = 4.dp)
) {
Text(
stringResource(R.string.debug_info_logs_view).uppercase()
stringResource(R.string.debug_info_logs_view)
)
}
}
Expand Down Expand Up @@ -297,7 +304,7 @@ fun DebugInfoScreen_Preview() {
onShareZip = {},
onShareLogsFile = {},
onViewDebugFile = {},
onNavUp = {},
onNavUp = {}
)
}
}

0 comments on commit 45adc4c

Please sign in to comment.