@@ -5,14 +5,21 @@ import androidx.compose.foundation.layout.Arrangement
55import androidx.compose.foundation.layout.Column
66import androidx.compose.foundation.layout.Row
77import androidx.compose.foundation.layout.Spacer
8+ import androidx.compose.foundation.layout.fillMaxSize
89import androidx.compose.foundation.layout.fillMaxWidth
910import androidx.compose.foundation.layout.height
11+ import androidx.compose.foundation.layout.padding
12+ import androidx.compose.foundation.layout.safeContentPadding
1013import androidx.compose.foundation.layout.size
1114import androidx.compose.foundation.layout.width
15+ import androidx.compose.foundation.rememberScrollState
16+ import androidx.compose.foundation.verticalScroll
1217import androidx.compose.material3.AlertDialog
1318import androidx.compose.material3.Button
1419import androidx.compose.material3.CircularProgressIndicator
1520import androidx.compose.material3.MaterialTheme
21+ import androidx.compose.material3.OutlinedButton
22+ import androidx.compose.material3.Surface
1623import androidx.compose.material3.Text
1724import androidx.compose.material3.TextButton
1825import androidx.compose.runtime.Composable
@@ -26,17 +33,19 @@ import androidx.compose.ui.Modifier
2633import androidx.compose.ui.res.stringResource
2734import androidx.compose.ui.text.font.FontWeight
2835import androidx.compose.ui.unit.dp
36+ import androidx.compose.ui.window.Dialog
37+ import androidx.compose.ui.window.DialogProperties
2938import com.rk.resources.strings
3039import com.rk.terminal.AutoSetup
3140import com.rk.terminal.SetupEstimate
3241
3342/* *
34- * First-launch consent dialog for Auto Setup .
43+ * First-launch Auto Setup consent — a full-screen screen (not a small dialog) .
3544 *
36- * Shows an estimate of the storage/download required and (after a quick internet speed probe) an
37- * estimated time. The user can agree ([onLaunch] starts the setup terminal ) or skip — skipping
38- * first shows a warning that the IDE may break later with no support for manual fixes, and on
39- * confirmation calls [onDismissForever].
45+ * Shows the storage/download estimate and (after a quick internet speed probe) an estimated time.
46+ * The user can agree ([onLaunch] starts the background setup ) or skip — skipping first warns that
47+ * the IDE may break later with no support for manual fixes, and on confirmation calls
48+ * [onDismissForever].
4049 */
4150@Composable
4251fun AutoSetupDialog (onLaunch : () -> Unit , onDismissForever : () -> Unit ) {
@@ -71,49 +80,73 @@ fun AutoSetupDialog(onLaunch: () -> Unit, onDismissForever: () -> Unit) {
7180 return
7281 }
7382
74- AlertDialog (
83+ Dialog (
7584 onDismissRequest = {},
76- title = { Text (stringResource(strings.auto_setup_title)) },
77- text = {
78- Column (verticalArrangement = Arrangement .spacedBy(12 .dp)) {
79- Text (stringResource(strings.auto_setup_message), style = MaterialTheme .typography.bodyMedium)
80- Spacer (modifier = Modifier .height(4 .dp))
81- val est = estimate
82- if (est == null ) {
83- Row (verticalAlignment = Alignment .CenterVertically ) {
84- CircularProgressIndicator (modifier = Modifier .size(18 .dp), strokeWidth = 2 .dp)
85- Spacer (modifier = Modifier .width(10 .dp))
86- Text (
87- stringResource(strings.auto_setup_checking_speed),
88- style = MaterialTheme .typography.bodyMedium,
85+ properties =
86+ DialogProperties (
87+ usePlatformDefaultWidth = false ,
88+ dismissOnBackPress = false ,
89+ dismissOnClickOutside = false ,
90+ ),
91+ ) {
92+ Surface (modifier = Modifier .fillMaxSize()) {
93+ Column (modifier = Modifier .fillMaxSize().safeContentPadding().padding(24 .dp)) {
94+ Column (
95+ modifier = Modifier .weight(1f ).fillMaxWidth().verticalScroll(rememberScrollState()),
96+ verticalArrangement = Arrangement .spacedBy(16 .dp),
97+ ) {
98+ Text (
99+ text = stringResource(strings.auto_setup_title),
100+ style = MaterialTheme .typography.headlineMedium,
101+ fontWeight = FontWeight .Bold ,
102+ )
103+ Text (
104+ text = stringResource(strings.auto_setup_message),
105+ style = MaterialTheme .typography.bodyLarge,
106+ )
107+ Spacer (modifier = Modifier .height(4 .dp))
108+ val est = estimate
109+ if (est == null ) {
110+ Row (verticalAlignment = Alignment .CenterVertically ) {
111+ CircularProgressIndicator (modifier = Modifier .size(18 .dp), strokeWidth = 2 .dp)
112+ Spacer (modifier = Modifier .width(10 .dp))
113+ Text (
114+ stringResource(strings.auto_setup_checking_speed),
115+ style = MaterialTheme .typography.bodyMedium,
116+ )
117+ }
118+ } else {
119+ InfoRow (stringResource(strings.auto_setup_storage), est.storageText)
120+ InfoRow (stringResource(strings.auto_setup_data), est.dataText)
121+ InfoRow (
122+ stringResource(strings.auto_setup_eta),
123+ est.etaText ? : stringResource(strings.auto_setup_eta_unknown),
89124 )
90125 }
91- } else {
92- InfoRow (stringResource(strings.auto_setup_storage), est.storageText)
93- InfoRow (stringResource(strings.auto_setup_data), est.dataText)
94- InfoRow (
95- stringResource(strings.auto_setup_eta),
96- est.etaText ? : stringResource(strings.auto_setup_eta_unknown),
97- )
98126 }
99- }
100- },
101- confirmButton = {
102- Button (
103- onClick = {
104- activity?.let { AutoSetup .launch(it) }
105- onLaunch()
127+
128+ Spacer (modifier = Modifier .height(16 .dp))
129+
130+ Row (modifier = Modifier .fillMaxWidth(), horizontalArrangement = Arrangement .spacedBy(12 .dp)) {
131+ OutlinedButton (
132+ modifier = Modifier .weight(1f ),
133+ onClick = { showDeclineWarning = true },
134+ ) {
135+ Text (stringResource(strings.auto_setup_skip), maxLines = 1 )
136+ }
137+ Button (
138+ modifier = Modifier .weight(1f ),
139+ onClick = {
140+ activity?.let { AutoSetup .launch(it) }
141+ onLaunch()
142+ },
143+ ) {
144+ Text (stringResource(strings.auto_setup_start), maxLines = 1 )
145+ }
106146 }
107- ) {
108- Text (stringResource(strings.auto_setup_start))
109147 }
110- },
111- dismissButton = {
112- TextButton (onClick = { showDeclineWarning = true }) {
113- Text (stringResource(strings.auto_setup_skip))
114- }
115- },
116- )
148+ }
149+ }
117150}
118151
119152@Composable
0 commit comments