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

Commit e155040f authored by Jeremie Boulic's avatar Jeremie Boulic Committed by Android (Google) Code Review
Browse files

Merge "[DocsUI Peek] Define entry point for showing preview" into main

parents e30554d2 b10f59ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA
    }

    @Override
    public void showInspector(DocumentInfo doc) {
    public void showPreview(DocumentInfo doc) {
        throw new UnsupportedOperationException("Can't open properties.");
    }

+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public interface ActionHandler {

    void showCreateDirectoryDialog();

    void showInspector(DocumentInfo doc);
    void showPreview(DocumentInfo doc);

    @Nullable DocumentInfo renameDocument(String name, DocumentInfo document);

+1 −1
Original line number Diff line number Diff line
@@ -990,7 +990,7 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
                    ? mActivity.getCurrentDirectory()
                    : mModel.getDocuments(selection).get(0);

            mActions.showInspector(doc);
            mActions.showPreview(doc);
            return true;
        } else if (id == R.id.dir_menu_cut_to_clipboard) {
            mActions.cutToClipboard();
+16 −4
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package com.android.documentsui.files;
import static android.content.ContentResolver.wrap;

import static com.android.documentsui.base.SharedMinimal.DEBUG;
import static com.android.documentsui.flags.Flags.desktopFileHandling;
import com.android.documentsui.flags.Flags;

import android.app.DownloadManager;
import android.content.ActivityNotFoundException;
@@ -551,7 +551,7 @@ public class ActionHandler<T extends FragmentActivity & AbstractActionHandler.Co
            return;
        }

        if (desktopFileHandling()) {
        if (Flags.desktopFileHandling()) {
            Intent intent = buildViewIntent(doc);
            intent.setComponent(
                    new ComponentName("android", "com.android.internal.app.ResolverActivity"));
@@ -571,8 +571,7 @@ public class ActionHandler<T extends FragmentActivity & AbstractActionHandler.Co
        }
    }

    @Override
    public void showInspector(DocumentInfo doc) {
    private void showInspector(DocumentInfo doc) {
        Metrics.logUserAction(MetricConsts.USER_ACTION_INSPECTOR);
        Intent intent = InspectorActivity.createIntent(mActivity, doc.derivedUri, doc.userId);

@@ -596,4 +595,17 @@ public class ActionHandler<T extends FragmentActivity & AbstractActionHandler.Co
        }
        mActivity.startActivity(intent);
    }

    private void showPeek() {
        Log.d(TAG, "Peek not implemented");
    }

    @Override
    public void showPreview(DocumentInfo doc) {
        if (Flags.useMaterial3() && Flags.usePeekPreview()) {
            showPeek();
        } else {
            showInspector(doc);
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ public class FilesActivity extends BaseActivity implements AbstractActionHandler
        } else if (id == R.id.option_menu_select_all) {
            mInjector.actions.selectAllFiles();
        } else if (id == R.id.option_menu_inspect) {
            mInjector.actions.showInspector(getCurrentDirectory());
            mInjector.actions.showPreview(getCurrentDirectory());
        } else {
            final boolean ok = super.onOptionsItemSelected(item);
            if (DEBUG && !ok) {
Loading