Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glitches while opening menu-drawer #71

Closed
akshaydeo opened this issue Feb 5, 2013 · 10 comments
Closed

Glitches while opening menu-drawer #71

akshaydeo opened this issue Feb 5, 2013 · 10 comments

Comments

@akshaydeo
Copy link

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 ?

@SimonVT
Copy link
Owner

SimonVT commented Feb 5, 2013

Is it a small delay when opening the drawer for the first time, every time, or?
What API level are you running this on?

@akshaydeo
Copy link
Author

The small delay is every time I open the drawer. I am testing this on Samsung Galaxy note 2, HTC one x, S3 and nexus s. All the devices show this behavior. All of them are API 16+.

@akshaydeo
Copy link
Author

And when I slowly drag till some distance (considerably more than a fling would drag) this runs smoothly.

@SimonVT
Copy link
Owner

SimonVT commented Feb 5, 2013

Can I get you to supply a full sample which displays this behavior?

@akshaydeo
Copy link
Author

should i mail you the code simonvt@gmail.com ?

@SimonVT
Copy link
Owner

SimonVT commented Feb 5, 2013

You can just link it here

@akshaydeo
Copy link
Author

Ok this is weird. When i excerpted out the code related with menu drawer into the new app it works fine without any glitch. I feel its issue at the my end.

@akshaydeo
Copy link
Author

Apparently It was issue related with theme
android:theme="@style/Theme.Sherlock.Light.DarkActionBar"

When I removed in my main app it started working smoothly. Is this a known issue ??

@akshaydeo akshaydeo reopened this Feb 5, 2013
@SimonVT
Copy link
Owner

SimonVT commented Feb 5, 2013

I don't have any issues with the DarkActionbar theme.

@SimonVT SimonVT closed this as completed Mar 20, 2013
@tiwadara
Copy link

tiwadara commented Sep 8, 2013

capture
capture1

I am also having this same issue, even on the emulator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants