@@ -15,17 +15,44 @@ Check this [project on Behance] (https://www.behance.net/gallery/20411445/Mobile
1515* For a working implementation, have a look at the ``` app ``` module*
1616
1717#### 1. Clone repository and add sources into your project or use Gradle:
18- ``` compile 'com.yalantis:contextmenu:1.0.1 ' ```
18+ ``` compile 'com.yalantis:contextmenu:1.0.2 ' ```
1919#### 2. Create list of ` MenuObject ` , which consists of icon or icon and description.
20-
20+ You can use any ` resource, bitmap, drawable, color ` as image:
21+ ```
22+ item.setResource(...)
23+ item.setBitmap(...)
24+ item.setDrawable(...)
25+ item.setColor(...)
26+ ```
27+ You can set image ` ScaleType ` :
28+ ```
29+ item.setScaleType(ScaleType.FIT_XY)
30+ ```
31+ You can use any ` resource, drawable, color ` as background:
32+ ```
33+ item.setBgResource(...)
34+ item.setBgDrawable(...)
35+ item.setBgColor(...)
2136```
22- ArrayList<MenuObject> menuObjects = new ArrayList<>();
23- menuObjects.add(new MenuObject(R.drawable.icn_close));
24- menuObjects.add(new MenuObject(R.drawable.icn_1, "Send message"));
25- menuObjects.add(new MenuObject(R.drawable.icn_2, "Like profile"));
26- menuObjects.add(new MenuObject(R.drawable.icn_3, "Add to friends"));
27- menuObjects.add(new MenuObject(R.drawable.icn_4, "Add to favorites"));
28- menuObjects.add(new MenuObject(R.drawable.icn_5, "Block user"));
37+ You can use any ` color ` as text color:
38+ ```
39+ item.setTextColor(...)
40+ ```
41+ You can set any ` color ` as divider color:
42+ ```
43+ item.setDividerColor(...)
44+ ```
45+ Example:
46+ ```
47+ MenuObject close = new MenuObject();
48+ close.setResource(R.drawable.icn_close);
49+
50+ MenuObject send = new MenuObject("Send message");
51+ send.setResource(R.drawable.icn_1);
52+
53+ List<MenuObject> menuObjects = new ArrayList<>();
54+ menuObjects.add(close);
55+ menuObjects.add(send);
2956```
3057
3158#### 3. Create ` newInstance ` of ` ContextMenuDialogFragment ` , which received menu item size and list of ` MenuObject ` .
@@ -73,14 +100,30 @@ For better experience menu item size should be equal to `ActionBar` height.
73100
74101 ` animationDelay ` - delay in millis after fragment opening and before closing, which will make animation smoother on slow devices,
75102
76- ` animationDuration ` - duration of every piece of animation in millis.
103+ ` animationDuration ` - duration of every piece of animation in millis,
104+
105+ ` fitSystemWindows ` - if true, then the default implementation of fitSystemWindows(Rect) will be executed,
106+
107+ ` clipToPadding ` - true to clip children to the padding of the group, false otherwise.
108+
109+ The last two parameters may be useful if you use _ Translucent_ parameters in your theme:
110+ ```
111+ <item name="android:windowTranslucentStatus">true</item>
112+ ```
113+ To stay ` Context Menu ` below Status Bar set ` fitSystemWindows ` to true and ` clipToPadding ` to false.
77114
78115## Compatibility
79116
80117 * Android Honeycomb 3.0+
81118
82119# Changelog
83120
121+ ### Version: 1.0.2
122+
123+ * Changed ` MenuObject ` constructors. Image setting is moved to methods
124+ * Added styling of ` MenuObject ` image, background, text color, divider color
125+ * Added possibility to interact with translucent Status Bar
126+
84127### Version: 1.0.1
85128
86129 * Added ` OnMenuItemLongClickListener ` (usage: the same as ` OnMenuItemClickListener ` , check sample app)
0 commit comments