Skip to content

Commit

Permalink
UI improvements
Browse files Browse the repository at this point in the history
Signed-off-by: sowjanyakch <[email protected]>
  • Loading branch information
sowjanyakch committed Sep 23, 2024
1 parent 34086d3 commit 4b24fb1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
Expand All @@ -37,20 +38,19 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
Expand All @@ -74,6 +74,7 @@ import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand Down Expand Up @@ -580,58 +581,69 @@ fun ShowChangePassword(onDismiss: () -> Unit, conversationCreationViewModel: Con
Dialog(onDismissRequest = {
onDismiss()
}) {
Card(
Surface(
modifier = Modifier
.fillMaxWidth()
.height(375.dp)
.padding(16.dp)
.background(color = colorResource(id = R.color.appbar)),
shape = RoundedCornerShape(16.dp)
.padding(32.dp)
.background(color = colorResource(id = R.color.appbar))
) {
Column(
modifier = Modifier
.fillMaxSize(),
.fillMaxSize()
.padding(vertical = 16.dp, horizontal = 16.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = stringResource(id = R.string.nc_change_password))
Text(text = stringResource(id = R.string.nc_set_new_password), fontWeight = FontWeight.SemiBold)
Spacer(modifier = Modifier.height(16.dp))
OutlinedTextField(
value = changedPassword,
onValueChange = {
changedPassword = it
},
label = { Text(text = stringResource(id = R.string.nc_set_new_password)) },
label = { Text(text = stringResource(id = R.string.nc_password)) },
singleLine = true
)
if (changedPassword.isNotEmpty() && changedPassword.isNotBlank()) {
Spacer(modifier = Modifier.height(16.dp))

Column(
modifier = Modifier.fillMaxWidth()
.padding(vertical = 8.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
TextButton(
onClick = {
conversationCreationViewModel.updatePassword(changedPassword)
conversationCreationViewModel.isPasswordEnabled.value = true
onDismiss()
},
modifier = Modifier.padding(8.dp)
enabled = changedPassword.isNotEmpty() && changedPassword.isNotBlank(),
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp)
) {
Text(text = stringResource(id = R.string.nc_change_password))
}
}
TextButton(
onClick = {
conversationCreationViewModel.isPasswordEnabled.value = true
onDismiss()
},
modifier = Modifier.padding(8.dp)
) {
Text(text = stringResource(id = R.string.nc_remove_password))
}
TextButton(
onClick = {
conversationCreationViewModel.isPasswordEnabled.value = true
onDismiss()
},
modifier = Modifier.padding(8.dp)
) {
Text(text = stringResource(id = R.string.nc_cancel))
Spacer(modifier = Modifier.height(4.dp))
TextButton(
onClick = {
conversationCreationViewModel.isPasswordEnabled.value = false
onDismiss()
},
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp)
) {
Text(
text = stringResource(id = R.string.nc_remove_password),
color = colorResource(id = R.color.nc_darkRed)
)
}
Spacer(modifier = Modifier.height(4.dp))
TextButton(
onClick = { onDismiss() },
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp)
) {
Text(text = stringResource(id = R.string.nc_cancel))
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,10 @@ How to translate with transifex:
<string name="nc_guest_access_allow_summary">Allow guests to share a public link to join this conversation.</string>
<string name="nc_guest_access_allow_failed">Cannot enable/disable guest access.</string>
<string name="nc_set_password">Set Password</string>
<string name="nc_password">Password</string>
<string name="nc_change_password">Change Password</string>
<string name="nc_remove_password">Remove Password</string>
<string name="nc_set_new_password">Set a new password</string>
<string name="nc_set_new_password">Set new password</string>
<string name="nc_guest_access_password_title">Password protection</string>
<string name="nc_guest_access_password_summary">Set a password to restrict who can use the public link.</string>
<string name="nc_guest_access_password_dialog_title">Guest access password</string>
Expand Down

0 comments on commit 4b24fb1

Please sign in to comment.