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

Commit efd10ac3 authored by Steve McKay's avatar Steve McKay
Browse files

Allow GetInfo on current directory.

But don't allow on Recents (since we can't get info about the root directory).
Allow displayName to be overridden by Intent.EXTRA_TITLE extra.
    This is useful as most root documents don't appear to have useful displayNames.
    So for all root docs, we pass the root name as the title.
Bonus: load directory icon correctly (wasn't being animated to full opacity).

Bug: 64025130
Bug: 64000934
Bug: 64068972
Test: Update menu manager tests. Increased coverage of InspectorController. Added showInspector test coverage.
Change-Id: Ifa125a7e7376aea40b1c53c18ebf5a5d528b440e
parent c14027ff
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -77,5 +77,10 @@
            android:title="@string/menu_settings"
            android:showAsAction="never"
            android:visible="false" />
       <item
           android:id="@+id/option_menu_inspector"
           android:title="@string/menu_inspector"
           android:showAsAction="never"
           android:visible="false" />
    </group>
</menu>
+3 −5
Original line number Diff line number Diff line
@@ -425,12 +425,10 @@ public abstract class BaseActivity
        }

        mNavigator.update();

        // Causes talkback to announce the activity's new title
        if (mState.stack.isRecents()) {
            setTitle(mProviders.getRecentsRoot().title);
        } else {
        setTitle(mState.stack.getTitle());
        }

        invalidateOptionsMenu();
    }

+14 −3
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public abstract class MenuManager {
                menu.findItem(R.id.option_menu_list));
        updateAdvanced(menu.findItem(R.id.option_menu_advanced));
        updateDebug(menu.findItem(R.id.option_menu_debug));

        updateInspector(menu.findItem(R.id.option_menu_inspector));
        Menus.disableHiddenItems(menu);
    }

@@ -273,8 +273,19 @@ public abstract class MenuManager {
        rename.setVisible(false);
    }

    protected void updateInspector(MenuItem properties, SelectionDetails selectionDetails) {
        properties.setVisible(false);
    /**
     * This method is called for standard activity option menu as opposed
     * to when there is a selection.
     */
    protected void updateInspector(MenuItem inspector) {
        inspector.setVisible(false);
    }

    /**
     * This method is called for action mode, when a selection exists.
     */
    protected void updateInspector(MenuItem inspector, SelectionDetails selectionDetails) {
        inspector.setVisible(false);
    }

    protected void updateViewInOwner(MenuItem view, SelectionDetails selectionDetails) {
+5 −4
Original line number Diff line number Diff line
@@ -106,6 +106,10 @@ public interface Features {
            return isEnabled(R.bool.feature_content_refresh);
        }

        private boolean isFunPolicyEnabled() {
            return !mUserMgr.hasUserRestriction(UserManager.DISALLOW_FUN);
        }

        private boolean isDebugPolicyEnabled() {
            return !mUserMgr.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES);
        }
@@ -120,15 +124,12 @@ public interface Features {
            return isEnabled(R.bool.feature_folders_in_search_results);
        }

        private boolean isFunPolicyEnabled() {
            return !mUserMgr.hasUserRestriction(UserManager.DISALLOW_FUN);
        }

        @Override
        public boolean isGestureScaleEnabled() {
            return isEnabled(R.bool.feature_gesture_scale);
        }

        @Override
        public boolean isInspectorEnabled() {
            return isEnabled(R.bool.feature_inspector);
        }
+17 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.provider.DocumentsContract;
import android.text.TextUtils;
import android.util.Log;
import android.view.DragEvent;

@@ -679,11 +680,26 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
    public void showInspector(DocumentInfo doc) {
        Metrics.logUserAction(mActivity, Metrics.USER_ACTION_INSPECTOR);
        Intent intent = new Intent(mActivity, InspectorActivity.class);
        intent.setData(doc.derivedUri);

        // permit the display of debug info about the file.
        intent.putExtra(
                Shared.EXTRA_SHOW_DEBUG,
                mFeatures.isDebugSupportEnabled() &&
                        (Build.IS_DEBUGGABLE || DebugFlags.getDocumentDetailsEnabled()));
        intent.setData(doc.derivedUri);

        // The "root document" (top level folder in a root) don't usually have a
        // human friendly display name. That's because we've never shown the root
        // folder's name to anyone.
        // For that reason when the doc being inspected is the root folder,
        // we override the displayName of the doc w/ the Root's name instead.
        // The Root's name is shown to the user in the sidebar.
        if (doc.isDirectory() && mState.stack.size() == 1 && mState.stack.get(0).equals(doc)) {
            RootInfo root = mActivity.getCurrentRoot();
            // Recents root title isn't defined, but inspector is disabled for recents root folder.
            assert !TextUtils.isEmpty(root.title);
            intent.putExtra(Intent.EXTRA_TITLE, root.title);
        }
        mActivity.startActivity(intent);
    }

Loading