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

Commit a9d424ab authored by Garfield, Tan's avatar Garfield, Tan Committed by Garfield Tan
Browse files

Open root list when hovering on the edge in drawer layout.

Bug: 28345294

Change-Id: Ia569003e21aea0641ccc1d2a5e042bdc93f32bb3
(cherry picked from commit 49eda9885e81a32f8a3d7cc7b9f9f15766b2621e)
parent 4ccc419c
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -52,8 +52,21 @@

            </com.android.documentsui.DocumentsToolbar>

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <include layout="@layout/directory_cluster"/>

                <!-- Drawer edge is a dummy view used to capture hovering event
                     on view edge to open the drawer. (b/28345294) -->
                <View
                    android:id="@+id/drawer_edge"
                    android:background="@android:color/transparent"
                    android:layout_width="@dimen/drawer_edge_width"
                    android:layout_height="match_parent"/>
            </FrameLayout>

        </LinearLayout>

        <LinearLayout
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@
    <dimen name="grid_item_elevation">2dp</dimen>
    <dimen name="max_drawer_width">280dp</dimen>

    <dimen name="drawer_edge_width">12dp</dimen>

    <dimen name="drag_shadow_width">160dp</dimen>
    <dimen name="drag_shadow_height">48dp</dimen>

+2 −0
Original line number Diff line number Diff line
@@ -256,6 +256,8 @@ public abstract class BaseActivity extends Activity
        } else {
            new PickRootTask(this, root).executeOnExecutor(getExecutorForCurrentDirectory());
        }

        mNavigator.revealRootsDrawer(false);
    }

    @Override
+0 −6
Original line number Diff line number Diff line
@@ -316,12 +316,6 @@ public class DocumentsActivity extends BaseActivity {
                .executeOnExecutor(getExecutorForCurrentDirectory());
    }

    @Override
    void onRootPicked(RootInfo root) {
        super.onRootPicked(root);
        mNavigator.revealRootsDrawer(false);
    }

    @Override
    public void onDocumentPicked(DocumentInfo doc, Model model) {
        final FragmentManager fm = getFragmentManager();
+27 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import static com.android.documentsui.Shared.DEBUG;

import android.annotation.IntDef;
import android.app.Activity;
import android.content.Context;
import android.support.annotation.ColorRes;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.DrawerLayout.DrawerListener;
@@ -120,7 +120,8 @@ abstract class DrawerController implements DrawerListener {
    /**
     * Runtime controller that manages a real drawer.
     */
    private static final class RuntimeDrawerController extends DrawerController {
    private static final class RuntimeDrawerController extends DrawerController
            implements ItemDragListener.DragHost {
        private final ActionBarDrawerToggle mToggle;
        private DrawerLayout mLayout;
        private View mDrawer;
@@ -138,6 +139,30 @@ abstract class DrawerController implements DrawerListener {
            mToggle = toggle;

            mLayout.setDrawerListener(this);

            View edge = layout.findViewById(R.id.drawer_edge);
            edge.setOnDragListener(new ItemDragListener<>(this));
        }

        @Override
        public void runOnUiThread(Runnable runnable) {
            mDrawer.post(runnable);
        }

        @Override
        public void setDropTargetHighlight(View v, boolean highlight) {
            assert (v.getId() == R.id.drawer_edge);

            @ColorRes int id = highlight ? R.color.item_doc_background_selected :
                android.R.color.transparent;
            v.setBackgroundColor(id);
        }

        @Override
        public void onViewHovered(View v) {
            assert (v.getId() == R.id.drawer_edge);

            setOpen(true);
        }

        @Override
Loading