Skip to content

Commit

Permalink
Fix the problem of items > 10. #4
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecialCyCi committed Dec 27, 2014
1 parent 97d9b83 commit 8b7eff3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
9 changes: 4 additions & 5 deletions ResideMenu/res/layout/residemenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
android:scrollbars="none"
android:paddingLeft="30dp"
android:layout_width="150dp"
android:layout_height="fill_parent">
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical">
<LinearLayout
android:id="@+id/layout_left_menu"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

Expand All @@ -38,12 +38,11 @@
android:scrollbars="none"
android:paddingRight="30dp"
android:layout_width="150dp"
android:layout_height="fill_parent"
android:layout_gravity="right">
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical">
<LinearLayout
android:id="@+id/layout_right_menu"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right">
Expand Down
3 changes: 2 additions & 1 deletion ResideMenu/res/layout/residemenu_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="30dp">
android:paddingTop="15dp"
android:paddingBottom="15dp">

<ImageView
android:layout_width="30dp"
Expand Down
30 changes: 15 additions & 15 deletions ResideMenu/src/com/special/ResideMenu/ResideMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ private void initViews(Context context){
layoutRightMenu = (LinearLayout) findViewById(R.id.layout_right_menu);
imageViewBackground = (ImageView) findViewById(R.id.iv_background);
}

@Override
protected boolean fitSystemWindows(Rect insets) {
// Applies the content insets to the view's padding, consuming that content (modifying the insets to be 0),
// and returning true. This behavior is off by default and can be enabled through setFitsSystemWindows(boolean)
// in api14+ devices.
this.setPadding(viewActivity.getPaddingLeft() + insets.left, viewActivity.getPaddingTop() + insets.top,
viewActivity.getPaddingRight() + insets.right, viewActivity.getPaddingBottom() + insets.bottom);
insets.left = insets.top = insets.right = insets.bottom = 0;
return true;
}
protected boolean fitSystemWindows(Rect insets) {
// Applies the content insets to the view's padding, consuming that content (modifying the insets to be 0),
// and returning true. This behavior is off by default and can be enabled through setFitsSystemWindows(boolean)
// in api14+ devices.
this.setPadding(viewActivity.getPaddingLeft() + insets.left, viewActivity.getPaddingTop() + insets.top,
viewActivity.getPaddingRight() + insets.right, viewActivity.getPaddingBottom() + insets.bottom);
insets.left = insets.top = insets.right = insets.bottom = 0;
return true;
}

/**
* use the method to set up the activity which residemenu need to show;
Expand Down Expand Up @@ -210,10 +210,10 @@ public void setMenuItems(List<ResideMenuItem> menuItems, int direction){
private void rebuildMenu(){
layoutLeftMenu.removeAllViews();
layoutRightMenu.removeAllViews();
for(int i = 0; i < leftMenuItems.size() ; i ++)
layoutLeftMenu.addView(leftMenuItems.get(i), i);
for(int i = 0; i < rightMenuItems.size() ; i ++)
layoutRightMenu.addView(rightMenuItems.get(i), i);
for (ResideMenuItem leftMenuItem : leftMenuItems)
layoutLeftMenu.addView(leftMenuItem);
for (ResideMenuItem rightMenuItem : rightMenuItems)
layoutRightMenu.addView(rightMenuItem);
}

/**
Expand Down Expand Up @@ -272,7 +272,7 @@ public void openMenu(int direction){
}

/**
* close the reslide menu;
* close the menu;
*/
public void closeMenu(){

Expand Down

0 comments on commit 8b7eff3

Please sign in to comment.