https://github.com/mainrs/android-compose-menuactions
An Android Compose library adding TopBar menu actions.
https://github.com/mainrs/android-compose-menuactions
android-compose android-library kotlin kotlin-android
Last synced: about 2 months ago
JSON representation
An Android Compose library adding TopBar menu actions.
- Host: GitHub
- URL: https://github.com/mainrs/android-compose-menuactions
- Owner: mainrs
- License: mit
- Created: 2022-06-13T22:45:51.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-19T09:55:08.000Z (almost 3 years ago)
- Last Synced: 2025-02-09T09:13:48.891Z (3 months ago)
- Topics: android-compose, android-library, kotlin, kotlin-android
- Language: Kotlin
- Homepage:
- Size: 103 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Compose Action Menu Items
> Based on https://gist.github.com/MachFour/369ebb56a66e2f583ebfb988dda2decf, originally licensed
> under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
>
> The idea has been extended on and appropriate changes have been made.# Installation
First, make sure that https://jitpack.io has been declared as a Maven repository. Then just declare
the dependency either in Gradle```groovy
dependencies {
implementation 'com.github.mainrs:android-compose-menuactions:1.0.0'
}
```or the new Kotlin DSL
```kotlin
dependencies {
implementation("com.github.mainrs:android-compose-menuactions:1.0.0")
}
```# Usage
```kotlin
@Composable
fun MainContent() {
SmallTopAppBar(title = { Text(text = "Test App") }, actions = {
ActionMenu(actions = listOf(
Action(title = R.string.synchronize,
icon = Icons.Default.Sync,
iconContentDescription = R.string.synchronize_cd,
onClick = {}),Action(title = R.string.settings,
icon = Icons.Default.Settings,
iconContentDescription = R.string.settings_cd,
onClick = {}),
))
})
}
```There is a small example app under [./app] that also showcases how the `maxIcons` property
influences the menu layout.# License
This project is licensed under the [MIT license](./license).