From f3f361c65046627e6a64186a2efd32fd9c13d73c Mon Sep 17 00:00:00 2001 From: Saket Date: Sat, 11 Feb 2023 22:43:13 -0500 Subject: [PATCH] Prepare for release 2.0.0-rc01 --- README.md | 72 +++---------------------------------------- docs/compose/index.md | 2 +- docs/index.md | 6 ++-- docs/views/index.md | 2 +- gradle.properties | 2 +- 5 files changed, 10 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 8ff7e08..7a26dc8 100644 --- a/README.md +++ b/README.md @@ -2,78 +2,14 @@ ![demo](demo.gif) -`cascade` builds nested popup menus with smooth height animations. It is designed to be a *drop-in* replacement for [PopupMenu](https://developer.android.com/reference/androidx/appcompat/widget/PopupMenu) so using it in your project is beautifully only a word away. Try out the [sample app](https://github.com/saket/cascade/releases/download/1.3.0/cascade_v1.3.0_sample.apk) to see it in action. +`cascade` builds nested popup menus with smooth height animations. It is designed to be a *drop-in* replacement for both [PopupMenu](https://developer.android.com/reference/androidx/appcompat/widget/PopupMenu) and [DropdownMenu](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#DropdownMenu(kotlin.Boolean,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.unit.DpOffset,androidx.compose.ui.window.PopupProperties,kotlin.Function1)), so using it in your project is beautifully only a word away. Try out the [sample app](https://github.com/saket/cascade/releases/download/2.0.0-rc01/cascade_v2.0.0-rc01_sample.apk) to see it in action. ```groovy -implementation "me.saket.cascade:cascade:1.3.0" +implementation "me.saket.cascade:cascade:2.0.0-rc01" +implementation "me.saket.cascade:cascade-compose:2.0.0-rc01" ``` -```diff -- val popup = PopupMenu(context, anchor) -+ val popup = CascadePopupMenu(context, anchor) - popup.inflate(R.menu.nicolas_cage_movies) - popup.show() -``` - -#### Use as Toolbar's overflow menu - -```kotlin -toolbar.overrideAllPopupMenus { context, anchor -> - CascadePopupMenu(context, anchor) -} - -// The lambda can be collapsed into a reference -// if you're only using the two-param constructor. -toolbar.overrideAllPopupMenus(with = ::CascadePopupMenu) -``` - -### Customization - -`cascade` is great for apps that prefer applying dynamic themes at runtime, which `PopupMenu` makes it extremely hard to do so. By providing a `CascadePopupMenu.Styler` object, you can adjust colors, spacings and text styles from Kotlin ([example](https://github.com/saket/cascade/blob/ea668552999be0d3fd235e9feefa782ac92b13d4/sample/src/main/java/me/saket/cascade/sample/MainActivity.kt#L91:L110)). - -```kotlin -CascadePopupMenu(context, anchor, styler = CascadePopupMenu.Styler(...)) -``` - -By default, `cascade` will pick up values from your theme in the same way as `PopupMenu` would. - -```xml - - - -``` - -### Navigation - -For sub-menus, `cascade` will automatically navigate to the parent menu when the title is clicked. For manual navigation, `CascadePopupMenu#navigateBack()` or [CascadeBackNavigator](https://github.com/saket/cascade/blob/trunk/cascade/src/main/java/me/saket/cascade/CascadeBackNavigator.kt) can be used. - -```kotlin -popup.menu.addSubMenu("Remove").also { - it.setHeaderTitle("Are you sure?") - it.add("Burn them all") - it.add("Take me back").setOnMenuItemClickListener { - popup.navigateBack() - } -} -``` - -### Custom layouts - -`cascade` was originally inspired by Google Drive's [menu](https://twitter.com/saketme/status/1313130386743066627) that uses a variety of complex controls. For apps that want to create something similar, a batteries-included [CascadePopupWindow](https://github.com/saket/cascade/blob/trunk/cascade/src/main/java/me/saket/cascade/CascadePopupWindow.kt) is provided for use with custom layouts. - -```kotlin -val popup = CascadePopupWindow(context) -popup.contentView.addView(CustomMenuView(context)) // Also see contentView.goBack(). -popup.show(anchor) -``` +See project website for full documentation. ## License diff --git a/docs/compose/index.md b/docs/compose/index.md index 138192d..eba214b 100644 --- a/docs/compose/index.md +++ b/docs/compose/index.md @@ -5,7 +5,7 @@ [drop_down_menu]: https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#DropdownMenu(kotlin.Boolean,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.unit.DpOffset,androidx.compose.ui.window.PopupProperties,kotlin.Function1) ```groovy -implementation "me.saket.cascade:cascade-compose:2.0.0-beta1" +implementation "me.saket.cascade:cascade-compose:2.0.0-rc01" implementation "androidx.compose.material3:material3:…" // https://d.android.com/jetpack/androidx/releases/compose-material3 ``` diff --git a/docs/index.md b/docs/index.md index 4cb821b..e6c9889 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,11 +2,11 @@ ![demo](https://github.com/saket/cascade/raw/trunk/demo.gif) -`cascade` builds nested popup menus with smooth height animations. It is designed to be a *drop-in* replacement for both [PopupMenu](https://developer.android.com/reference/androidx/appcompat/widget/PopupMenu) and [DropdownMenu](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#DropdownMenu(kotlin.Boolean,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.unit.DpOffset,androidx.compose.ui.window.PopupProperties,kotlin.Function1)), so using it in your project is beautifully only a word away. Try out the [sample app](https://github.com/saket/cascade/releases/download/1.3.0/cascade_v1.3.0_sample.apk) to see it in action. +`cascade` builds nested popup menus with smooth height animations. It is designed to be a *drop-in* replacement for both [PopupMenu](https://developer.android.com/reference/androidx/appcompat/widget/PopupMenu) and [DropdownMenu](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#DropdownMenu(kotlin.Boolean,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.unit.DpOffset,androidx.compose.ui.window.PopupProperties,kotlin.Function1)), so using it in your project is beautifully only a word away. Try out the [sample app](https://github.com/saket/cascade/releases/download/2.0.0-rc01/cascade_v2.0.0-rc01_sample.apk) to see it in action. ```groovy -implementation "me.saket.cascade:cascade:2.0.0-beta1" -implementation "me.saket.cascade:cascade-compose:2.0.0-beta1" +implementation "me.saket.cascade:cascade:2.0.0-rc01" +implementation "me.saket.cascade:cascade-compose:2.0.0-rc01" ``` === "Compose UI" diff --git a/docs/views/index.md b/docs/views/index.md index 5b97029..c328a80 100644 --- a/docs/views/index.md +++ b/docs/views/index.md @@ -3,7 +3,7 @@ `cascade` offers a drop-in replacement for [PopupMenu](https://developer.android.com/reference/androidx/appcompat/widget/PopupMenu). For guidance on creating & nesting menus, the [official documentation](https://developer.android.com/develop/ui/views/components/menus) can be followed while replacing any usages of `PopupMenu` with `CascadePopupMenu`. ```groovy -implementation "me.saket.cascade:cascade:2.0.0-beta1" +implementation "me.saket.cascade:cascade:2.0.0-rc01" ``` ```diff diff --git a/gradle.properties b/gradle.properties index af52686..96d4196 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ android.useAndroidX=true android.defaults.buildfeatures.buildconfig=false GROUP=me.saket.cascade -VERSION_NAME=2.0.0-SNAPSHOT +VERSION_NAME=2.0.0-rc01 POM_INCEPTION_YEAR=2020 POM_URL=https://github.com/saket/cascade