Skip to content

Commit

Permalink
Fix some ui issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Jun 11, 2024
1 parent a4c0b3d commit 47db813
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ fun MullvadExposedDropdownMenuBox(
modifier = Modifier.fillMaxWidth().menuAnchor(),
readOnly = true,
value = title,
onValueChange = { /* Do nothing */},
onValueChange = { /* Do nothing */ },
label = { Text(text = label) },
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
colors = colors,
)
ExposedDropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
modifier = Modifier.background(MaterialTheme.colorScheme.surfaceContainer)
modifier = Modifier.background(MaterialTheme.colorScheme.primary)
) {
content { expanded = false }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.lazy.LazyListState
Expand Down Expand Up @@ -274,7 +276,7 @@ fun ScaffoldWithSmallTopBar(
content: @Composable (modifier: Modifier) -> Unit
) {
Scaffold(
modifier = modifier.fillMaxSize(),
modifier = modifier.fillMaxSize().imePadding(),
topBar = {
MullvadSmallTopBar(
title = appBarTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ fun ApiAccessListScreen(
currentApiAccessMethodName = state.currentApiAccessMethod?.name,
onInfoClicked = onApiAccessInfoClick
)
// Spacer(modifier = Modifier.height(Dimens.verticalSpace))
apiAccessMethodItems(
state.apiAccessMethods,
onApiAccessMethodClick = onApiAccessMethodClick
Expand Down Expand Up @@ -132,7 +131,7 @@ private fun LazyListScope.currentAccessMethod(
verticalAlignment = Alignment.CenterVertically
) {
Text(
style = MaterialTheme.typography.titleLarge,
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onBackground,
text =
stringResource(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.mullvad.mullvadvpn.compose.screen

import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Spacer
Expand All @@ -10,6 +11,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -218,9 +220,13 @@ fun EditApiAccessMethodScreen(
onPasswordChanged = onPasswordChanged
)
}
Spacer(modifier = Modifier.height(Dimens.largePadding))
Spacer(modifier = Modifier.weight(1f))
TestMethodButton(
modifier = Modifier.padding(bottom = Dimens.verticalSpace),
modifier =
Modifier.padding(
bottom = Dimens.verticalSpace,
top = Dimens.largePadding
),
testMethodState = state.testMethodState,
onTestMethod = onTestMethod
)
Expand Down Expand Up @@ -251,7 +257,8 @@ private fun NameInputField(
isDigitsOnlyAllowed = false,
maxCharLength = ApiAccessMethodName.MAX_LENGTH,
errorText = nameError?.let { textResource(id = R.string.this_field_is_required) },
capitalization = KeyboardCapitalization.Words
capitalization = KeyboardCapitalization.Words,
modifier = Modifier.animateContentSize()
)
}

Expand Down Expand Up @@ -368,7 +375,8 @@ private fun ServerIpInput(
R.string.this_field_is_required
}
)
}
},
modifier = Modifier.animateContentSize()
)
}

Expand Down Expand Up @@ -396,6 +404,7 @@ private fun PortInput(
}
)
},
modifier = Modifier.animateContentSize()
)
}

Expand Down Expand Up @@ -428,6 +437,7 @@ private fun PasswordInput(
ImeAction.Done
},
errorText = passwordError?.let { textResource(id = R.string.this_field_is_required) },
modifier = Modifier.animateContentSize()
)
}

Expand Down Expand Up @@ -529,6 +539,7 @@ private fun UsernameInput(
isValidValue = usernameError == null,
isDigitsOnlyAllowed = false,
errorText = usernameError?.let { textResource(id = R.string.this_field_is_required) },
modifier = Modifier.animateContentSize()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ class EditApiAccessMethodViewModel(
> =
zipOrAccumulate(
if (skipNameValidation) {
parseName(name)
} else {
ApiAccessMethodName.fromString(name).right()
} else {
parseName(name)
},
when (apiAccessMethodTypes) {
ApiAccessMethodTypes.SHADOWSOCKS -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ val menuItemColors: MenuItemColors
leadingIconColor = MaterialTheme.colorScheme.onSurface,
textColor = MaterialTheme.colorScheme.onSurface,
)



0 comments on commit 47db813

Please sign in to comment.