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

Commit 49c677ef authored by Jeremie Boulic's avatar Jeremie Boulic
Browse files

[DocsUI Peek] Image preview

Bug: 382170389
Flag: com.android.documentsui.flags.use_material3
Flag: com.android.documentsui.flags.use_peek_preview_ro
Test: DocumentsUIGoogleTests:com.android.documentsui.peek.PeekUiTest
Change-Id: I5b261008cb4cc82ed8f9d19ac72e32d72aa7d1b8
parent 9634676d
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,12 @@ java_defaults {
        "docsui-change-ids",
        "docsui-change-ids",
        "guava",
        "guava",
        "modules-utils-build_system",
        "modules-utils-build_system",
        // Glide and dependencies. Optimized out when use_peek_preview_ro flag enabled.
        // See b/421076517 for more details.
        "androidx.exifinterface_exifinterface",
        "glide-disklrucache-prebuilt",
        "glide-gifdecoder-prebuilt",
        "glide-prebuilt",
    ],
    ],


    privileged: true,
    privileged: true,
+2 −2
Original line number Original line Diff line number Diff line
@@ -29,8 +29,8 @@
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        android:layout_height="match_parent">


        <com.android.documentsui.peek.RenderView
        <FrameLayout
            android:id="@+id/peek_preview"
            android:id="@+id/peek_preview_frame"
            android:layout_width="match_parent"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
            android:layout_height="match_parent" />
        <!-- Text and icons using android:white because the underlying black scrim doesn't
        <!-- Text and icons using android:white because the underlying black scrim doesn't
+2 −1
Original line number Original line Diff line number Diff line
@@ -12,7 +12,8 @@
     See the License for the specific language governing permissions and
     See the License for the specific language governing permissions and
     limitations under the License.
     limitations under the License.
-->
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/peek_preview_container"
    android:id="@+id/peek_preview_container"
    android:layout_width="match_parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    android:layout_height="match_parent">
+3 −0
Original line number Original line Diff line number Diff line
@@ -694,4 +694,7 @@


    <!-- Text used in Peek to indicate that no preview is available. -->
    <!-- Text used in Peek to indicate that no preview is available. -->
    <string name="peek_no_preview">No preview available</string>
    <string name="peek_no_preview">No preview available</string>

    <!-- Accessibility label for an image preview in Peek. -->
    <string name="a11y_peek_image_preview">Image preview of <xliff:g id="filename" example="image.png">%s</xliff:g></string>
</resources>
</resources>
+16 −10
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.documentsui.files;


import static com.android.documentsui.OperationDialogFragment.DIALOG_TYPE_UNKNOWN;
import static com.android.documentsui.OperationDialogFragment.DIALOG_TYPE_UNKNOWN;
import static com.android.documentsui.base.SharedMinimal.DEBUG;
import static com.android.documentsui.base.SharedMinimal.DEBUG;
import static com.android.documentsui.flags.Flags.usePeekPreviewRo;
import static com.android.documentsui.util.FlagUtils.isUseMaterial3FlagEnabled;
import static com.android.documentsui.util.FlagUtils.isUseMaterial3FlagEnabled;
import static com.android.documentsui.util.FlagUtils.isUsePeekPreviewFlagEnabled;
import static com.android.documentsui.util.FlagUtils.isUsePeekPreviewFlagEnabled;
import static com.android.documentsui.util.FlagUtils.isVisualSignalsFlagEnabled;
import static com.android.documentsui.util.FlagUtils.isVisualSignalsFlagEnabled;
@@ -170,6 +171,10 @@ public class FilesActivity extends BaseActivity implements AbstractActionHandler
                            mInjector.messages);
                            mInjector.messages);
        }
        }


        // Directly use the generated method `usePeekPreviewRo` to optimize out Peek when the flag
        // isn't enabled. The optimization is not happening with the FlagUtils's
        // `isUsePeekPreviewFlagEnabled`.
        if (usePeekPreviewRo()) {
            if (isUsePeekPreviewFlagEnabled()) {
            if (isUsePeekPreviewFlagEnabled()) {
                ViewModelProvider viewModelProvider = new ViewModelProvider(this);
                ViewModelProvider viewModelProvider = new ViewModelProvider(this);
                PeekViewModel viewModel = viewModelProvider.get(PeekViewModel.class);
                PeekViewModel viewModel = viewModelProvider.get(PeekViewModel.class);
@@ -181,6 +186,7 @@ public class FilesActivity extends BaseActivity implements AbstractActionHandler
                        this,
                        this,
                        mPeekViewManager);
                        mPeekViewManager);
            }
            }
        }


        Runnable closeSelectionBarRunnable =
        Runnable closeSelectionBarRunnable =
                (isUseMaterial3FlagEnabled()
                (isUseMaterial3FlagEnabled()
Loading