Code Monkey home page Code Monkey logo

android-menudrawer's People

Contributors

dhuckaby avatar jakewharton avatar kevinsawicki avatar kwazi avatar levinotik avatar simonvt avatar smoreau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-menudrawer's Issues

Error Running on Android 2.1

Hello, whenever I try to attach a side menu on android 2.1(be it on the samples or in my own app) I get an ERROR/AndroidRuntime(4470): FATAL EXCEPTION: main
java.lang.NoSuchMethodError: net.simonvt.widget.BuildLayerFrameLayout.setLayerType

even when I dont set the layertype.On ICS everything works fine(I am using the dev branch).What can be wrong?

I want to creat the menu like app of path on ios . left menu and right menu

Hey Simon/Jake

First of all, thanks for sharing your app menu drawer implementation.

I want to creat the menu like app of path on ios . that have two menu for left and right in the mainactiviy in the theam time.

But in your code,i found : public MenuDrawerManager(Activity activity, int dragMode, int gravity) {
mActivity = activity;
mDragMode = dragMode;

    mMenuDrawer = gravity == MenuDrawer.MENU_POSITION_RIGHT ? new RightDrawer(activity) : new LeftDrawer(activity);

so, that's mean :your library can not do that. ?
Thanks/

Overdraw

A new developer option in JellyBean 4.2 allows you to show GPU overdraw (you've probably seen it already at http://www.curious-creature.org/2012/12/01/android-performance-case-study).

With this option enabled you can see that the sliding menu is still being drawn behind the content view even when the sliding drawer is shut.

This will have a negative performance impact on any activity that uses this.

Slow sliding.

When the content view is being moved slowly, the view movement becomes slower than the finger(pointer) movement.

The finger reaches the end and the view gets left behind.

[Feature Request] Add a way to have "holes" in TOUCH_MODE_FULLSCREEN

Hi,

It would be cool if there's an easy way to disable the allowdrag for certain zone when in TOUCH_MODE_FULLSCREEN.

For Viewpager for example we can override canScroll.

This may be needed for screen that contains seekbar or custom gesture zone that currently can't pass over this menu.

I think the same way as viewpager would be enough.

Change the duration of the opening / closing animation

Hi,

I am searching a way to accelerate the animation of the side menu.

I have searched in the source code and found that there is no real Android animation, the opening - closing is done in method animateOffsetTo().

So, is it possible to add a setter to velocity, as it will produce the effect I want.

Better would be a way to give the time in ms.

 protected void animateOffsetTo(int position, int velocity, boolean animate) {
        endDrag();
        endPeek();

        final int startX = (int) mOffsetPixels;
        final int dx = position - startX;
        if (dx == 0 || !animate) {
            setOffsetPixels(position);
            setDrawerState(position == 0 ? STATE_CLOSED : STATE_OPEN);
            stopLayerTranslation();
            return;
        }

        int duration;

        velocity = Math.abs(velocity);
        if (velocity > 0) {
            duration = 4 * Math.round(1000.f * Math.abs((float) dx / velocity));
        } else {
            duration = (int) (600.f * Math.abs((float) dx / mMenuSize));
        }

        duration = Math.min(duration, DURATION_MAX);

        if (dx > 0) {
            setDrawerState(STATE_OPENING);
            mScroller.startScroll(startX, 0, dx, 0, duration);
        } else {
            setDrawerState(STATE_CLOSING);
            mScroller.startScroll(startX, 0, dx, 0, duration);
        }

        startLayerTranslation();

        postAnimationInvalidate();
    }

I added code so every reader may understand how things work.

Regards

[Feature Request] Add a setter for MAX_DRAG_BEZEL_DP

Hi,

First thanks for your wonderfull lib.

Some of my users use covers for their phones / tablets that goes up to the border of the touch area and the default value of 24dp does not permit them to start the bezel swipe to show the menu.

Adding a new setter to configure this value would correct this.

Thanks,
Tolriq.

First Item Cutted

When i implement a menu bassed on scrollview, some times the was moved little up and the first item was cutted imposibiliting the correct use of the menu.

MenuDraver.setMenuWidth incorrectly updates childrens width

I used a bit google translator so the text may seem strange.
Android: 2.3.7

MDM= new MenuDrawerManager(this, MenuDrawer.MENU_DRAG_WINDOW);
MDM.setContentView(~empty FrameLayout, that will be a container in which
        I will be add or replace different Fragments depending on
        which menu item was clicked~);
MDM.setMenuView(~MenuScrollView from example application
        with padding to left and right side,
        which contains LinearLayout with menu items);

I'm using ActionBarSherlock, that placed, in this case, above fragment container.

actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(~Custom view that consist from
        custom implementation of ImageButton and standard TextView~);

Implementation of ImageButton overrides onMeasure to make button always square (regardless of the orientation of the screen) depending on ActionBar height:

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int height = View.MeasureSpec.getSize(heightMeasureSpec);       
    ~Here I call method from activity that contains the menu, 
        passing the new width of the button. 
        This method changes the width of the menu through call
        MenuDraver.setMenuWidth with new width 
        computed to make right border of the button 
        (in menu opened state) located
        exactly at right border of the screen, if the total screen width
        less then some MAX_MENU_WIDTH constant.
        There are actually a bit more complicated scheme,
        but it does not matter. 
        The point is that on devices with a small
        screen I need to change the width of the menu
        when changed screen orientation.~
    super.onMeasure(heightMeasureSpec, heightMeasureSpec);
}

Im manually handle screen orientation changes (android:configChanges="keyboardHidden|orientation|screenSize|locale").
MenuDraver.setMenuWidth correctly work on first use, but then, when screen orientation being changed, size of mMenuContainer is updates correctly, but its children, MenuScrollView , on its onSizeChanged method obtains incorrect, outdated (from previonsly orientation) size, and its padding displays incorrectly (skewed to one side).

I fixed it replacing this:

public void setMenuWidth(final int width) {
    mMenuWidth = width;
    mMenuWidthSet = true;
    if (mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING) {
        setOffsetPixels(mMenuWidth);
    }
    requestLayout();
    invalidate();
}

With this:

public void setMenuWidth(final int width) {
    mMenuWidth = width;
    mMenuWidthSet = true;
    if (mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING) {
        setOffsetPixels(mMenuWidth);
    }
    post(new Runnable() {
        public void run() {
            requestLayout();
            invalidate();
        }
    }); 
}

After these changes, it has become updating mMenuContainer childs properly.


Little off topic, possibly this:

@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    final int offsetPixels = mOffsetPixels;
    
    drawMenuOverlay(canvas, offsetPixels);
    if (mDropShadowEnabled) 
        drawDropShadow(canvas, offsetPixels);
    if (mArrowBitmap != null) 
        drawArrow(canvas, offsetPixels);
}

Will be a bit more effective in this form:

@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    final int offsetPixels = mOffsetPixels;
    
    if (mDrawerState != STATE_OPEN)
        drawMenuOverlay(canvas, offsetPixels);
    if (mDropShadowEnabled) 
        drawDropShadow(canvas, offsetPixels);
    if (mArrowBitmap != null) 
        drawArrow(canvas, offsetPixels);
}

mDrawerState doesn't changed to STATE_DRAGGING on onInterceptTouchEvent()

There is no mDrawerState change when start dragging a content window. OnDrawerStateChangeListener is notified only after removiing a finger. I suppose that this is due the issue at the following code from onInterceptTouchEvent():

case MotionEvent.ACTION_MOVE:
...
if (allowDrag) {
mIsDragging = true;
...
}

mIsDragging is set to true, but mDrawerState doesn't changed to STATE_DRAGGING.

click menu item back mainview

HI, When i click Menu item ,I want to change another activity stil the activity has the left menu .

private AdapterView.OnItemClickListener mItemClickListener = new AdapterView.OnItemClickListener() {
@OverRide
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mActivePosition = position;
mMenuDrawer.setActiveView(view, position);
// mContentTextView.setText(((TextView) view).getText());
mMenuDrawer.closeMenu();

        //start new activity  

//
Intent intent=new Intent(BaseActivity.this,CopyOfTestActivity.class);
startActivity(intent);
//
}
};

Use fragments as menu and content?

How would one use fragments for the menu and the content? Is it doable with the library? Or is it maybe easy to modify the library to play nice with fragments?

The library is really cool but if I can't use it with fragments, I really don't see its usefulness.

UI bug in Gingerbread when menu is scrolled

Hello, I discovered this bug today and confirmed it on 2 physical gingerbread devices, and 1 emulator. It may affect Froyo and older devices as well, but I did not test.

When scrolling the sliding menu, the entire background goes white. Sometimes it goes back to normal once finished scrolling, but not always.

To reproduce: open the included samples and add enough Items to cause the menu to scroll. Try scrolling.

Example, open ViewPagerSample.java and add these menu items:

    List<Object> items = new ArrayList<Object>();
    items.add(new Item("Item 1", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 2", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 1"));
    items.add(new Item("Item 3", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 4", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 2"));
    items.add(new Item("Item 5", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 6", R.drawable.ic_action_select_all_dark));
    items.add(new Item("Item 7", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 8", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 3"));
    items.add(new Item("Item 9", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 10", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 4"));
    items.add(new Item("Item 11", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 12", R.drawable.ic_action_select_all_dark));
    items.add(new Item("Item 13", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 14", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 5"));
    items.add(new Item("Item 15", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 16", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 6"));
    items.add(new Item("Item 17", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 18", R.drawable.ic_action_select_all_dark));

Launch the app, open the example, scroll the menu.

Maven Dependency

Adding the android-menudrawer library as a maven dependency.

<dependency>
            <groupId>net.simonvt</groupId>
            <artifactId>android-menudrawer</artifactId>
            <version>1.0.0</version>
            <type>apklib</type>
</dependency>

The library is downloaded from the Central Repository in

target/unpack/apklibs/net.simonvt_android-menudrawer_apklib_1.0.0

The target in it's project.properties is

Project target.

target=android-8

It should be 16.

Progress Dialog on SideMenu

Hello, how can I show a progress dialog inside the sidemenu(Like facebook does on its right sidemenu).

Thank you

add a shadow on the top of the sidebar menu

There is a shadow on the right side of the menu meaning the main part is on top of the slide menu.
But there is no shadow on top of the slide menu (between the actionbar and the slide menu content). Would be more realistic to add this shadow, isn't it?

I tried by myself but I don't like my solution (which is basically an onDraw() overwrite). If implemented in the lib, would be more clean and everyone would benefit from it.

Orientation change crash when using static menu drawer on one orientation only

Hello, @SimonVT, Thanks for this version 2.0.0.

I am having an issue using MenuDrawer.attach() with attachStatic = true in landscape and attachStatic = false in portrait.

mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.LEFT, getResources().getBoolean(R.bool.has_static_menu_drawer));

When switching from landscape to portrait I get the exception:

Caused by: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class net.simonvt.menudrawer.DraggableDrawer$SavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/md__drawer. Make sure other views do not use the same id.
at android.view.View.onRestoreInstanceState(View.java:12112)
at android.view.View.dispatchRestoreInstanceState(View.java:12088)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2582)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2588)
at android.view.View.restoreHierarchyState(View.java:12066)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1634)
at android.app.Activity.onRestoreInstanceState(Activity.java:938)
at com.actionbarsherlock.app.SherlockFragmentActivity.onRestoreInstanceState(SherlockFragmentActivity.java:133)
at android.app.Activity.performRestoreInstanceState(Activity.java:910)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1131)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
... 12 more

When switching from portrait to landscape I get the exception:

Caused by: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to net.simonvt.menudrawer.DraggableDrawer$SavedState
at net.simonvt.menudrawer.DraggableDrawer.onRestoreInstanceState(DraggableDrawer.java:622)
at android.view.View.dispatchRestoreInstanceState(View.java:12088)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2582)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2588)
at android.view.View.restoreHierarchyState(View.java:12066)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1634)
at android.app.Activity.onRestoreInstanceState(Activity.java:938)
at com.actionbarsherlock.app.SherlockFragmentActivity.onRestoreInstanceState(SherlockFragmentActivity.java:133)
at android.app.Activity.performRestoreInstanceState(Activity.java:910)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1131)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
... 11 more

Maybe what I am trying to do is just not supported yet ?

Issues With TabActivity and Preference Activity

First of all it is a great library but i am having issues while implementing it with TabActivity and Preference Activity.

With TabActivity the drawer itself does not shows up but with Preference Activity it hides my preferences view.

Background problem when scrolling listview

First I must tell you that 1 year ago, users with HTC Desire had similiar problem with my application. The listview background was all white on their problem and I could find the solution to that.

In you library, I have a similiar problem as you can see in the images below
Image with normal ListView
It becomes like this when I touch it.

I am using Motorola Atrix here. Atrix and MotoBlue UI has these kind of problems and I published my update. After couple of days my users complaint about this. Lots of users had this issue. And after that, I have published another update with using MenuScrollView with only TextViews in it. The problem is resolved now but I want to use ListView in my menudrawer.

What do you say? Thank you.

Add Maven Support?

I'd like to see maven support for this library. It makes it easy to add as a dependency on my project.

Api target problem for Honeycomb

Hi,

There's a problem in current 1.0 about android.view.View.buildLayer() in BuildLayerFrameLayout

You call this function if MenuDrawer.USE_TRANSLATIONS is set but you set this bool with :

static final boolean USE_TRANSLATIONS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;

But this function is API level 12 so should be Build.VERSION_CODES.HONEYCOMB_MR1

scrolling listview in menu changes background color to white

Looks like menudrawer expects any context to have a background color of white?

I was testing out a listview in the menu like what you see w/ SlideMenu and when you scroll, the entire background turns white (it's normally a dark grey). It sometimes gets stuck w/ a white background.

For the latter stuck background issue, you also see it sometimes with the static drawer sample...just try scrolling it up/down a bunch of times (I was testing on an old Moto Cliq w/ Android 2.1).

[feature request] Add ability to open menu drawer all the way

I have a need for a way for the menu drawer to be animated completely open so that you only see the menu and none of the content view. I want this to be triggered by the user while they're viewing the menu, so there needs to be another FULLY_OPEN state in addition to the OPEN state.

One way I thought about implementing this would be to allow the content view to be shifted to any arbitrary position (not just 0 and mMenuWidth). The menu would then be in the OPEN state any time the position of the menu is non-zero. The OPENING state would be set any time the menu is animating to the right (like it is now, I think) and CLOSING would be set when moving to the left.

Does anyone see a problem with this approach? One issue that comes to mind is that it becomes unclear what opacity the menu overlay should have since the menu width is undefined. The width of the menu view would need to be defined somewhere as well.

Scroller collision

Hi, Simon.

I'm using your number-picker library project and menudrawer and getting following error from dex:

java.lang.IllegalArgumentException: already added: Lnet/simonvt/widget/Scroller;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:486)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:180)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:703)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:577)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1000)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Could you move Scroller class to other package?

Disable the shadow on the side menu

Hi,

I want to disable the shadow on the right side of the menu because it doesn't match with the UI of my application. I've searched in resources a png or a drawable to delete. I imagine it is done programmatically. But I've not found where. Can you indicate me a way to do it ?

Thank you.

The content of menudrawer gets out beyond the screen with FEATURE_ACTION_BAR_OVERLAY

Drag mode was set to window.

The problem seems to be at MenuDrawer.onMeasure() method:

@OverRide
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
...
if (mDragMode == MENU_DRAG_WINDOW) {
View v = mContentView.getChildAt(0);
final int topPadding = v.getPaddingTop();
mMenuContainer.setPadding(0, topPadding, 0, 0);
}

topPadding equals to 25dp (status bar height?) without FEATURE_ACTION_BAR_OVERLAY, and 0 with FEATURE_ACTION_BAR_OVERLAY. But the contentView (android.R.id.content) gets topMargin=25dp when FEATURE_ACTION_BAR_OVERLAY is requested.
In case of FEATURE_ACTION_BAR_OVERLAY a decor view (getWindow().getDecorView()) is instance of ActionBarOverlayLayout (for API 16). That layout overrides fitSystemWindows(Rect insets) method and applies the insets for a content view. Maybe the MenuDrawer should contains such logic too.

IllegalStateException during activity startup

Hi Simon, thanks for this great library!

I got this crash while an activity was starting up (I never saw the activity, it crashed before it rendered)

W/dalvikvm( 8005): threadid=1: thread exiting with uncaught exception (group=0x40eb0300)
E/AndroidRuntime( 8005): FATAL EXCEPTION: main
E/AndroidRuntime( 8005): java.lang.IllegalStateException: This view must be attached to a window first
E/AndroidRuntime( 8005): at android.view.View.buildLayer(View.java:12109)
E/AndroidRuntime( 8005): at net.simonvt.widget.BuildLayerFrameLayout$2.run(BuildLayerFrameLayout.java:62)
E/AndroidRuntime( 8005): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 8005): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 8005): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 8005): at android.app.ActivityThread.main(ActivityThread.java:4931)
E/AndroidRuntime( 8005): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 8005): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 8005): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime( 8005): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
E/AndroidRuntime( 8005): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 316): Force finishing activity com.goalworthy.android/.nonui.activities.RecentGoalsActivity_

Menu has artefacts on window with surface view on HTC Sense 2.3

Hi.

On Android 2.3 on HTC Sence device the menu draws incorrectly. When you open the menu a part of it remains black. It seems like a surface "hole" not moved when you just call offsetLeftAndRight(). requestLayout() call fixes the problem.

@Override
protected void onOffsetPixelsChanged(int offsetPixels) {
    if (USE_TRANSLATIONS) {
        mContentView.setTranslationX(offsetPixels);
        offsetMenu(offsetPixels);
        requestLayout();
        invalidate();
    } else {
        mContentView.offsetLeftAndRight(offsetPixels - mContentView.getLeft());
        offsetMenu(offsetPixels);
        requestLayout();
        invalidate();
    }
}

Glitches while opening menu-drawer

Hello, first of all great job !!

I am using menu drawer with a custom layout as

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/activity_dashboard_menu_drawer_view"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<TextView android:id="@+id/activity_dashboard_login_category"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:drawableLeft="@drawable/facebook_menudrawer_icon"
          android:text="@string/activity_dashboard_login_category"
          style="@style/MenuDrawerCategoryStyle"/>

<LinearLayout
        android:id="@+id/activity_dashboard_menu_drawer_app_category_filter"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

</LinearLayout>

<main.java.com.appsurfer.views.components.MenuView
        android:id="@+id/activity_dashboard_menu_drawer_menu_view"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"/>

And in code i use a custom base list adapter to update the elements of the menudrawer

 private void prepareMenuDrawer() {
    // Initialize menu drawer manager
    mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT);
    mMenuDrawer.setContentView(R.layout.activity_dashboard);
    // initialize menu view
    LinearLayout menuDrawerLayout = (LinearLayout) getLayoutInflater().inflate(R.layout.activity_dashboard_menu_drawer_view, null);
    MenuView menuView = (MenuView) menuDrawerLayout.findViewById(R.id.activity_dashboard_menu_drawer_menu_view);
    menuView.setAdapter(getMenuListAdapter());
    menuView.setOnScrollChangedListener(new MenuView.OnScrollChangedListener() {
        @Override
        public void onScrollChanged() {
            mMenuDrawer.invalidate();
        }
    });
    // Initialize menu drawer manager
    mMenuDrawer.setMenuView(menuDrawerLayout);
}


private MenuListAdapter getMenuListAdapter() {
    MenuListAdapter menuListAdapter = new MenuListAdapter(mContext, mHandler);
    // creating array list of menu
    ArrayList<MenuItem> menuItems = new ArrayList<MenuItem>();
    menuItems.add(new MenuItem(0, "Login", 0, MenuItem.MenuItemType.CATEGORY));
    menuItems.add(new MenuItem(1, "Title", 0, MenuItem.MenuItemType.TITLE));       
    return menuListAdapter;
}

But with this code, there is a visible hick up while opening and closing the menu drawer. I mean if i am opening the menu bar at the start it stops and then the movement is fine and smooth.

I thought it might be because of adapter, but without setting the adapter if I open a blank menu drawer still issue is there. I am building for the min sdk 8 and target sdk 12. Can you help me on this ?

How to set activities into contentView

Dear sir,

I am going to implement facebook style menu. I searched a lot s of libraries for it and found this library is best.
But I have small issue for integrating with my project.
My project has already many FragmentActivityies. I am going to switch these activities using flyin menu. But I dont know how to set activities into contentView of ManuDrawer as view.

Please help me.
Regards,
Wang.

Rendering problem when used with Google Maps Android API v2

If there is map (v2) inside content area sliding menu is not rendered and you see just a black background.

I have faced that issue on Galaxy S3 and many other 2.3 phones. However on Galaxy Nexus with 4.2 everything is ok.

I have attached screenshot that illustrates the problem.
map_problem

View.LAYER_TYPE_HARDWARE and SurfaceView

Hi, Simon. It's me again. I faced with problem when content view with SurfaceView (GLSurfaceView i guess) becomes transparent while sliding. It turns normal when sliding is finished, I've found that this behavior is side effect of forced View.LAYER_TYPE_HARDWARE. If i comment setLayerType() lines the view draws as it should. Can you provide a mechanism to disable LAYER_TYPE_HARDWARE setting.

/**
 * If possible, set the layer type to {@link View#LAYER_TYPE_HARDWARE}.
 */
private void startLayerTranslation() {
    if (USE_TRANSLATIONS && !mLayerTypeHardware) {
        mLayerTypeHardware = true;
        mContentView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        mMenuContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }
}

/**
 * If the current layer type is {@link View#LAYER_TYPE_HARDWARE}, this will set it to @link View#LAYER_TYPE_NONE}.
 */
private void stopLayerTranslation() {
    if (mLayerTypeHardware) {
        mLayerTypeHardware = false;
        mContentView.setLayerType(View.LAYER_TYPE_NONE, null);
        mMenuContainer.setLayerType(View.LAYER_TYPE_NONE, null);
    }
}

Right menu slides on top of the main content

This is more of a new feature request( maybe something to consider in the library roadmap). If you take a look at the new Google+ app the notifications slide out from the right on top of the fragment, which makes more sense for a right menu considering its more of an extension drawer rather than a navigation menu.

ListView stop working after openning the MenuDrawer

In the ListActivity Sample, after opining the MenuDrawer the ListView will stop scrolling and the istviewItem will not get highlighted when you click on it, however the itemClickLstener gets fired (toast appear)

steps:
1- run MenuDrawerDemo
2- go to ListActivity Sample
3- scroll listView or click on any item (its working fine)
4- open the MenuDrawer
5- try to scroll the listView (not scrolling), click on any listViewItem (the cell will not highlight but the toast will appear)

device 1: galaxy Tab 7.7 (GT-P6800) run Honeycomb 3.2
device 2: emulator run Android 3.2

I think its a Honeycomb Bug.

Allow menu to be placed statically behind main content

Thanks for making this available! I'm really liking it so far.

I have one requirement that isn't met by your class. The menu view should be statically placed behind the main content. When the menu is shown, it should look like it's always underneath the main content and the content is just being pushed out of the way. The current implementation has the menu view moving a bit as well when it's shown.

I've been able to implement my behavior by commenting out this line. Do you think this makes sense as a configuration option similar to MENU_DRAG_CONTENT/MENU_DRAG_WINDOW?

Use a fragment as a menu view?

I am trying to use a fragment (inside a FrameLayout) for setMenuView(), but it crashes on Android 4.1. Any suggestion how to fix/workaround that?

Here is the code:

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  mMenuDrawerManager = new MenuDrawerManager(this, MenuDrawer.MENU_DRAG_WINDOW);
  mMenuDrawerManager.setContentView(R.layout.card_list_activity);
  mMenuDrawerManager.setMenuView(R.layout.card_list_menu); // this line causes the crash
}

And the error:

12-05 17:25:12.615: E/AndroidRuntime(30997): android.view.InflateException: Binary XML file line #17: Error inflating class

FCs on dev lib

Hi,

I am using the dev branch of this library to have the static mode after a rotation. In the master version there is bug you fixed Sunday when you rotate the scree and the code switch from static to draggable drawer.

So I released a beta with that.

Few of my user are having a crash. Here is the log

java.lang.NoSuchMethodError: net.simonvt.menudrawer.MenuDrawer.postOnAnimation
at net.simonvt.menudrawer.MenuDrawer.animateIndicatorInvalidate(SourceFile:619)
at net.simonvt.menudrawer.MenuDrawer.openMenu(SourceFile:599)
                                     startAnimatingIndicator
at net.simonvt.menudrawer.MenuDrawer.openMenu(SourceFile:585)
                                     setActiveView
at com.pommedeterresautee.twoborange3.Activities.Main.MainActivity$1.onItemClick(SourceFile:132)
at android.widget.AdapterView.performItemClick(AdapterView.java:284)
at android.widget.ListView.performItemClick(ListView.java:3513)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:1881)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method) 

Affected devices are:
HTC Desire under 2.3.7
SGH-I747M under 4.04

Log have been retraced as I obfuscate my code.

Let me know if you want more information, I can contact these users to ask them few things.

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.