Skip to content

Commit

Permalink
Fixing attachSlidingMenu method. Still untested
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeinstein10 committed Sep 12, 2012
1 parent 6d2d643 commit 5731fd4
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions library/src/com/slidingmenu/lib/SlidingMenu.java
Expand Up @@ -4,7 +4,6 @@

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
Expand All @@ -16,7 +15,6 @@
import android.support.v4.os.ParcelableCompat;
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -58,17 +56,10 @@ public static void attachSlidingMenu(Activity activity, SlidingMenu sm, boolean
} else {
// take the above view out of
ViewGroup content = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT);
View above = content.getChildAt(0);
content.removeAllViews();
sm.setContent(above);
content.addView(sm, LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
// if (parent != null) {
// parent.removeView(mViewAbove);
// }
// // save people from having transparent backgrounds
// if (mViewAbove.getBackground() == null) {
// mViewAbove.setBackgroundResource(background);
// }
// mSlidingMenu.setViewAbove(mViewAbove);
// parent.addView(mSlidingMenu, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
}

Expand Down Expand Up @@ -385,7 +376,7 @@ public void setOnClosedListener(OnClosedListener listener) {
mViewAbove.setOnClosedListener(listener);
}

public static class SavedState extends BaseSavedState {
private static class SavedState extends BaseSavedState {
boolean mBehindShowing;

public SavedState(Parcelable superState) {
Expand Down Expand Up @@ -417,16 +408,16 @@ public SavedState[] newArray(int size) {
}
}


public Parcelable onSaveInstanceState() {
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.mBehindShowing = isBehindShowing();
return ss;
}


public void onRestoreInstanceState(Parcelable state) {
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
Expand All @@ -441,7 +432,7 @@ public void onRestoreInstanceState(Parcelable state) {
showAbove();
}
}

@Override
protected boolean fitSystemWindows(Rect insets) {
RelativeLayout.LayoutParams params = ((RelativeLayout.LayoutParams)mViewBehind.getLayoutParams());
Expand Down

0 comments on commit 5731fd4

Please sign in to comment.