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

Commit 5e1e7790 authored by Ben Lin's avatar Ben Lin
Browse files

DO NOT MERGE ANYWHERE

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

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

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

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

        super.onBackPressed();
    }

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

    public void onStackPicked(DocumentStack stack) {
        try {
            // Update the restored stack to ensure we have freshest data
+0 −39
Original line number Diff line number Diff line
@@ -60,12 +60,6 @@ public class FilesActivity 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 DocumentClipper mClipper;

    public FilesActivity() {
@@ -395,39 +389,6 @@ public class FilesActivity 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
    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;
    }

    // Turns out only DocumentsActivity was ever calling saveStackBlocking.
    // There may be a  case where we want to contribute entries from
    // Behavior here in FilesActivity, but it isn't yet obvious.