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

Commit 77deb830 authored by Kelvin Kwan's avatar Kelvin Kwan Committed by Automerger Merge Worker
Browse files

Merge "Update cross-profile error strings and UI" into rvc-dev am: 9f4e9b74 am: d515a62a

Change-Id: If53aeeebab1daad92fc8b48723084b7241001277
parents ba09b840 d515a62a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -26,24 +26,24 @@

    <ImageView
        android:id="@+id/artwork"
        android:layout_width="32dp"
        android:layout_height="32dp"/>
        android:layout_width="24dp"
        android:layout_height="24dp"/>
    <TextView
        android:id="@+id/title"
        android:layout_marginTop="16dp"
        android:layout_marginTop="8dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="@style/EmptyStateTitleText"/>
    <TextView
        android:id="@+id/message"
        android:layout_marginTop="8dp"
        android:layout_marginTop="4dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:textAppearance="@style/EmptyStateMessageText"/>
    <Button
        android:id="@+id/button"
        android:layout_marginTop="24dp"
        android:layout_marginTop="16dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/EmptyStateButton"/>
+34 −14
Original line number Diff line number Diff line
@@ -173,24 +173,44 @@
    <!-- Error message shown when querying for a list of documents failed [CHAR LIMIT=48] -->
    <string name="query_error">Can\u2019t load content at the moment</string>

    <!-- Error message title shown when the target profile is in quiet mode [CHAR LIMIT=72] -->
    <string name="quiet_mode_error_title">Turn on work apps</string>
    <!-- Error message content shown when the target profile is in quiet mode [CHAR LIMIT=72] -->
    <string name="quiet_mode_error_message">Turn on work apps to access work files</string>
    <!-- Button text shown on a button when work profile is off. Clicking on the button will switch on the work profile [CHAR LIMIT=48] -->
    <string name="quiet_mode_button">Switch on work</string>

    <!-- Error message title shown when the admin does not allow the user to share files across profile [CHAR LIMIT=72] -->
    <string name="cant_share_across_profile_error_title">Can\u2019t share across profiles</string>
    <!-- Error message content shown when the admin does not allow the user to share files across profile. Shows in work tab[CHAR LIMIT=200] -->
    <string name="cant_share_to_personal_error_message">Your IT admin does not allow you to access
        work files from a personal app
    <!-- Title of an error message. This screen is shown when the user's work profile is paused. [CHAR LIMIT=72] -->
    <string name="quiet_mode_error_title">Work profile is paused</string>
    <!-- Button text shown on a button when work profile is paused. Tapping the button will switch on the work profile [CHAR LIMIT=48] -->
    <string name="quiet_mode_button">Turn on</string>

    <!-- Error message title shown when a user's IT admin does not allow the user to select work files from a personal app. [CHAR LIMIT=72] -->
    <string name="cant_select_work_files_error_title">Can\u2019t select work files</string>
    <!-- Error message that's shown when the user's IT admin doesn't allow the user to select work files from a personal app. [CHAR LIMIT=200] -->
    <string name="cant_select_work_files_error_message">Your IT admin doesn\u2019t allow you to
        access work files from a personal app
    </string>
    <!-- Error message content shown when the admin does not allow the user to share files across profile. Shows in personal tab[CHAR LIMIT=200] -->
    <string name="cant_share_to_work_error_message">Your IT admin does not allow you to

    <!-- Error message title shown when the user's IT admin doesn't allow them to select personal files from a work app. [CHAR LIMIT=72] -->
    <string name="cant_select_personal_files_error_title">Can\u2019t select personal files</string>
    <!-- Error message that's shown when the user's IT admin doesn't allow the user to select personal files from a work app. [CHAR LIMIT=200] -->
    <string name="cant_select_personal_files_error_message">Your IT admin doesn\u2019t allow you to
        access personal files from a work app
    </string>

    <!-- Error message title shown when the admin does not allow the user to save files from their personal profile to their work profile. [CHAR LIMIT=72] -->
    <string name="cant_save_to_work_error_title">Can\u2019t save to work profile</string>
    <!-- Error message shown when the user's IT admin doesn't allow the user to save files from their personal profile to their work profile. [CHAR LIMIT=200] -->
    <string name="cant_save_to_work_error_message">Your IT admin doesn\u2019t allow you to save
        personal files to your work profile
    </string>

    <!-- Error message title shown when the admin does not allow the user to save files from their work profile to their personal profile. [CHAR LIMIT=72] -->
    <string name="cant_save_to_personal_error_title">Can\u2019t save to personal profile</string>
    <!-- Error message shown when the user's IT admin doesn't allow the user to save files from their work profile to their personal profile. [CHAR LIMIT=200] -->
    <string name="cant_save_to_personal_error_message">Your IT admin doesn\u2019t allow you to save
        work files to your personal profile
    </string>

    <!-- Error message title. This message is shown when a user tries to do something on their work device, but that action isn't allowed by their IT admin. [CHAR LIMIT=72] -->
    <string name="cross_profile_action_not_allowed_title">This action isn\u2019t allowed</string>
    <!-- Error message. This message is shown when a user tries to do something on their work device, but that action isn't allowed by their IT admin. [CHAR LIMIT=200] -->
    <string name="cross_profile_action_not_allowed_message">To learn more, contact your IT admin</string>

    <!-- Title of storage root location that contains recently modified or used documents [CHAR LIMIT=24] -->
    <string name="root_recent">Recent</string>
    <!-- Subtitle of storage root indicating the total free space available, in bytes [CHAR LIMIT=24] -->
+2 −2
Original line number Diff line number Diff line
@@ -92,13 +92,13 @@

    <style name="EmptyStateTitleText">
        <item name="android:textColor">@color/empty_state_text</item>
        <item name="android:textSize">18sp</item>
        <item name="android:textSize">14sp</item>
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="EmptyStateMessageText">
        <item name="android:textColor">@color/empty_state_text</item>
        <item name="android:textSize">14sp</item>
        <item name="android:textSize">12sp</item>
    </style>

    <style name="EmptyStateButtonTextAppearance">
+6 −2
Original line number Diff line number Diff line
@@ -91,9 +91,13 @@ final class InflateMessageDocumentHolder extends MessageHolder {
    private void bindCrossProfileMessageView() {
        mContentView.setVisibility(View.GONE);
        mCrossProfileView.setVisibility(View.VISIBLE);

        mCrossProfileTitle.setText(mMessage.getTitleString());
        if (!TextUtils.isEmpty(mMessage.getMessageString())) {
            mCrossProfileMessage.setVisibility(View.VISIBLE);
            mCrossProfileMessage.setText(mMessage.getMessageString());
        } else {
            mCrossProfileMessage.setVisibility(View.GONE);
        }
        mCrossProfileImage.setImageDrawable(mMessage.getIcon());
        if (!TextUtils.isEmpty(mMessage.getButtonString())) {
            mCrossProfileButton.setVisibility(View.VISIBLE);
+41 −7
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.documentsui.dirlist;
import android.Manifest;
import android.app.AuthenticationRequiredException;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;

@@ -224,23 +225,56 @@ abstract class Message {
            }
            update(
                    mEnv.getContext().getResources().getText(R.string.quiet_mode_error_title),
                    mEnv.getContext().getResources().getText(R.string.quiet_mode_error_message),
                    /* messageString= */ "",
                    buttonText,
                    mEnv.getContext().getDrawable(R.drawable.work_off));
        }

        private void updateToCrossProfileNoPermissionErrorMessage() {
            mLayout = InflateMessageDocumentHolder.LAYOUT_CROSS_PROFILE_ERROR;
            update(
                    mEnv.getContext().getResources().getText(
                            R.string.cant_share_across_profile_error_title),
                    mEnv.getContext().getResources().getText(UserId.CURRENT_USER.isSystem()
                            ? R.string.cant_share_to_personal_error_message
                            : R.string.cant_share_to_work_error_message),
            boolean currentUserIsSystem = UserId.CURRENT_USER.isSystem();
            update(getCrossProfileNoPermissionErrorTitle(),
                    getCrossProfileNoPermissionErrorMessage(),
                    /* buttonString= */ null,
                    mEnv.getContext().getDrawable(R.drawable.share_off));
        }

        private CharSequence getCrossProfileNoPermissionErrorTitle() {
            boolean currentUserIsSystem = UserId.CURRENT_USER.isSystem();
            Resources res = mEnv.getContext().getResources();
            switch (mEnv.getDisplayState().action) {
                case State.ACTION_GET_CONTENT:
                case State.ACTION_OPEN:
                case State.ACTION_OPEN_TREE:
                    return res.getText(currentUserIsSystem
                            ? R.string.cant_select_work_files_error_title
                            : R.string.cant_select_personal_files_error_title);
                case State.ACTION_CREATE:
                    return res.getText(currentUserIsSystem
                            ? R.string.cant_save_to_work_error_title
                            : R.string.cant_save_to_personal_error_title);
            }
            return res.getText(R.string.cross_profile_action_not_allowed_title);
        }

        private CharSequence getCrossProfileNoPermissionErrorMessage() {
            boolean currentUserIsSystem = UserId.CURRENT_USER.isSystem();
            Resources res = mEnv.getContext().getResources();
            switch (mEnv.getDisplayState().action) {
                case State.ACTION_GET_CONTENT:
                case State.ACTION_OPEN:
                case State.ACTION_OPEN_TREE:
                    return res.getText(currentUserIsSystem
                            ? R.string.cant_select_work_files_error_message
                            : R.string.cant_select_personal_files_error_message);
                case State.ACTION_CREATE:
                    return res.getText(currentUserIsSystem
                            ? R.string.cant_save_to_work_error_message
                            : R.string.cant_save_to_personal_error_message);
            }
            return res.getText(R.string.cross_profile_action_not_allowed_message);
        }

        private void updateToInflatedErrorMessage() {
            update(null, mEnv.getContext().getResources().getText(R.string.query_error), null,
                    mEnv.getContext().getDrawable(R.drawable.hourglass));
Loading