Skip to content

Commit c2396d5

Browse files
Special LeungSpecial Leung
authored andcommitted
Update README.
1 parent 2b377cd commit c2396d5

2 files changed

Lines changed: 254 additions & 11 deletions

File tree

README.md

Lines changed: 125 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,116 @@
11
#AndroidResideMenu
22
------
3+
### 中文说明请点击 [这里][1]
34

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.
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.
67
And thanks to the authors for the above idea and contribution.
7-
8+
<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/1.png" width="320" height="568" />
89
<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/2.gif" width="320" height="568" />
910

10-
## Fixes
11-
[Overlapping Soft NavigationBar to contentUI][4]
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+
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
47+
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] )**
51+
52+
**or**
53+
54+
If you want to merge ResideMenu with your project, you should follow these steps.
55+
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
60+
61+
## Usage
62+
init ResideMenu: write these code in Activity onCreate()
63+
```java
64+
// attach to current activity;
65+
resideMenu = new ResideMenu(this);
66+
resideMenu.setBackground(R.drawable.menu_background);
67+
resideMenu.attachToActivity(this);
68+
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+
};
108+
```
12109

13-
## [Default Usage][5]
110+
disable a swipe direction
111+
```java
112+
resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_RIGHT);
113+
```
14114

15115
## Custom Usage
16116

@@ -35,8 +135,22 @@ As your configuration's completed, now you can customize side menus by getting i
35135
// TODO: Do whatever you need to with rightMenu
36136
```
37137

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
138+
##Ignored Views
139+
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.
140+
```java
141+
// add gesture operation's ignored views
142+
FrameLayout ignored_view = (FrameLayout) findViewById(R.id.ignored_view);
143+
resideMenu.addIgnoredView(ignored_view);
144+
```
145+
So that in ignored view’s workplace, the slipping gesture will not be allowed to operate menu.
146+
147+
##About me
148+
A student from SCAU China.<br>
149+
Email: specialcyci#gmail.com
150+
151+
152+
[1]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/README_CN.md
153+
[2]: http://dribbble.com/shots/1116265-Instasave-iPhone-App
154+
[3]: http://dribbble.com/shots/1114754-Social-Feed-iOS7
155+
[4]: https://github.com/romaonthego/RESideMenu
156+
[5]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/ResideMenuDemo/project.properties

README_CN.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#AndroidResideMenu
2+
3+
------
4+
5+
ReisdeMenu 创意灵感来自于Dribbble[1][1]还有[2][2],而这个是Android版的ResideMenu,在视觉效果上部分参考了[iOS版的RESideMenu][3],并在此感谢以上作者的贡献。
6+
<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/1.png" width="320" height="568" />
7+
<img src="https://github.com/SpecialCyCi/AndroidResideMenu/raw/master/2.gif" width="320" height="568" />
8+
9+
## DEMO
10+
11+
本代码即是DEMO,您可以下载后选择您喜欢的IDE运行。SDK版本建议使用4.0以上
12+
13+
## Version Migration
14+
15+
#### `v1.0`, `v1.1`, `v1.2`, `v1.3` 升级到 `v1.4`
16+
17+
如果你开启了手势滑动,你需要替换被依附的 Activity 里 `dispatchTouchEvent()` 代码
18+
19+
```java
20+
@Override
21+
public boolean dispatchTouchEvent(MotionEvent ev) {
22+
return resideMenu.dispatchTouchEvent(ev);
23+
}
24+
```
25+
26+
## Requirements
27+
28+
运行在 Android 2.3 +
29+
30+
## Installation
31+
32+
### Gradle
33+
34+
```gradle
35+
repositories {
36+
mavenCentral()
37+
}
38+
dependencies {
39+
compile 'com.specyci:residemenu:1.6+'
40+
}
41+
```
42+
43+
### Other
44+
45+
直接导入ResideMenu项目并作为依赖项目<br>
46+
**[例子][6]**
47+
48+
**or**
49+
直接合并到您的项目之中
50+
51+
1. 复制src/com/special/ResideMenu下的所有代码到您的项目相应位置
52+
2. 复制libs/nineoldandroids-library-2.4.0.jar到您项目libs/下
53+
3. 复制res/drawable-hdpi/shadow.9.png到您的项目相应位置
54+
4. 复制res/layout/residemenu.xml 和 residemenu_item.xml到您的项目相应位置
55+
56+
## Usage
57+
写在Activity onCreate()中
58+
```java
59+
// attach to current activity;
60+
resideMenu = new ResideMenu(this);
61+
resideMenu.setBackground(R.drawable.menu_background);
62+
resideMenu.attachToActivity(this);
63+
64+
// create menu items;
65+
String titles[] = { "Home", "Profile", "Calendar", "Settings" };
66+
int icon[] = { R.drawable.icon_home, R.drawable.icon_profile, R.drawable.icon_calendar, R.drawable.icon_settings };
67+
68+
for (int i = 0; i < titles.length; i++){
69+
ResideMenuItem item = new ResideMenuItem(this, icon[i], titles[i]);
70+
item.setOnClickListener(this);
71+
resideMenu.addMenuItem(item, ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT
72+
}
73+
```
74+
如果您需要使用手势滑动开启/关闭菜单,请复写activity的dispatchTouchEvent(),代码如下
75+
```java
76+
@Override
77+
public boolean dispatchTouchEvent(MotionEvent ev) {
78+
return resideMenu.dispatchTouchEvent(ev);
79+
}
80+
```
81+
**在某些场景下,手势滑动开启/关闭菜单可能与您的某些控件产生冲突,例如viewpager,这时您可以把viewpager添加到ignored view.请参见下节Ignored Views**
82+
83+
开启/关闭菜单
84+
open or close menu
85+
```java
86+
resideMenu.openMenu(ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT
87+
resideMenu.closeMenu();
88+
```
89+
监听菜单状态
90+
```java
91+
resideMenu.setMenuListener(menuListener);
92+
private ResideMenu.OnMenuListener menuListener = new ResideMenu.OnMenuListener() {
93+
@Override
94+
public void openMenu() {
95+
Toast.makeText(mContext, "Menu is opened!", Toast.LENGTH_SHORT).show();
96+
}
97+
98+
@Override
99+
public void closeMenu() {
100+
Toast.makeText(mContext, "Menu is closed!", Toast.LENGTH_SHORT).show();
101+
}
102+
};
103+
```
104+
105+
禁止手势操作某个菜单方向
106+
```java
107+
resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_RIGHT);
108+
```
109+
110+
111+
##Ignored Views
112+
在某些场景下,手势滑动开启/关闭菜单可能与您的某些控件产生冲突,例如viewpager,这时您可以把viewpager添加到ignored view.
113+
```java
114+
// add gesture operation's ignored views
115+
FrameLayout ignored_view = (FrameLayout) findViewById(R.id.ignored_view);
116+
resideMenu.addIgnoredView(ignored_view);
117+
```
118+
这样子在ignored_view操作的区域就不允许用手势滑动操作菜单.
119+
120+
##About me
121+
A student from SCAU China.<br>
122+
Email: specialcyci#gmail.com
123+
124+
[1]: http://dribbble.com/shots/1116265-Instasave-iPhone-App
125+
[2]: http://dribbble.com/shots/1114754-Social-Feed-iOS7
126+
[3]: https://github.com/romaonthego/RESideMenu
127+
[4]: http://dribbble.com/shots/1116265-Instasave-iPhone-App
128+
[5]: http://dribbble.com/shots/1114754-Social-Feed-iOS7
129+
[6]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/ResideMenuDemo/project.properties

0 commit comments

Comments
 (0)