-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from PermanentOrg/feature/VSP-1355
Settings Menu redesign
- Loading branch information
Showing
35 changed files
with
787 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/src/main/java/org/permanent/permanent/ui/composeComponents/PartialScreenLayout.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.permanent.permanent.ui.composeComponents | ||
|
||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.layout.Layout | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun PartialScreenLayout( | ||
modifier: Modifier = Modifier, | ||
content: @Composable () -> Unit | ||
) { | ||
Layout( | ||
modifier = modifier.clip(shape = RoundedCornerShape(8.dp)), | ||
content = content | ||
) { measurables, constraints -> | ||
val placeable = measurables[0].measure(constraints) | ||
|
||
val width = constraints.maxWidth | ||
val height = (constraints.maxHeight * 0.96).toInt() | ||
|
||
layout(width, height) { | ||
placeable.placeRelative( | ||
(constraints.maxWidth - width) / 2, | ||
0 | ||
) | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
app/src/main/java/org/permanent/permanent/ui/composeComponents/SettingsMenuItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.permanent.permanent.ui.composeComponents | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import androidx.core.content.ContextCompat | ||
import org.permanent.permanent.R | ||
|
||
@Composable | ||
fun SettingsMenuItem( | ||
iconResource: Painter, | ||
text: String, | ||
itemColor: Color = Color(ContextCompat.getColor(LocalContext.current, R.color.colorPrimary)), | ||
onClick: () -> Unit | ||
) { | ||
val semiboldFont = FontFamily(Font(R.font.open_sans_semibold_ttf)) | ||
val smallTextSize = 15.sp | ||
|
||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 16.dp, horizontal = 32.dp) | ||
.clickable { onClick() }, | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(24.dp), | ||
|
||
) { | ||
Image( | ||
painter = iconResource, | ||
contentDescription = "Next", | ||
colorFilter = ColorFilter.tint(itemColor), | ||
modifier = Modifier.size(26.dp) | ||
) | ||
Text( | ||
text = text, | ||
fontSize = smallTextSize, | ||
color = itemColor, | ||
fontFamily = semiboldFont | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun SettingsMenuItemComposablePreview() { | ||
SettingsMenuItem( | ||
iconResource = painterResource(id = R.drawable.ic_plus_primary), | ||
text = "Add storage!", | ||
onClick = { /*TODO*/ }) | ||
} |
Oops, something went wrong.