Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions design/api/current.api
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,66 @@ package com.urlaunched.android.design.ui.image {

}

package com.urlaunched.android.design.ui.menuItem.models {

public final class MenuItem {
ctor public MenuItem(int textResources, kotlin.jvm.functions.Function0<kotlin.Unit> onClick);
method public int component1();
method public kotlin.jvm.functions.Function0<kotlin.Unit> component2();
method public com.urlaunched.android.design.ui.menuItem.models.MenuItem copy(int textResources, kotlin.jvm.functions.Function0<kotlin.Unit> onClick);
method public kotlin.jvm.functions.Function0<kotlin.Unit> getOnClick();
method public int getTextResources();
property public final kotlin.jvm.functions.Function0<kotlin.Unit> onClick;
property public final int textResources;
}

public final class MenuItemColors {
ctor public MenuItemColors(optional long textColor, optional long backgroundColor);
method public long component1-0d7_KjU();
method public long component2-0d7_KjU();
method public com.urlaunched.android.design.ui.menuItem.models.MenuItemColors copy--OWjLjI(long textColor, long backgroundColor);
method public long getBackgroundColor();
method public long getTextColor();
property public final long backgroundColor;
property public final long textColor;
}

public final class MenuItemDimens {
ctor public MenuItemDimens(optional float containerHeight, optional float cornerRadiusShape, optional float startPadding, optional float endPadding, optional float topPadding, optional float bottomPadding, optional float spacerHeight);
method public float component1-D9Ej5fM();
method public float component2-D9Ej5fM();
method public float component3-D9Ej5fM();
method public float component4-D9Ej5fM();
method public float component5-D9Ej5fM();
method public float component6-D9Ej5fM();
method public float component7-D9Ej5fM();
method public com.urlaunched.android.design.ui.menuItem.models.MenuItemDimens copy-oRJhP44(float containerHeight, float cornerRadiusShape, float startPadding, float endPadding, float topPadding, float bottomPadding, float spacerHeight);
method public float getBottomPadding();
method public float getContainerHeight();
method public float getCornerRadiusShape();
method public float getEndPadding();
method public float getSpacerHeight();
method public float getStartPadding();
method public float getTopPadding();
property public final float bottomPadding;
property public final float containerHeight;
property public final float cornerRadiusShape;
property public final float endPadding;
property public final float spacerHeight;
property public final float startPadding;
property public final float topPadding;
}

}

package com.urlaunched.android.design.ui.menuItem.ui {

public final class MenuItemWrapperKt {
method @androidx.compose.runtime.Composable public static void MenuItemWrapper(optional androidx.compose.ui.Modifier modifier, java.util.List<com.urlaunched.android.design.ui.menuItem.models.MenuItem> menuItem, androidx.compose.ui.text.TextStyle textStyle, kotlin.jvm.functions.Function0<kotlin.Unit> trailingIcon, optional com.urlaunched.android.design.ui.menuItem.models.MenuItemColors menuItemColors, optional com.urlaunched.android.design.ui.menuItem.models.MenuItemDimens menuItemDimens);
}

}

package com.urlaunched.android.design.ui.modifiers {

public final class IfNotNullKt {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.urlaunched.android.design.ui.menuItem.models

data class MenuItem(
val textResources: Int,
val onClick: () -> Unit
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.urlaunched.android.design.ui.menuItem.models

import androidx.compose.ui.graphics.Color

data class MenuItemColors(
val textColor: Color = Color.Black,
val backgroundColor: Color = Color.White
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.urlaunched.android.design.ui.menuItem.models

import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.urlaunched.android.design.resources.dimens.Dimens

data class MenuItemDimens(
val containerHeight: Dp = 48.dp,
val cornerRadiusShape: Dp = Dimens.cornerRadiusNormalSpecial,
val startPadding: Dp = Dimens.spacingBigSpecial,
val endPadding: Dp = Dimens.spacingNormal,
val topPadding: Dp = Dimens.spacingNormalSpecial,
val bottomPadding: Dp = Dimens.spacingNormalSpecial,
val spacerHeight: Dp = Dimens.spacingSmall
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.urlaunched.android.design.ui.menuItem.ui

import androidx.compose.foundation.background
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.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import com.urlaunched.android.design.ui.menuItem.models.MenuItemColors
import com.urlaunched.android.design.ui.menuItem.models.MenuItemDimens

@Composable
internal fun MenuItem(
titleResource: Int,
textStyle: TextStyle,
menuItemColors: MenuItemColors,
menuItemDimens: MenuItemDimens,
onClick: () -> Unit,
trailingIcon: @Composable () -> Unit
) {
Row(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(menuItemDimens.cornerRadiusShape))
.background(color = menuItemColors.backgroundColor)
.height(menuItemDimens.containerHeight)
.clickable(onClick = onClick)
.padding(
start = menuItemDimens.startPadding,
end = menuItemDimens.endPadding,
top = menuItemDimens.topPadding,
bottom = menuItemDimens.bottomPadding
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = stringResource(titleResource),
style = textStyle,
color = menuItemColors.textColor
)

trailingIcon()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.urlaunched.android.design.ui.menuItem.ui

import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import com.urlaunched.android.design.ui.menuItem.models.MenuItem
import com.urlaunched.android.design.ui.menuItem.models.MenuItemColors
import com.urlaunched.android.design.ui.menuItem.models.MenuItemDimens

@Composable
fun MenuItemWrapper(
modifier: Modifier = Modifier,
menuItem: List<MenuItem>,
textStyle: TextStyle,
trailingIcon: @Composable () -> Unit,
menuItemColors: MenuItemColors = MenuItemColors(),
menuItemDimens: MenuItemDimens = MenuItemDimens()
) {
LazyColumn(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally
) {
items(menuItem) { item ->
MenuItem(
titleResource = item.textResources,
textStyle = textStyle,
onClick = item.onClick,
trailingIcon = trailingIcon,
menuItemColors = menuItemColors,
menuItemDimens = menuItemDimens
)

Spacer(modifier = Modifier.height(menuItemDimens.spacerHeight))
}
}
}