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

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

Merge "Fix select behavior in picking mode"

parents 9ddf56e5 166cd7c1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@ public abstract class MenuManager {
        updateModePicker(menu.findItem(R.id.sub_menu_grid), menu.findItem(R.id.sub_menu_list));
    }

    public void updateModel(Model model) {}

    /**
     * Called when we needs {@link MenuManager} to ask Android to show context menu for us.
     * {@link MenuManager} can choose to defeat this request.
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class Model {
    }

    @VisibleForTesting
    protected void update(DirectoryResult result) {
    public void update(DirectoryResult result) {
        assert(result != null);
        if (DEBUG) Log.i(TAG, "Updating model with new result set.");

+1 −0
Original line number Diff line number Diff line
@@ -1121,6 +1121,7 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
                        mModel.doc != null ? mModel.doc.derivedUri : null);
                // For orientation changed case, sometimes the docs loading comes after the menu
                // update. We need to update the menu here to ensure the status is correct.
                mInjector.menuManager.updateModel(mModel);
                mInjector.menuManager.updateOptionMenu();

                mActivity.updateHeaderTitle();
+7 −1
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.recyclerview.widget.RecyclerView;

import com.android.documentsui.base.Shared;
import com.android.documentsui.base.State;

import java.util.function.Consumer;
import java.util.function.Function;

import javax.annotation.Nullable;
@@ -49,6 +49,8 @@ public abstract class DocumentHolder

    protected @Nullable String mModelId;

    protected @State.ActionType int mAction;

    // See #addKeyEventListener for details on the need for this field.
    private KeyboardEventListener<DocumentItemDetails> mKeyEventListener;

@@ -99,6 +101,10 @@ public abstract class DocumentHolder
        setEnabledRecursive(itemView, enabled);
    }

    public void setAction(@State.ActionType int action) {
        mAction = action;
    }

    public void bindPreviewIcon(boolean show, Function<View, Boolean> clickCallback) {}

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.widget.TextView;

import com.android.documentsui.IconUtils;
import com.android.documentsui.R;
import com.android.documentsui.base.State;
import com.android.documentsui.ui.Views;

final class GridDirectoryHolder extends DocumentHolder {
@@ -73,7 +74,7 @@ final class GridDirectoryHolder extends DocumentHolder {

    @Override
    public boolean inSelectRegion(MotionEvent event) {
        return Views.isEventOver(event, mIconLayout);
        return mAction == State.ACTION_BROWSE ? Views.isEventOver(event, mIconLayout) : false;
    }

    /**
Loading