Skip to content

Commit c7945d6

Browse files
author
jfeinstein10
committed
Taking out fading for now. Too many bugs.
1 parent 8088844 commit c7945d6

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

example/src/com/slidingmenu/example/ExampleActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void onCreate(Bundle savedInstanceState) {
3737
t.commit();
3838

3939
// customize the SlidingMenu
40+
this.setSlidingActionBarEnabled(false);
4041
getSlidingMenu().setShadowWidthRes(R.dimen.shadow_width);
4142
getSlidingMenu().setShadowDrawable(R.drawable.shadow);
4243
getSlidingMenu().setBehindOffsetRes(R.dimen.actionbar_home_width);
@@ -48,6 +49,7 @@ public void onCreate(Bundle savedInstanceState) {
4849
actionBar.setDisplayHomeAsUpEnabled(true);
4950
}
5051

52+
5153
public class PagerAdapter extends FragmentPagerAdapter implements
5254
ViewPager.OnPageChangeListener, TabListener{
5355

library/src/com/slidingmenu/lib/CustomViewAbove.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,9 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
849849
child.layout(childLeft, childTop,
850850
childLeft + child.getMeasuredWidth(),
851851
childTop + child.getMeasuredHeight());
852+
Log.v(TAG, "top: " + childTop + ", left: " + childLeft +
853+
", height: " + child.getMeasuredHeight() +
854+
", width:" + child.getMeasuredWidth());
852855
}
853856
}
854857
mTopPageBounds = paddingTop;
@@ -1213,7 +1216,6 @@ public boolean onTouchEvent(MotionEvent ev) {
12131216
scrollX = leftBound;
12141217
} else if (scrollX > rightBound) {
12151218
scrollX = rightBound;
1216-
// scrollX = getChildWidth(mCurItem);
12171219
}
12181220
// Don't lose the rounded component
12191221
mLastMotionX += scrollX - (int) scrollX;
@@ -1312,10 +1314,17 @@ protected void onDraw(Canvas canvas) {
13121314
mShadowDrawable.draw(canvas);
13131315
}
13141316

1315-
if (mFadeEnabled) {
1316-
final float openPercent = (mScroller.getCurrX()) / (float) behindWidth;
1317-
onDrawBehindFade(canvas, openPercent, behindWidth);
1318-
}
1317+
// if (mFadeEnabled) {
1318+
// float openPercent = 0;
1319+
// if (mScrollState == SCROLL_STATE_DRAGGING) {
1320+
// openPercent= (behindWidth - Math.min(mLastMotionX, behindWidth)) / (float) behindWidth;
1321+
// Log.v("STATE_DRAGGING", "openPercent: "+openPercent);
1322+
// } else {
1323+
// openPercent= (mScroller.getCurrX()) / (float) behindWidth;
1324+
// Log.v("STATE_SETTLING", "openPercent: "+openPercent+", scrollerX: "+mScroller.getCurrX());
1325+
// }
1326+
// onDrawBehindFade(canvas, openPercent, behindWidth);
1327+
// }
13191328
}
13201329

13211330
private float mFadeDegree;

library/src/com/slidingmenu/lib/CustomViewBehind.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class CustomViewBehind extends CustomViewAbove {
1010

11-
private static final String TAG = "CustomViewBehind2";
11+
private static final String TAG = "CustomViewBehind";
1212

1313
public CustomViewBehind(Context context) {
1414
this(context, null);

library/src/com/slidingmenu/lib/SlidingMenu.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ public int getBehindOffset() {
157157
* @param i The margin on the right of the screen that the behind view scrolls to
158158
*/
159159
public void setBehindOffset(int i) {
160-
((RelativeLayout.LayoutParams)mViewBehind.getLayoutParams()).setMargins(0, 0, i, 0);
160+
RelativeLayout.LayoutParams params = ((RelativeLayout.LayoutParams)mViewBehind.getLayoutParams());
161+
int bottom = params.bottomMargin;
162+
int top = params.topMargin;
163+
int left = params.leftMargin;
164+
((RelativeLayout.LayoutParams)mViewBehind.getLayoutParams()).setMargins(left, top, i, bottom);
161165
}
162166

163167
/**

library/src/com/slidingmenu/lib/app/SlidingActivityHelper.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.view.ViewGroup.LayoutParams;
99
import android.widget.LinearLayout;
1010

11+
import com.slidingmenu.lib.R;
1112
import com.slidingmenu.lib.SlidingMenu;
1213

1314
public class SlidingActivityHelper {
@@ -27,7 +28,7 @@ public SlidingActivityHelper(Activity activity) {
2728
}
2829

2930
public void onCreate(Bundle savedInstanceState) {
30-
mSlidingMenu = new SlidingMenu(mActivity);
31+
mSlidingMenu = (SlidingMenu) mActivity.getLayoutInflater().inflate(R.layout.slidingmenumain, null);
3132
}
3233

3334
public void onPostCreate(Bundle savedInstanceState) {
@@ -44,15 +45,15 @@ public void onPostCreate(Bundle savedInstanceState) {
4445
decor.removeView(child);
4546
newDecor.addView(child);
4647
}
47-
decor.addView(mSlidingMenu, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
48+
decor.addView(mSlidingMenu);
4849
mSlidingMenu.setViewAbove(newDecor);
4950
} else {
5051
ViewGroup parent = (ViewGroup) mViewAbove.getParent();
5152
if (parent != null) {
5253
parent.removeView(mViewAbove);
5354
}
5455
mSlidingMenu.setViewAbove(mViewAbove);
55-
mActivity.setContentView(mSlidingMenu);
56+
mActivity.getWindow().setContentView(mSlidingMenu);
5657
}
5758
}
5859

0 commit comments

Comments
 (0)