Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1a7da27 authored by Scott Mertz's avatar Scott Mertz Committed by Gerrit Code Review
Browse files

Fix sort mode popup after rotation from portrait to landscape

ListPopupWindow doesn't appear to correctly recalculate its popup
size after rotation.  Force the recalculation on rotation and allow
the window to fill the entire screen if necessary.

FEIJ-1192
Change-Id: I6345a56c4dde3dd73c3d902afd0a840307014178
(cherry picked from commit 5042221d)
parent 6c15a6ab
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ public class NavigationActivity extends Activity
    private NavigationCustomTitleView mCustomTitleView;
    private InputMethodManager mImm;
    private FilesystemInfoDialog.OnConfigChangeListener mOnConfigChangeListener;
    private ListPopupWindow mPopupWindow;

    private final BroadcastReceiver mNotificationReceiver = new BroadcastReceiver() {
        @Override
@@ -806,6 +807,9 @@ public class NavigationActivity extends Activity
        if (navView != null) {
            navView.refreshViewMode();
        }
        if (mPopupWindow != null) {
            mPopupWindow.postShow();
        }
    }

    /**
@@ -2194,14 +2198,15 @@ public class NavigationActivity extends Activity
        final MenuSettingsAdapter adapter = new MenuSettingsAdapter(this, settings);

        //Create a show the popup menu
        final ListPopupWindow popup = DialogHelper.createListPopupWindow(this, adapter, anchor);
        popup.setOnItemClickListener(new OnItemClickListener() {
        mPopupWindow = DialogHelper.createListPopupWindow(this, adapter, anchor);
        mPopupWindow.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                FileManagerSettings setting =
                        ((MenuSettingsAdapter)parent.getAdapter()).getSetting(position);
                final int value = ((MenuSettingsAdapter)parent.getAdapter()).getId(position);
                popup.dismiss();
                mPopupWindow.dismiss();
                mPopupWindow = null;
                try {
                    if (setting.compareTo(FileManagerSettings.SETTINGS_LAYOUT_MODE) == 0) {
                        //Need to change the layout
@@ -2246,13 +2251,14 @@ public class NavigationActivity extends Activity

            }
        });
        popup.setOnDismissListener(new PopupWindow.OnDismissListener() {
        mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                adapter.dispose();
            }
        });
        popup.show();
        mPopupWindow.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
        mPopupWindow.show();
    }

    /**