Skip to content

Commit 2b377cd

Browse files
committed
Merge pull request #72 from yayaa/master
CustomView support on Menus & Soft NavigationBar Overlapping Bug Fix
2 parents 237ccbb + ac63196 commit 2b377cd

7 files changed

Lines changed: 268 additions & 387 deletions

File tree

README.md

Lines changed: 23 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,42 @@
11
#AndroidResideMenu
22
------
3-
### 中文说明请点击 [这里][1]
43

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.
76
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-
```
287

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" />
479

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]
5112

52-
**or**
13+
## [Default Usage][5]
5314

54-
If you want to merge ResideMenu with your project, you should follow these steps.
15+
## Custom Usage
5516

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.
6018

61-
## Usage
62-
init ResideMenu: write these code in Activity onCreate()
6319
```java
64-
// attach to current activity;
65-
resideMenu = new ResideMenu(this);
20+
resideMenu = new ResideMenu(activity, R.layout.menu_left, R.layout.menu_right);
6621
resideMenu.setBackground(R.drawable.menu_background);
67-
resideMenu.attachToActivity(this);
22+
resideMenu.attachToActivity(activity);
23+
resideMenu.setScaleValue(0.5f);
6824

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);
10827
```
10928

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:
11430

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.
11731
```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
12136
```
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-
12837

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

README_CN.md

Lines changed: 0 additions & 129 deletions
This file was deleted.

ResideMenu/res/layout/residemenu.xml

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
3+
4+
<ImageView
5+
android:id="@+id/iv_background"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
android:adjustViewBounds="true"
9+
android:scaleType="centerCrop" />
10+
11+
<ImageView
12+
android:id="@+id/iv_shadow"
13+
android:layout_width="fill_parent"
14+
android:layout_height="fill_parent"
15+
android:background="@drawable/shadow"
16+
android:scaleType="fitXY" />
17+
18+
<RelativeLayout
19+
android:id="@+id/sv_menu_holder"
20+
android:layout_width="match_parent"
21+
android:layout_height="match_parent" >
22+
23+
</RelativeLayout>
24+
25+
</merge>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent" >
5+
6+
<ScrollView
7+
android:id="@+id/sv_left_menu"
8+
android:layout_width="150dp"
9+
android:layout_height="wrap_content"
10+
android:layout_alignParentLeft="true"
11+
android:layout_centerVertical="true"
12+
android:layout_marginLeft="30dp"
13+
android:scrollbars="none" >
14+
15+
<LinearLayout
16+
android:id="@+id/layout_left_menu"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:orientation="vertical" >
20+
</LinearLayout>
21+
</ScrollView>
22+
23+
</RelativeLayout>

0 commit comments

Comments
 (0)