Skip to content

Commit

Permalink
Merge branch 'Haoxiqiang-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecialCyCi committed Jun 12, 2014
2 parents e9730e2 + a3ba05e commit 481b6e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions ResideMenu/src/com/special/ResideMenu/ResideMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class ResideMenu extends FrameLayout{
private int scaleDirection = DIRECTION_LEFT;
private int pressedState = PRESSED_DOWN;
private List<Integer> disabledSwipeDirection = new ArrayList<Integer>();
//valid scale factor is between 0.0f and 1.0f.
private float mScaleValue = 0.5f;

public ResideMenu(Context context) {
super(context);
Expand Down Expand Up @@ -256,9 +258,9 @@ public void openMenu(int direction){
setScaleDirection(direction);

isOpened = true;
AnimatorSet scaleDown_activity = buildScaleDownAnimation(viewActivity, 0.5f, 0.5f);
AnimatorSet scaleDown_activity = buildScaleDownAnimation(viewActivity, mScaleValue, mScaleValue);
AnimatorSet scaleDown_shadow = buildScaleDownAnimation(imageViewShadow,
0.5f + shadowAdjustScaleX, 0.5f + shadowAdjustScaleY);
mScaleValue + shadowAdjustScaleX, mScaleValue + shadowAdjustScaleY);
AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 1.0f);
scaleDown_shadow.addListener(animationListener);
scaleDown_activity.playTogether(scaleDown_shadow);
Expand Down Expand Up @@ -568,6 +570,10 @@ public int getScreenWidth(){
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return displayMetrics.widthPixels;
}

public void setScaleValue(float scaleValue) {
this.mScaleValue = scaleValue;
}

public interface OnMenuListener{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ private void setUpMenu() {
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
resideMenu.setMenuListener(menuListener);
//valid scale factor is between 0.0f and 1.0f. leftmenu'width is 150dip.
resideMenu.setScaleValue(0.6f);

// create menu items;
itemHome = new ResideMenuItem(this, R.drawable.icon_home, "Home");
Expand All @@ -56,7 +58,7 @@ private void setUpMenu() {
resideMenu.addMenuItem(itemSettings, ResideMenu.DIRECTION_RIGHT);

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

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

0 comments on commit 481b6e6

Please sign in to comment.