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

Commit 914c6750 authored by Zemiao Zhu's avatar Zemiao Zhu Committed by Automerger Merge Worker
Browse files

Merge "Add 'create new folder' option to blocked directory header in picker."...

Merge "Add 'create new folder' option to blocked directory header in picker." into rvc-dev am: 6ccee1cc am: 9957fd52

Change-Id: Ic9a39a50e85bb81b297256aeb3dbb5e0bfe1ac82
parents fe36f0fb 9957fd52
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -22,5 +22,7 @@
        android:tint="?android:attr/colorPrimary">
    <path
        android:fillColor="?android:attr/colorBackground"
        android:pathData="M12,5.99L19.53,19L4.47,19L12,5.99M12,2L1,21h22L12,2zM13,16h-2v2h2v-2zM13,10h-2v4h2v-4z"/>
        android:pathData="M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm0.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" />
    <path
        android:pathData="M0 0h24v24H0V0z" />
</vector>
 No newline at end of file
+69 −31
Original line number Diff line number Diff line
@@ -31,6 +31,11 @@
        app:strokeWidth="1dp"
        app:strokeColor="?android:strokeColor">

        <LinearLayout
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:animateLayoutChanges="true"
                android:id="@+id/message_container"
@@ -61,8 +66,16 @@
                        android:id="@+id/message_title"
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:textSize="16sp"
                        android:textAppearance="@style/DrawerMenuPrimary"/>

                    <TextView
                        android:id="@+id/message_subtitle"
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:selectAllOnFocus="true"
                        android:textSize="12sp"/>

                    <TextView
                        android:id="@+id/message_textview"
                        android:layout_height="wrap_content"
@@ -70,7 +83,7 @@
                        android:selectAllOnFocus="true"/>

                    <Button
                    android:id="@+id/button_dismiss"
                        android:id="@+id/dismiss_button"
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:layout_gravity="end"
@@ -79,5 +92,30 @@

                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/action_view"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:orientation="vertical">

                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:background="?android:strokeColor"/>

                <Button
                    android:id="@+id/action_button"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:layout_marginStart="48dp"
                    android:layout_gravity="start"
                    style="@style/DialogTextButton"/>
            </LinearLayout>

        </LinearLayout>

    </com.google.android.material.card.MaterialCardView>
</FrameLayout>
+6 −7
Original line number Diff line number Diff line
@@ -490,13 +490,12 @@
    <string name="open_tree_dialog_title">Allow <xliff:g id="appName" example="Drive">%1$s</xliff:g> to access files in <xliff:g id="directory" example="DCIM">%2$s</xliff:g>?</string>
    <!-- Confrim dialog message show on open document tree flow.-->
    <string name="open_tree_dialog_message">This will let <xliff:g id="appName" example="Drive">%1$s</xliff:g> access current and future content stored in <xliff:g id="directory" example="DCIM">%2$s</xliff:g>.</string>
    <!-- Header message title show on open document tree flow. [CHAR_LIMIT=48] -->
    <string name="open_tree_header_title">Can\u2019t share <xliff:g id="folderName" example="Download">%1$s</xliff:g> folder with <xliff:g id="appName" example="Drive">%2$s</xliff:g></string>
    <!-- Header message content show on open document tree flow and on root top. [CHAR_LIMIT=80]-->
    <string name="open_tree_header_message_root">Choose a folder below, or create a new one</string>
    <!-- Header message content show on open document tree flow and in child folder. [CHAR_LIMIT=80]-->
    <string name="open_tree_header_message_child">Choose another folder, or create a new one</string>

    <!-- Header message title show on open document tree flow when directory is blocked. [CHAR_LIMIT=48] -->
    <string name="directory_blocked_header_title">Choose another folder</string>
    <!-- Header message subtitle show on open document tree flow when directory is blocked. [CHAR_LIMIT=80]-->
    <string name="directory_blocked_header_subtitle">This folder can\u2019t be used for security reasons</string>
    <!-- Button text for the "create new folder" button. [CHAR_LIMIT=48] -->
    <string name="create_new_folder_button">Create new folder</string>


    <!-- Search hint on search view. [CHAR LIMIT=48] -->
+24 −7
Original line number Diff line number Diff line
@@ -38,8 +38,11 @@ final class HeaderMessageDocumentHolder extends MessageHolder {
    private final View mRoot;
    private final ImageView mIcon;
    private final TextView mTitle;
    private final TextView mSubtitle;
    private final TextView mTextView;
    private final Button mButton;
    private final View mActionView;
    private final Button mDismissButton;
    private final Button mActionButton;
    private Message mMessage;

    public HeaderMessageDocumentHolder(Context context, ViewGroup parent) {
@@ -48,13 +51,17 @@ final class HeaderMessageDocumentHolder extends MessageHolder {
        mRoot = itemView.findViewById(R.id.item_root);
        mIcon = (ImageView) itemView.findViewById(R.id.message_icon);
        mTitle = itemView.findViewById(R.id.message_title);
        mSubtitle = itemView.findViewById(R.id.message_subtitle);
        mTextView = (TextView) itemView.findViewById(R.id.message_textview);
        mButton = (Button) itemView.findViewById(R.id.button_dismiss);
        mActionView = (View) itemView.findViewById(R.id.action_view);
        mActionButton = (Button) itemView.findViewById(R.id.action_button);
        mDismissButton = (Button) itemView.findViewById(R.id.dismiss_button);
    }

    public void bind(Message message) {
        mMessage = message;
        mButton.setOnClickListener(this::onButtonClick);
        mDismissButton.setOnClickListener(this::onButtonClick);
        mActionButton.setOnClickListener(this::onButtonClick);
        bind(null, null);
    }

@@ -77,20 +84,30 @@ final class HeaderMessageDocumentHolder extends MessageHolder {
    public void bind(Cursor cursor, String modelId) {
        if (mMessage.getTitleString() != null) {
            mTitle.setVisibility(View.VISIBLE);
            mSubtitle.setVisibility(View.VISIBLE);
            mTextView.setVisibility(View.GONE);
            mTitle.setText(mMessage.getTitleString());
            mSubtitle.setText(mMessage.getMessageString());
        } else {
            mTitle.setVisibility(View.GONE);
            mSubtitle.setVisibility(View.GONE);
            mTextView.setVisibility(View.VISIBLE);
            mTextView.setText(mMessage.getMessageString());
        }

        mTextView.setText(mMessage.getMessageString());
        mIcon.setImageDrawable(mMessage.getIcon());

        if (mMessage.shouldKeep()) {
            mButton.setVisibility(View.GONE);
            mActionView.setVisibility(View.VISIBLE);
            mDismissButton.setVisibility(View.GONE);
            if (mMessage.getButtonString() != null) {
                mActionButton.setText(mMessage.getButtonString());
            }
        } else {
            mButton.setVisibility(View.VISIBLE);
            mActionView.setVisibility(View.GONE);
            mDismissButton.setVisibility(View.VISIBLE);
            if (mMessage.getButtonString() != null) {
                mButton.setText(mMessage.getButtonString());
                mDismissButton.setText(mMessage.getButtonString());
            }
        }
    }
+7 −12
Original line number Diff line number Diff line
@@ -145,6 +145,9 @@ abstract class Message {
                    && mEnv.getDisplayState().stack.peek().isBlockedFromTree()
                    && mEnv.getDisplayState().restrictScopeStorage) {
                updateBlockFromTreeMessage();
                mCallback = () -> {
                    mEnv.getActionHandler().showCreateDirectoryDialog();
                };
            }
        }

@@ -166,18 +169,10 @@ abstract class Message {

        private void updateBlockFromTreeMessage() {
            mShouldKeep = true;
            if (mEnv.getDisplayState().stack.size() <= 1) {
                update(null,
                        mEnv.getContext().getString(R.string.open_tree_header_message_root),
                        null, mEnv.getContext().getDrawable(R.drawable.ic_dialog_info));
            } else {
                final String folder = mEnv.getDisplayState().stack.getTitle();
                final String callingApp = mEnv.getCallingAppName();
                update(mEnv.getContext().getString(R.string.open_tree_header_title,
                        folder, callingApp),
                        mEnv.getContext().getString(R.string.open_tree_header_message_child),
                        null, mEnv.getContext().getDrawable(R.drawable.ic_dialog_info));
            }
            update(mEnv.getContext().getString(R.string.directory_blocked_header_title),
                    mEnv.getContext().getString(R.string.directory_blocked_header_subtitle),
                    mEnv.getContext().getString(R.string.create_new_folder_button),
                    mEnv.getContext().getDrawable(R.drawable.ic_dialog_info));
        }
    }