Skip to content

Commit

Permalink
change a wrong void's name and update README doc
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecialCyCi committed Apr 14, 2014
1 parent c30a5e7 commit a3fc46d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ init ResideMenu: write these code in Activity onCreate()
for (int i = 0; i < titles.length; i++){
ResideMenuItem item = new ResideMenuItem(this, icon[i], titles[i]);
item.setOnClickListener(this);
resideMenu.addMenuItem(item);
resideMenu.addMenuItem(item, ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT
}
```
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.
Expand All @@ -59,7 +59,7 @@ If you want to use slipping gesture to operate(lock/unlock) the menu, override t

open/close menu
```java
resideMenu.openMenu();
resideMenu.openMenu(ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT
resideMenu.closeMenu();
```

Expand All @@ -79,6 +79,11 @@ listen in the menu state
};
```

disable a direction
```java
resideMenu.setDirectionDisable(ResideMenu.DIRECTION_RIGHT);
```

##Ignored Views
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.
```java
Expand All @@ -97,4 +102,4 @@ Email: specialcyci#gmail.com
[2]: http://dribbble.com/shots/1116265-Instasave-iPhone-App
[3]: http://dribbble.com/shots/1114754-Social-Feed-iOS7
[4]: https://github.com/romaonthego/RESideMenu
[5]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/ResideMenuDemo/project.properties
[5]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/ResideMenuDemo/project.properties
12 changes: 9 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ReisdeMenu 创意灵感来自于Dribbble[1][1]还有[2][2],而这个是Android
for (int i = 0; i < titles.length; i++){
ResideMenuItem item = new ResideMenuItem(this, icon[i], titles[i]);
item.setOnClickListener(this);
resideMenu.addMenuItem(item);
resideMenu.addMenuItem(item, ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT
}
```
如果您需要使用手势滑动开启/关闭菜单,请复写activity的dispatchTouchEvent(),代码如下
Expand All @@ -57,7 +57,7 @@ ReisdeMenu 创意灵感来自于Dribbble[1][1]还有[2][2],而这个是Android
开启/关闭菜单
open or close menu
```java
resideMenu.openMenu();
resideMenu.openMenu(ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT
resideMenu.closeMenu();
```
监听菜单状态
Expand All @@ -76,6 +76,12 @@ resideMenu.closeMenu();
};
```

禁止使用某个菜单方向
```java
resideMenu.setDirectionDisable(ResideMenu.DIRECTION_RIGHT);
```


##Ignored Views
在某些场景下,手势滑动开启/关闭菜单可能与您的某些控件产生冲突,例如viewpager,这时您可以把viewpager添加到ignored view.
```java
Expand All @@ -94,4 +100,4 @@ Email: specialcyci#gmail.com
[3]: https://github.com/romaonthego/RESideMenu
[4]: http://dribbble.com/shots/1116265-Instasave-iPhone-App
[5]: http://dribbble.com/shots/1114754-Social-Feed-iOS7
[6]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/ResideMenuDemo/project.properties
[6]: https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/ResideMenuDemo/project.properties
8 changes: 4 additions & 4 deletions ResideMenu/src/com/special/ResideMenu/ResideMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class ResideMenu extends FrameLayout implements GestureDetector.OnGesture
private float lastRawX;
private boolean canScale = false;
private int scaleDirection = DIRECTION_LEFT;
private List<Integer> disableDirection = new ArrayList<Integer>();
private List<Integer> disabledDirection = new ArrayList<Integer>();

public ResideMenu(Context context) {
super(context);
Expand Down Expand Up @@ -272,12 +272,12 @@ public void closeMenu(){
scaleUp_activity.start();
}

public void setDisableDirection(int direction){
disableDirection.add(direction);
public void setDirectionDisable(int direction){
disabledDirection.add(direction);
}

private boolean isInDisableDirection(int direction){
return disableDirection.contains(direction);
return disabledDirection.contains(direction);
}

private void setScaleDirection(int direction){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void setUpMenu() {
resideMenu.addMenuItem(itemSettings, ResideMenu.DIRECTION_RIGHT);

// You can disable a direction by setting ->
// resideMenu.setDisableDirection(ResideMenu.DIRECTION_RIGHT);
// resideMenu.setDirectionDisable(ResideMenu.DIRECTION_RIGHT);

findViewById(R.id.title_bar_left_menu).setOnClickListener(new View.OnClickListener() {
@Override
Expand Down

0 comments on commit a3fc46d

Please sign in to comment.