siyamed / android-satellite-menu

Android Satellite Menu
1.4k stars 644 forks source link

Rotation causes a funy behaviour #2

Open ohrock opened 12 years ago

ohrock commented 12 years ago

Hi!

In the demo App itself, if you expand the menu, then rotate, the menu is all the sudden closed. This in itself could be an OK behavior, the real issue comes when pressing to expand the menu again the icons do a funny dance and close themselves.

I imagine, what is going on is that the menu is keeping the expanded state internally while the reality of the views correlates to a new fresh activity, and don't reflect the internal views. I have been looking around for a way of maybe resetting the controller during onPause and recreating it during onResume, but it doesn't make a difference.

Other than that good job, the menu does look really good... and thank you for sharing!

siyamed commented 12 years ago

Hi,

I will correct this and return to you. Thanks for the feedback !!!

elihart commented 10 years ago

This still appears to be an issue. I found that adding

if (rotated) {
            // Rotated needs to be false when we call expand, otherwise it will
            // think it's already expanded
            rotated = false;
            // can't expand if no items have been added.
            if (!menuItems.isEmpty()) {
                expand();
            }
        }

to the bottom of onRestoreInstanceState() in SatelliteMenu.java seems to work. This will restore the menu to the open position as long as you add the menu items in your activity's onCreate(). Alternatively if you want the menu to stay closed you can just have rotated be set to false.