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

Commit f324a5b7 authored by Wenbo Jie (介文博)'s avatar Wenbo Jie (介文博) Committed by Android (Google) Code Review
Browse files

Merge "[DocsUI M3] Use GridDocumentHolder for photo picking" into main

parents ff32f9c0 263283f7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ final class DirectoryAddonsAdapter extends DocumentsAdapter {
                        || getItemViewType(position) == ITEM_TYPE_HEADER_MESSAGE
                        || getItemViewType(position) == ITEM_TYPE_INFLATED_MESSAGE) {
                    return columnCount;
                } else if (mEnv.getDisplayState().isPhotoPicking()
                } else if (!isUseMaterial3FlagEnabled()
                        && mEnv.getDisplayState().isPhotoPicking()
                        && mEnv.getDisplayState().derivedMode == State.MODE_GRID) {
                    // If on photo picking state and grid mode,
                    // the UI should show 3 images a row or 2 folders a row.
+1 −1
Original line number Diff line number Diff line
@@ -976,7 +976,7 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
        // Clamp so that we always lay out the grid with at least 2 columns by default.
        // If on photo picking state, the UI should show 3 images a row or 2 folders a row,
        // so use 6 columns by default and set folder size to 3 and document size is to 2.
        mColumnUnit = mState.isPhotoPicking() ? 3 : 1;
        mColumnUnit = (!isUseMaterial3FlagEnabled() && mState.isPhotoPicking()) ? 3 : 1;
        int columnCount = mColumnUnit * Math.max(2,
                (mRecView.getWidth() - viewPadding) / (cellWidth + cellMargin));

+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ import com.android.modules.utils.build.SdkLevel;
import java.util.Map;
import java.util.function.Function;

// TODO(b/379776735): remove this file after use_material3 flag is launched.
// GridDocumentHolder is used for all types of grid items.
final class GridPhotoHolder extends DocumentHolder {

    private final ImageView mIconMimeLg;
+12 −5
Original line number Diff line number Diff line
@@ -105,10 +105,17 @@ final class ModelBackedDocumentsAdapter extends DocumentsAdapter {
                                        mEnv.getContext(), parent, mIconHelper, mConfigStore);
                        break;
                    case ITEM_TYPE_DOCUMENT:
                        holder = state.isPhotoPicking()
                                ? new GridPhotoHolder(mEnv.getContext(), parent, mIconHelper,
                        holder =
                                (!isUseMaterial3FlagEnabled() && state.isPhotoPicking())
                                        ? new GridPhotoHolder(
                                                mEnv.getContext(),
                                                parent,
                                                mIconHelper,
                                                mConfigStore)
                                : new GridDocumentHolder(mEnv.getContext(), parent, mIconHelper,
                                        : new GridDocumentHolder(
                                                mEnv.getContext(),
                                                parent,
                                                mIconHelper,
                                                mConfigStore);
                        break;
                    default: