-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.0.0-alpha07 release version with good integration with Material 3
- Loading branch information
1 parent
7ebd66e
commit b681fdf
Showing
11 changed files
with
184 additions
and
105 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
67 changes: 0 additions & 67 deletions
67
app/src/main/java/com/germainkevin/collapsingtopbarcompose/Components.kt
This file was deleted.
Oops, something went wrong.
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
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/germainkevin/collapsingtopbarcompose/Utils.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,7 @@ | ||
package com.germainkevin.collapsingtopbarcompose | ||
|
||
import android.content.Context | ||
import android.widget.Toast | ||
|
||
fun createToast(context: Context, message: String) = | ||
Toast.makeText(context, message, Toast.LENGTH_LONG).show() |
89 changes: 89 additions & 0 deletions
89
app/src/main/java/com/germainkevin/collapsingtopbarcompose/ui/Components.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,89 @@ | ||
package com.germainkevin.collapsingtopbarcompose.ui | ||
|
||
import android.content.Context | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.MoreVert | ||
import androidx.compose.material.icons.outlined.Search | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.germainkevin.collapsingtopbarcompose.R | ||
import com.germainkevin.collapsingtopbarcompose.createToast | ||
|
||
@Composable | ||
fun ContactListNames(context: Context, contactName: String) { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.background(MaterialTheme.colorScheme.background) | ||
.clickable { createToast(context, contactName) }, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Text( | ||
text = contactName, | ||
style = MaterialTheme.typography.bodyLarge | ||
.copy(color = MaterialTheme.colorScheme.onBackground), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(16.dp) | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun MoreMenuIcons() { | ||
IconButton(onClick = { }) { | ||
Icon( | ||
Icons.Outlined.Search, | ||
contentDescription = stringResource(id = R.string.action_search), | ||
tint = MaterialTheme.colorScheme.onPrimary | ||
) | ||
} | ||
IconButton(onClick = { | ||
}) { | ||
Icon( | ||
Icons.Outlined.MoreVert, | ||
contentDescription = stringResource(id = R.string.more_menu_desc), | ||
tint = MaterialTheme.colorScheme.onPrimary | ||
) | ||
} | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun LeftDrawer( | ||
drawerItems: List<ImageVector>, | ||
closeLeftDrawer: () -> Unit | ||
) { | ||
val selectedItem = remember { mutableStateOf(drawerItems[0]) } | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(MaterialTheme.colorScheme.background) | ||
) { | ||
drawerItems.forEach { item -> | ||
NavigationDrawerItem( | ||
icon = { Icon(item, contentDescription = null) }, | ||
label = { Text(item.name) }, | ||
selected = item == selectedItem.value, | ||
onClick = { | ||
selectedItem.value = item | ||
closeLeftDrawer() | ||
}, | ||
shape = RoundedCornerShape(topEnd = 24.dp, bottomEnd = 24.dp), | ||
badge = { Text(text = " 20") }, | ||
modifier = Modifier.padding(end = 16.dp, top = 12.dp, bottom = 12.dp) | ||
) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.