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

Commit 52eb50fb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove onBeforePop() logic so back no longer opens/closes drawer." into nyc-andromeda-dev

parents d2f2eff4 ec243369
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -626,23 +626,13 @@ public abstract class BaseActivity extends Activity implements NavigationViewMan
            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));