diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt index c2793bd..a6dbac6 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt @@ -85,7 +85,6 @@ inline fun BeeTablesCompose( textAlign: TextAlign = TextAlign.Center, tablePadding: Dp = 0.dp, columnToIndexIncreaseWidth: Int? = null, - crossinline onRowClick: (Int) -> Unit = {}, ) { OutlinedCard( elevation = CardDefaults.cardElevation(defaultElevation = tableElevation), @@ -143,7 +142,6 @@ inline fun BeeTablesCompose( textAlign = textAlign, tablePadding = tablePadding, columnToIndexIncreaseWidth = columnToIndexIncreaseWidth, - onRowClick = { onRowClick(it) }, ) } else { TableRowComponent( @@ -156,8 +154,6 @@ inline fun BeeTablesCompose( textAlign = textAlign, tablePadding = tablePadding, columnToIndexIncreaseWidth = columnToIndexIncreaseWidth, - onRowClick = { onRowClick(it) }, - ) } } diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt index 56a6688..d001bc6 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt @@ -15,10 +15,8 @@ */ package com.breens.beetablescompose.components -import android.widget.Toast import androidx.compose.foundation.background import androidx.compose.foundation.border -import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -31,7 +29,6 @@ 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.platform.LocalContext import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow @@ -52,7 +49,6 @@ fun TableRowComponent( tablePadding: Dp, columnToIndexIncreaseWidth: Int?, dividerThickness: Dp, - onRowClick: (Int) -> Unit = {}, ) { Row( Modifier @@ -68,8 +64,7 @@ fun TableRowComponent( .border( width = dividerThickness, color = rowBorderColor, - ) - .clickable { onRowClick(index) }, + ), contentAlignment = contentAlignment, ) { Text( @@ -90,13 +85,11 @@ fun TableRowComponent( @Composable @Preview(showBackground = true) fun TableRowComponentPreview() { - val context = LocalContext.current val titles = listOf("Man Utd", "26", "7", "95") TableRowComponent( data = titles, rowBorderColor = lightGray(), - onRowClick = { Toast.makeText(context, "Row ...${titles[it]},", Toast.LENGTH_SHORT).show() }, rowTextStyle = MaterialTheme.typography.bodySmall, rowBackGroundColor = lightColor(), contentAlignment = Alignment.Center, diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt index 5efdf43..d579067 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt @@ -16,7 +16,6 @@ package com.breens.beetablescompose.components 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.Row @@ -50,7 +49,6 @@ fun TableRowComponentWithoutDividers( textAlign: TextAlign, tablePadding: Dp, columnToIndexIncreaseWidth: Int?, - onRowClick: (Int) -> Unit = {}, ) { Column( modifier = Modifier.padding(horizontal = tablePadding), @@ -64,10 +62,8 @@ fun TableRowComponentWithoutDividers( val weight = if (index == columnToIndexIncreaseWidth) 8f else 2f Box( modifier = Modifier - .weight(weight) - .clickable { onRowClick(index) }, + .weight(weight), contentAlignment = contentAlignment, - ) { Text( text = title, diff --git a/app/src/main/java/com/breens/beetablescompose/MainActivity.kt b/app/src/main/java/com/breens/beetablescompose/MainActivity.kt index 5a72579..4cbdbbf 100644 --- a/app/src/main/java/com/breens/beetablescompose/MainActivity.kt +++ b/app/src/main/java/com/breens/beetablescompose/MainActivity.kt @@ -16,7 +16,6 @@ package com.breens.beetablescompose import android.os.Bundle -import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.Arrangement @@ -40,7 +39,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.breens.beetablescompose.ui.theme.BeeTablesComposeTheme @@ -51,7 +49,6 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { - val context = LocalContext.current BeeTablesComposeTheme { Surface( color = MaterialTheme.colorScheme.background, @@ -95,10 +92,6 @@ class MainActivity : ComponentActivity() { ), contentAlignment = if (centerContent) Alignment.Center else Alignment.CenterStart, textAlign = if (centerTextAlignment) TextAlign.Center else TextAlign.Start, - - onRowClick = { index -> - Log.i("TAG", "AM click at position ${ premierLeagueTeams[index]}") - }, ) Spacer(modifier = Modifier.padding(12.dp))