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

Commit ec243369 authored by Ben Lin's avatar Ben Lin
Browse files

Remove onBeforePop() logic so back no longer opens/closes drawer.

Bug: 30814333
Change-Id: Ia03896eb3fb41981ed25fedcdf859400b4f5b7e8
parent 7d75f7bb
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -621,23 +621,13 @@ public abstract class BaseActivity extends Activity
            return;
        }

        if (!mState.hasLocationChanged()) {
            super.onBackPressed();
            return;
        }

        if (onBeforePopDir() || popDir()) {
        if (popDir()) {
            return;
        }

        super.onBackPressed();
    }

    protected boolean onBeforePopDir() {
        // Files app overrides this with some fancy logic.
        return false;
    }

    /**
     * Declare a global key handler to route key events when there isn't a specific focus view. This
     * covers the scenario where a user opens DocumentsUI and just starts typing.
+0 −39
Original line number Diff line number Diff line
@@ -75,12 +75,6 @@ public class ManageActivity extends BaseActivity {

    public static final String TAG = "FilesActivity";

    // See comments where this const is referenced for details.
    private static final int DRAWER_NO_FIDDLE_DELAY = 1500;

    // Track the time we opened the drawer in response to back being pressed.
    // We use the time gap to figure out whether to close app or reopen the drawer.
    private long mDrawerLastFiddled;
    private Tuner mTuner;
    private MenuManager mMenuManager;
    private FocusManager mFocusManager;
@@ -507,39 +501,6 @@ public class ManageActivity extends BaseActivity {
        }
    }

    // Do some "do what a I want" drawer fiddling, but don't
    // do it if user already hit back recently and we recently
    // did some fiddling.
    @Override
    protected boolean onBeforePopDir() {
        int size = mState.stack.size();

        if (mDrawer.isPresent()
                && (System.currentTimeMillis() - mDrawerLastFiddled) > DRAWER_NO_FIDDLE_DELAY) {
            // Close drawer if it is open.
            if (mDrawer.isOpen()) {
                mDrawer.setOpen(false);
                mDrawerLastFiddled = System.currentTimeMillis();
                return true;
            }

            final Intent intent = getIntent();
            final boolean launchedExternally = intent != null && intent.getData() != null
                    && mState.action == State.ACTION_BROWSE;

            // Open the Close drawer if it is closed and we're at the top of a root, but only when
            // not launched by another app.
            if (size <= 1 && !launchedExternally) {
                mDrawer.setOpen(true);
                // Remember so we don't just close it again if back is pressed again.
                mDrawerLastFiddled = System.currentTimeMillis();
                return true;
            }
        }

        return false;
    }

    @Override
    public void onTaskFinished(Uri... uris) {
        if (DEBUG) Log.d(TAG, "onFinished() " + Arrays.toString(uris));