OSDN Git Service

cmfm: Fix FC with hardware menu
authorJorge Ruesga <jorge@ruesga.com>
Mon, 17 Nov 2014 21:23:57 +0000 (22:23 +0100)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Mon, 17 Nov 2014 22:02:38 +0000 (22:02 +0000)
JIRA: NIGHTLIES-364
https://jira.cyanogenmod.org/browse/NIGHTLIES-364
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Change-Id: I6c3f56f841f7ec69004cd4a280fdd191a47e4844

src/com/cyanogenmod/filemanager/activities/NavigationActivity.java

index 6770acf..72149e7 100644 (file)
@@ -417,8 +417,6 @@ public class NavigationActivity extends Activity
     private boolean mExitFlag = false;
     private long mExitBackTimeout = -1;
 
-    private View mOptionsAnchorView;
-
     private int mOrientation;
 
     /**
@@ -1535,7 +1533,11 @@ public class NavigationActivity extends Activity
     @Override
     public boolean onKeyUp(int keyCode, KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_MENU) {
-            showOverflowPopUp(this.mOptionsAnchorView);
+            if (mDrawerLayout.isDrawerOpen(mDrawer)) {
+                mDrawerLayout.closeDrawer(mDrawer);
+            } else {
+                mDrawerLayout.openDrawer(mDrawer);
+            }
             return true;
         }
         if (keyCode == KeyEvent.KEYCODE_BACK) {
@@ -1632,10 +1634,6 @@ public class NavigationActivity extends Activity
                 openSearch();
                 break;
 
-            case R.id.ab_overflow:
-                showOverflowPopUp(view);
-                break;
-
             default:
                 break;
         }
@@ -1852,56 +1850,6 @@ public class NavigationActivity extends Activity
     }
 
     /**
-     * Method that shows a popup with the activity main menu.
-     *
-     * @param anchor The action button that was pressed
-     */
-    private void showOverflowPopUp(View anchor) {
-        SimpleMenuListAdapter adapter =
-                new HighlightedSimpleMenuListAdapter(this, R.menu.navigation);
-        Menu menu = adapter.getMenu();
-        int cc = this.mActionBar.getChildCount();
-        for (int i = 0, j = this.mActionBar.getChildCount() - 1; i < cc; i++, j--) {
-            View child = this.mActionBar.getChildAt(i);
-            boolean visible = child.getVisibility() == View.VISIBLE;
-            if (visible) {
-                menu.removeItem(menu.getItem(j).getItemId());
-            }
-        }
-
-        final ListPopupWindow popup = DialogHelper.createListPopupWindow(this, adapter, anchor);
-        popup.setOnItemClickListener(new OnItemClickListener() {
-            @Override
-            public void onItemClick(
-                    final AdapterView<?> parent, final View v, final int position, final long id) {
-
-                final int itemId = (int)id;
-                NavigationActivity.this.mHandler.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        popup.dismiss();
-                        switch (itemId) {
-                            case R.id.mnu_settings:
-                                //Settings
-                                openSettings();
-                                break;
-
-                            case R.id.mnu_search:
-                                //Search
-                                openSearch();
-                                popup.dismiss();
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-                });
-            }
-        });
-        popup.show();
-    }
-
-    /**
      * Method that show the information of a filesystem mount point.
      *
      * @param mp The mount point info