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

Commit c53dafc4 authored by yongga's avatar yongga Committed by Gerrit Code Review
Browse files

CMFileManager: Do not create multiple action dialogs

Multiple instances of ActionsDialog are created if the user
clicks the menu too quickly.

Do not create an instance if a dialog has already been displayed.

CRs-Fixed: 960229, 970649
Change-Id: I610331cf71cb1b59aef6f89d8fdcb1c6ccda6044
parent e62ef71f
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ public class NavigationActivity extends Activity
    private InputMethodManager mImm;
    private FilesystemInfoDialog.OnConfigChangeListener mOnConfigChangeListener;
    private ListPopupWindow mPopupWindow;
    private ActionsDialog mActionsDialog;

    private final BroadcastReceiver mNotificationReceiver = new BroadcastReceiver() {
        @Override
@@ -2530,10 +2531,13 @@ public class NavigationActivity extends Activity
        // For this to work, SecureConsole NEEDS to be refactored.

        // Show the dialog
        ActionsDialog dialog = new ActionsDialog(this, this, item, global, false);
        dialog.setOnRequestRefreshListener(this);
        dialog.setOnSelectionListener(getCurrentNavigationView());
        dialog.show();
        if (mActionsDialog != null && mActionsDialog.isShowing()) {
            return;
        }
        mActionsDialog = new ActionsDialog(this, this, item, global, false);
        mActionsDialog.setOnRequestRefreshListener(this);
        mActionsDialog.setOnSelectionListener(getCurrentNavigationView());
        mActionsDialog.show();
    }

    /**
+10 −0
Original line number Diff line number Diff line
@@ -198,6 +198,16 @@ public class ActionsDialog implements OnItemClickListener, OnItemLongClickListen
        DialogHelper.delegateDialogShow(this.mContext, this.mDialog);
    }

    /**
     * Method that judges whether the dialog is showing.
     */
    public boolean isShowing() {
        if (this.mDialog != null) {
            return this.mDialog.isShowing();
        }
        return false;
    }

    /**
     * {@inheritDoc}
     */