Skip to content

Commit 153448d

Browse files
authored
Merge branch 'master' into develop
2 parents a70cae4 + 4748ea9 commit 153448d

File tree

5 files changed

+43
-15
lines changed

5 files changed

+43
-15
lines changed

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Side--Menu.Android-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1388)
1+
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Side--Menu.Android-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1388) [![Yalantis](https://github.com/Yalantis/Side-Menu.Android/blob/master/badge.png)](https://yalantis.com/?utm_source=github)
22
Side Menu
33
==============
4-
Side menu with some categories to choose.
5-
Made in <a href="http://yalantis.com/"> Yalantis</a>.<br>
4+
#### Side menu with some categories to choose.
65
Check this <a href="https://dribbble.com/shots/1689922-Side-Menu-Animation?list=searches&tag=yalantis&offset=0">project on dribbble</a>.<br>
76
Check this <a href="https://www.behance.net/gallery/20411445/Mobile-Animations-Interactions ">project on Behance</a>.
87

@@ -22,14 +21,14 @@ Using
2221
======
2322
First of all you have to upload animation submodule with `git submodule update --init` command <br>
2423
<br>
25-
Or you can add gradle dependency with <br>
24+
Or you can add gradle dependency with command :<br>
2625
```groovy
2726
dependencies {
28-
compile 'com.yalantis:sidemenu:1.0'`
27+
compile 'com.yalantis:sidemenu:1.0'
2928
}
3029
```
31-
command.<br>
32-
and <br>
30+
.<br>
31+
and command:<br>
3332
```groovy
3433
repositories {
3534
maven {
@@ -41,7 +40,11 @@ and <br>
4140
}
4241
4342
```
44-
<br> for CircularReveal module
43+
44+
To add gradle dependency you need to open build.gradle (in your app folder,not in a project folder) then copy and add the dependencies there in the dependencies block;
45+
46+
47+
<br> for CircularReveal module
4548

4649

4750
After you have to create special overlay layout to show in behind current `Circular Reveal` animated view.
@@ -123,6 +126,28 @@ And to add all items to menu you have to add all of them into `LinearLayout`
123126
All menu items should implement `Resourceble` interface to get menu item name and drawable res
124127
And all fragments should implement `ScreenShotable` to get screenshot of a fragment
125128

129+
You can customize icons that u place in the menu,or add mor items. Simply by changing the list you parse to view animator .For example:
130+
131+
```java
132+
133+
private List<SlideMenuItem> list = new ArrayList<>(); \\ the list of menu items
134+
135+
SlideMenuItem menuItem0 = new SlideMenuItem(ContentFragment.CLOSE, R.drawable.icn_close);
136+
list.add(menuItem0);
137+
SlideMenuItem menuItem = new SlideMenuItem(ContentFragment.BUILDING, R.drawable.icn_1); \\first parameter is the id of menu item,the second is the icon resouce
138+
list.add(menuItem);
139+
SlideMenuItem menuItem2 = new SlideMenuItem(ContentFragment.BOOK, R.drawable.icn_2);
140+
list.add(menuItem2);
141+
142+
viewAnimator = new ViewAnimator<>(this, list, contentFragment, drawerLayout, this);
143+
```
144+
145+
#### Let us know!
146+
147+
We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.
148+
149+
P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned!
150+
126151
## License
127152

128153
Copyright 2015, Yalantis

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
android:theme="@style/AppTheme">
1010
<activity
1111
android:name=".MainActivity"
12+
android:configChanges="orientation|screenSize"
1213
android:label="@string/app_name">
1314
<intent-filter>
1415
<action android:name="android.intent.action.MAIN"/>

app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ public class MainActivity extends AppCompatActivity implements ViewAnimator.View
4040
protected void onCreate(Bundle savedInstanceState) {
4141
super.onCreate(savedInstanceState);
4242
setContentView(R.layout.activity_main);
43-
if (savedInstanceState == null) {
44-
contentFragment = ContentFragment.newInstance(R.drawable.content_music);
45-
getSupportFragmentManager().beginTransaction()
46-
.add(R.id.content_frame, contentFragment)
47-
.commit();
48-
}
43+
contentFragment = ContentFragment.newInstance(R.drawable.content_music);
44+
getSupportFragmentManager().beginTransaction()
45+
.replace(R.id.content_frame, contentFragment)
46+
.commit();
4947
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
5048
drawerLayout.setScrimColor(Color.TRANSPARENT);
5149
linearLayout = (LinearLayout) findViewById(R.id.left_drawer);

badge.png

1.17 KB
Loading

library/src/main/java/yalantis/com/sidemenu/util/ViewAnimator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.os.Handler;
44
import android.support.v4.widget.DrawerLayout;
5-
import android.support.v7.app.ActionBarActivity;
65
import android.support.v7.app.AppCompatActivity;
76
import android.view.View;
87
import android.view.animation.AccelerateInterpolator;
@@ -25,31 +24,36 @@ public class ViewAnimator<T extends Resourceble> {
2524
public static final int CIRCULAR_REVEAL_ANIMATION_DURATION = 500;
2625

2726
private AppCompatActivity appCompatActivity;
27+
2828
private List<T> list;
2929

3030
private List<View> viewList = new ArrayList<>();
3131
private ScreenShotable screenShotable;
3232
private DrawerLayout drawerLayout;
3333
private ViewAnimatorListener animatorListener;
3434

35+
3536
public ViewAnimator(AppCompatActivity activity,
3637
List<T> items,
3738
ScreenShotable screenShotable,
3839
final DrawerLayout drawerLayout,
3940
ViewAnimatorListener animatorListener) {
4041
this.appCompatActivity = activity;
42+
4143
this.list = items;
4244
this.screenShotable = screenShotable;
4345
this.drawerLayout = drawerLayout;
4446
this.animatorListener = animatorListener;
4547
}
4648

49+
4750
public void showMenuContent() {
4851
setViewsClickable(false);
4952
viewList.clear();
5053
double size = list.size();
5154
for (int i = 0; i < size; i++) {
5255
View viewMenu = appCompatActivity.getLayoutInflater().inflate(R.layout.menu_list_item, null);
56+
5357
final int finalI = i;
5458
viewMenu.setOnClickListener(new View.OnClickListener() {
5559
@Override

0 commit comments

Comments
 (0)