Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Make it work on Android 4.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
bk138 committed Jul 26, 2013
1 parent d69d7a8 commit 0fe72c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libslidemenu/project.properties
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
target=android-18
android.library=true
12 changes: 11 additions & 1 deletion libslidemenu/src/com/coboltforge/slidemenu/SlideMenu.java
Expand Up @@ -123,6 +123,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
private TranslateAnimation slideMenuLeftAnim;
private TranslateAnimation slideContentLeftAnim;


private ArrayList<SlideMenuItem> menuItemList;
private SlideMenuInterface.OnSlideMenuItemClickListener callback;

Expand Down Expand Up @@ -192,8 +193,10 @@ public void init(Activity act, int menuResource, SlideMenuInterface.OnSlideMenuI
setAnimationDuration(slideDuration);
// and get our menu
parseXml(menuResource);

}


/**
* Set how long slide animation should be
* @see TranslateAnimation#setDuration(long)
Expand Down Expand Up @@ -299,8 +302,12 @@ private void show(boolean animate) {
* the android.R.id.content FrameLayout is directly attached to the DecorView,
* without the intermediate LinearLayout that holds the titlebar plus content.
*/
content = (FrameLayout) act.findViewById(android.R.id.content);
if(Build.VERSION.SDK_INT < 18)
content = (ViewGroup) act.findViewById(android.R.id.content);
else
content = (ViewGroup) act.findViewById(android.R.id.content).getParent(); //FIXME? what about the corner cases (fullscreen etc)
}

FrameLayout.LayoutParams parm = new FrameLayout.LayoutParams(-1, -1, 3);
parm.setMargins(menuSize, 0, -menuSize, 0);
content.setLayoutParams(parm);
Expand Down Expand Up @@ -328,11 +335,14 @@ private void show(boolean animate) {
parent.addView(content); // add content to FrameLayout
}


LayoutInflater inflater = (LayoutInflater) act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
menu = inflater.inflate(R.layout.slidemenu, null);

FrameLayout.LayoutParams lays = new FrameLayout.LayoutParams(-1, -1, 3);
lays.setMargins(0, statusHeight, 0, 0);
menu.setLayoutParams(lays);

parent.addView(menu);

// set header
Expand Down

0 comments on commit 0fe72c0

Please sign in to comment.