Fix color picker size (#808)

* Fix color picker size

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Removed missing comment & import optimization

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Added border

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Color picker: use OutlinedButton

---------

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Ricki Hirner <hirner@bitfire.at>
This commit is contained in:
Arnau Mora 2024-05-27 14:53:39 +02:00 committed by GitHub
parent 4a49c8d6c2
commit 9a31835b1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 15 deletions

3
.gitignore vendored
View file

@ -8,8 +8,9 @@
# Files for the Dalvik VM
*.dex
# Java class files
# Java/Kotlin
*.class
.kotlin/
# Generated files
bin/

View file

@ -5,15 +5,15 @@
package at.bitfire.davdroid.ui.account
import android.accounts.Account
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
@ -22,6 +22,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Checkbox
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExposedDropdownMenuBox
@ -29,6 +30,7 @@ import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
@ -173,7 +175,8 @@ fun CreateCalendarScreen(
.padding(8.dp)
) {
Row(
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.height(IntrinsicSize.Max)
) {
val focusRequester = remember { FocusRequester() }
OutlinedTextField(
@ -194,17 +197,21 @@ fun CreateCalendarScreen(
}
var showColorPicker by remember { mutableStateOf(false) }
Box(Modifier
.background(color = Color(color), shape = RoundedCornerShape(4.dp))
.clickable {
OutlinedButton(
onClick = {
showColorPicker = true
}
.size(48.dp)
.semantics {
contentDescription =
context.getString(R.string.create_collection_color)
}
)
},
colors = ButtonDefaults.outlinedButtonColors(
containerColor = Color(color)
),
shape = RoundedCornerShape(4.dp),
modifier = Modifier
.fillMaxHeight()
.aspectRatio(1f)
.semantics {
contentDescription = context.getString(R.string.create_collection_color)
}
) { /* no content */ }
if (showColorPicker) {
CalendarColorPickerDialog(
onSelectColor = { color ->