Skip to content

Commit

Permalink
update DEMO and fixed SpecialCyCi#5
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecialCyCi committed Apr 13, 2014
1 parent 6cc421c commit 37e09be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ResideMenu/src/com/special/ResideMenu/ResideMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ private void setViewPadding(){
public void openMenu(int direction){
if (isInDisableDirection(direction))
throw new IllegalArgumentException("You have set this direction disable, but now you want to open menu in this direction.");
setScaleDirection(direction);

isOpened = true;
setScaleDirection(direction);
AnimatorSet scaleDown_activity = buildScaleDownAnimation(view_activity, 0.5f, 0.5f);
AnimatorSet scaleDown_shadow = buildScaleDownAnimation(iv_shadow, 0.5f + shadow_AdjustScaleX, 0.5f + shadow_AdjustScaleY);
AnimatorSet alpha_menu = buildMenuAnimation(sv_menu, 1.0f);
Expand Down
10 changes: 9 additions & 1 deletion ResideMenuDemo/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_width="28dp"
android:layout_height="28dp"
android:background="@drawable/titlebar_menu_selector"
android:id="@+id/title_bar_menu"
android:id="@+id/title_bar_left_menu"
android:layout_gravity="left|center_vertical"
android:layout_marginLeft="10dp"/>

Expand All @@ -36,6 +36,14 @@
android:textSize="24sp"
android:textColor="#999999"
android:layout_gravity="center"/>

<Button
android:layout_width="28dp"
android:layout_height="28dp"
android:background="@drawable/titlebar_menu_selector"
android:id="@+id/title_bar_right_menu"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="10dp"/>
</FrameLayout>

<ImageView
Expand Down
12 changes: 10 additions & 2 deletions ResideMenuDemo/src/com/special/ResideMenuDemo/MenuActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ private void setUpMenu() {
resideMenu.addMenuItem(itemCalendar, ResideMenu.DIRECTION_RIGHT);
resideMenu.addMenuItem(itemSettings, ResideMenu.DIRECTION_RIGHT);

resideMenu.setDisableDirection(ResideMenu.DIRECTION_RIGHT);
findViewById(R.id.title_bar_menu).setOnClickListener(new View.OnClickListener() {
// You can disable a direction by setting ->
// resideMenu.setDisableDirection(ResideMenu.DIRECTION_RIGHT);

findViewById(R.id.title_bar_left_menu).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
resideMenu.openMenu(ResideMenu.DIRECTION_LEFT);
}
});
findViewById(R.id.title_bar_right_menu).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
resideMenu.openMenu(ResideMenu.DIRECTION_RIGHT);
}
});
}

@Override
Expand Down

0 comments on commit 37e09be

Please sign in to comment.