-
-
Notifications
You must be signed in to change notification settings - Fork 21
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 #291 from you-apps/contacts-page-redesign
feat: contacts page redesign
- Loading branch information
Showing
4 changed files
with
220 additions
and
46 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/bnyro/contacts/ui/components/base/LargeButtonWithIcon.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,44 @@ | ||
package com.bnyro.contacts.ui.components.base | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.Icon | ||
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.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
fun LargeButtonWithIcon( | ||
modifier: Modifier = Modifier, | ||
imageVector: ImageVector, | ||
text: String, | ||
onClick: () -> Unit | ||
) { | ||
Button( | ||
modifier = modifier, | ||
onClick = onClick, | ||
shape = RoundedCornerShape(50.dp) | ||
) { | ||
Row( | ||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 16.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Icon( | ||
modifier = Modifier.size(20.dp), | ||
imageVector = imageVector, | ||
contentDescription = text | ||
) | ||
Spacer(modifier = Modifier.width(10.dp)) | ||
Text(text = text, fontSize = 18.sp) | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/bnyro/contacts/ui/components/base/SmallButtonWithIcon.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,41 @@ | ||
package com.bnyro.contacts.ui.components.base | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.offset | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.OutlinedButton | ||
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.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
fun SmallButtonWithIcon( | ||
modifier: Modifier = Modifier, | ||
imageVector: ImageVector, | ||
text: String, | ||
onClick: () -> Unit | ||
) { | ||
OutlinedButton( | ||
modifier = modifier, | ||
onClick = onClick, | ||
) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Icon( | ||
modifier = Modifier.size(16.dp).offset(x = (-4).dp), | ||
imageVector = imageVector, | ||
contentDescription = text | ||
) | ||
Spacer(modifier = Modifier.width(4.dp)) | ||
Text(text = text, fontSize = 14.sp) | ||
} | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
app/src/main/java/com/bnyro/contacts/ui/components/shapes/CurlyCornerShape.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,84 @@ | ||
package com.bnyro.contacts.ui.components.shapes | ||
|
||
import androidx.compose.foundation.shape.CornerBasedShape | ||
import androidx.compose.foundation.shape.CornerSize | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.foundation.shape.ZeroCornerSize | ||
import androidx.compose.ui.geometry.Size | ||
import androidx.compose.ui.graphics.Outline | ||
import androidx.compose.ui.graphics.Path | ||
import androidx.compose.ui.unit.LayoutDirection | ||
import kotlin.math.cos | ||
import kotlin.math.sin | ||
|
||
val curlyCornerShape = CurlyCornerShape() | ||
|
||
class CurlyCornerShape( | ||
private val amp: Double = 10.0, | ||
private val count: Int = 8, | ||
) : CornerBasedShape( | ||
topStart = ZeroCornerSize, | ||
topEnd = ZeroCornerSize, | ||
bottomEnd = ZeroCornerSize, | ||
bottomStart = ZeroCornerSize | ||
) { | ||
|
||
private fun sineCircleXYatAngle( | ||
d1: Double, | ||
d2: Double, | ||
d3: Double, | ||
d4: Double, | ||
d5: Double, | ||
i: Int, | ||
): List<Double> = (i.toDouble() * d5).run { | ||
listOf( | ||
(sin(this) * d4 + d3) * cos(d5) + d1, | ||
(sin(this) * d4 + d3) * sin(d5) + d2 | ||
) | ||
} | ||
|
||
override fun createOutline( | ||
size: Size, | ||
topStart: Float, | ||
topEnd: Float, | ||
bottomEnd: Float, | ||
bottomStart: Float, | ||
layoutDirection: LayoutDirection, | ||
): Outline { | ||
val d = 2.0 | ||
val r2: Double = size.width / d | ||
var r13: Double = size.height / d | ||
val r18 = size.width / 2.0 - amp | ||
val path = Path() | ||
path.moveTo((d * r2 - amp).toFloat(), r13.toFloat()) | ||
var i = 0 | ||
while (true) { | ||
val i2 = i + 1 | ||
val d3 = r13 | ||
val r5: List<Double> = sineCircleXYatAngle( | ||
r2, r13, r18, amp, Math.toRadians( | ||
i.toDouble() | ||
), count | ||
) | ||
path.lineTo(r5[0].toFloat(), r5[1].toFloat()) | ||
if (i2 >= 360) { | ||
path.close() | ||
return Outline.Generic(path) | ||
} | ||
i = i2 | ||
r13 = d3 | ||
} | ||
} | ||
|
||
override fun copy( | ||
topStart: CornerSize, | ||
topEnd: CornerSize, | ||
bottomEnd: CornerSize, | ||
bottomStart: CornerSize, | ||
) = RoundedCornerShape( | ||
topStart = topStart, | ||
topEnd = topEnd, | ||
bottomEnd = bottomEnd, | ||
bottomStart = bottomStart | ||
) | ||
} |
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