|
1 | 1 | #AndroidResideMenu |
2 | 2 | ------ |
3 | | -### 中文说明请点击 [这里][1] |
4 | 3 |
|
5 | | -The idea of ResideMenu is from Dribble [1][2] and [2][3]. It has come true and run in iOS devices. [iOS ResideMenu][4] |
6 | | -This project is the RefsideMenu Android version. The visual effect is partly referred to iOS version of ResideMenu. |
| 4 | +The idea of ResideMenu is from Dribble [1] and [2]. It has come true and run in iOS devices. [iOS ResideMenu][3] |
| 5 | +This project is the ResideMenu Android version. The visual effect is partly referred to iOS version of ResideMenu. |
7 | 6 | And thanks to the authors for the above idea and contribution. |
8 | | -<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/1.png" width="320" height="568" /> |
9 | | -<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/2.gif" width="320" height="568" /> |
10 | | - |
11 | | -Now with 3D support ! |
12 | | -<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/3Dsupport.png" width="320" height="568" /> |
13 | | -## DEMO |
14 | | -This copy is the demo. |
15 | | - |
16 | | -## Version Migration |
17 | | - |
18 | | -#### Upgrading to `v1.4` from `v1.3`, `v1.2`, `v1.1`, `v1.0` |
19 | | - |
20 | | -Duplicate the followed code in dispatchTouchEvent() of Activity, replace the old `dispatchTouchEvent()` code. |
21 | | - |
22 | | -```java |
23 | | - @Override |
24 | | - public boolean dispatchTouchEvent(MotionEvent ev) { |
25 | | - return resideMenu.dispatchTouchEvent(ev); |
26 | | - } |
27 | | -``` |
28 | 7 |
|
29 | | -## Requirements |
30 | | - |
31 | | -Run in Android 2.3 + |
32 | | - |
33 | | -## Installation |
34 | | - |
35 | | -### Gradle |
36 | | - |
37 | | -```gradle |
38 | | -repositories { |
39 | | - mavenCentral() |
40 | | -} |
41 | | -dependencies { |
42 | | - compile 'com.specyci:residemenu:1.6+' |
43 | | -} |
44 | | -``` |
45 | | - |
46 | | -### Other |
| 8 | +<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/2.gif" width="320" height="568" /> |
47 | 9 |
|
48 | | - 1. import ResideMenu project to your workspace. |
49 | | - 2. make it as a dependency library project to your main project. |
50 | | -<br>**( see [example][5] )** |
| 10 | +## Fixes |
| 11 | +[Overlapping Soft NavigationBar to contentUI][4] |
51 | 12 |
|
52 | | -**or** |
| 13 | +## [Default Usage][5] |
53 | 14 |
|
54 | | -If you want to merge ResideMenu with your project, you should follow these steps. |
| 15 | +## Custom Usage |
55 | 16 |
|
56 | | - 1. Copy all files from src/com/special/ResideMenu to your project. |
57 | | - 2. Copy libs/nineoldandroids-library-2.4.0.jar to your project’s corresponding path: libs/ |
58 | | - 3. Copy res/drawable-hdpi/shadow.9.png to your project’s corresponding path: res/drawable-hdpi/ |
59 | | - 4. Copy res/layout/residemenu.xml and residemenu_item.xml to your project’s corresponding path: res/layout |
| 17 | +Do your reside menu configurations, by creating an instance of ResideMenu with your custom layout's resource Ids. If you want to use default layout, just pass that variable as -1. |
60 | 18 |
|
61 | | -## Usage |
62 | | -init ResideMenu: write these code in Activity onCreate() |
63 | 19 | ```java |
64 | | - // attach to current activity; |
65 | | - resideMenu = new ResideMenu(this); |
| 20 | + resideMenu = new ResideMenu(activity, R.layout.menu_left, R.layout.menu_right); |
66 | 21 | resideMenu.setBackground(R.drawable.menu_background); |
67 | | - resideMenu.attachToActivity(this); |
| 22 | + resideMenu.attachToActivity(activity); |
| 23 | + resideMenu.setScaleValue(0.5f); |
68 | 24 |
|
69 | | - // create menu items; |
70 | | - String titles[] = { "Home", "Profile", "Calendar", "Settings" }; |
71 | | - int icon[] = { R.drawable.icon_home, R.drawable.icon_profile, R.drawable.icon_calendar, R.drawable.icon_settings }; |
72 | | - |
73 | | - for (int i = 0; i < titles.length; i++){ |
74 | | - ResideMenuItem item = new ResideMenuItem(this, icon[i], titles[i]); |
75 | | - item.setOnClickListener(this); |
76 | | - resideMenu.addMenuItem(item, ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT |
77 | | - } |
78 | | -``` |
79 | | -If you want to use slipping gesture to operate(lock/unlock) the menu, override this code in Acitivity dispatchTouchEvent() (please duplicate the followed code in dispatchTouchEvent() of Activity. |
80 | | -```java |
81 | | - @Override |
82 | | - public boolean dispatchTouchEvent(MotionEvent ev) { |
83 | | - return resideMenu.dispatchTouchEvent(ev); |
84 | | - } |
85 | | -``` |
86 | | -**On some occasions, the slipping gesture function for locking/unlocking menu, may have conflicts with your widgets, such as viewpager. By then you can add the viewpager to ignored view, please refer to next chapter – Ignored Views.** |
87 | | - |
88 | | -open/close menu |
89 | | -```java |
90 | | -resideMenu.openMenu(ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT |
91 | | -resideMenu.closeMenu(); |
92 | | -``` |
93 | | - |
94 | | -listen in the menu state |
95 | | -```java |
96 | | - resideMenu.setMenuListener(menuListener); |
97 | | - private ResideMenu.OnMenuListener menuListener = new ResideMenu.OnMenuListener() { |
98 | | - @Override |
99 | | - public void openMenu() { |
100 | | - Toast.makeText(mContext, "Menu is opened!", Toast.LENGTH_SHORT).show(); |
101 | | - } |
102 | | - |
103 | | - @Override |
104 | | - public void closeMenu() { |
105 | | - Toast.makeText(mContext, "Menu is closed!", Toast.LENGTH_SHORT).show(); |
106 | | - } |
107 | | - }; |
| 25 | + resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_RIGHT); |
| 26 | + resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_LEFT); |
108 | 27 | ``` |
109 | 28 |
|
110 | | -disable a swipe direction |
111 | | -```java |
112 | | - resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_RIGHT); |
113 | | -``` |
| 29 | +As your configuration's completed, now you can customize side menus by getting instances of them as following: |
114 | 30 |
|
115 | | -##Ignored Views |
116 | | -On some occasions, the slipping gesture function for locking/unlocking menu, may have conflicts with your widgets such as viewpager.By then you can add the viewpager to ignored view. |
117 | 31 | ```java |
118 | | - // add gesture operation's ignored views |
119 | | - FrameLayout ignored_view = (FrameLayout) findViewById(R.id.ignored_view); |
120 | | - resideMenu.addIgnoredView(ignored_view); |
| 32 | + View leftMenu = resideMenu.getLeftMenuView(); |
| 33 | + // TODO: Do whatever you need to with leftMenu |
| 34 | + View rightMenu = resideMenu.getRightMenuView(); |
| 35 | + // TODO: Do whatever you need to with rightMenu |
121 | 36 | ``` |
122 | | -So that in ignored view’s workplace, the slipping gesture will not be allowed to operate menu. |
123 | | - |
124 | | -##About me |
125 | | -A student from SCAU China.<br> |
126 | | -Email: specialcyci#gmail.com |
127 | | - |
128 | 37 |
|
129 | | - [1]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/README_CN.md |
130 | | - [2]: http://dribbble.com/shots/1116265-Instasave-iPhone-App |
131 | | - [3]: http://dribbble.com/shots/1114754-Social-Feed-iOS7 |
132 | | - [4]: https://github.com/romaonthego/RESideMenu |
133 | | - [5]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/ResideMenuDemo/project.properties |
| 38 | + [1]: http://dribbble.com/shots/1116265-Instasave-iPhone-App |
| 39 | + [2]: http://dribbble.com/shots/1114754-Social-Feed-iOS7 |
| 40 | + [3]: https://github.com/romaonthego/RESideMenu |
| 41 | + [4]: https://github.com/SpecialCyCi/AndroidResideMenu/issues/68 |
| 42 | + [5]: https://github.com/SpecialCyCi/AndroidResideMenu#usage |
0 commit comments