Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzaitsev committed Apr 24, 2015
1 parent c6aca59 commit ad111e4
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Check this [project on Behance] (https://www.behance.net/gallery/20411445/Mobile
*For a working implementation, have a look at the ```app``` module*

#### 1. Clone repository and add sources into your project or use Gradle:
``` compile 'com.yalantis:contextmenu:1.0.3' ```
``` compile 'com.yalantis:contextmenu:1.0.4' ```
#### 2. Create list of `MenuObject`, which consists of icon or icon and description.
You can use any `resource, bitmap, drawable, color` as image:
```
Expand Down Expand Up @@ -70,10 +70,15 @@ Example:
menuObjects.add(send);
```

#### 3. Create `newInstance` of `ContextMenuDialogFragment`, which received menu item size and list of `MenuObject`.
#### 3. Create `newInstance` of `ContextMenuDialogFragment`, which received `MenuParams` object.

```
mMenuDialogFragment = ContextMenuDialogFragment.newInstance((int) getResources().getDimension(R.dimen.tool_bar_height), menuObjects );
MenuParams menuParams = new MenuParams();
menuParams.setActionBarSize((int) getResources().getDimension(R.dimen.tool_bar_height));
menuParams.setMenuObjects(getMenuObjects());
menuParams.setClosableOutside(true);
// set other settings to meet your need
mMenuDialogFragment = ContextMenuDialogFragment.newInstance(menuParams);
```

#### 4. Set menu with button, which will open `ContextMenuDialogFragment`.
Expand Down Expand Up @@ -111,15 +116,19 @@ public class MainActivity extends ActionBarActivity implements OnMenuItemClickLi
## Customization:
For better experience menu item size should be equal to `ActionBar` height.

`newInstance` of `ContextMenuDialogFragment` can receive:
`newInstance` of `ContextMenuDialogFragment` receives `MenuParams` object that has the fields:

`animationDelay` - delay in millis after fragment opening and before closing, which will make animation smoother on slow devices,
`mMenuObjects` - list of MenuObject objects,

`animationDuration` - duration of every piece of animation in millis,
`mAnimationDelay` - delay in millis after fragment opening and before closing, which will make animation smoother on slow devices,

`fitSystemWindows` - if true, then the default implementation of fitSystemWindows(Rect) will be executed,
`nAnimationDuration` - duration of every piece of animation in millis,

`clipToPadding` - true to clip children to the padding of the group, false otherwise.
`isClosableOutside` - if menu can be closed on touch to non-button area,

`isFitSystemWindows` - if true, then the default implementation of fitSystemWindows(Rect) will be executed,

`isClipToPadding` - true to clip children to the padding of the group, false otherwise.

The last two parameters may be useful if you use _Translucent_ parameters in your theme:
```
Expand All @@ -133,6 +142,11 @@ To stay `Context Menu` below Status Bar set `fitSystemWindows` to true and `clip

# Changelog

### Version: 1.0.4

* Old `ContextMenuDialogFragment` `newInstance` methods are deprecated. Use new universal one that received `MenuParams`.
* Added possibility to dismiss menu by clicking on non-button area. See `MenuParams.setClosableOutside(boolean)`.

### Version: 1.0.3

* Added menu text appearence style. (Note: other text style methods are deprecated).
Expand Down

0 comments on commit ad111e4

Please sign in to comment.