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

Commit 7b216347 authored by Tony Huang's avatar Tony Huang Committed by Android (Google) Code Review
Browse files

Merge "Show create folder button on specific picking action"

parents b250899c 86e6dda8
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2019 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M20,6h-8l-2,-2L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM19,14h-3v3h-2v-3h-3v-2h3L14,9h2v3h3v2z"/>
</vector>
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2019 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M3,18h6v-2L3,16v2zM3,6v2h18L21,6L3,6zM3,13h12v-2L3,11v2z"/>
</vector>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
        android:showAsAction="always" />
    <item
        android:id="@+id/action_menu_sort"
        android:icon="@drawable/ic_sort"
        android:title="@string/menu_sort"
        android:showAsAction="never" />
    <item
+2 −0
Original line number Diff line number Diff line
@@ -50,12 +50,14 @@
        <item
            android:id="@+id/option_menu_create_dir"
            android:title="@string/menu_create_dir"
            android:icon="@drawable/ic_create_new_folder"
            android:alphabeticShortcut="e"
            android:visible="false"
            app:showAsAction="never"/>
        <item
            android:id="@+id/option_menu_sort"
            android:title="@string/menu_sort"
            android:icon="@drawable/ic_sort"
            android:showAsAction="never"
            android:visible="false" />
        <item
+6 −0
Original line number Diff line number Diff line
@@ -70,6 +70,10 @@ public final class MenuManager extends com.android.documentsui.MenuManager {
            // May already be hidden because the root
            // doesn't support search.
            mSearchManager.showMenu(null);

            // Show on toolbar because there are only two menu items while ACTION_OPEN_TREE.
            menu.findItem(R.id.option_menu_sort).setShowAsAction(mState.action == ACTION_OPEN_TREE
                    ? MenuItem.SHOW_AS_ACTION_ALWAYS : MenuItem.SHOW_AS_ACTION_NEVER);
        }
    }

@@ -125,6 +129,8 @@ public final class MenuManager extends com.android.documentsui.MenuManager {

    @Override
    protected void updateCreateDir(MenuItem createDir) {
        createDir.setShowAsAction(picking()
                ? MenuItem.SHOW_AS_ACTION_ALWAYS : MenuItem.SHOW_AS_ACTION_NEVER);
        createDir.setVisible(picking());
        createDir.setEnabled(picking() && mDirDetails.canCreateDirectory());
    }